src/mess/video/733_asr.c
| r1952 | r1953 | |
| 22 | 22 | |
| 23 | 23 | #include "driver.h" |
| 24 | 24 | #include "mslegacy.h" |
| 25 | | #include "deprecat.h" |
| 26 | 25 | |
| 27 | 26 | #include "733_asr.h" |
| 28 | 27 | |
| r1952 | r1953 | |
| 180 | 179 | memcpy(dst, fontdata6x8, asrfontdata_size); |
| 181 | 180 | } |
| 182 | 181 | |
| 183 | | int asr733_init_term(int unit, void (*int_callback)(int state)) |
| 182 | int asr733_init_term(running_machine *machine, int unit, void (*int_callback)(int state)) |
| 184 | 183 | { |
| 185 | | asr[unit].bitmap = auto_bitmap_alloc(Machine->screen[0].width, Machine->screen[0].height, BITMAP_FORMAT_INDEXED16); |
| 184 | asr[unit].bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, BITMAP_FORMAT_INDEXED16); |
| 186 | 185 | |
| 187 | | fillbitmap(asr[unit].bitmap, Machine->pens[0], &Machine->screen[0].visarea); |
| 186 | fillbitmap(asr[unit].bitmap, machine->pens[0], &machine->screen[0].visarea); |
| 188 | 187 | |
| 189 | 188 | asr[unit].int_callback = int_callback; |
| 190 | 189 | |
| r1952 | r1953 | |
| 218 | 217 | } |
| 219 | 218 | |
| 220 | 219 | /* write a single char on screen */ |
| 221 | | static void asr_draw_char(int unit, int character, int x, int y, int color) |
| 220 | static void asr_draw_char(running_machine *machine, int unit, int character, int x, int y, int color) |
| 222 | 221 | { |
| 223 | | drawgfx(asr[unit].bitmap, Machine->gfx[0], character-32, color, 0, 0, |
| 224 | | x+1, y, &Machine->screen[0].visarea, /*TRANSPARENCY_PEN*/TRANSPARENCY_NONE, 0); |
| 222 | drawgfx(asr[unit].bitmap, machine->gfx[0], character-32, color, 0, 0, |
| 223 | x+1, y, &machine->screen[0].visarea, /*TRANSPARENCY_PEN*/TRANSPARENCY_NONE, 0); |
| 225 | 224 | } |
| 226 | 225 | |
| 227 | | static void asr_linefeed(int unit) |
| 226 | static void asr_linefeed(running_machine *machine, int unit) |
| 228 | 227 | { |
| 229 | 228 | UINT8 buf[asr_window_width]; |
| 230 | 229 | int y; |
| r1952 | r1953 | |
| 232 | 231 | for (y=asr_window_offset_y; y<asr_window_offset_y+asr_window_height-asr_scroll_step; y++) |
| 233 | 232 | { |
| 234 | 233 | extract_scanline8(asr[unit].bitmap, asr_window_offset_x, y+asr_scroll_step, asr_window_width, buf); |
| 235 | | draw_scanline8(asr[unit].bitmap, asr_window_offset_x, y, asr_window_width, buf, Machine->pens, -1); |
| 234 | draw_scanline8(asr[unit].bitmap, asr_window_offset_x, y, asr_window_width, buf, machine->pens, -1); |
| 236 | 235 | } |
| 237 | 236 | |
| 238 | | fillbitmap(asr[unit].bitmap, Machine->pens[0], &asr_scroll_clear_window); |
| 237 | fillbitmap(asr[unit].bitmap, machine->pens[0], &asr_scroll_clear_window); |
| 239 | 238 | } |
| 240 | 239 | |
| 241 | | static void asr_transmit(int unit, UINT8 data) |
| 240 | static void asr_transmit(running_machine *machine, int unit, UINT8 data) |
| 242 | 241 | { |
| 243 | 242 | switch (data) |
| 244 | 243 | { |
| r1952 | r1953 | |
| 277 | 276 | |
| 278 | 277 | case 0x0A: |
| 279 | 278 | /* LF: line feed */ |
| 280 | | asr_linefeed(unit); |
| 279 | asr_linefeed(machine, unit); |
| 281 | 280 | break; |
| 282 | 281 | |
| 283 | 282 | case 0x0D: |
| r1952 | r1953 | |
| 294 | 293 | if (asr[unit].x == 80) |
| 295 | 294 | { |
| 296 | 295 | asr[unit].x = 0; |
| 297 | | asr_linefeed(unit); |
| 296 | asr_linefeed(machine, unit); |
| 298 | 297 | } |
| 299 | | asr_draw_char(unit, data, asr_window_offset_x+asr[unit].x*8, asr_window_offset_y+asr_window_height-8, 0); |
| 298 | asr_draw_char(machine, unit, data, asr_window_offset_x+asr[unit].x*8, asr_window_offset_y+asr_window_height-8, 0); |
| 300 | 299 | asr[unit].x++; |
| 301 | 300 | break; |
| 302 | 301 | } |
| r1952 | r1953 | |
| 364 | 363 | 14: enable interrupts, 1 to enable interrupts |
| 365 | 364 | 15: diagnostic mode, 0 for normal mode |
| 366 | 365 | */ |
| 367 | | void asr733_cru_w(int offset, int data, int unit) |
| 366 | void asr733_cru_w(running_machine *machine, int offset, int data, int unit) |
| 368 | 367 | { |
| 369 | 368 | switch (offset) |
| 370 | 369 | { |
| r1952 | r1953 | |
| 382 | 381 | else |
| 383 | 382 | asr[unit].xmit_buf &= ~ (1 << offset); |
| 384 | 383 | if ((offset == 7) && (asr[unit].mode & AM_dtr_mask) && (asr[unit].mode & AM_rts_mask)) /* right??? */ |
| 385 | | asr_transmit(unit, asr[unit].xmit_buf); |
| 384 | asr_transmit(machine, unit, asr[unit].xmit_buf); |
| 386 | 385 | break; |
| 387 | 386 | |
| 388 | 387 | case 8: /* not used */ |
| r1952 | r1953 | |
| 420 | 419 | |
| 421 | 420 | WRITE8_HANDLER(asr733_0_cru_w) |
| 422 | 421 | { |
| 423 | | asr733_cru_w(offset, data, 0); |
| 422 | asr733_cru_w(machine, offset, data, 0); |
| 424 | 423 | } |
| 425 | 424 | |
| 426 | 425 | |
| 427 | 426 | /* |
| 428 | 427 | Video refresh |
| 429 | 428 | */ |
| 430 | | void asr733_refresh(bitmap_t *bitmap, int unit, int x, int y) |
| 429 | void asr733_refresh(running_machine *machine, bitmap_t *bitmap, int unit, int x, int y) |
| 431 | 430 | { |
| 432 | | copybitmap(bitmap, asr[unit].bitmap, 0, 0, x, y, &Machine->screen[0].visarea); |
| 431 | copybitmap(bitmap, asr[unit].bitmap, 0, 0, x, y, &machine->screen[0].visarea); |
| 433 | 432 | } |
| 434 | 433 | |
| 435 | 434 | |
src/mess/video/733_asr.h
| r1952 | r1953 | |
| 24 | 24 | extern PALETTE_INIT ( asr733 ) ; |
| 25 | 25 | |
| 26 | 26 | void asr733_init(void); |
| 27 | | int asr733_init_term(int unit, void (*int_callback)(int state)); |
| 27 | int asr733_init_term(running_machine *machine, int unit, void (*int_callback)(int state)); |
| 28 | 28 | |
| 29 | 29 | void asr733_reset(int unit); |
| 30 | 30 | |
| 31 | 31 | int asr733_cru_r(int offset, int unit); |
| 32 | | void asr733_cru_w(int offset, int data, int unit); |
| 32 | void asr733_cru_w(running_machine *machine, int offset, int data, int unit); |
| 33 | 33 | |
| 34 | 34 | READ8_HANDLER(asr733_0_cru_r); |
| 35 | 35 | WRITE8_HANDLER(asr733_0_cru_w); |
| 36 | 36 | |
| 37 | | void asr733_refresh(bitmap_t *bitmap, int unit, int x, int y); |
| 37 | void asr733_refresh(running_machine *machine, bitmap_t *bitmap, int unit, int x, int y); |
| 38 | 38 | |
| 39 | 39 | void asr733_keyboard(int unit); |
| 40 | 40 | |