src/mess/machine/teleprinter.c
| r10428 | r10429 | |
| 176 | 176 | teleprinter_state *term = get_safe_token(device); |
| 177 | 177 | |
| 178 | 178 | memcpy(term->buffer,term->buffer+TELEPRINTER_WIDTH,(TELEPRINTER_HEIGHT-1)*TELEPRINTER_WIDTH); |
| 179 | | memset(term->buffer + TELEPRINTER_WIDTH*(TELEPRINTER_HEIGHT-1),0,TELEPRINTER_WIDTH); |
| 179 | memset(term->buffer + TELEPRINTER_WIDTH*(TELEPRINTER_HEIGHT-1),0x20,TELEPRINTER_WIDTH); |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | static void teleprinter_write_char(device_t *device,UINT8 data) { |
| r10428 | r10429 | |
| 184 | 184 | |
| 185 | 185 | term->buffer[(TELEPRINTER_HEIGHT-1)*TELEPRINTER_WIDTH+term->x_pos] = data; |
| 186 | 186 | term->x_pos++; |
| 187 | | if (term->x_pos > TELEPRINTER_WIDTH) { |
| 187 | if (term->x_pos >= TELEPRINTER_WIDTH) |
| 188 | { |
| 188 | 189 | term->x_pos = 0; |
| 189 | 190 | teleprinter_scroll_line(device); |
| 190 | 191 | } |
| r10428 | r10429 | |
| 202 | 203 | teleprinter_state *term = get_safe_token(device); |
| 203 | 204 | switch(data) { |
| 204 | 205 | case 10: term->x_pos = 0; |
| 205 | | teleprinter_scroll_line(device); |
| 206 | | break; |
| 206 | teleprinter_scroll_line(device); |
| 207 | break; |
| 207 | 208 | case 13: term->x_pos = 0; break; |
| 208 | | case 9: do { |
| 209 | | term->x_pos ++; |
| 210 | | } while ((term->x_pos % 8)!=0); |
| 211 | | break; |
| 209 | case 9: term->x_pos = (term->x_pos & 0xf8) + 8; |
| 210 | if (term->x_pos >= TELEPRINTER_WIDTH) |
| 211 | term->x_pos = TELEPRINTER_WIDTH-1; |
| 212 | |
| 213 | break; |
| 212 | 214 | case 16: break; |
| 213 | 215 | default: teleprinter_write_char(device,data); break; |
| 214 | 216 | } |
| r10428 | r10429 | |
| 263 | 265 | |
| 264 | 266 | MACHINE_CONFIG_FRAGMENT( generic_teleprinter ) |
| 265 | 267 | MCFG_SCREEN_ADD(TELEPRINTER_SCREEN_TAG, RASTER) |
| 266 | | MCFG_SCREEN_REFRESH_RATE(50) |
| 267 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 268 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 268 | MCFG_SCREEN_REFRESH_RATE(50) |
| 269 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 270 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 269 | 271 | MCFG_SCREEN_SIZE(TELEPRINTER_WIDTH*8, TELEPRINTER_HEIGHT*8) |
| 270 | 272 | MCFG_SCREEN_VISIBLE_AREA(0, TELEPRINTER_WIDTH*8-1, 0, TELEPRINTER_HEIGHT*8-1) |
| 271 | 273 | MCFG_PALETTE_LENGTH(2) |
| 272 | | MCFG_PALETTE_INIT(black_and_white) |
| 274 | MCFG_PALETTE_INIT(black_and_white) |
| 273 | 275 | |
| 274 | 276 | MCFG_VIDEO_START(teleprinter) |
| 275 | 277 | MCFG_VIDEO_UPDATE(teleprinter) |
| r10428 | r10429 | |
| 287 | 289 | |
| 288 | 290 | devcb_resolve_write8(&term->teleprinter_keyboard_func, &intf->teleprinter_keyboard_func, device); |
| 289 | 291 | |
| 290 | | device->machine->scheduler().timer_pulse(attotime::from_hz(240), FUNC(keyboard_callback), 0, (void*)device); |
| 292 | if (term->teleprinter_keyboard_func.target) |
| 293 | device->machine->scheduler().timer_pulse(attotime::from_hz(240), FUNC(keyboard_callback), 0, (void*)device); |
| 291 | 294 | } |
| 292 | 295 | |
| 293 | 296 | /*------------------------------------------------- |
src/mess/machine/terminal.c
| r10428 | r10429 | |
| 283 | 283 | case 0x08: if (term->x_pos) term->x_pos--; |
| 284 | 284 | break; |
| 285 | 285 | |
| 286 | | case 0x09: term->x_pos ++; |
| 287 | | term->x_pos += term->x_pos % 8; |
| 286 | case 0x09: term->x_pos = (term->x_pos & 0xf8) + 8; |
| 288 | 287 | if (term->x_pos >= TERMINAL_WIDTH) |
| 289 | 288 | term->x_pos = TERMINAL_WIDTH-1; |
| 290 | 289 | break; |
| r10428 | r10429 | |
| 525 | 524 | const terminal_interface *intf = get_interface(device); |
| 526 | 525 | |
| 527 | 526 | devcb_resolve_write8(&term->terminal_keyboard_func, &intf->terminal_keyboard_func, device); |
| 528 | | device->machine->scheduler().timer_pulse(attotime::from_hz(2400), FUNC(keyboard_callback), 0, (void*)device); |
| 527 | |
| 528 | if (term->terminal_keyboard_func.target) |
| 529 | device->machine->scheduler().timer_pulse(attotime::from_hz(2400), FUNC(keyboard_callback), 0, (void*)device); |
| 529 | 530 | } |
| 530 | 531 | |
| 531 | 532 | /*------------------------------------------------- |