Previous 15994 Revisions Next

r3468 Sunday 19th October, 2008 at 14:29:11 UTC by Curt Coder
[ABC80] Converted to use timer devices.
[TMC600] Converted to use timer devices.
[src/mess/drivers]abc80.c
[src/mess/includes]abc80.h tmc600.h
[src/mess/video]abc80.c tmc600.c

src/mess/video/tmc600.c
r3467r3468
4444   }
4545}
4646
47static TIMER_CALLBACK( blink_tick )
47static TIMER_DEVICE_CALLBACK( blink_tick )
4848{
49   tmc600_state *state = machine->driver_data;
49   tmc600_state *state = timer->machine->driver_data;
5050
5151   state->blink = !state->blink;
5252}
r3467r3468
140140
141141   state->char_rom = memory_region(machine, "chargen");
142142
143   /* allocate blink timer */
144
145   state->blink_timer = timer_alloc(blink_tick, NULL);
146   timer_adjust_periodic(state->blink_timer, attotime_zero, 0, ATTOTIME_IN_HZ(2));
147
148143   /* register for state saving */
149144
150145   state_save_register_global_pointer(state->page_ram, TMC600_PAGE_RAM_SIZE);
r3467r3468
166161}
167162
168163MACHINE_DRIVER_START( tmc600_video )
169//   MDRV_TIMER_ADD_PERIODIC("blink", blink_tick, HZ(2))
164   MDRV_TIMER_ADD_PERIODIC("blink", blink_tick, HZ(2))
170165
171166   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
172167   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
src/mess/video/abc80.c
r3467r3468
7171   return ((row & 0x07) << 7) + (row >> 3) * num_cols + col;
7272}
7373
74static TIMER_CALLBACK(abc80_blink_tick)
74static TIMER_DEVICE_CALLBACK(abc80_blink_tick)
7575{
76   abc80_state *state = machine->driver_data;
76   abc80_state *state = timer->machine->driver_data;
7777
7878   state->blink = !state->blink;
7979}
r3467r3468
202202{
203203   abc80_state *state = machine->driver_data;
204204
205   /* allocate blink timer */
206
207   state->blink_timer = timer_alloc(abc80_blink_tick, NULL);
208   timer_adjust_periodic(state->blink_timer, attotime_zero, 0, ATTOTIME_IN_HZ(ABC80_XTAL/2/6/64/312/16));
209
210205   /* create tx_tilemap */
211206
212207   state->tx_tilemap = tilemap_create(abc80_get_tile_info, abc80_tilemap_scan, 6, 10, 40, 24);
r3467r3468
250245}
251246
252247MACHINE_DRIVER_START( abc80_video )
253//   MDRV_TIMER_ADD_PERIODIC("blink", abc80_blink_tick, HZ(ABC80_XTAL/2/6/64/312/16))
248   MDRV_TIMER_ADD_PERIODIC("blink", abc80_blink_tick, HZ(ABC80_XTAL/2/6/64/312/16))
254249
255250   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
256251   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
src/mess/includes/tmc600.h
r3467r3468
2222
2323   const device_config *cdp1869;
2424
25   emu_timer *blink_timer;
26
2725   /* keyboard state */
2826   int keylatch;         /* key latch */
2927};
src/mess/includes/abc80.h
r3467r3468
6262   int char_bank;
6363   int char_row;
6464
65   /* timers */
66   emu_timer *keyboard_timer;
67   emu_timer *z80pio_astb_timer;
68   emu_timer *blink_timer;
69
7065   /* devices */
7166   const device_config *z80pio;
7267
src/mess/drivers/abc80.c
r3467r3468
209209   }
210210}
211211
212static TIMER_CALLBACK( abc80_keyboard_tick )
212static TIMER_DEVICE_CALLBACK( abc80_keyboard_tick )
213213{
214   abc80_keyboard_scan(machine);
214   abc80_keyboard_scan(timer->machine);
215215}
216216
217217/* Memory Maps */
r3467r3468
354354
355355/* Z80 PIO Interface */
356356
357static TIMER_CALLBACK( z80pio_astb_tick )
357static TIMER_DEVICE_CALLBACK( z80pio_astb_tick )
358358{
359   abc80_state *state = machine->driver_data;
359   abc80_state *state = timer->machine->driver_data;
360360
361361   /* toggle ASTB every other video line */
362362   state->z80pio_astb = !state->z80pio_astb;
r3467r3468
490490   state_save_register_global(state->key_data);
491491   state_save_register_global(state->key_strobe);
492492   state_save_register_global(state->z80pio_astb);
493
494   /* allocate the keyboard scan timer */
495
496   state->keyboard_timer = timer_alloc(abc80_keyboard_tick, NULL);
497   timer_adjust_periodic(state->keyboard_timer, attotime_zero, 0, ATTOTIME_IN_USEC(2500)); // 2.5 ms
498
499   /* allocate Z80PIO strobe timer */
500
501   state->z80pio_astb_timer = timer_alloc(z80pio_astb_tick, NULL);
502   timer_adjust_periodic(state->z80pio_astb_timer, attotime_zero, 0, video_screen_get_time_until_pos(device_list_find_by_tag(machine->config->devicelist, VIDEO_SCREEN, "main"), 0, 0));
503493}
504494
505495/* Machine Drivers */
r3467r3468
517507   MDRV_MACHINE_START(abc80)
518508
519509   /* keyboard */
520//   MDRV_TIMER_ADD_PERIODIC("keyboard", abc80_keyboard_tick, USEC(2500))
510   MDRV_TIMER_ADD_PERIODIC("keyboard", abc80_keyboard_tick, USEC(2500))
521511
522512   /* Z80PIO */
523//   MDRV_TIMER_ADD_SCANLINE("pio_astb", z80pio_astb_tick, SCREEN_TAG, 0, 1)
513   MDRV_TIMER_ADD_SCANLINE("pio_astb", z80pio_astb_tick, SCREEN_TAG, 0, 1)
524514   MDRV_Z80PIO_ADD(Z80PIO_TAG, abc80_pio_intf)
525515
526516   /* video hardware */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team