Previous 15994 Revisions Next

r10429 Monday 14th February, 2011 at 11:19:51 UTC by Robbbert
[TERMINAL & TELEPRINTER] Only scan keyboard if a handler exists. Fixed a bug with tabs.
Teleprinter - fixed bug when line gets full.
[src/mess/machine]teleprinter.c terminal.c

src/mess/machine/teleprinter.c
r10428r10429
176176   teleprinter_state *term = get_safe_token(device);
177177
178178   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);
180180}
181181
182182static void teleprinter_write_char(device_t *device,UINT8 data) {
r10428r10429
184184
185185   term->buffer[(TELEPRINTER_HEIGHT-1)*TELEPRINTER_WIDTH+term->x_pos] = data;
186186   term->x_pos++;
187   if (term->x_pos > TELEPRINTER_WIDTH) {
187   if (term->x_pos >= TELEPRINTER_WIDTH)
188   {
188189      term->x_pos = 0;
189190      teleprinter_scroll_line(device);
190191   }
r10428r10429
202203   teleprinter_state *term = get_safe_token(device);
203204   switch(data) {
204205      case 10: term->x_pos = 0;
205             teleprinter_scroll_line(device);
206             break;
206            teleprinter_scroll_line(device);
207            break;
207208      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;
212214      case 16: break;
213215      default: teleprinter_write_char(device,data); break;
214216   }
r10428r10429
263265
264266MACHINE_CONFIG_FRAGMENT( generic_teleprinter )
265267   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)
269271   MCFG_SCREEN_SIZE(TELEPRINTER_WIDTH*8, TELEPRINTER_HEIGHT*8)
270272   MCFG_SCREEN_VISIBLE_AREA(0, TELEPRINTER_WIDTH*8-1, 0, TELEPRINTER_HEIGHT*8-1)
271273   MCFG_PALETTE_LENGTH(2)
272    MCFG_PALETTE_INIT(black_and_white)
274   MCFG_PALETTE_INIT(black_and_white)
273275
274276   MCFG_VIDEO_START(teleprinter)
275277   MCFG_VIDEO_UPDATE(teleprinter)
r10428r10429
287289
288290   devcb_resolve_write8(&term->teleprinter_keyboard_func, &intf->teleprinter_keyboard_func, device);
289291
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);
291294}
292295
293296/*-------------------------------------------------
src/mess/machine/terminal.c
r10428r10429
283283         case 0x08:   if (term->x_pos) term->x_pos--;
284284               break;
285285
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;
288287               if (term->x_pos >= TERMINAL_WIDTH)
289288                  term->x_pos = TERMINAL_WIDTH-1;
290289               break;
r10428r10429
525524   const terminal_interface *intf = get_interface(device);
526525
527526   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);
529530}
530531
531532/*-------------------------------------------------

Previous 15994 Revisions Next


© 1998-2018 The MESS Team