Previous 199869 Revisions Next

r18139 Tuesday 25th September, 2012 at 14:21:56 UTC by Miodrag Milanović
TIMER_CALLBACK_DEVICE_MEMBER modernization part 2 (no whatsnew)
[src/mame/drivers]acommand.c aristmk4.c astrocorp.c big10.c blitz68k.c bnstars.c coolridr.c cshooter.c csplayh5.c ddealer.c dfruit.c dwarfd.c ecoinfr.c expro02.c firefox.c galpani3.c halleys.c hvyunit.c icecold.c igs017.c igspoker.c jackie.c jalmah.c jchan.c jclub2.c kas89.c koftball.c lastbank.c littlerb.c maxaflex.c mediagx.c meijinsn.c meritm.c meyc8088.c mpu3.c mpu4vid.c namcos11.c olibochu.c panicr.c photon2.c pkscram.c popobear.c quizshow.c rotaryf.c rowamet.c royalmah.c sangho.c sbowling.c scregg.c sfkick.c sigmab98.c sothello.c subsino2.c tasman.c tmaster.c tmmjprd.c tonton.c videopkr.c wheelfir.c zac_1.c zac_2.c
[src/mess/drivers]4004clk.c babbage.c bigbord2.c bml3.c chesstrv.c csc.c d6800.c eacc.c exelv.c fk1.c glasgow.c h8.c h89.c iq151.c jr100.c junior.c kim1.c mc10.c mephisto.c mk1.c mk2.c mmodular.c mstation.c multi8.c mycom.c nakajies.c nanos.c pasogo.c pc100.c pc6001.c pc8801.c pce220.c pegasus.c prestige.c px4.c rainbow.c rex6000.c scorpion.c smc777.c supercon.c vboy.c vg5k.c vt100.c z9001.c

trunk/src/mame/drivers/sfkick.c
r18138r18139
7979   DECLARE_WRITE8_MEMBER(ppi_port_c_w);
8080   DECLARE_DRIVER_INIT(sfkick);
8181   virtual void machine_reset();
82   TIMER_DEVICE_CALLBACK_MEMBER(sfkick_interrupt);
8283};
8384
8485
r18138r18139
449450   sfkick_remap_banks(machine());
450451}
451452
452static TIMER_DEVICE_CALLBACK( sfkick_interrupt )
453TIMER_DEVICE_CALLBACK_MEMBER(sfkick_state::sfkick_interrupt)
453454{
454   sfkick_state *state = timer.machine().driver_data<sfkick_state>();
455   state->m_v9938->interrupt();
455   m_v9938->interrupt();
456456}
457457
458458static void irqhandler(device_t *device, int irq)
r18138r18139
475475   MCFG_CPU_ADD("maincpu",Z80,MASTER_CLOCK/6)
476476   MCFG_CPU_PROGRAM_MAP(sfkick_map)
477477   MCFG_CPU_IO_MAP(sfkick_io_map)
478   MCFG_TIMER_ADD_SCANLINE("scantimer", sfkick_interrupt, "screen", 0, 1)
478   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sfkick_state, sfkick_interrupt, "screen", 0, 1)
479479
480480   MCFG_QUANTUM_TIME(attotime::from_hz(60000))
481481
trunk/src/mame/drivers/meijinsn.c
r18138r18139
9797   virtual void video_start();
9898   virtual void palette_init();
9999   UINT32 screen_update_meijinsn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
100   TIMER_DEVICE_CALLBACK_MEMBER(meijinsn_interrupt);
100101};
101102
102103
r18138r18139
316317}
317318
318319
319static TIMER_DEVICE_CALLBACK( meijinsn_interrupt )
320TIMER_DEVICE_CALLBACK_MEMBER(meijinsn_state::meijinsn_interrupt)
320321{
321   meijinsn_state *state = timer.machine().driver_data<meijinsn_state>();
322322   int scanline = param;
323323
324324   if(scanline == 240)
325      state->m_maincpu->set_input_line(1, HOLD_LINE);
325      m_maincpu->set_input_line(1, HOLD_LINE);
326326
327327   if(scanline == 0)
328      state->m_maincpu->set_input_line(2, HOLD_LINE);
328      m_maincpu->set_input_line(2, HOLD_LINE);
329329}
330330
331331static const ay8910_interface ay8910_config =
r18138r18139
357357   /* basic machine hardware */
358358   MCFG_CPU_ADD("maincpu", M68000, 9000000 )
359359   MCFG_CPU_PROGRAM_MAP(meijinsn_map)
360   MCFG_TIMER_ADD_SCANLINE("scantimer", meijinsn_interrupt, "screen", 0, 1)
360   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", meijinsn_state, meijinsn_interrupt, "screen", 0, 1)
361361
362362   MCFG_CPU_ADD("audiocpu", Z80, 4000000)
363363   MCFG_CPU_PROGRAM_MAP(meijinsn_sound_map)
trunk/src/mame/drivers/coolridr.c
r18138r18139
321321   virtual void video_start();
322322   UINT32 screen_update_coolridr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
323323   INTERRUPT_GEN_MEMBER(system_h1);
324   TIMER_DEVICE_CALLBACK_MEMBER(system_h1_sub);
324325};
325326
326327
r18138r18139
11441145}
11451146
11461147//IRQs 10,12 and 14 are valid on SH-1 instead
1147static TIMER_DEVICE_CALLBACK( system_h1_sub )
1148TIMER_DEVICE_CALLBACK_MEMBER(coolridr_state::system_h1_sub)
11481149{
1149   coolridr_state *state = timer.machine().driver_data<coolridr_state>();
11501150   int scanline = param;
11511151
11521152   switch(scanline)
11531153   {
1154       case 512:state->m_subcpu->set_input_line(0xa, HOLD_LINE); break;
1155        case 256:state->m_subcpu->set_input_line(0xc, HOLD_LINE); break;
1156        case 0:state->m_subcpu->set_input_line(0xe, HOLD_LINE); break;
1154       case 512:m_subcpu->set_input_line(0xa, HOLD_LINE); break;
1155        case 256:m_subcpu->set_input_line(0xc, HOLD_LINE); break;
1156        case 0:m_subcpu->set_input_line(0xe, HOLD_LINE); break;
11571157   }
11581158}
11591159
r18138r18139
11731173
11741174   MCFG_CPU_ADD("sub", SH1, 16000000)   // SH7032 HD6417032F20!! 16 mhz
11751175   MCFG_CPU_PROGRAM_MAP(coolridr_submap)
1176   MCFG_TIMER_ADD_SCANLINE("scantimer", system_h1_sub, "screen", 0, 1)
1176   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", coolridr_state, system_h1_sub, "screen", 0, 1)
11771177
11781178   MCFG_GFXDECODE(coolridr)
11791179
trunk/src/mame/drivers/sangho.c
r18138r18139
6767   DECLARE_DRIVER_INIT(sangho);
6868   DECLARE_MACHINE_RESET(pzlestar);
6969   DECLARE_MACHINE_RESET(sexyboom);
70   TIMER_DEVICE_CALLBACK_MEMBER(sangho_interrupt);
7071};
7172
7273
r18138r18139
405406   device.machine().device("maincpu")->execute().set_input_line(0, (i ? HOLD_LINE : CLEAR_LINE));
406407}
407408
408static TIMER_DEVICE_CALLBACK( sangho_interrupt )
409TIMER_DEVICE_CALLBACK_MEMBER(sangho_state::sangho_interrupt)
409410{
410   sangho_state *state = timer.machine().driver_data<sangho_state>();
411411   int scanline = param;
412412
413413   if((scanline % 2) == 0)
414414   {
415      state->m_v9958->set_sprite_limit(0);
416      state->m_v9958->set_resolution(RENDER_HIGH);
417      state->m_v9958->interrupt();
415      m_v9958->set_sprite_limit(0);
416      m_v9958->set_resolution(RENDER_HIGH);
417      m_v9958->interrupt();
418418   }
419419}
420420
r18138r18139
424424   MCFG_CPU_ADD("maincpu", Z80,8000000) // ?
425425   MCFG_CPU_PROGRAM_MAP(sangho_map)
426426   MCFG_CPU_IO_MAP(pzlestar_io_map)
427   MCFG_TIMER_ADD_SCANLINE("scantimer", sangho_interrupt, "screen", 0, 1)
427   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sangho_state, sangho_interrupt, "screen", 0, 1)
428428
429429   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
430430
r18138r18139
456456   MCFG_CPU_ADD("maincpu", Z80,8000000) // ?
457457   MCFG_CPU_PROGRAM_MAP(sangho_map)
458458   MCFG_CPU_IO_MAP(sexyboom_io_map)
459   MCFG_TIMER_ADD_SCANLINE("scantimer", sangho_interrupt, "screen", 0, 1)
459   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sangho_state, sangho_interrupt, "screen", 0, 1)
460460
461461   MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
462462
trunk/src/mame/drivers/tasman.c
r18138r18139
3737   DECLARE_DRIVER_INIT(kingtut);
3838   DECLARE_VIDEO_START(kongambl);
3939   UINT32 screen_update_kongambl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
40   TIMER_DEVICE_CALLBACK_MEMBER(kongambl_vblank);
4041};
4142
4243
r18138r18139
579580   kongambl_sprite_callback
580581};
581582
582static TIMER_DEVICE_CALLBACK( kongambl_vblank )
583TIMER_DEVICE_CALLBACK_MEMBER(kongambl_state::kongambl_vblank)
583584{
584   kongambl_state *state = timer.machine().driver_data<kongambl_state>();
585585   int scanline = param;
586586
587587   if(scanline == 512)
588      state->m_maincpu->set_input_line(1, HOLD_LINE); // vblank?
588      m_maincpu->set_input_line(1, HOLD_LINE); // vblank?
589589
590590   if(scanline == 0)
591      state->m_maincpu->set_input_line(3, HOLD_LINE); // sprite irq?
591      m_maincpu->set_input_line(3, HOLD_LINE); // sprite irq?
592592}
593593
594594static MACHINE_CONFIG_START( kongambl, kongambl_state )
595595   MCFG_CPU_ADD("maincpu", M68EC020, 25000000)
596596   MCFG_CPU_PROGRAM_MAP(kongambl_map)
597   MCFG_TIMER_ADD_SCANLINE("scantimer", kongambl_vblank, "screen", 0, 1)
597   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kongambl_state, kongambl_vblank, "screen", 0, 1)
598598
599599   MCFG_CPU_ADD("sndcpu", M68000, 16000000)
600600   MCFG_CPU_PROGRAM_MAP(kongamaud_map)
trunk/src/mame/drivers/cshooter.c
r18138r18139
120120   DECLARE_MACHINE_RESET(cshooter);
121121   DECLARE_MACHINE_RESET(airraid);
122122   UINT32 screen_update_cshooter(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
123   TIMER_DEVICE_CALLBACK_MEMBER(cshooter_scanline);
123124};
124125
125126
r18138r18139
202203/* main cpu */
203204
204205
205static TIMER_DEVICE_CALLBACK( cshooter_scanline )
206TIMER_DEVICE_CALLBACK_MEMBER(cshooter_state::cshooter_scanline)
206207{
207208   int scanline = param;
208209
209210   if(scanline == 240) // vblank-out irq
210      timer.machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE,0x10); /* RST 10h */
211      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE,0x10); /* RST 10h */
211212
212213   if(scanline == 0) // vblank-in irq
213      timer.machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE,0x08); /* RST 08h */
214      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE,0x08); /* RST 08h */
214215}
215216
216217
r18138r18139
439440static MACHINE_CONFIG_START( cshooter, cshooter_state )
440441   MCFG_CPU_ADD("maincpu", Z80,XTAL_12MHz/2)       /* verified on pcb */
441442   MCFG_CPU_PROGRAM_MAP(cshooter_map)
442   MCFG_TIMER_ADD_SCANLINE("scantimer", cshooter_scanline, "screen", 0, 1)
443   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", cshooter_state, cshooter_scanline, "screen", 0, 1)
443444
444445   MCFG_CPU_ADD("audiocpu", Z80,XTAL_14_31818MHz/4)       /* verified on pcb */
445446   MCFG_CPU_PROGRAM_MAP(sound_map)
r18138r18139
466467static MACHINE_CONFIG_START( airraid, cshooter_state )
467468   MCFG_CPU_ADD("maincpu", Z80,XTAL_12MHz/2)       /* verified on pcb */
468469   MCFG_CPU_PROGRAM_MAP(airraid_map)
469   MCFG_TIMER_ADD_SCANLINE("scantimer", cshooter_scanline, "screen", 0, 1)
470   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", cshooter_state, cshooter_scanline, "screen", 0, 1)
470471
471472   SEIBU2_AIRRAID_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4)       /* verified on pcb */
472473
trunk/src/mame/drivers/tonton.c
r18138r18139
4343   DECLARE_WRITE8_MEMBER(ay_bout_w);
4444   virtual void machine_start();
4545   virtual void machine_reset();
46   TIMER_DEVICE_CALLBACK_MEMBER(tonton_interrupt);
4647};
4748
4849#define MAIN_CLOCK XTAL_21_4772MHz
r18138r18139
202203*      R/W Handlers and Interrupt Routines       *
203204*************************************************/
204205
205static TIMER_DEVICE_CALLBACK( tonton_interrupt )
206TIMER_DEVICE_CALLBACK_MEMBER(tonton_state::tonton_interrupt)
206207{
207   tonton_state *state = timer.machine().driver_data<tonton_state>();
208   state->m_v9938->set_sprite_limit(0);
209   state->m_v9938->set_resolution(0);
210   state->m_v9938->interrupt();
208   m_v9938->set_sprite_limit(0);
209   m_v9938->set_resolution(0);
210   m_v9938->interrupt();
211211}
212212
213213
r18138r18139
255255   MCFG_CPU_ADD("maincpu",Z80,MAIN_CLOCK/6)   /* Guess. According to other MSX2 based gambling games */
256256   MCFG_CPU_PROGRAM_MAP(tonton_map)
257257   MCFG_CPU_IO_MAP(tonton_io)
258   MCFG_TIMER_ADD_SCANLINE("scantimer", tonton_interrupt, "screen", 0, 1)
258   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tonton_state, tonton_interrupt, "screen", 0, 1)
259259
260260   MCFG_NVRAM_ADD_0FILL("nvram")
261261
trunk/src/mame/drivers/sigmab98.c
r18138r18139
178178   UINT32 screen_update_sigmab98(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
179179   void screen_eof_sammymdl(screen_device &screen, bool state);
180180   INTERRUPT_GEN_MEMBER(gegege_vblank_interrupt);
181   TIMER_DEVICE_CALLBACK_MEMBER(sammymd1_irq);
181182};
182183
183184
r18138r18139
17851786                                 Animal Catch
17861787***************************************************************************/
17871788
1788static TIMER_DEVICE_CALLBACK( sammymd1_irq )
1789TIMER_DEVICE_CALLBACK_MEMBER(sigmab98_state::sammymd1_irq)
17891790{
1790   sigmab98_state *state = timer.machine().driver_data<sigmab98_state>();
17911791   int scanline = param;
17921792
17931793   if(scanline == 240)
1794      state->m_maincpu->set_input_line_and_vector(0,HOLD_LINE, state->m_vblank_vector);
1794      m_maincpu->set_input_line_and_vector(0,HOLD_LINE, m_vblank_vector);
17951795
17961796   if(scanline == 128)
1797      state->m_maincpu->set_input_line_and_vector(0,HOLD_LINE, state->m_timer0_vector);
1797      m_maincpu->set_input_line_and_vector(0,HOLD_LINE, m_timer0_vector);
17981798
17991799   if(scanline == 32)
1800      state->m_maincpu->set_input_line_and_vector(0,HOLD_LINE, state->m_timer1_vector);
1800      m_maincpu->set_input_line_and_vector(0,HOLD_LINE, m_timer1_vector);
18011801}
18021802
18031803static MACHINE_CONFIG_DERIVED( animalc, sammymdl )
18041804   MCFG_CPU_MODIFY("maincpu")
18051805   MCFG_CPU_PROGRAM_MAP( animalc_map )
18061806   MCFG_CPU_IO_MAP( animalc_io )
1807   MCFG_TIMER_ADD_SCANLINE("scantimer", sammymd1_irq, "screen", 0, 1)
1807   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sigmab98_state, sammymd1_irq, "screen", 0, 1)
18081808MACHINE_CONFIG_END
18091809
18101810/***************************************************************************
r18138r18139
18151815   MCFG_CPU_MODIFY("maincpu")
18161816   MCFG_CPU_PROGRAM_MAP( haekaka_map )
18171817   MCFG_CPU_IO_MAP( haekaka_io )
1818   MCFG_TIMER_ADD_SCANLINE("scantimer", sammymd1_irq, "screen", 0, 1)
1818   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sigmab98_state, sammymd1_irq, "screen", 0, 1)
18191819MACHINE_CONFIG_END
18201820
18211821/***************************************************************************
r18138r18139
18261826   MCFG_CPU_MODIFY("maincpu")
18271827   MCFG_CPU_PROGRAM_MAP( itazuram_map )
18281828   MCFG_CPU_IO_MAP( itazuram_io )
1829   MCFG_TIMER_ADD_SCANLINE("scantimer", sammymd1_irq, "screen", 0, 1)
1829   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sigmab98_state, sammymd1_irq, "screen", 0, 1)
18301830MACHINE_CONFIG_END
18311831
18321832/***************************************************************************
r18138r18139
18371837   MCFG_CPU_MODIFY("maincpu")
18381838   MCFG_CPU_PROGRAM_MAP( haekaka_map )
18391839   MCFG_CPU_IO_MAP( pyenaget_io )
1840   MCFG_TIMER_ADD_SCANLINE("scantimer", sammymd1_irq, "screen", 0, 1)
1840   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sigmab98_state, sammymd1_irq, "screen", 0, 1)
18411841MACHINE_CONFIG_END
18421842
18431843/***************************************************************************
r18138r18139
18481848   MCFG_CPU_MODIFY("maincpu")
18491849   MCFG_CPU_PROGRAM_MAP( tdoboon_map )
18501850   MCFG_CPU_IO_MAP( tdoboon_io )
1851   MCFG_TIMER_ADD_SCANLINE("scantimer", sammymd1_irq, "screen", 0, 1)
1851   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sigmab98_state, sammymd1_irq, "screen", 0, 1)
18521852
18531853   MCFG_SCREEN_MODIFY("screen")
18541854   MCFG_SCREEN_VISIBLE_AREA(0,0x140-1, 0+4,0xf0+4-1)
trunk/src/mame/drivers/popobear.c
r18138r18139
9696   DECLARE_WRITE8_MEMBER(popobear_irq_ack_w);
9797   virtual void video_start();
9898   UINT32 screen_update_popobear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
99   TIMER_DEVICE_CALLBACK_MEMBER(popobear_irq);
99100};
100101
101102void popobear_state::video_start()
r18138r18139
437438INPUT_PORTS_END
438439
439440
440static TIMER_DEVICE_CALLBACK( popobear_irq )
441TIMER_DEVICE_CALLBACK_MEMBER(popobear_state::popobear_irq)
441442{
442   popobear_state *state = timer.machine().driver_data<popobear_state>();
443443   int scanline = param;
444444
445445   /* Order is trusted (5 as vblank-out makes the title screen logo spinning to behave wrongly) */
446446   if(scanline == 240)
447      state->m_maincpu->set_input_line(3, ASSERT_LINE);
447      m_maincpu->set_input_line(3, ASSERT_LINE);
448448
449449   if(scanline == 0)
450      state->m_maincpu->set_input_line(5, ASSERT_LINE);
450      m_maincpu->set_input_line(5, ASSERT_LINE);
451451
452452   /* TODO: actually a timer irq, tied with YM2413 sound chip (controls BGM tempo) */
453453   if(scanline == 64 || scanline == 192)
454      state->m_maincpu->set_input_line(2, ASSERT_LINE);
454      m_maincpu->set_input_line(2, ASSERT_LINE);
455455}
456456
457457static MACHINE_CONFIG_START( popobear, popobear_state )
r18138r18139
460460   // levels 2,3,5 look interesting
461461   //MCFG_CPU_VBLANK_INT_DRIVER("screen", popobear_state, irq5_line_assert)
462462   //MCFG_CPU_PERIODIC_INT_DRIVER(popobear_state, irq2_line_assert, 120)
463   MCFG_TIMER_ADD_SCANLINE("scantimer", popobear_irq, "screen", 0, 1)
463   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", popobear_state, popobear_irq, "screen", 0, 1)
464464
465465   MCFG_SCREEN_ADD("screen", RASTER)
466466   MCFG_SCREEN_REFRESH_RATE(60)
trunk/src/mame/drivers/quizshow.c
r18138r18139
6464   virtual void video_start();
6565   virtual void palette_init();
6666   UINT32 screen_update_quizshow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
67   TIMER_DEVICE_CALLBACK_MEMBER(quizshow_clock_timer_cb);
6768};
6869
6970
r18138r18139
352353GFXDECODE_END
353354
354355
355static TIMER_DEVICE_CALLBACK( quizshow_clock_timer_cb )
356TIMER_DEVICE_CALLBACK_MEMBER(quizshow_state::quizshow_clock_timer_cb)
356357{
357   quizshow_state *state = timer.machine().driver_data<quizshow_state>();
358   state->m_clocks++;
358   m_clocks++;
359359
360360   // blink is on 4F and 8F
361   int blink_old = state->m_blink_state;
362   state->m_blink_state = (state->m_clocks >> 2 & state->m_clocks >> 1) & 0x40;
363   if (state->m_blink_state != blink_old)
364      state->m_tilemap->mark_all_dirty();
361   int blink_old = m_blink_state;
362   m_blink_state = (m_clocks >> 2 & m_clocks >> 1) & 0x40;
363   if (m_blink_state != blink_old)
364      m_tilemap->mark_all_dirty();
365365}
366366
367367void quizshow_state::machine_reset()
r18138r18139
376376   MCFG_CPU_ADD("maincpu", S2650, MASTER_CLOCK / 16) // divider guessed
377377   MCFG_CPU_PROGRAM_MAP(quizshow_mem_map)
378378   MCFG_CPU_IO_MAP(quizshow_io_map)
379   MCFG_TIMER_ADD_PERIODIC("clock_timer", quizshow_clock_timer_cb, attotime::from_hz(PIXEL_CLOCK / (HTOTAL * 8))) // 8V
379   MCFG_TIMER_DRIVER_ADD_PERIODIC("clock_timer", quizshow_state, quizshow_clock_timer_cb, attotime::from_hz(PIXEL_CLOCK / (HTOTAL * 8))) // 8V
380380
381381   /* video hardware */
382382   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/igspoker.c
r18138r18139
121121   DECLARE_VIDEO_START(cpokerpk);
122122   UINT32 screen_update_igs_video(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
123123   UINT32 screen_update_cpokerpk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
124   TIMER_DEVICE_CALLBACK_MEMBER(igs_interrupt);
124125};
125126
126127
r18138r18139
132133}
133134
134135
135static TIMER_DEVICE_CALLBACK( igs_interrupt )
136TIMER_DEVICE_CALLBACK_MEMBER(igspoker_state::igs_interrupt)
136137{
137   igspoker_state *state = timer.machine().driver_data<igspoker_state>();
138138   int scanline = param;
139139
140140   if((scanline % 32) != 0)
141141      return;
142142
143143   if((scanline % 64) == 32)
144      state->m_maincpu->set_input_line(0, ASSERT_LINE);
144      m_maincpu->set_input_line(0, ASSERT_LINE);
145145
146   if((scanline % 64) == 0 && state->m_nmi_enable)
147      state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
146   if((scanline % 64) == 0 && m_nmi_enable)
147      m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
148148}
149149
150150
r18138r18139
17711771   MCFG_CPU_ADD("maincpu",Z80, 3579545)
17721772   MCFG_CPU_PROGRAM_MAP(igspoker_prg_map)
17731773   MCFG_CPU_IO_MAP(igspoker_io_map)
1774   MCFG_TIMER_ADD_SCANLINE("scantimer", igs_interrupt, "screen", 0, 1)
1774   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", igspoker_state, igs_interrupt, "screen", 0, 1)
17751775
17761776
17771777   /* video hardware */
trunk/src/mame/drivers/videopkr.c
r18138r18139
364364   DECLARE_PALETTE_INIT(babypkr);
365365   DECLARE_PALETTE_INIT(fortune1);
366366   UINT32 screen_update_videopkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
367   TIMER_DEVICE_CALLBACK_MEMBER(sound_t1_callback);
367368};
368369
369370
r18138r18139
930931}
931932
932933
933static TIMER_DEVICE_CALLBACK(sound_t1_callback)
934TIMER_DEVICE_CALLBACK_MEMBER(videopkr_state::sound_t1_callback)
934935{
935   videopkr_state *state = timer.machine().driver_data<videopkr_state>();
936   if (state->m_te_40103 == 1)
936   if (m_te_40103 == 1)
937937   {
938      state->m_dc_40103++;
938      m_dc_40103++;
939939
940      if (state->m_dc_40103 == 0)
940      if (m_dc_40103 == 0)
941941      {
942         timer.machine().device("soundcpu")->execute().set_input_line(0, ASSERT_LINE);
942         machine().device("soundcpu")->execute().set_input_line(0, ASSERT_LINE);
943943      }
944944   }
945945}
r18138r18139
12441244   MCFG_CPU_IO_MAP(i8039_sound_port)
12451245   MCFG_NVRAM_ADD_0FILL("nvram")
12461246
1247   MCFG_TIMER_ADD_PERIODIC("t1_timer", sound_t1_callback, attotime::from_hz(50))
1247   MCFG_TIMER_DRIVER_ADD_PERIODIC("t1_timer", videopkr_state, sound_t1_callback, attotime::from_hz(50))
12481248
12491249   /* video hardware */
12501250   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/jackie.c
r18138r18139
111111   virtual void machine_reset();
112112   virtual void video_start();
113113   UINT32 screen_update_jackie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
114   TIMER_DEVICE_CALLBACK_MEMBER(jackie_irq);
114115};
115116
116117
r18138r18139
557558   rom[0x7e86] = 0xc3;
558559}
559560
560static TIMER_DEVICE_CALLBACK( jackie_irq )
561TIMER_DEVICE_CALLBACK_MEMBER(jackie_state::jackie_irq)
561562{
562   jackie_state *state = timer.machine().driver_data<jackie_state>();
563563   int scanline = param;
564564
565565   if((scanline % 32) != 0)
566566      return;
567567
568   if((scanline % 64) == 32 && state->m_irq_enable)
569      state->m_maincpu->set_input_line(0, HOLD_LINE);
570   else if   ((scanline % 64) == 0 && state->m_nmi_enable)
571      state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
568   if((scanline % 64) == 32 && m_irq_enable)
569      m_maincpu->set_input_line(0, HOLD_LINE);
570   else if   ((scanline % 64) == 0 && m_nmi_enable)
571      m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
572572}
573573
574574static MACHINE_CONFIG_START( jackie, jackie_state )
r18138r18139
577577   MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 2)
578578   MCFG_CPU_PROGRAM_MAP(jackie_prg_map)
579579   MCFG_CPU_IO_MAP(jackie_io_map)
580   MCFG_TIMER_ADD_SCANLINE("scantimer", jackie_irq, "screen", 0, 1)
580   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", jackie_state, jackie_irq, "screen", 0, 1)
581581
582582
583583   /* video hardware */
trunk/src/mame/drivers/big10.c
r18138r18139
7575   DECLARE_READ8_MEMBER(mux_r);
7676   DECLARE_WRITE8_MEMBER(mux_w);
7777   virtual void machine_reset();
78   TIMER_DEVICE_CALLBACK_MEMBER(big10_interrupt);
7879};
7980
8081
r18138r18139
9091   device.machine().device("maincpu")->execute().set_input_line(0, (i ? ASSERT_LINE : CLEAR_LINE));
9192}
9293
93static TIMER_DEVICE_CALLBACK( big10_interrupt )
94TIMER_DEVICE_CALLBACK_MEMBER(big10_state::big10_interrupt)
9495{
95   big10_state *state = timer.machine().driver_data<big10_state>();
96   state->m_v9938->interrupt();
96   m_v9938->interrupt();
9797}
9898
9999
r18138r18139
247247   MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6)   /* guess */
248248   MCFG_CPU_PROGRAM_MAP(main_map)
249249   MCFG_CPU_IO_MAP(main_io)
250   MCFG_TIMER_ADD_SCANLINE("scantimer", big10_interrupt, "screen", 0, 1)
250   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", big10_state, big10_interrupt, "screen", 0, 1)
251251
252252
253253   MCFG_NVRAM_ADD_0FILL("nvram")
trunk/src/mame/drivers/rowamet.c
r18138r18139
4949   virtual void machine_reset();
5050public:
5151   DECLARE_DRIVER_INIT(rowamet);
52   TIMER_DEVICE_CALLBACK_MEMBER(rowamet_timer);
5253};
5354
5455
r18138r18139
119120{
120121}
121122
122static TIMER_DEVICE_CALLBACK( rowamet_timer )
123TIMER_DEVICE_CALLBACK_MEMBER(rowamet_state::rowamet_timer)
123124{
124125   static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0, 0, 0, 0, 0, 0 };
125   rowamet_state *state = timer.machine().driver_data<rowamet_state>();
126   state->m_out_offs &= 15;
126   m_out_offs &= 15;
127127
128   UINT8 digit = state->m_out_offs << 1;
129   output_set_digit_value(digit, patterns[state->m_p_ram[state->m_out_offs]>>4]);
130   output_set_digit_value(++digit, patterns[state->m_p_ram[state->m_out_offs++]&15]);
128   UINT8 digit = m_out_offs << 1;
129   output_set_digit_value(digit, patterns[m_p_ram[m_out_offs]>>4]);
130   output_set_digit_value(++digit, patterns[m_p_ram[m_out_offs++]&15]);
131131}
132132
133133static MACHINE_CONFIG_START( rowamet, rowamet_state )
r18138r18139
137137   MCFG_CPU_ADD("cpu2", Z80, 1888888)
138138   MCFG_CPU_PROGRAM_MAP(rowamet_sub_map)
139139   MCFG_CPU_IO_MAP(rowamet_sub_io)
140   MCFG_TIMER_ADD_PERIODIC("rowamet_timer", rowamet_timer, attotime::from_hz(200))
140   MCFG_TIMER_DRIVER_ADD_PERIODIC("rowamet_timer", rowamet_state, rowamet_timer, attotime::from_hz(200))
141141
142142   /* Video */
143143   MCFG_DEFAULT_LAYOUT(layout_rowamet)
trunk/src/mame/drivers/namcos11.c
r18138r18139
342342   DECLARE_DRIVER_INIT(xevi3dg);
343343   DECLARE_DRIVER_INIT(tekken2);
344344   DECLARE_MACHINE_RESET(namcos11);
345   TIMER_DEVICE_CALLBACK_MEMBER(mcu_irq0_cb);
346   TIMER_DEVICE_CALLBACK_MEMBER(mcu_irq2_cb);
347   TIMER_DEVICE_CALLBACK_MEMBER(mcu_adc_cb);
345348};
346349
347350INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... )
r18138r18139
10001003}
10011004
10021005
1003static TIMER_DEVICE_CALLBACK( mcu_irq0_cb )
1006TIMER_DEVICE_CALLBACK_MEMBER(namcos11_state::mcu_irq0_cb)
10041007{
1005   namcos11_state *state = timer.machine().driver_data<namcos11_state>();
10061008
1007   state->m_mcu->set_input_line(M37710_LINE_IRQ0, HOLD_LINE);
1009   m_mcu->set_input_line(M37710_LINE_IRQ0, HOLD_LINE);
10081010}
10091011
1010static TIMER_DEVICE_CALLBACK( mcu_irq2_cb )
1012TIMER_DEVICE_CALLBACK_MEMBER(namcos11_state::mcu_irq2_cb)
10111013{
1012   namcos11_state *state = timer.machine().driver_data<namcos11_state>();
10131014
1014   state->m_mcu->set_input_line(M37710_LINE_IRQ2, HOLD_LINE);
1015   m_mcu->set_input_line(M37710_LINE_IRQ2, HOLD_LINE);
10151016}
10161017
1017static TIMER_DEVICE_CALLBACK( mcu_adc_cb )
1018TIMER_DEVICE_CALLBACK_MEMBER(namcos11_state::mcu_adc_cb)
10181019{
1019   namcos11_state *state = timer.machine().driver_data<namcos11_state>();
10201020
1021   state->m_mcu->set_input_line(M37710_LINE_ADC, HOLD_LINE);
1021   m_mcu->set_input_line(M37710_LINE_ADC, HOLD_LINE);
10221022}
10231023
10241024static MACHINE_CONFIG_START( coh100, namcos11_state )
r18138r18139
10301030   MCFG_CPU_PROGRAM_MAP(c76_map)
10311031   MCFG_CPU_IO_MAP(c76_io_map)
10321032   /* TODO: irq generation for these */
1033   MCFG_TIMER_ADD_PERIODIC("mcu_irq0", mcu_irq0_cb, attotime::from_hz(60))
1034   MCFG_TIMER_ADD_PERIODIC("mcu_irq2", mcu_irq2_cb, attotime::from_hz(60))
1035   MCFG_TIMER_ADD_PERIODIC("mcu_adc",  mcu_adc_cb, attotime::from_hz(60))
1033   MCFG_TIMER_DRIVER_ADD_PERIODIC("mcu_irq0", namcos11_state, mcu_irq0_cb, attotime::from_hz(60))
1034   MCFG_TIMER_DRIVER_ADD_PERIODIC("mcu_irq2", namcos11_state, mcu_irq2_cb, attotime::from_hz(60))
1035   MCFG_TIMER_DRIVER_ADD_PERIODIC("mcu_adc", namcos11_state, mcu_adc_cb, attotime::from_hz(60))
10361036
10371037   MCFG_MACHINE_RESET_OVERRIDE(namcos11_state, namcos11 )
10381038
trunk/src/mame/drivers/panicr.c
r18138r18139
9999   virtual void video_start();
100100   virtual void palette_init();
101101   UINT32 screen_update_panicr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
102   TIMER_DEVICE_CALLBACK_MEMBER(panicr_scanline);
102103};
103104
104105
r18138r18139
490491GFXDECODE_END
491492
492493
493static TIMER_DEVICE_CALLBACK( panicr_scanline )
494TIMER_DEVICE_CALLBACK_MEMBER(panicr_state::panicr_scanline)
494495{
495496   int scanline = param;
496497
497498   if(scanline == 240) // vblank-out irq
498      timer.machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xc4/4);
499      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xc4/4);
499500
500501   if(scanline == 0) // <unknown>
501      timer.machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xc8/4);
502      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xc8/4);
502503}
503504
504505static MACHINE_CONFIG_START( panicr, panicr_state )
505506   MCFG_CPU_ADD("maincpu", V20,MASTER_CLOCK/2) /* Sony 8623h9 CXQ70116D-8 (V20 compatible) */
506507   MCFG_CPU_PROGRAM_MAP(panicr_map)
507   MCFG_TIMER_ADD_SCANLINE("scantimer", panicr_scanline, "screen", 0, 1)
508   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", panicr_state, panicr_scanline, "screen", 0, 1)
508509
509510   MCFG_CPU_ADD(CPUTAG_T5182,Z80,SOUND_CLOCK/4)   /* 3.579545 MHz */
510511   MCFG_CPU_PROGRAM_MAP(t5182_map)
trunk/src/mame/drivers/hvyunit.c
r18138r18139
128128   virtual void video_start();
129129   UINT32 screen_update_hvyunit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
130130   void screen_eof_hvyunit(screen_device &screen, bool state);
131   TIMER_DEVICE_CALLBACK_MEMBER(hvyunit_scanline);
131132};
132133
133134
r18138r18139
624625 *************************************/
625626
626627/* Main Z80 uses IM2 */
627static TIMER_DEVICE_CALLBACK( hvyunit_scanline )
628TIMER_DEVICE_CALLBACK_MEMBER(hvyunit_state::hvyunit_scanline)
628629{
629   hvyunit_state *state = timer.machine().driver_data<hvyunit_state>();
630630   int scanline = param;
631631
632632   if(scanline == 240) // vblank-out irq
633      state->m_master_cpu->execute().set_input_line_and_vector(0, HOLD_LINE, 0xfd);
633      m_master_cpu->execute().set_input_line_and_vector(0, HOLD_LINE, 0xfd);
634634
635635   /* Pandora "sprite end dma" irq? TODO: timing is likely off */
636636   if(scanline == 64)
637      state->m_master_cpu->execute().set_input_line_and_vector(0, HOLD_LINE, 0xff);
637      m_master_cpu->execute().set_input_line_and_vector(0, HOLD_LINE, 0xff);
638638}
639639
640640static const kaneko_pandora_interface hvyunit_pandora_config =
r18138r18139
656656   MCFG_CPU_ADD("master", Z80, 6000000)
657657   MCFG_CPU_PROGRAM_MAP(master_memory)
658658   MCFG_CPU_IO_MAP(master_io)
659   MCFG_TIMER_ADD_SCANLINE("scantimer", hvyunit_scanline, "screen", 0, 1)
659   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", hvyunit_state, hvyunit_scanline, "screen", 0, 1)
660660
661661   MCFG_CPU_ADD("slave", Z80, 6000000)
662662   MCFG_CPU_PROGRAM_MAP(slave_memory)
trunk/src/mame/drivers/rotaryf.c
r18138r18139
2727   required_device<cpu_device> m_maincpu;
2828   required_shared_ptr<UINT8> m_videoram;
2929   UINT32 screen_update_rotaryf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
30   TIMER_DEVICE_CALLBACK_MEMBER(rotaryf_interrupt);
3031};
3132
3233
r18138r18139
4041 *
4142 *************************************/
4243
43static TIMER_DEVICE_CALLBACK( rotaryf_interrupt )
44TIMER_DEVICE_CALLBACK_MEMBER(rotaryf_state::rotaryf_interrupt)
4445{
45   rotaryf_state *state = timer.machine().driver_data<rotaryf_state>();
4646   int scanline = param;
4747
4848   if (scanline == 256)
49      state->m_maincpu->set_input_line(I8085_RST55_LINE, HOLD_LINE);
49      m_maincpu->set_input_line(I8085_RST55_LINE, HOLD_LINE);
5050   else if((scanline % 64) == 0)
5151   {
52      state->m_maincpu->set_input_line(I8085_RST75_LINE, ASSERT_LINE);
53      state->m_maincpu->set_input_line(I8085_RST75_LINE, CLEAR_LINE);
52      m_maincpu->set_input_line(I8085_RST75_LINE, ASSERT_LINE);
53      m_maincpu->set_input_line(I8085_RST75_LINE, CLEAR_LINE);
5454   }
5555}
5656
r18138r18139
171171   MCFG_CPU_ADD("maincpu",I8085A,4000000) /* ?? MHz */
172172   MCFG_CPU_PROGRAM_MAP(rotaryf_map)
173173   MCFG_CPU_IO_MAP(rotaryf_io_map)
174   MCFG_TIMER_ADD_SCANLINE("scantimer", rotaryf_interrupt, "screen", 0, 1)
174   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", rotaryf_state, rotaryf_interrupt, "screen", 0, 1)
175175
176176   /* video hardware */
177177   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/jalmah.c
r18138r18139
206206   DECLARE_VIDEO_START(urashima);
207207   UINT32 screen_update_jalmah(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
208208   UINT32 screen_update_urashima(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
209   TIMER_DEVICE_CALLBACK_MEMBER(jalmah_mcu_sim);
209210};
210211
211212
r18138r18139
930931
931932}
932933
933static TIMER_DEVICE_CALLBACK( jalmah_mcu_sim )
934TIMER_DEVICE_CALLBACK_MEMBER(jalmah_state::jalmah_mcu_sim)
934935{
935   jalmah_state *state = timer.machine().driver_data<jalmah_state>();
936   switch(state->m_mcu_prg)
936   switch(m_mcu_prg)
937937   {
938938      /*
939939            #define DAIREIKA_MCU (0x11)
r18138r18139
943943            #define KAKUMEI2_MCU (0x22)
944944            #define SUCHIPI_MCU  (0x23)
945945        */
946         case MJZOOMIN_MCU: mjzoomin_mcu_run(timer.machine()); break;
947         case DAIREIKA_MCU: daireika_mcu_run(timer.machine()); break;
948         case URASHIMA_MCU: urashima_mcu_run(timer.machine()); break;
946         case MJZOOMIN_MCU: mjzoomin_mcu_run(machine()); break;
947         case DAIREIKA_MCU: daireika_mcu_run(machine()); break;
948         case URASHIMA_MCU: urashima_mcu_run(machine()); break;
949949         case KAKUMEI_MCU:
950950         case KAKUMEI2_MCU:
951         case SUCHIPI_MCU:  second_mcu_run(timer.machine()); break;
951         case SUCHIPI_MCU:  second_mcu_run(machine()); break;
952952   }
953953}
954954
r18138r18139
14221422   MCFG_PALETTE_LENGTH(0x400)
14231423
14241424
1425   MCFG_TIMER_ADD_PERIODIC("mcusim", jalmah_mcu_sim, attotime::from_hz(10000)) // not real, but for simulating the MCU
1425   MCFG_TIMER_DRIVER_ADD_PERIODIC("mcusim", jalmah_state, jalmah_mcu_sim, attotime::from_hz(10000))
14261426
14271427   MCFG_SPEAKER_STANDARD_MONO("mono")
14281428   MCFG_OKIM6295_ADD("oki", 4000000, OKIM6295_PIN7_LOW)
trunk/src/mame/drivers/blitz68k.c
r18138r18139
175175   DECLARE_VIDEO_START(blitz68k_addr_factor1);
176176   UINT32 screen_update_blitz68k(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
177177   UINT32 screen_update_blitz68k_noblit(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
178   TIMER_DEVICE_CALLBACK_MEMBER(steaser_mcu_sim);
178179};
179180
180181/*************************************************************************************************************
r18138r18139
175517562008ad = 1 -> hold 5
17561757*/
17571758
1758static TIMER_DEVICE_CALLBACK( steaser_mcu_sim )
1759TIMER_DEVICE_CALLBACK_MEMBER(blitz68k_state::steaser_mcu_sim)
17591760{
1760   blitz68k_state *state = timer.machine().driver_data<blitz68k_state>();
17611761//  static int i;
17621762   /*first off, signal the "MCU is running" flag*/
1763   state->m_nvram[0x932/2] = 0xffff;
1763   m_nvram[0x932/2] = 0xffff;
17641764   /*clear the inputs (they are impulsed)*/
17651765//  for(i=0;i<8;i+=2)
1766//      state->m_nvram[((0x8a0)+i)/2] = 0;
1766//      m_nvram[((0x8a0)+i)/2] = 0;
17671767   /*finally, read the inputs*/
1768   state->m_nvram[0x89e/2] = timer.machine().root_device().ioport("MENU")->read() & 0xffff;
1769   state->m_nvram[0x8a0/2] = timer.machine().root_device().ioport("STAT")->read() & 0xffff;
1770   state->m_nvram[0x8a2/2] = timer.machine().root_device().ioport("BET_DEAL")->read() & 0xffff;
1771   state->m_nvram[0x8a4/2] = timer.machine().root_device().ioport("TAKE_DOUBLE")->read() & 0xffff;
1772   state->m_nvram[0x8a6/2] = timer.machine().root_device().ioport("SMALL_BIG")->read() & 0xffff;
1773   state->m_nvram[0x8a8/2] = timer.machine().root_device().ioport("CANCEL_HOLD1")->read() & 0xffff;
1774   state->m_nvram[0x8aa/2] = timer.machine().root_device().ioport("HOLD2_HOLD3")->read() & 0xffff;
1775   state->m_nvram[0x8ac/2] = timer.machine().root_device().ioport("HOLD4_HOLD5")->read() & 0xffff;
1768   m_nvram[0x89e/2] = machine().root_device().ioport("MENU")->read() & 0xffff;
1769   m_nvram[0x8a0/2] = machine().root_device().ioport("STAT")->read() & 0xffff;
1770   m_nvram[0x8a2/2] = machine().root_device().ioport("BET_DEAL")->read() & 0xffff;
1771   m_nvram[0x8a4/2] = machine().root_device().ioport("TAKE_DOUBLE")->read() & 0xffff;
1772   m_nvram[0x8a6/2] = machine().root_device().ioport("SMALL_BIG")->read() & 0xffff;
1773   m_nvram[0x8a8/2] = machine().root_device().ioport("CANCEL_HOLD1")->read() & 0xffff;
1774   m_nvram[0x8aa/2] = machine().root_device().ioport("HOLD2_HOLD3")->read() & 0xffff;
1775   m_nvram[0x8ac/2] = machine().root_device().ioport("HOLD4_HOLD5")->read() & 0xffff;
17761776}
17771777
17781778
r18138r18139
17811781   MCFG_CPU_PROGRAM_MAP(steaser_map)
17821782   MCFG_CPU_VBLANK_INT_DRIVER("screen", blitz68k_state, irq5_line_hold) //3, 4 & 6 used, mcu comms?
17831783
1784   MCFG_TIMER_ADD_PERIODIC("coinsim", steaser_mcu_sim, attotime::from_hz(10000)) // not real, but for simulating the MCU
1784   MCFG_TIMER_DRIVER_ADD_PERIODIC("coinsim", blitz68k_state, steaser_mcu_sim, attotime::from_hz(10000))
17851785MACHINE_CONFIG_END
17861786
17871787static MACHINE_CONFIG_START( cjffruit, blitz68k_state )
trunk/src/mame/drivers/expro02.c
r18138r18139
183183   virtual void video_start();
184184   virtual void palette_init();
185185   UINT32 screen_update_galsnew(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
186   TIMER_DEVICE_CALLBACK_MEMBER(expro02_scanline);
186187};
187188
188189
r18138r18139
497498 *
498499 *************************************/
499500
500static TIMER_DEVICE_CALLBACK( expro02_scanline )
501TIMER_DEVICE_CALLBACK_MEMBER(expro02_state::expro02_scanline)
501502{
502503   int scanline = param;
503504
504505   if(scanline == 224) // vblank-out irq
505      timer.machine().device("maincpu")->execute().set_input_line(3, HOLD_LINE);
506      machine().device("maincpu")->execute().set_input_line(3, HOLD_LINE);
506507   else if(scanline == 0) // vblank-in irq?
507      timer.machine().device("maincpu")->execute().set_input_line(5, HOLD_LINE);
508      machine().device("maincpu")->execute().set_input_line(5, HOLD_LINE);
508509   else if(scanline == 112) // VDP end task? (controls sprite colors in gameplay)
509      timer.machine().device("maincpu")->execute().set_input_line(4, HOLD_LINE);
510      machine().device("maincpu")->execute().set_input_line(4, HOLD_LINE);
510511}
511512
512513void expro02_state::machine_reset()
r18138r18139
547548   /* basic machine hardware */
548549   MCFG_CPU_ADD("maincpu", M68000, 12000000)
549550   MCFG_CPU_PROGRAM_MAP(galsnew_map)
550   MCFG_TIMER_ADD_SCANLINE("scantimer", expro02_scanline, "screen", 0, 1)
551   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", expro02_state, expro02_scanline, "screen", 0, 1)
551552
552553   /* CALC01 MCU @ 16Mhz (unknown type, simulated) */
553554
trunk/src/mame/drivers/mediagx.c
r18138r18139
198198   DECLARE_READ32_MEMBER(speedup9_r);   
199199   DECLARE_READ32_MEMBER(speedup10_r);   
200200   DECLARE_READ32_MEMBER(speedup11_r);   
201   TIMER_DEVICE_CALLBACK_MEMBER(sound_timer_callback);
201202};
202203
203204// Display controller registers
r18138r18139
742743
743744/* Analog Devices AD1847 Stereo DAC */
744745
745static TIMER_DEVICE_CALLBACK( sound_timer_callback )
746TIMER_DEVICE_CALLBACK_MEMBER(mediagx_state::sound_timer_callback)
746747{
747   mediagx_state *state = timer.machine().driver_data<mediagx_state>();
748748
749   state->m_ad1847_sample_counter = 0;
749   m_ad1847_sample_counter = 0;
750750   timer.adjust(attotime::from_msec(10));
751751
752   dmadac_transfer(&state->m_dmadac[0], 1, 0, 1, state->m_dacl_ptr, state->m_dacl);
753   dmadac_transfer(&state->m_dmadac[1], 1, 0, 1, state->m_dacr_ptr, state->m_dacr);
752   dmadac_transfer(&m_dmadac[0], 1, 0, 1, m_dacl_ptr, m_dacl);
753   dmadac_transfer(&m_dmadac[1], 1, 0, 1, m_dacr_ptr, m_dacr);
754754
755   state->m_dacl_ptr = 0;
756   state->m_dacr_ptr = 0;
755   m_dacl_ptr = 0;
756   m_dacr_ptr = 0;
757757}
758758
759759static void ad1847_reg_write(running_machine &machine, int reg, UINT8 data)
r18138r18139
11931193
11941194   MCFG_IDE_CONTROLLER_ADD("ide", ide_intf, ide_devices, "hdd", NULL, true)
11951195
1196   MCFG_TIMER_ADD("sound_timer", sound_timer_callback)
1196   MCFG_TIMER_DRIVER_ADD("sound_timer", mediagx_state, sound_timer_callback)
11971197
11981198   MCFG_MC146818_ADD( "rtc", MC146818_STANDARD )
11991199
trunk/src/mame/drivers/zac_1.c
r18138r18139
5353   required_device<cpu_device> m_maincpu;
5454   required_shared_ptr<UINT8> m_p_ram;
5555   required_device<samples_device> m_samples;
56   TIMER_DEVICE_CALLBACK_MEMBER(zac_1_inttimer);
57   TIMER_DEVICE_CALLBACK_MEMBER(zac_1_outtimer);
5658protected:
5759
5860   // devices
r18138r18139
201203   }
202204}
203205
204static TIMER_DEVICE_CALLBACK( zac_1_inttimer )
206TIMER_DEVICE_CALLBACK_MEMBER(zac_1_state::zac_1_inttimer)
205207{
206   zac_1_state *state = timer.machine().driver_data<zac_1_state>();
207   if (state->m_t_c > 0x40)
208   if (m_t_c > 0x40)
208209   {
209      UINT8 vector = (state->ioport("TEST")->read() ) ? 0x10 : 0x18;
210      state->m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, vector);
210      UINT8 vector = (ioport("TEST")->read() ) ? 0x10 : 0x18;
211      m_maincpu->set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, vector);
211212   }
212213   else
213      state->m_t_c++;
214      m_t_c++;
214215}
215216
216217/* scores = 1800-182D; solenoids = 1840-1853;
217218   lamps = 1880-18BF; bookkeeping=18C0-18FF. 4-tone osc=1854-1857.
218219   182E-183F is a storage area for inputs. */
219static TIMER_DEVICE_CALLBACK( zac_1_outtimer )
220TIMER_DEVICE_CALLBACK_MEMBER(zac_1_state::zac_1_outtimer)
220221{
221222   static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0, 0, 0, 0, 0, 0 };
222   zac_1_state *state = timer.machine().driver_data<zac_1_state>();
223   state->m_out_offs++;
223   m_out_offs++;
224224
225   if (state->m_out_offs < 0x40)
225   if (m_out_offs < 0x40)
226226   {
227      UINT8 display = (state->m_out_offs >> 3) & 7;
228      UINT8 digit = state->m_out_offs & 7;
229      output_set_digit_value(display * 10 + digit, patterns[state->m_p_ram[state->m_out_offs]&15]);
227      UINT8 display = (m_out_offs >> 3) & 7;
228      UINT8 digit = m_out_offs & 7;
229      output_set_digit_value(display * 10 + digit, patterns[m_p_ram[m_out_offs]&15]);
230230   }
231231   else
232   if (state->m_out_offs == 0x4a) // outhole
232   if (m_out_offs == 0x4a) // outhole
233233   {
234      if (BIT(state->m_p_ram[state->m_out_offs], 0))
235         state->m_samples->start(0, 5);
234      if (BIT(m_p_ram[m_out_offs], 0))
235         m_samples->start(0, 5);
236236   }
237237   else
238   if (state->m_out_offs == 0x4b) // knocker (not strapids)
238   if (m_out_offs == 0x4b) // knocker (not strapids)
239239   {
240      if (BIT(state->m_p_ram[state->m_out_offs], 0))
241         state->m_samples->start(0, 6);
240      if (BIT(m_p_ram[m_out_offs], 0))
241         m_samples->start(0, 6);
242242   }
243243}
244244
r18138r18139
249249   MCFG_CPU_IO_MAP(zac_1_io)
250250   MCFG_NVRAM_ADD_0FILL("ram")
251251
252   MCFG_TIMER_ADD_PERIODIC("zac_1_inttimer", zac_1_inttimer, attotime::from_hz(200))
253   MCFG_TIMER_ADD_PERIODIC("zac_1_outtimer", zac_1_outtimer, attotime::from_hz(187500))
252   MCFG_TIMER_DRIVER_ADD_PERIODIC("zac_1_inttimer", zac_1_state, zac_1_inttimer, attotime::from_hz(200))
253   MCFG_TIMER_DRIVER_ADD_PERIODIC("zac_1_outtimer", zac_1_state, zac_1_outtimer, attotime::from_hz(187500))
254254
255255   /* Video */
256256   MCFG_DEFAULT_LAYOUT(layout_zac_1)
trunk/src/mame/drivers/dfruit.c
r18138r18139
6464
6565   UINT8 ram_bank_r(UINT16 offset, UINT8 bank_num);
6666   void ram_bank_w(UINT16 offset, UINT8 data, UINT8 bank_num);
67   TIMER_DEVICE_CALLBACK_MEMBER(dfruit_irq_scanline);
6768};
6869
6970void dfruit_state::video_start()
r18138r18139
347348   DEVCB_NULL                  /* Port C write */
348349};
349350
350static TIMER_DEVICE_CALLBACK( dfruit_irq_scanline )
351TIMER_DEVICE_CALLBACK_MEMBER(dfruit_state::dfruit_irq_scanline)
351352{
352   dfruit_state *state = timer.machine().driver_data<dfruit_state>();
353353   int scanline = param;
354354
355   if (scanline == 240 && (state->m_irq_enable & 4))
355   if (scanline == 240 && (m_irq_enable & 4))
356356   {
357      state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, state->m_irq_vector[2]);
357      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_irq_vector[2]);
358358   }
359359
360   if (scanline == 0 && (state->m_irq_enable & 2))
360   if (scanline == 0 && (m_irq_enable & 2))
361361   {
362      state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, state->m_irq_vector[1]);
362      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_irq_vector[1]);
363363   }
364364
365   if (scanline == 196 && (state->m_irq_enable & 1))
365   if (scanline == 196 && (m_irq_enable & 1))
366366   {
367      //state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, state->m_irq_vector[0]);
367      //m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_irq_vector[0]);
368368   }
369369}
370370
r18138r18139
387387   /* basic machine hardware */
388388   MCFG_CPU_ADD("maincpu",Z80,MASTER_CLOCK/2) //!!! TC0091LVC !!!
389389   MCFG_CPU_PROGRAM_MAP(dfruit_map)
390   MCFG_TIMER_ADD_SCANLINE("scantimer", dfruit_irq_scanline, "screen", 0, 1)
390   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dfruit_state, dfruit_irq_scanline, "screen", 0, 1)
391391
392392   //MCFG_MACHINE_START_OVERRIDE(dfruit_state,4enraya)
393393   //MCFG_MACHINE_RESET_OVERRIDE(dfruit_state,4enraya)
trunk/src/mame/drivers/kas89.c
r18138r18139
228228   DECLARE_DRIVER_INIT(kas89);
229229   virtual void machine_start();
230230   virtual void machine_reset();
231   TIMER_DEVICE_CALLBACK_MEMBER(kas89_interrupt);
232   TIMER_DEVICE_CALLBACK_MEMBER(kas89_nmi_cb);
233   TIMER_DEVICE_CALLBACK_MEMBER(kas89_sound_nmi_cb);
231234};
232235
233236#define VDP_MEM             0x40000
r18138r18139
242245   device.machine().device("maincpu")->execute().set_input_line(0, (i ? ASSERT_LINE : CLEAR_LINE));
243246}
244247
245static TIMER_DEVICE_CALLBACK( kas89_interrupt )
248TIMER_DEVICE_CALLBACK_MEMBER(kas89_state::kas89_interrupt)
246249{
247   kas89_state *state = timer.machine().driver_data<kas89_state>();
248250   int scanline = param;
249251
250252   if((scanline % 2) == 0)
251      state->m_v9938->interrupt();
253      m_v9938->interrupt();
252254}
253255
254256
r18138r18139
310312   return m_mux_data;
311313}
312314
313static TIMER_DEVICE_CALLBACK ( kas89_nmi_cb )
315TIMER_DEVICE_CALLBACK_MEMBER(kas89_state::kas89_nmi_cb)
314316{
315   kas89_state *state = timer.machine().driver_data<kas89_state>();
316
317   if (state->m_main_nmi_enable)
318      state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
317   if (m_main_nmi_enable)
318      m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
319319}
320320
321static TIMER_DEVICE_CALLBACK ( kas89_sound_nmi_cb )
321TIMER_DEVICE_CALLBACK_MEMBER(kas89_state::kas89_sound_nmi_cb)
322322{
323   kas89_state *state = timer.machine().driver_data<kas89_state>();
324
325   state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
323   m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
326324}
327325
328326
r18138r18139
779777   MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6)   /* Confirmed */
780778   MCFG_CPU_PROGRAM_MAP(kas89_map)
781779   MCFG_CPU_IO_MAP(kas89_io)
782   MCFG_TIMER_ADD_SCANLINE("scantimer", kas89_interrupt, "screen", 0, 1)
783   MCFG_TIMER_ADD_PERIODIC("kas89_nmi", kas89_nmi_cb, attotime::from_hz(138)) /* Connected to a 138Hz osc. *AND* bit6 of port $82 */
780   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kas89_state, kas89_interrupt, "screen", 0, 1)
781   MCFG_TIMER_DRIVER_ADD_PERIODIC("kas89_nmi", kas89_state, kas89_nmi_cb, attotime::from_hz(138))
784782
785783   MCFG_CPU_ADD("audiocpu", Z80, MASTER_CLOCK/6)   /* Confirmed */
786784   MCFG_CPU_PROGRAM_MAP(audio_map)
787785   MCFG_CPU_IO_MAP(audio_io)
788   MCFG_TIMER_ADD_PERIODIC("kas89_snmi", kas89_sound_nmi_cb, attotime::from_hz(138)) /* Connected to a 138Hz osc.*/
786   MCFG_TIMER_DRIVER_ADD_PERIODIC("kas89_snmi", kas89_state, kas89_sound_nmi_cb, attotime::from_hz(138))
789787
790788
791789   MCFG_NVRAM_ADD_0FILL("nvram")
trunk/src/mame/drivers/sbowling.c
r18138r18139
7474   virtual void video_start();
7575   virtual void palette_init();
7676   UINT32 screen_update_sbowling(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
77   TIMER_DEVICE_CALLBACK_MEMBER(sbw_interrupt);
7778};
7879
7980TILE_GET_INFO_MEMBER(sbowling_state::get_sb_tile_info)
r18138r18139
160161
161162
162163
163static TIMER_DEVICE_CALLBACK( sbw_interrupt )
164TIMER_DEVICE_CALLBACK_MEMBER(sbowling_state::sbw_interrupt)
164165{
165   sbowling_state *state = timer.machine().driver_data<sbowling_state>();
166166   int scanline = param;
167167
168168   if(scanline == 256)
169      state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); /* RST 08h */
169      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); /* RST 08h */
170170
171171   if(scanline == 128)
172      state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); /* RST 10h */
172      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); /* RST 10h */
173173
174174}
175175
r18138r18139
385385   MCFG_CPU_ADD("maincpu", I8080, XTAL_19_968MHz/10)   /* ? */
386386   MCFG_CPU_PROGRAM_MAP(main_map)
387387   MCFG_CPU_IO_MAP(port_map)
388   MCFG_TIMER_ADD_SCANLINE("scantimer", sbw_interrupt, "screen", 0, 1)
388   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sbowling_state, sbw_interrupt, "screen", 0, 1)
389389
390390   /* video hardware */
391391   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/photon2.c
r18138r18139
3737   virtual void palette_init();
3838   UINT32 screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3939   void screen_eof_spectrum(screen_device &screen, bool state);
40   TIMER_DEVICE_CALLBACK_MEMBER(spec_interrupt_hack);
4041};
4142
4243
r18138r18139
294295 *
295296 *************************************/
296297
297static TIMER_DEVICE_CALLBACK( spec_interrupt_hack )
298TIMER_DEVICE_CALLBACK_MEMBER(photon2_state::spec_interrupt_hack)
298299{
299   photon2_state *state = timer.machine().driver_data<photon2_state>();
300300   int scanline = param;
301301
302302   if (scanline == SPEC_SCREEN_HEIGHT/2)
303303   {
304      state->m_maincpu->set_input_line(0, HOLD_LINE);
304      m_maincpu->set_input_line(0, HOLD_LINE);
305305   }
306306   else if(scanline == 0)
307307   {
308      if ( state->m_nmi_enable )
308      if ( m_nmi_enable )
309309      {
310         state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
310         m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
311311      }
312312   }
313313}
r18138r18139
322322   MCFG_CPU_ADD("maincpu", Z80, 3500000)        /* 3.5 MHz */
323323   MCFG_CPU_PROGRAM_MAP(spectrum_mem)
324324   MCFG_CPU_IO_MAP(spectrum_io)
325   MCFG_TIMER_ADD_SCANLINE("scantimer", spec_interrupt_hack, "screen", 0, 1)
325   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", photon2_state, spec_interrupt_hack, "screen", 0, 1)
326326
327327
328328    /* video hardware */
trunk/src/mame/drivers/bnstars.c
r18138r18139
157157   virtual void video_start();
158158   UINT32 screen_update_bnstars_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
159159   UINT32 screen_update_bnstars_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
160   TIMER_DEVICE_CALLBACK_MEMBER(ms32_interrupt);
160161};
161162
162163
r18138r18139
13511352}
13521353
13531354/* TODO: fix this arrangement (derived from old deprecat lib) */
1354static TIMER_DEVICE_CALLBACK(ms32_interrupt)
1355TIMER_DEVICE_CALLBACK_MEMBER(bnstars_state::ms32_interrupt)
13551356{
13561357   int scanline = param;
1357   if( scanline == 0 ) irq_raise(timer.machine(), 10);
1358   if( scanline == 8)  irq_raise(timer.machine(), 9);
1358   if( scanline == 0 ) irq_raise(machine(), 10);
1359   if( scanline == 8)  irq_raise(machine(), 9);
13591360   /* hayaosi1 needs at least 12 IRQ 0 per frame to work (see code at FFE02289)
13601361       kirarast needs it too, at least 8 per frame, but waits for a variable amount
13611362       47pi2 needs ?? per frame (otherwise it hangs when you lose)
r18138r18139
13641365       desertwr
13651366       p47aces
13661367       */
1367   if( (scanline % 8) == 0 && scanline <= 224 ) irq_raise(timer.machine(), 0);
1368   if( (scanline % 8) == 0 && scanline <= 224 ) irq_raise(machine(), 0);
13681369}
13691370
13701371void bnstars_state::machine_reset()
r18138r18139
13781379   /* basic machine hardware */
13791380   MCFG_CPU_ADD("maincpu", V70, 20000000) // 20MHz
13801381   MCFG_CPU_PROGRAM_MAP(bnstars_map)
1381   MCFG_TIMER_ADD_SCANLINE("scantimer", ms32_interrupt, "lscreen", 0, 1)
1382   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", bnstars_state, ms32_interrupt, "lscreen", 0, 1)
13821383
13831384//  MCFG_CPU_ADD("audiocpu", Z80, 4000000)
13841385//  MCFG_CPU_PROGRAM_MAP(bnstars_z80_map)
trunk/src/mame/drivers/firefox.c
r18138r18139
9999   virtual void machine_start();
100100   virtual void video_start();
101101   UINT32 screen_update_firefox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
102   TIMER_DEVICE_CALLBACK_MEMBER(video_timer_callback);
102103};
103104
104105
r18138r18139
250251   return 0;
251252}
252253
253static TIMER_DEVICE_CALLBACK( video_timer_callback )
254TIMER_DEVICE_CALLBACK_MEMBER(firefox_state::video_timer_callback)
254255{
255   timer.machine().primary_screen->update_now();
256   machine().primary_screen->update_now();
256257
257   timer.machine().device("maincpu")->execute().set_input_line(M6809_IRQ_LINE, ASSERT_LINE );
258   machine().device("maincpu")->execute().set_input_line(M6809_IRQ_LINE, ASSERT_LINE );
258259}
259260
260261static void set_rgba( running_machine &machine, int start, int index, unsigned char *palette_ram )
r18138r18139
701702   MCFG_CPU_ADD("maincpu", M6809E, MASTER_XTAL/2)
702703   MCFG_CPU_PROGRAM_MAP(main_map)
703704   /* interrupts count starting at end of VBLANK, which is 44, so add 44 */
704   MCFG_TIMER_ADD_SCANLINE("32v", video_timer_callback, "screen", 96+44, 128)
705   MCFG_TIMER_DRIVER_ADD_SCANLINE("32v", firefox_state, video_timer_callback, "screen", 96+44, 128)
705706
706707   MCFG_CPU_ADD("audiocpu", M6502, MASTER_XTAL/8)
707708   MCFG_CPU_PROGRAM_MAP(audio_map)
trunk/src/mame/drivers/royalmah.c
r18138r18139
199199   UINT32 screen_update_royalmah(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
200200   INTERRUPT_GEN_MEMBER(suzume_irq);
201201   INTERRUPT_GEN_MEMBER(mjtensin_interrupt);
202   TIMER_DEVICE_CALLBACK_MEMBER(janptr96_interrupt);
202203};
203204
204205
r18138r18139
32913292MACHINE_CONFIG_END
32923293
32933294/* It runs in IM 2, thus needs a vector on the data bus */
3294static TIMER_DEVICE_CALLBACK( janptr96_interrupt )
3295TIMER_DEVICE_CALLBACK_MEMBER(royalmah_state::janptr96_interrupt)
32953296{
3296   royalmah_state *state = timer.machine().driver_data<royalmah_state>();
32973297   int scanline = param;
32983298
32993299   if(scanline == 248)
3300      state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0x80);   // vblank
3300      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0x80);   // vblank
33013301
33023302   if(scanline == 0)
3303      state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0x84);   // demo
3303      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0x84);   // demo
33043304}
33053305
33063306WRITE_LINE_MEMBER(royalmah_state::janptr96_rtc_irq)
r18138r18139
33193319   MCFG_CPU_ADD("maincpu",Z80,XTAL_16MHz/2)   /* 8 MHz? */
33203320   MCFG_CPU_PROGRAM_MAP(janptr96_map)
33213321   MCFG_CPU_IO_MAP(janptr96_iomap)
3322   MCFG_TIMER_ADD_SCANLINE("scantimer", janptr96_interrupt, "screen", 0, 1)   /* IM 2 needs a vector on the data bus */
3322   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", royalmah_state, janptr96_interrupt, "screen", 0, 1)
33233323
33243324   MCFG_SCREEN_MODIFY("screen")
33253325   MCFG_SCREEN_VISIBLE_AREA(0, 255, 8, 255-8)
trunk/src/mame/drivers/igs017.c
r18138r18139
156156   DECLARE_MACHINE_RESET(mgcs);
157157   DECLARE_MACHINE_RESET(lhzb2a);
158158   UINT32 screen_update_igs017(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
159   TIMER_DEVICE_CALLBACK_MEMBER(irqblocka_interrupt);
160   TIMER_DEVICE_CALLBACK_MEMBER(mgcs_interrupt);
161   TIMER_DEVICE_CALLBACK_MEMBER(mgdh_interrupt);
159162};
160163
161164
r18138r18139
32213224                                Machine Drivers
32223225***************************************************************************/
32233226
3224static TIMER_DEVICE_CALLBACK( irqblocka_interrupt )
3227TIMER_DEVICE_CALLBACK_MEMBER(igs017_state::irqblocka_interrupt)
32253228{
3226   igs017_state *state = timer.machine().driver_data<igs017_state>();
32273229   int scanline = param;
32283230
3229   if(scanline == 240 && state->m_irq_enable)
3230      state->m_maincpu->set_input_line(0, HOLD_LINE);
3231   if(scanline == 240 && m_irq_enable)
3232      m_maincpu->set_input_line(0, HOLD_LINE);
32313233
3232   if(scanline == 0 && state->m_nmi_enable)
3233      state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
3234   if(scanline == 0 && m_nmi_enable)
3235      m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
32343236}
32353237
32363238
r18138r18139
32573259   MCFG_CPU_ADD("maincpu", Z180, XTAL_16MHz / 2)
32583260   MCFG_CPU_PROGRAM_MAP(iqblocka_map)
32593261   MCFG_CPU_IO_MAP(iqblocka_io)
3260   MCFG_TIMER_ADD_SCANLINE("scantimer", irqblocka_interrupt, "screen", 0, 1)
3262   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", igs017_state, irqblocka_interrupt, "screen", 0, 1)
32613263
32623264   MCFG_I8255A_ADD( "ppi8255", iqblocka_ppi8255_intf )
32633265
r18138r18139
32883290
32893291// mgcs
32903292
3291static TIMER_DEVICE_CALLBACK( mgcs_interrupt )
3293TIMER_DEVICE_CALLBACK_MEMBER(igs017_state::mgcs_interrupt)
32923294{
3293   igs017_state *state = timer.machine().driver_data<igs017_state>();
32943295   int scanline = param;
32953296
3296   if(scanline == 240 && state->m_irq1_enable)
3297      state->m_maincpu->set_input_line(1, HOLD_LINE);
3297   if(scanline == 240 && m_irq1_enable)
3298      m_maincpu->set_input_line(1, HOLD_LINE);
32983299
3299   if(scanline == 0 && state->m_irq2_enable)
3300      state->m_maincpu->set_input_line(2, HOLD_LINE);
3300   if(scanline == 0 && m_irq2_enable)
3301      m_maincpu->set_input_line(2, HOLD_LINE);
33013302}
33023303
33033304MACHINE_RESET_MEMBER(igs017_state,mgcs)
r18138r18139
33223323static MACHINE_CONFIG_START( mgcs, igs017_state )
33233324   MCFG_CPU_ADD("maincpu", M68000, XTAL_22MHz / 2)
33243325   MCFG_CPU_PROGRAM_MAP(mgcs)
3325   MCFG_TIMER_ADD_SCANLINE("scantimer", mgcs_interrupt, "screen", 0, 1)
3326   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", igs017_state, mgcs_interrupt, "screen", 0, 1)
33263327
33273328   MCFG_MACHINE_RESET_OVERRIDE(igs017_state,mgcs)
33283329
r18138r18139
33623363static MACHINE_CONFIG_START( lhzb2, igs017_state )
33633364   MCFG_CPU_ADD("maincpu", M68000, XTAL_22MHz / 2)
33643365   MCFG_CPU_PROGRAM_MAP(lhzb2)
3365   MCFG_TIMER_ADD_SCANLINE("scantimer", mgcs_interrupt, "screen", 0, 1)
3366   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", igs017_state, mgcs_interrupt, "screen", 0, 1)
33663367
33673368   MCFG_MACHINE_RESET_OVERRIDE(igs017_state,mgcs)
33683369
r18138r18139
33993400static MACHINE_CONFIG_START( lhzb2a, igs017_state )
34003401   MCFG_CPU_ADD("maincpu", M68000, XTAL_22MHz/2)
34013402   MCFG_CPU_PROGRAM_MAP(lhzb2a)
3402   MCFG_TIMER_ADD_SCANLINE("scantimer", mgcs_interrupt, "screen", 0, 1)
3403   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", igs017_state, mgcs_interrupt, "screen", 0, 1)
34033404
34043405   MCFG_MACHINE_RESET_OVERRIDE(igs017_state,lhzb2a)
34053406
r18138r18139
34303431static MACHINE_CONFIG_START( slqz2, igs017_state )
34313432   MCFG_CPU_ADD("maincpu", M68000, XTAL_22MHz / 2)
34323433   MCFG_CPU_PROGRAM_MAP(slqz2)
3433   MCFG_TIMER_ADD_SCANLINE("scantimer", mgcs_interrupt, "screen", 0, 1)
3434   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", igs017_state, mgcs_interrupt, "screen", 0, 1)
34343435
34353436   MCFG_MACHINE_RESET_OVERRIDE(igs017_state,mgcs)
34363437
r18138r18139
34703471static MACHINE_CONFIG_START( sdmg2, igs017_state )
34713472   MCFG_CPU_ADD("maincpu", M68000, XTAL_22MHz/2)
34723473   MCFG_CPU_PROGRAM_MAP(sdmg2)
3473   MCFG_TIMER_ADD_SCANLINE("scantimer", mgcs_interrupt, "screen", 0, 1)
3474   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", igs017_state, mgcs_interrupt, "screen", 0, 1)
34743475
34753476   MCFG_MACHINE_RESET_OVERRIDE(igs017_state,mgcs)
34763477
r18138r18139
34973498
34983499// mgdh
34993500
3500static TIMER_DEVICE_CALLBACK( mgdh_interrupt )
3501TIMER_DEVICE_CALLBACK_MEMBER(igs017_state::mgdh_interrupt)
35013502{
3502   igs017_state *state = timer.machine().driver_data<igs017_state>();
35033503   int scanline = param;
35043504
3505   if(scanline == 240 && state->m_irq1_enable)
3506      state->m_maincpu->set_input_line(1, HOLD_LINE);
3505   if(scanline == 240 && m_irq1_enable)
3506      m_maincpu->set_input_line(1, HOLD_LINE);
35073507
3508   if(scanline == 0 && state->m_irq2_enable)
3509      state->m_maincpu->set_input_line(3, HOLD_LINE); // lev 3 instead of 2
3508   if(scanline == 0 && m_irq2_enable)
3509      m_maincpu->set_input_line(3, HOLD_LINE); // lev 3 instead of 2
35103510}
35113511
35123512static I8255A_INTERFACE( mgdh_ppi8255_intf )
r18138r18139
35223522static MACHINE_CONFIG_START( mgdha, igs017_state )
35233523   MCFG_CPU_ADD("maincpu", M68000, XTAL_22MHz / 2)
35243524   MCFG_CPU_PROGRAM_MAP(mgdha_map)
3525   MCFG_TIMER_ADD_SCANLINE("scantimer", mgdh_interrupt, "screen", 0, 1)
3525   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", igs017_state, mgdh_interrupt, "screen", 0, 1)
35263526
35273527   MCFG_MACHINE_RESET_OVERRIDE(igs017_state,mgcs)
35283528
r18138r18139
35533553   MCFG_CPU_ADD("maincpu", Z180, XTAL_16MHz / 2)
35543554   MCFG_CPU_PROGRAM_MAP(tjsb_map)
35553555   MCFG_CPU_IO_MAP(tjsb_io)
3556   MCFG_TIMER_ADD_SCANLINE("scantimer", irqblocka_interrupt, "screen", 0, 1)
3556   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", igs017_state, irqblocka_interrupt, "screen", 0, 1)
35573557
35583558   MCFG_I8255A_ADD( "ppi8255", iqblocka_ppi8255_intf )
35593559
trunk/src/mame/drivers/csplayh5.c
r18138r18139
8080   DECLARE_DRIVER_INIT(csplayh7);
8181   DECLARE_DRIVER_INIT(junai2);
8282   virtual void machine_reset();
83   TIMER_DEVICE_CALLBACK_MEMBER(csplayh5_irq);
8384};
8485
8586
r18138r18139
596597   }
597598}
598599
599static TIMER_DEVICE_CALLBACK( csplayh5_irq )
600TIMER_DEVICE_CALLBACK_MEMBER(csplayh5_state::csplayh5_irq)
600601{
601   csplayh5_state *state = timer.machine().driver_data<csplayh5_state>();
602602   int scanline = param;
603603
604604   if(scanline == 212*2)
605      state->m_maincpu->set_input_line_and_vector(1, HOLD_LINE,0x100/4);
605      m_maincpu->set_input_line_and_vector(1, HOLD_LINE,0x100/4);
606606
607607   if((scanline % 2) == 0)
608608   {
609      state->m_v9958->set_sprite_limit(0);
610      state->m_v9958->set_resolution(RENDER_HIGH);
611      state->m_v9958->interrupt();
609      m_v9958->set_sprite_limit(0);
610      m_v9958->set_resolution(RENDER_HIGH);
611      m_v9958->interrupt();
612612   }
613613}
614614
r18138r18139
624624   /* basic machine hardware */
625625   MCFG_CPU_ADD("maincpu",M68000,16000000) /* TMP68301-16 */
626626   MCFG_CPU_PROGRAM_MAP(csplayh5_map)
627   MCFG_TIMER_ADD_SCANLINE("scantimer", csplayh5_irq, "screen", 0, 1)
627   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", csplayh5_state, csplayh5_irq, "screen", 0, 1)
628628
629629#if USE_H8
630630   MCFG_CPU_ADD("subcpu", H83002, 16000000)   /* unknown clock */
trunk/src/mame/drivers/galpani3.c
r18138r18139
113113   }
114114   virtual void video_start();
115115   UINT32 screen_update_galpani3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
116   TIMER_DEVICE_CALLBACK_MEMBER(galpani3_vblank);
116117};
117118
118119
r18138r18139
124125
125126
126127
127static TIMER_DEVICE_CALLBACK( galpani3_vblank ) // 2, 3, 5 ?
128TIMER_DEVICE_CALLBACK_MEMBER(galpani3_state::galpani3_vblank)// 2, 3, 5 ?
128129{
129   galpani3_state *state = timer.machine().driver_data<galpani3_state>();
130130   int scanline = param;
131131
132132   if(scanline == 240)
133      state->m_maincpu->set_input_line(2, HOLD_LINE);
133      m_maincpu->set_input_line(2, HOLD_LINE);
134134
135135   if(scanline == 0)
136      state->m_maincpu->set_input_line(3, HOLD_LINE);
136      m_maincpu->set_input_line(3, HOLD_LINE);
137137
138138   if(scanline == 128)
139      state->m_maincpu->set_input_line(5, HOLD_LINE); // timer, related to sound chip?
139      m_maincpu->set_input_line(5, HOLD_LINE); // timer, related to sound chip?
140140}
141141
142142
r18138r18139
510510static MACHINE_CONFIG_START( galpani3, galpani3_state )
511511   MCFG_CPU_ADD("maincpu", M68000, XTAL_28_63636MHz/2)   // Confirmed from PCB
512512   MCFG_CPU_PROGRAM_MAP(galpani3_map)
513   MCFG_TIMER_ADD_SCANLINE("scantimer", galpani3_vblank, "screen", 0, 1)
513   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", galpani3_state, galpani3_vblank, "screen", 0, 1)
514514
515515   MCFG_SCREEN_ADD("screen", RASTER)
516516   MCFG_SCREEN_REFRESH_RATE(60)
trunk/src/mame/drivers/scregg.c
r18138r18139
6666   DECLARE_DRIVER_INIT(rockduck);
6767   DECLARE_MACHINE_START(scregg);
6868   DECLARE_MACHINE_RESET(scregg);
69   TIMER_DEVICE_CALLBACK_MEMBER(scregg_interrupt);
6970};
7071
7172
7273
73static TIMER_DEVICE_CALLBACK( scregg_interrupt )
74TIMER_DEVICE_CALLBACK_MEMBER(scregg_state::scregg_interrupt)
7475{
7576   // assume that the irq generator is similar to burgertime hw
76   scregg_state *state = timer.machine().driver_data<scregg_state>();
77   state->m_maincpu->set_input_line(0, (param & 8) ? ASSERT_LINE : CLEAR_LINE);
77   m_maincpu->set_input_line(0, (param & 8) ? ASSERT_LINE : CLEAR_LINE);
7878}
7979
8080WRITE8_MEMBER(scregg_state::scregg_irqack_w)
r18138r18139
262262   /* basic machine hardware */
263263   MCFG_CPU_ADD("maincpu", M6502, XTAL_12MHz/8)
264264   MCFG_CPU_PROGRAM_MAP(dommy_map)
265   MCFG_TIMER_ADD_SCANLINE("irq", scregg_interrupt, "screen", 0, 8)
265   MCFG_TIMER_DRIVER_ADD_SCANLINE("irq", scregg_state, scregg_interrupt, "screen", 0, 8)
266266
267267   MCFG_MACHINE_START_OVERRIDE(scregg_state,scregg)
268268   MCFG_MACHINE_RESET_OVERRIDE(scregg_state,scregg)
r18138r18139
294294   /* basic machine hardware */
295295   MCFG_CPU_ADD("maincpu", M6502, XTAL_12MHz/8)
296296   MCFG_CPU_PROGRAM_MAP(eggs_map)
297   MCFG_TIMER_ADD_SCANLINE("irq", scregg_interrupt, "screen", 0, 8)
297   MCFG_TIMER_DRIVER_ADD_SCANLINE("irq", scregg_state, scregg_interrupt, "screen", 0, 8)
298298
299299   MCFG_MACHINE_START_OVERRIDE(scregg_state,scregg)
300300   MCFG_MACHINE_RESET_OVERRIDE(scregg_state,scregg)
trunk/src/mame/drivers/halleys.c
r18138r18139
267267   UINT32 screen_update_halleys(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
268268   UINT32 screen_update_benberob(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
269269   TIMER_CALLBACK_MEMBER(blitter_reset);
270   TIMER_DEVICE_CALLBACK_MEMBER(halleys_scanline);
271   TIMER_DEVICE_CALLBACK_MEMBER(benberob_scanline);
270272};
271273
272274
r18138r18139
15411543// Interrupt and Hardware Handlers
15421544
15431545
1544static TIMER_DEVICE_CALLBACK( halleys_scanline )
1546TIMER_DEVICE_CALLBACK_MEMBER(halleys_state::halleys_scanline)
15451547{
1546   halleys_state *state = timer.machine().driver_data<halleys_state>();
15471548   int scanline = param;
15481549
15491550   /* TODO: fix this */
r18138r18139
15511552   {
15521553      case 248:
15531554         // clear collision list of this frame unconditionally
1554         state->m_collision_count = 0;
1555         m_collision_count = 0;
15551556         break;
15561557
15571558      // In Halley's Comet, NMI is used exclusively to handle coin input
15581559      case 56*3:
1559         timer.machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
1560         machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
15601561         break;
15611562
15621563      // FIRQ drives gameplay; we need both types of NMI each frame.
15631564      case 56*2:
1564         state->m_mVectorType = 1; timer.machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE);
1565         m_mVectorType = 1; machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE);
15651566         break;
15661567
15671568      case 56:
1568         state->m_mVectorType = 0; timer.machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE);
1569         m_mVectorType = 0; machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE);
15691570         break;
15701571   }
15711572}
15721573
15731574
1574static TIMER_DEVICE_CALLBACK( benberob_scanline )
1575TIMER_DEVICE_CALLBACK_MEMBER(halleys_state::benberob_scanline)
15751576{
1576   halleys_state *state = timer.machine().driver_data<halleys_state>();
15771577   int scanline = param;
15781578
15791579   /* TODO: fix this */
r18138r18139
15831583         break;
15841584
15851585      case 56*3:
1586         timer.machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
1586         machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
15871587         break;
15881588
15891589      case 56*2:
15901590      case 56*1:
15911591         // FIRQ must not happen when the blitter is being updated or it'll cause serious screen artifacts
1592         if (!state->m_blitter_busy) timer.machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); else state->m_firq_level++;
1592         if (!m_blitter_busy) machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); else m_firq_level++;
15931593         break;
15941594   }
15951595}
r18138r18139
19591959static MACHINE_CONFIG_START( halleys, halleys_state )
19601960   MCFG_CPU_ADD("maincpu", M6809, XTAL_19_968MHz/12) /* verified on pcb */
19611961   MCFG_CPU_PROGRAM_MAP(halleys_map)
1962   MCFG_TIMER_ADD_SCANLINE("scantimer", halleys_scanline, "screen", 0, 1)
1962   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", halleys_state, halleys_scanline, "screen", 0, 1)
19631963
19641964   MCFG_CPU_ADD("audiocpu", Z80, XTAL_6MHz/2) /* verified on pcb */
19651965   MCFG_CPU_PROGRAM_MAP(sound_map)
r18138r18139
20002000   MCFG_CPU_MODIFY("maincpu")
20012001   MCFG_CPU_CLOCK(XTAL_19_968MHz/12) /* not verified but pcb identical to halley's comet */
20022002   MCFG_TIMER_MODIFY("scantimer")
2003   MCFG_TIMER_CALLBACK(benberob_scanline)
2003   MCFG_TIMER_DRIVER_CALLBACK(halleys_state, benberob_scanline)
20042004
20052005   MCFG_SCREEN_MODIFY("screen")
20062006   MCFG_SCREEN_UPDATE_DRIVER(halleys_state, screen_update_benberob)
trunk/src/mame/drivers/maxaflex.c
r18138r18139
5959   DECLARE_READ8_MEMBER(maxaflex_atari_pia_pb_r);
6060   DECLARE_DRIVER_INIT(a600xl);
6161   DECLARE_MACHINE_RESET(supervisor_board);
62   TIMER_DEVICE_CALLBACK_MEMBER(mcu_timer_proc);
6263};
6364
6465
r18138r18139
180181   m_ddrC = data;
181182}
182183
183static TIMER_DEVICE_CALLBACK( mcu_timer_proc )
184TIMER_DEVICE_CALLBACK_MEMBER(maxaflex_state::mcu_timer_proc)
184185{
185   maxaflex_state *state = timer.machine().driver_data<maxaflex_state>();
186   if ( --state->m_tdr == 0x00 )
186   if ( --m_tdr == 0x00 )
187187   {
188      if ( (state->m_tcr & 0x40) == 0 )
188      if ( (m_tcr & 0x40) == 0 )
189189      {
190190         //timer interrupt!
191         generic_pulse_irq_line(timer.machine().device("mcu"), M68705_INT_TIMER, 1);
191         generic_pulse_irq_line(machine().device("mcu")->execute(), M68705_INT_TIMER, 1);
192192      }
193193   }
194194}
r18138r18139
410410   MCFG_CPU_PROGRAM_MAP(mcu_mem)
411411
412412   MCFG_PIA6821_ADD("pia", maxaflex_atarixl_pia_interface)
413   MCFG_TIMER_ADD("mcu_timer", mcu_timer_proc)
413   MCFG_TIMER_DRIVER_ADD("mcu_timer", maxaflex_state, mcu_timer_proc)
414414
415415   /* video hardware */
416416   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/icecold.c
r18138r18139
5656   // motors positions
5757   int      m_rmotor;         // right motor position (0-100)
5858   int      m_lmotor;         // left motor position (0-100)
59   TIMER_DEVICE_CALLBACK_MEMBER(icecold_sint_timer);
60   TIMER_DEVICE_CALLBACK_MEMBER(icecold_motors_timer);
5961};
6062
6163static ADDRESS_MAP_START( icecold_map, AS_PROGRAM, 8, icecold_state )
r18138r18139
286288   return m_sint;
287289}
288290
289static TIMER_DEVICE_CALLBACK( icecold_sint_timer )
291TIMER_DEVICE_CALLBACK_MEMBER(icecold_state::icecold_sint_timer)
290292{
291   icecold_state *state = timer.machine().driver_data<icecold_state>();
292   state->m_sint = !state->m_sint;
293   state->m_pia1->ca1_w(state->m_sint);
293   m_sint = !m_sint;
294   m_pia1->ca1_w(m_sint);
294295}
295296
296static TIMER_DEVICE_CALLBACK( icecold_motors_timer )
297TIMER_DEVICE_CALLBACK_MEMBER(icecold_state::icecold_motors_timer)
297298{
298   icecold_state *state = timer.machine().driver_data<icecold_state>();
299299
300300   // /MOTENBL is set high during reset for disable the motors control
301   if (state->m_motenbl == 0)
301   if (m_motenbl == 0)
302302   {
303      int lmotor_dir = ((state->m_motors_ctrl & 0x0f) == 0x06) ? -1 : ((state->m_motors_ctrl & 0x0f) == 0x09) ? +1 : 0;
304      int rmotor_dir = ((state->m_motors_ctrl & 0xf0) == 0x60) ? -1 : ((state->m_motors_ctrl & 0xf0) == 0x90) ? +1 : 0;
303      int lmotor_dir = ((m_motors_ctrl & 0x0f) == 0x06) ? -1 : ((m_motors_ctrl & 0x0f) == 0x09) ? +1 : 0;
304      int rmotor_dir = ((m_motors_ctrl & 0xf0) == 0x60) ? -1 : ((m_motors_ctrl & 0xf0) == 0x90) ? +1 : 0;
305305
306306      // update motors position
307      state->m_lmotor += lmotor_dir;
308      state->m_rmotor += rmotor_dir;
307      m_lmotor += lmotor_dir;
308      m_rmotor += rmotor_dir;
309309
310310      // if one motor is at the top of the playfield, closes the ball gate switch, to simulate ball movement
311      if (state->m_lmotor >= 99 || state->m_rmotor >= 99 )
312         state->m_ball_gate_sw = 1;
311      if (m_lmotor >= 99 || m_rmotor >= 99 )
312         m_ball_gate_sw = 1;
313313      // if the motors are at the bottom of the playfield, opens the ball gate switch for start the game
314      else if (state->m_lmotor <= 1 && state->m_rmotor <= 1 )
315         state->m_ball_gate_sw = 0;
314      else if (m_lmotor <= 1 && m_rmotor <= 1 )
315         m_ball_gate_sw = 0;
316316
317317      // motors are keep in range 0-100
318      state->m_lmotor = MIN(state->m_lmotor, 100);
319      state->m_lmotor = MAX(state->m_lmotor, 0);
320      state->m_rmotor = MIN(state->m_rmotor, 100);
321      state->m_rmotor = MAX(state->m_rmotor, 0);
318      m_lmotor = MIN(m_lmotor, 100);
319      m_lmotor = MAX(m_lmotor, 0);
320      m_rmotor = MIN(m_rmotor, 100);
321      m_rmotor = MAX(m_rmotor, 0);
322322
323323      if (lmotor_dir != 0 || rmotor_dir != 0)
324324      {
325         output_set_value("lmotor", state->m_lmotor);
326         output_set_value("rmotor", state->m_rmotor);
325         output_set_value("lmotor", m_lmotor);
326         output_set_value("rmotor", m_rmotor);
327327
328328         popmessage("Left Motor   Right Motor\n%-4s         %-4s\n%02d\\100       %02d\\100",
329329                 (lmotor_dir > 0) ? " up" : ((lmotor_dir < 0) ? "down" : "off"),
330                 (rmotor_dir > 0) ? " up" : ((rmotor_dir < 0) ? "down" : "off"), state->m_lmotor, state->m_rmotor);
330                 (rmotor_dir > 0) ? " up" : ((rmotor_dir < 0) ? "down" : "off"), m_lmotor, m_rmotor);
331331      }
332332   }
333333}
r18138r18139
424424   MCFG_I8279_ADD("i8279", XTAL_6MHz/4, icecold_i8279_intf)
425425
426426   // 30Hz signal from CH-C of ay0
427   MCFG_TIMER_ADD_PERIODIC("sint_timer", icecold_sint_timer, attotime::from_hz(30))
427   MCFG_TIMER_DRIVER_ADD_PERIODIC("sint_timer", icecold_state, icecold_sint_timer, attotime::from_hz(30))
428428
429429   // for update motors position
430   MCFG_TIMER_ADD_PERIODIC("motors_timer", icecold_motors_timer, attotime::from_msec(50))
430   MCFG_TIMER_DRIVER_ADD_PERIODIC("motors_timer", icecold_state, icecold_motors_timer, attotime::from_msec(50))
431431
432432   // video hardware
433433   MCFG_DEFAULT_LAYOUT(layout_icecold)
trunk/src/mame/drivers/ecoinfr.c
r18138r18139
8787   DECLARE_DRIVER_INIT(ecoinfr);
8888   DECLARE_DRIVER_INIT(ecoinfrmab);
8989   virtual void machine_reset();
90   TIMER_DEVICE_CALLBACK_MEMBER(ecoinfr_irq_timer);
9091};
9192
9293
9394
94TIMER_DEVICE_CALLBACK( ecoinfr_irq_timer )
95TIMER_DEVICE_CALLBACK_MEMBER(ecoinfr_state::ecoinfr_irq_timer)
9596{
9697
97   ecoinfr_state *state = timer.machine().driver_data<ecoinfr_state>();
98   state->irq_toggle^=1;
98   irq_toggle^=1;
9999
100   //printf("blah %d\n", state->irq_toggle);
100   //printf("blah %d\n", irq_toggle);
101101
102102   /* What are the IRQ sources / freq?
103103     It runs in IM2
r18138r18139
108108
109109    */
110110
111   if (state->irq_toggle==0)
111   if (irq_toggle==0)
112112   {
113      timer.machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xe4);
113      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xe4);
114114   }
115115   else
116116   {
117      timer.machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xe0);
117      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xe0);
118118   }
119119
120120
r18138r18139
651651   MCFG_CPU_ADD("maincpu", Z80,4000000)
652652   MCFG_CPU_PROGRAM_MAP(memmap)
653653   MCFG_CPU_IO_MAP(portmap)
654   MCFG_TIMER_ADD_PERIODIC("ectimer",ecoinfr_irq_timer, attotime::from_hz(250))
654   MCFG_TIMER_DRIVER_ADD_PERIODIC("ectimer", ecoinfr_state, ecoinfr_irq_timer, attotime::from_hz(250))
655655
656656   MCFG_I8251_ADD(UPD8251_TAG, default_i8251_interface)
657657MACHINE_CONFIG_END
trunk/src/mame/drivers/pkscram.c
r18138r18139
4545   virtual void machine_reset();
4646   virtual void video_start();
4747   UINT32 screen_update_pkscramble(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
48   TIMER_DEVICE_CALLBACK_MEMBER(scanline_callback);
4849};
4950
5051
r18138r18139
215216   SET_TILE_INFO_MEMBER(0,tile,color,0);
216217}
217218
218static TIMER_DEVICE_CALLBACK( scanline_callback )
219TIMER_DEVICE_CALLBACK_MEMBER(pkscram_state::scanline_callback)
219220{
220   pkscram_state *state = timer.machine().driver_data<pkscram_state>();
221221   if (param == interrupt_scanline)
222222   {
223       if (state->m_out & 0x2000)
224          timer.machine().device("maincpu")->execute().set_input_line(1, ASSERT_LINE);
225      timer.adjust(timer.machine().primary_screen->time_until_pos(param + 1), param+1);
226      state->m_interrupt_line_active = 1;
223       if (m_out & 0x2000)
224          machine().device("maincpu")->execute().set_input_line(1, ASSERT_LINE);
225      timer.adjust(machine().primary_screen->time_until_pos(param + 1), param+1);
226      m_interrupt_line_active = 1;
227227   }
228228   else
229229   {
230      if (state->m_interrupt_line_active)
231          timer.machine().device("maincpu")->execute().set_input_line(1, CLEAR_LINE);
232      timer.adjust(timer.machine().primary_screen->time_until_pos(interrupt_scanline), interrupt_scanline);
233      state->m_interrupt_line_active = 0;
230      if (m_interrupt_line_active)
231          machine().device("maincpu")->execute().set_input_line(1, CLEAR_LINE);
232      timer.adjust(machine().primary_screen->time_until_pos(interrupt_scanline), interrupt_scanline);
233      m_interrupt_line_active = 0;
234234   }
235235}
236236
r18138r18139
308308   MCFG_NVRAM_ADD_0FILL("nvram")
309309
310310
311   MCFG_TIMER_ADD("scan_timer", scanline_callback)
311   MCFG_TIMER_DRIVER_ADD("scan_timer", pkscram_state, scanline_callback)
312312
313313   /* video hardware */
314314   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/mpu4vid.c
r18138r18139
269269   DECLARE_MACHINE_RESET(mpu4_vid);
270270   DECLARE_VIDEO_START(mpu4_vid);
271271   UINT32 screen_update_mpu4_vid(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
272   TIMER_DEVICE_CALLBACK_MEMBER(scanline_timer_callback);
272273};
273274
274275
r18138r18139
14961497
14971498
14981499
1499static TIMER_DEVICE_CALLBACK( scanline_timer_callback )
1500TIMER_DEVICE_CALLBACK_MEMBER(mpu4vid_state::scanline_timer_callback)
15001501{
1501   mpu4vid_state *state = timer.machine().driver_data<mpu4vid_state>();
15021502
1503   state->m_scn2674->scn2674_do_scanline(timer.machine(), param);
1503   m_scn2674->scn2674_do_scanline(machine(), param);
15041504}
15051505
15061506
r18138r18139
15451545   MCFG_ACIA6850_ADD("acia6850_1", m68k_acia_if)
15461546
15471547   // for the video timing
1548   MCFG_TIMER_ADD_SCANLINE("scan_timer", scanline_timer_callback, "screen", 0, 1)
1548   MCFG_TIMER_DRIVER_ADD_SCANLINE("scan_timer", mpu4vid_state, scanline_timer_callback, "screen", 0, 1)
15491549MACHINE_CONFIG_END
15501550
15511551static MACHINE_CONFIG_DERIVED( crmaze, mpu4_vid )
trunk/src/mame/drivers/dwarfd.c
r18138r18139
350350   virtual void video_start();
351351   virtual void palette_init();
352352   UINT32 screen_update_dwarfd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
353   TIMER_DEVICE_CALLBACK_MEMBER(dwarfd_interrupt);
353354};
354355
355356
r18138r18139
870871};
871872
872873
873static TIMER_DEVICE_CALLBACK( dwarfd_interrupt )
874TIMER_DEVICE_CALLBACK_MEMBER(dwarfd_state::dwarfd_interrupt)
874875{
875   dwarfd_state *state = timer.machine().driver_data<dwarfd_state>();
876876   int scanline = param;
877877
878878   if((scanline % 8) != 0)
r18138r18139
880880
881881   if (scanline < 25*8)
882882   {
883      state->m_maincpu->set_input_line(I8085_RST65_LINE, HOLD_LINE); // 34 - every 8th line
884      state->m_line = scanline/8;
885      state->m_idx = 0;
883      m_maincpu->set_input_line(I8085_RST65_LINE, HOLD_LINE); // 34 - every 8th line
884      m_line = scanline/8;
885      m_idx = 0;
886886   }
887887   else
888888   {
889889      if (scanline == 25*8)
890890      {
891         state->m_maincpu->set_input_line(I8085_RST55_LINE, HOLD_LINE);//2c - generated by  crt - end of frame
891         m_maincpu->set_input_line(I8085_RST55_LINE, HOLD_LINE);//2c - generated by  crt - end of frame
892892      }
893893   }
894894}
r18138r18139
10721072   MCFG_CPU_CONFIG(dwarfd_i8085_config)
10731073   MCFG_CPU_PROGRAM_MAP(mem_map)
10741074   MCFG_CPU_IO_MAP(io_map)
1075   MCFG_TIMER_ADD_SCANLINE("scantimer", dwarfd_interrupt, "screen", 0, 1)
1075   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dwarfd_state, dwarfd_interrupt, "screen", 0, 1)
10761076
10771077
10781078   /* video hardware */
trunk/src/mame/drivers/meritm.c
r18138r18139
240240   DECLARE_MACHINE_START(meritm_crt260);
241241   DECLARE_MACHINE_START(merit_common);
242242   UINT32 screen_update_meritm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
243   TIMER_DEVICE_CALLBACK_MEMBER(meritm_interrupt);
244   TIMER_DEVICE_CALLBACK_MEMBER(vblank_start_tick);
245   TIMER_DEVICE_CALLBACK_MEMBER(vblank_end_tick);
243246};
244247
245248
r18138r18139
422425 *************************************/
423426
424427
425static TIMER_DEVICE_CALLBACK( meritm_interrupt )
428TIMER_DEVICE_CALLBACK_MEMBER(meritm_state::meritm_interrupt)
426429{
427   meritm_state *state = timer.machine().driver_data<meritm_state>();
428430   int scanline = param;
429431
430432   if((scanline % 2) == 0)
431433   {
432      state->m_v9938_0->set_sprite_limit(0);
433      state->m_v9938_0->set_resolution(RENDER_HIGH);
434      state->m_v9938_0->interrupt();
434      m_v9938_0->set_sprite_limit(0);
435      m_v9938_0->set_resolution(RENDER_HIGH);
436      m_v9938_0->interrupt();
435437
436      state->m_v9938_1->set_sprite_limit(0);
437      state->m_v9938_1->set_resolution(RENDER_HIGH);
438      state->m_v9938_1->interrupt();
438      m_v9938_1->set_sprite_limit(0);
439      m_v9938_1->set_resolution(RENDER_HIGH);
440      m_v9938_1->interrupt();
439441   }
440442}
441443
r18138r18139
11501152#define MSX2_VISIBLE_XBORDER_PIXELS   8 * 2
11511153#define MSX2_VISIBLE_YBORDER_PIXELS   14 * 2
11521154
1153static TIMER_DEVICE_CALLBACK( vblank_start_tick )
1155TIMER_DEVICE_CALLBACK_MEMBER(meritm_state::vblank_start_tick)
11541156{
1155   meritm_state *state = timer.machine().driver_data<meritm_state>();
11561157   /* this is a workaround to signal the v9938 vblank interrupt correctly */
1157   state->m_vint = 0x08;
1158   state->m_z80pio_0->port_a_write(state->m_vint);
1158   m_vint = 0x08;
1159   m_z80pio_0->port_a_write(m_vint);
11591160}
11601161
1161static TIMER_DEVICE_CALLBACK( vblank_end_tick )
1162TIMER_DEVICE_CALLBACK_MEMBER(meritm_state::vblank_end_tick)
11621163{
1163   meritm_state *state = timer.machine().driver_data<meritm_state>();
11641164   /* this is a workaround to signal the v9938 vblank interrupt correctly */
1165   state->m_vint = 0x18;
1166   state->m_z80pio_0->port_a_write(state->m_vint);
1165   m_vint = 0x18;
1166   m_z80pio_0->port_a_write(m_vint);
11671167}
11681168
11691169static MACHINE_CONFIG_START( meritm_crt250, meritm_state )
r18138r18139
11711171   MCFG_CPU_PROGRAM_MAP(meritm_crt250_map)
11721172   MCFG_CPU_IO_MAP(meritm_crt250_io_map)
11731173   MCFG_CPU_CONFIG(meritm_daisy_chain)
1174   MCFG_TIMER_ADD_SCANLINE("scantimer", meritm_interrupt, "screen", 0, 1)
1174   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", meritm_state, meritm_interrupt, "screen", 0, 1)
11751175
11761176
11771177   MCFG_I8255A_ADD( "ppi8255", crt250_ppi8255_intf )
r18138r18139
11791179   MCFG_Z80PIO_ADD( "z80pio_0", SYSTEM_CLK/6, meritm_audio_pio_intf )
11801180   MCFG_Z80PIO_ADD( "z80pio_1", SYSTEM_CLK/6, meritm_io_pio_intf )
11811181
1182   MCFG_TIMER_ADD_SCANLINE("vblank_start", vblank_start_tick, "screen", 259, 262)
1183   MCFG_TIMER_ADD_SCANLINE("vblank_end",   vblank_end_tick,   "screen", 262, 262)
1182   MCFG_TIMER_DRIVER_ADD_SCANLINE("vblank_start", meritm_state, vblank_start_tick, "screen", 259, 262)
1183   MCFG_TIMER_DRIVER_ADD_SCANLINE("vblank_end", meritm_state, vblank_end_tick, "screen", 262, 262)
11841184
11851185   MCFG_NVRAM_ADD_0FILL("nvram")
11861186
trunk/src/mame/drivers/lastbank.c
r18138r18139
6565
6666   UINT8 ram_bank_r(UINT16 offset, UINT8 bank_num);
6767   void ram_bank_w(UINT16 offset, UINT8 data, UINT8 bank_num);
68   TIMER_DEVICE_CALLBACK_MEMBER(lastbank_irq_scanline);
6869};
6970
7071void lastbank_state::video_start()
r18138r18139
433434   GFXDECODE_ENTRY( "gfx1",      0, sp2_layout, 0, 16 )
434435GFXDECODE_END
435436
436static TIMER_DEVICE_CALLBACK( lastbank_irq_scanline )
437TIMER_DEVICE_CALLBACK_MEMBER(lastbank_state::lastbank_irq_scanline)
437438{
438   lastbank_state *state = timer.machine().driver_data<lastbank_state>();
439439   int scanline = param;
440440
441   if (scanline == 240 && (state->m_irq_enable & 4))
441   if (scanline == 240 && (m_irq_enable & 4))
442442   {
443      state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, state->m_irq_vector[2]);
443      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_irq_vector[2]);
444444   }
445445
446   if (scanline == 0 && (state->m_irq_enable & 2))
446   if (scanline == 0 && (m_irq_enable & 2))
447447   {
448      state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, state->m_irq_vector[1]);
448      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_irq_vector[1]);
449449   }
450450}
451451
r18138r18139
454454   /* basic machine hardware */
455455   MCFG_CPU_ADD("maincpu",Z80,MASTER_CLOCK/4) //!!! TC0091LVC !!!
456456   MCFG_CPU_PROGRAM_MAP(lastbank_map)
457   MCFG_TIMER_ADD_SCANLINE("scantimer", lastbank_irq_scanline, "screen", 0, 1)
457   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", lastbank_state, lastbank_irq_scanline, "screen", 0, 1)
458458
459459   MCFG_CPU_ADD("audiocpu",Z80,MASTER_CLOCK/4)
460460   MCFG_CPU_PROGRAM_MAP(lastbank_audio_map)
trunk/src/mame/drivers/jclub2.c
r18138r18139
146146   UINT32 screen_update_darkhors(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
147147   UINT32 screen_update_jclub2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
148148   UINT32 screen_update_jclub2o(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
149   TIMER_DEVICE_CALLBACK_MEMBER(darkhors_irq);
149150};
150151
151152
r18138r18139
672673
673674***************************************************************************/
674675
675static TIMER_DEVICE_CALLBACK( darkhors_irq )
676TIMER_DEVICE_CALLBACK_MEMBER(darkhors_state::darkhors_irq)
676677{
677   darkhors_state *state = timer.machine().driver_data<darkhors_state>();
678678   int scanline = param;
679679
680680   if(scanline == 248)
681      state->m_maincpu->set_input_line(5, HOLD_LINE);
681      m_maincpu->set_input_line(5, HOLD_LINE);
682682
683683   if(scanline == 0)
684      state->m_maincpu->set_input_line(3, HOLD_LINE);
684      m_maincpu->set_input_line(3, HOLD_LINE);
685685
686686   if(scanline == 128)
687      state->m_maincpu->set_input_line(4, HOLD_LINE);
687      m_maincpu->set_input_line(4, HOLD_LINE);
688688}
689689
690690static MACHINE_CONFIG_START( darkhors, darkhors_state )
691691   MCFG_CPU_ADD("maincpu", M68EC020, 12000000) // 36MHz/3 ??
692692   MCFG_CPU_PROGRAM_MAP(darkhors_map)
693   MCFG_TIMER_ADD_SCANLINE("scantimer", darkhors_irq, "screen", 0, 1)
693   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", darkhors_state, darkhors_irq, "screen", 0, 1)
694694
695695   MCFG_EEPROM_ADD("eeprom", eeprom_interface_93C46_8bit)
696696
r18138r18139
733733static MACHINE_CONFIG_START( jclub2, darkhors_state )
734734   MCFG_CPU_ADD("maincpu", M68EC020, 12000000)
735735   MCFG_CPU_PROGRAM_MAP(jclub2_map)
736   MCFG_TIMER_ADD_SCANLINE("scantimer", darkhors_irq, "screen", 0, 1)
736   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", darkhors_state, darkhors_irq, "screen", 0, 1)
737737
738738   MCFG_EEPROM_ADD("eeprom", eeprom_interface_93C46_8bit)
739739
r18138r18139
795795static MACHINE_CONFIG_START( jclub2o, darkhors_state )
796796   MCFG_CPU_ADD("maincpu", M68EC020, 12000000)
797797   MCFG_CPU_PROGRAM_MAP(jclub2o_map)
798   MCFG_TIMER_ADD_SCANLINE("scantimer", darkhors_irq, "screen", 0, 1)
798   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", darkhors_state, darkhors_irq, "screen", 0, 1)
799799
800800   MCFG_CPU_ADD("st0016",Z80,8000000)
801801   MCFG_CPU_PROGRAM_MAP(st0016_mem)
trunk/src/mame/drivers/jchan.c
r18138r18139
225225   DECLARE_DRIVER_INIT(jchan);
226226   virtual void video_start();
227227   UINT32 screen_update_jchan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
228   TIMER_DEVICE_CALLBACK_MEMBER(jchan_vblank);
228229};
229230
230231
r18138r18139
243244//  if it is incorrect jchan2 will crash when
244245//  certain characters win/lose but no finish
245246//  move was performed
246static TIMER_DEVICE_CALLBACK( jchan_vblank )
247TIMER_DEVICE_CALLBACK_MEMBER(jchan_state::jchan_vblank)
247248{
248   jchan_state *state = timer.machine().driver_data<jchan_state>();
249249   int scanline = param;
250250
251251   if(scanline == 240)
252      state->m_maincpu->set_input_line(1, HOLD_LINE);
252      m_maincpu->set_input_line(1, HOLD_LINE);
253253
254254   if(scanline == 11)
255      state->m_maincpu->set_input_line(2, HOLD_LINE);
255      m_maincpu->set_input_line(2, HOLD_LINE);
256256
257   if (state->m_irq_sub_enable)
257   if (m_irq_sub_enable)
258258   {
259259      if(scanline == 240)
260         state->m_subcpu->set_input_line(1, HOLD_LINE);
260         m_subcpu->set_input_line(1, HOLD_LINE);
261261
262262      if(scanline == 249)
263         state->m_subcpu->set_input_line(2, HOLD_LINE);
263         m_subcpu->set_input_line(2, HOLD_LINE);
264264
265265      if(scanline == 11)
266         state->m_subcpu->set_input_line(3, HOLD_LINE);
266         m_subcpu->set_input_line(3, HOLD_LINE);
267267   }
268268}
269269
r18138r18139
599599
600600   MCFG_CPU_ADD("maincpu", M68000, 16000000)
601601   MCFG_CPU_PROGRAM_MAP(jchan_main)
602   MCFG_TIMER_ADD_SCANLINE("scantimer", jchan_vblank, "screen", 0, 1)
602   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", jchan_state, jchan_vblank, "screen", 0, 1)
603603
604604   MCFG_CPU_ADD("sub", M68000, 16000000)
605605   MCFG_CPU_PROGRAM_MAP(jchan_sub)
trunk/src/mame/drivers/tmmjprd.c
r18138r18139
7070   UINT32 screen_update_tmmjprd_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7171   UINT32 screen_update_tmmjprd_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7272   TIMER_CALLBACK_MEMBER(tmmjprd_blit_done);
73   TIMER_DEVICE_CALLBACK_MEMBER(tmmjprd_scanline);
7374};
7475
7576
r18138r18139
732733GFXDECODE_END
733734
734735
735static TIMER_DEVICE_CALLBACK( tmmjprd_scanline )
736TIMER_DEVICE_CALLBACK_MEMBER(tmmjprd_state::tmmjprd_scanline)
736737{
737   //tmmjprd_state *state = timer.machine().driver_data<tmmjprd_state>();
738738   int scanline = param;
739739
740740   if(scanline == 224) // vblank-out irq
741      timer.machine().device("maincpu")->execute().set_input_line(5, HOLD_LINE);
741      machine().device("maincpu")->execute().set_input_line(5, HOLD_LINE);
742742
743743   if(scanline == 736) // blitter irq?
744      timer.machine().device("maincpu")->execute().set_input_line(3, HOLD_LINE);
744      machine().device("maincpu")->execute().set_input_line(3, HOLD_LINE);
745745
746746}
747747
748748static MACHINE_CONFIG_START( tmmjprd, tmmjprd_state )
749749   MCFG_CPU_ADD("maincpu",M68EC020,24000000) /* 24 MHz */
750750   MCFG_CPU_PROGRAM_MAP(tmmjprd_map)
751   MCFG_TIMER_ADD_SCANLINE("scantimer", tmmjprd_scanline, "lscreen", 0, 1)
751   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tmmjprd_state, tmmjprd_scanline, "lscreen", 0, 1)
752752
753753   MCFG_EEPROM_93C46_ADD("eeprom")
754754
trunk/src/mame/drivers/littlerb.c
r18138r18139
203203   }
204204   virtual void video_start();
205205   UINT32 screen_update_littlerb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
206   TIMER_DEVICE_CALLBACK_MEMBER(littlerb_scanline);
206207};
207208
208209
r18138r18139
565566   return 0;
566567}
567568
568static TIMER_DEVICE_CALLBACK( littlerb_scanline )
569TIMER_DEVICE_CALLBACK_MEMBER(littlerb_state::littlerb_scanline)
569570{
570   littlerb_state *state = timer.machine().driver_data<littlerb_state>();
571571   int scanline = param;
572572
573573   if((scanline % 2) == 0)
574574   {
575575      UINT8 res;
576      UINT8 *sample_rom = state->memregion("samples")->base();
576      UINT8 *sample_rom = memregion("samples")->base();
577577
578      res = sample_rom[state->m_sound_pointer_l|(state->m_sound_index_l<<10)|0x40000];
579      state->m_dacl->write_signed8(res);
580      res = sample_rom[state->m_sound_pointer_r|(state->m_sound_index_r<<10)|0x00000];
581      state->m_dacr->write_signed8(res);
582      state->m_sound_pointer_l++;
583      state->m_sound_pointer_l&=0x3ff;
584      state->m_sound_pointer_r++;
585      state->m_sound_pointer_r&=0x3ff;
578      res = sample_rom[m_sound_pointer_l|(m_sound_index_l<<10)|0x40000];
579      m_dacl->write_signed8(res);
580      res = sample_rom[m_sound_pointer_r|(m_sound_index_r<<10)|0x00000];
581      m_dacr->write_signed8(res);
582      m_sound_pointer_l++;
583      m_sound_pointer_l&=0x3ff;
584      m_sound_pointer_r++;
585      m_sound_pointer_r&=0x3ff;
586586   }
587587
588588//  logerror("IRQ\n");
589589   if(scanline == 288)
590590   {
591      state->m_maincpu->set_input_line(4, HOLD_LINE);
591      m_maincpu->set_input_line(4, HOLD_LINE);
592592   }
593593}
594594
r18138r18139
827827static MACHINE_CONFIG_START( littlerb, littlerb_state )
828828   MCFG_CPU_ADD("maincpu", M68000, 12000000)
829829   MCFG_CPU_PROGRAM_MAP(littlerb_main)
830   MCFG_TIMER_ADD_SCANLINE("scantimer", littlerb_scanline, "screen", 0, 1)
830   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", littlerb_state, littlerb_scanline, "screen", 0, 1)
831831
832832   MCFG_SCREEN_ADD("screen", RASTER)
833833   MCFG_SCREEN_REFRESH_RATE(50) // guess based on high vertical resolution
trunk/src/mame/drivers/zac_2.c
r18138r18139
2727   UINT8 m_out_offs;
2828   required_device<cpu_device> m_maincpu;
2929   required_shared_ptr<UINT8> m_p_ram;
30   TIMER_DEVICE_CALLBACK_MEMBER(zac_2_inttimer);
31   TIMER_DEVICE_CALLBACK_MEMBER(zac_2_outtimer);
3032protected:
3133
3234   // devices
r18138r18139
173175   m_t_c = 0;
174176}
175177
176static TIMER_DEVICE_CALLBACK( zac_2_inttimer )
178TIMER_DEVICE_CALLBACK_MEMBER(zac_2_state::zac_2_inttimer)
177179{
178180   // a pulse is sent via a capacitor (similar to what one finds at a reset pin)
179   zac_2_state *state = timer.machine().driver_data<zac_2_state>();
180   if (state->m_t_c > 0x80)
181      generic_pulse_irq_line_and_vector(state->m_maincpu, INPUT_LINE_IRQ0, 0xbf, 2);
181   if (m_t_c > 0x80)
182      generic_pulse_irq_line_and_vector(m_maincpu, INPUT_LINE_IRQ0, 0xbf, 2);
182183   else
183      state->m_t_c++;
184      m_t_c++;
184185}
185186
186static TIMER_DEVICE_CALLBACK( zac_2_outtimer )
187TIMER_DEVICE_CALLBACK_MEMBER(zac_2_state::zac_2_outtimer)
187188{
188189   static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0, 0, 0, 0, 0, 0 };
189   zac_2_state *state = timer.machine().driver_data<zac_2_state>();
190   state->m_out_offs++;
190   m_out_offs++;
191191// displays, solenoids, lamps
192192
193   if (state->m_out_offs < 0x40)
193   if (m_out_offs < 0x40)
194194   {
195      UINT8 display = (state->m_out_offs >> 3) & 7;
196      UINT8 digit = state->m_out_offs & 7;
197      output_set_digit_value(display * 10 + digit, patterns[state->m_p_ram[state->m_out_offs]&15]);
195      UINT8 display = (m_out_offs >> 3) & 7;
196      UINT8 digit = m_out_offs & 7;
197      output_set_digit_value(display * 10 + digit, patterns[m_p_ram[m_out_offs]&15]);
198198   }
199199}
200200
r18138r18139
205205   MCFG_CPU_IO_MAP(zac_2_io)
206206   MCFG_NVRAM_ADD_0FILL("ram")
207207
208   MCFG_TIMER_ADD_PERIODIC("zac_2_inttimer", zac_2_inttimer, attotime::from_hz(200))
209   MCFG_TIMER_ADD_PERIODIC("zac_2_outtimer", zac_2_outtimer, attotime::from_hz(187500))
208   MCFG_TIMER_DRIVER_ADD_PERIODIC("zac_2_inttimer", zac_2_state, zac_2_inttimer, attotime::from_hz(200))
209   MCFG_TIMER_DRIVER_ADD_PERIODIC("zac_2_outtimer", zac_2_state, zac_2_outtimer, attotime::from_hz(187500))
210210
211211   /* Video */
212212   MCFG_DEFAULT_LAYOUT(layout_zac_2)
trunk/src/mame/drivers/wheelfir.c
r18138r18139
286286   virtual void video_start();
287287   UINT32 screen_update_wheelfir(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
288288   void screen_eof_wheelfir(screen_device &screen, bool state);
289   TIMER_DEVICE_CALLBACK_MEMBER(scanline_timer_callback);
289290};
290291
291292
r18138r18139
727728   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
728729INPUT_PORTS_END
729730
730static TIMER_DEVICE_CALLBACK( scanline_timer_callback )
731TIMER_DEVICE_CALLBACK_MEMBER(wheelfir_state::scanline_timer_callback)
731732{
732   wheelfir_state *state = timer.machine().driver_data<wheelfir_state>();
733   timer.machine().scheduler().synchronize();
734   state->m_current_scanline=param;
733   machine().scheduler().synchronize();
734   m_current_scanline=param;
735735
736   if(state->m_current_scanline<NUM_SCANLINES)
736   if(m_current_scanline<NUM_SCANLINES)
737737   {
738738      //visible scanline
739739
740      state->m_toggle_bit = 0x0000;
740      m_toggle_bit = 0x0000;
741741
742      --state->m_scanline_cnt;
742      --m_scanline_cnt;
743743
744      if(state->m_current_scanline>0)
744      if(m_current_scanline>0)
745745      {
746746         //copy scanline offset
747         state->m_scanlines[state->m_current_scanline].x=(state->m_scanlines[state->m_current_scanline-1].x);
748         state->m_scanlines[state->m_current_scanline].y=(state->m_scanlines[state->m_current_scanline-1].y+1);
749         state->m_scanlines[state->m_current_scanline].unkbits=state->m_scanlines[state->m_current_scanline-1].unkbits;
747         m_scanlines[m_current_scanline].x=(m_scanlines[m_current_scanline-1].x);
748         m_scanlines[m_current_scanline].y=(m_scanlines[m_current_scanline-1].y+1);
749         m_scanlines[m_current_scanline].unkbits=m_scanlines[m_current_scanline-1].unkbits;
750750      }
751751
752      if(state->m_scanline_cnt==0) //<=0 ?
752      if(m_scanline_cnt==0) //<=0 ?
753753      {
754         timer.machine().device("maincpu")->execute().set_input_line(5, HOLD_LINE); // raster IRQ, changes scroll values for road
754         machine().device("maincpu")->execute().set_input_line(5, HOLD_LINE); // raster IRQ, changes scroll values for road
755755      }
756756
757757   }
758758   else
759759   {
760      if(state->m_current_scanline==NUM_SCANLINES) /* vblank */
760      if(m_current_scanline==NUM_SCANLINES) /* vblank */
761761      {
762         state->m_toggle_bit = 0x8000;
763         timer.machine().device("maincpu")->execute().set_input_line(3, HOLD_LINE);
762         m_toggle_bit = 0x8000;
763         machine().device("maincpu")->execute().set_input_line(3, HOLD_LINE);
764764      }
765765   }
766766}
r18138r18139
822822   MCFG_QUANTUM_TIME(attotime::from_hz(12000))
823823
824824
825   MCFG_TIMER_ADD_SCANLINE("scan_timer", scanline_timer_callback, "screen", 0, 1)
825   MCFG_TIMER_DRIVER_ADD_SCANLINE("scan_timer", wheelfir_state, scanline_timer_callback, "screen", 0, 1)
826826
827827   MCFG_SCREEN_ADD("screen", RASTER)
828828   MCFG_SCREEN_REFRESH_RATE(60)
trunk/src/mame/drivers/mpu3.c
r18138r18139
186186   virtual void machine_start();
187187   virtual void machine_reset();
188188   TIMER_CALLBACK_MEMBER(ic21_timeout);
189   TIMER_DEVICE_CALLBACK_MEMBER(gen_50hz);
190   TIMER_DEVICE_CALLBACK_MEMBER(ic10_callback);
189191};
190192
191193#define DISPLAY_PORT 0
r18138r18139
852854}
853855
854856/* generate a 50 Hz signal (some components rely on this for external sync) */
855static TIMER_DEVICE_CALLBACK( gen_50hz )
857TIMER_DEVICE_CALLBACK_MEMBER(mpu3_state::gen_50hz)
856858{
857   mpu3_state *state = timer.machine().driver_data<mpu3_state>();
858859   /* Although reported as a '50Hz' signal, the fact that both rising and
859860    falling edges of the pulse are used means the timer actually gives a 100Hz
860861    oscillating signal.*/
861   state->m_signal_50hz = state->m_signal_50hz?0:1;
862   timer.machine().device<ptm6840_device>("ptm_ic2")->set_c1(state->m_signal_50hz);
863   timer.machine().device<pia6821_device>("pia_ic3")->cb1_w(~state->m_signal_50hz);
864   update_triacs(timer.machine());
862   m_signal_50hz = m_signal_50hz?0:1;
863   machine().device<ptm6840_device>("ptm_ic2")->set_c1(m_signal_50hz);
864   machine().device<pia6821_device>("pia_ic3")->cb1_w(~m_signal_50hz);
865   update_triacs(machine());
865866}
866867
867static TIMER_DEVICE_CALLBACK( ic10_callback )
868TIMER_DEVICE_CALLBACK_MEMBER(mpu3_state::ic10_callback)
868869{
869   mpu3_state *state = timer.machine().driver_data<mpu3_state>();
870870   // TODO: Use discrete handler for 555, this is far too simplistic
871871
872   state->m_ic10_output = state->m_ic10_output?0:1;
873   timer.machine().device<ptm6840_device>("ptm_ic2")->set_c2(state->m_ic10_output);
874   timer.machine().device<pia6821_device>("pia_ic4")->ca1_w(state->m_ic10_output);
872   m_ic10_output = m_ic10_output?0:1;
873   machine().device<ptm6840_device>("ptm_ic2")->set_c2(m_ic10_output);
874   machine().device<pia6821_device>("pia_ic4")->ca1_w(m_ic10_output);
875875
876876}
877877WRITE8_MEMBER(mpu3_state::mpu3ptm_w)
r18138r18139
905905
906906   MCFG_MSC1937_ADD("vfd",0,LEFT_TO_RIGHT)
907907
908   MCFG_TIMER_ADD_PERIODIC("50hz",gen_50hz, attotime::from_hz(100))
909   MCFG_TIMER_ADD_PERIODIC("555_ic10",ic10_callback, PERIOD_OF_555_ASTABLE(10000,1000,0.0000001))
908   MCFG_TIMER_DRIVER_ADD_PERIODIC("50hz", mpu3_state, gen_50hz, attotime::from_hz(100))
909   MCFG_TIMER_DRIVER_ADD_PERIODIC("555_ic10", mpu3_state, ic10_callback, PERIOD_OF_555_ASTABLE(10000,1000,0.0000001))
910910
911911   /* 6840 PTM */
912912   MCFG_PTM6840_ADD("ptm_ic2", ptm_ic2_intf)
trunk/src/mame/drivers/koftball.c
r18138r18139
6666   TILE_GET_INFO_MEMBER(get_t2_tile_info);
6767   virtual void video_start();
6868   UINT32 screen_update_koftball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
69   TIMER_DEVICE_CALLBACK_MEMBER(bmc_interrupt);
6970};
7071
7172
r18138r18139
209210INPUT_PORTS_END
210211
211212
212static TIMER_DEVICE_CALLBACK( bmc_interrupt )
213TIMER_DEVICE_CALLBACK_MEMBER(koftball_state::bmc_interrupt)
213214{
214   koftball_state *state = timer.machine().driver_data<koftball_state>();
215215   int scanline = param;
216216
217217   if(scanline == 240)
218      state->m_maincpu->set_input_line(2, HOLD_LINE);
218      m_maincpu->set_input_line(2, HOLD_LINE);
219219
220220   if(scanline == 128)
221      state->m_maincpu->set_input_line(3, HOLD_LINE);
221      m_maincpu->set_input_line(3, HOLD_LINE);
222222
223223   if(scanline == 64)
224      state->m_maincpu->set_input_line(6, HOLD_LINE);
224      m_maincpu->set_input_line(6, HOLD_LINE);
225225}
226226
227227static const gfx_layout tilelayout =
r18138r18139
243243static MACHINE_CONFIG_START( koftball, koftball_state )
244244   MCFG_CPU_ADD("maincpu", M68000, 21477270/2 )
245245   MCFG_CPU_PROGRAM_MAP(koftball_mem)
246   MCFG_TIMER_ADD_SCANLINE("scantimer", bmc_interrupt, "screen", 0, 1)
246   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", koftball_state, bmc_interrupt, "screen", 0, 1)
247247
248248   MCFG_SCREEN_ADD("screen", RASTER)
249249   MCFG_SCREEN_REFRESH_RATE(60)
trunk/src/mame/drivers/astrocorp.c
r18138r18139
6565   DECLARE_DRIVER_INIT(showhand);
6666   DECLARE_VIDEO_START(astrocorp);
6767   UINT32 screen_update_astrocorp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
68   TIMER_DEVICE_CALLBACK_MEMBER(skilldrp_scanline);
6869};
6970
7071/***************************************************************************
r18138r18139
508509MACHINE_CONFIG_END
509510
510511
511static TIMER_DEVICE_CALLBACK( skilldrp_scanline )
512TIMER_DEVICE_CALLBACK_MEMBER(astrocorp_state::skilldrp_scanline)
512513{
513514   int scanline = param;
514515
515516   if(scanline == 240) // vblank-out irq. controls sprites, sound, i/o
516      timer.machine().device("maincpu")->execute().set_input_line(4, HOLD_LINE);
517      machine().device("maincpu")->execute().set_input_line(4, HOLD_LINE);
517518
518519   if(scanline == 0) // vblank-in? controls palette
519      timer.machine().device("maincpu")->execute().set_input_line(2, HOLD_LINE);
520      machine().device("maincpu")->execute().set_input_line(2, HOLD_LINE);
520521}
521522
522523static MACHINE_CONFIG_START( skilldrp, astrocorp_state )
r18138r18139
524525   /* basic machine hardware */
525526   MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz / 2)   // JX-1689F1028N GRX586.V5
526527   MCFG_CPU_PROGRAM_MAP(skilldrp_map)
527   MCFG_TIMER_ADD_SCANLINE("scantimer", skilldrp_scanline, "screen", 0, 1)
528   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", astrocorp_state, skilldrp_scanline, "screen", 0, 1)
528529
529530   MCFG_NVRAM_ADD_0FILL("nvram")
530531   MCFG_EEPROM_93C46_ADD("eeprom")
trunk/src/mame/drivers/meyc8088.c
r18138r18139
6565   virtual void palette_init();
6666   UINT32 screen_update_meyc8088(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6767   void screen_eof_meyc8088(screen_device &screen, bool state);
68   TIMER_DEVICE_CALLBACK_MEMBER(heartbeat_callback);
6869};
6970
7071
r18138r18139
166167
167168***************************************************************************/
168169
169TIMER_DEVICE_CALLBACK( heartbeat_callback )
170TIMER_DEVICE_CALLBACK_MEMBER(meyc8088_state::heartbeat_callback)
170171{
171   meyc8088_state *state = timer.machine().driver_data<meyc8088_state>();
172   state->m_status |= 0x20;
172   m_status |= 0x20;
173173}
174174
175175WRITE8_MEMBER(meyc8088_state::drive_w)
r18138r18139
380380
381381   MCFG_NVRAM_ADD_0FILL("nvram")
382382
383   MCFG_TIMER_ADD("heartbeat", heartbeat_callback)
383   MCFG_TIMER_DRIVER_ADD("heartbeat", meyc8088_state, heartbeat_callback)
384384
385385   /* video hardware */
386386   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/subsino2.c
r18138r18139
167167   DECLARE_VIDEO_START(xtrain);
168168   UINT32 screen_update_subsino2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
169169   INTERRUPT_GEN_MEMBER(am188em_int0_irq);
170   TIMER_DEVICE_CALLBACK_MEMBER(am188em_timer2_irq);
171   TIMER_DEVICE_CALLBACK_MEMBER(h8_timer_irq);
170172};
171173
172174
r18138r18139
870872      device.execute().set_input_line_and_vector(0, HOLD_LINE, 0x0c);   // INT0 (background scrolling in xplan)
871873}
872874
873static TIMER_DEVICE_CALLBACK( am188em_timer2_irq )
875TIMER_DEVICE_CALLBACK_MEMBER(subsino2_state::am188em_timer2_irq)
874876{
875   subsino2_state *state = timer.machine().driver_data<subsino2_state>();
876   if ((state->m_am188em_regs[AM188EM_IMASK+0] & 0x01) == 0)   // TMR mask
877      timer.machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0x4c/4);
877   if ((m_am188em_regs[AM188EM_IMASK+0] & 0x01) == 0)   // TMR mask
878      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0x4c/4);
878879}
879880
880881/***************************************************************************
r18138r18139
882883***************************************************************************/
883884
884885// To be removed when cpu core is updated
885static TIMER_DEVICE_CALLBACK( h8_timer_irq )
886TIMER_DEVICE_CALLBACK_MEMBER(subsino2_state::h8_timer_irq)
886887{
887   timer.machine().device("maincpu")->execute().set_input_line(H8_METRO_TIMER_HACK, HOLD_LINE);
888   machine().device("maincpu")->execute().set_input_line(H8_METRO_TIMER_HACK, HOLD_LINE);
888889}
889890
890891
r18138r18139
21782179   MCFG_CPU_ADD("maincpu", H83044, XTAL_44_1MHz / 3)
21792180   MCFG_CPU_PROGRAM_MAP( bishjan_map )
21802181   MCFG_CPU_VBLANK_INT_DRIVER("screen", subsino2_state,  irq0_line_hold)
2181   MCFG_TIMER_ADD_PERIODIC("timer", h8_timer_irq, attotime::from_hz(60)) // timer, ?? Hz
2182   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer", subsino2_state, h8_timer_irq, attotime::from_hz(60))
21822183
21832184   MCFG_NVRAM_ADD_0FILL("nvram")
21842185   MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(200), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_LOW)
r18138r18139
22382239   MCFG_CPU_ADD("maincpu", I80188, XTAL_20MHz )   // !! AMD AM188-EM !!
22392240   MCFG_CPU_PROGRAM_MAP( saklove_map )
22402241   MCFG_CPU_IO_MAP( saklove_io )
2241   MCFG_TIMER_ADD_PERIODIC("timer2", am188em_timer2_irq, attotime::from_hz(60)) // timer 2, ?? Hz
2242   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer2", subsino2_state, am188em_timer2_irq, attotime::from_hz(60))
22422243
22432244   MCFG_MACHINE_RESET_OVERRIDE(subsino2_state,am188em)
22442245   MCFG_NVRAM_ADD_0FILL("nvram")
r18138r18139
22752276   MCFG_CPU_PROGRAM_MAP( xplan_map )
22762277   MCFG_CPU_IO_MAP( xplan_io )
22772278   MCFG_CPU_VBLANK_INT_DRIVER("screen", subsino2_state,  am188em_int0_irq)
2278   MCFG_TIMER_ADD_PERIODIC("timer2", am188em_timer2_irq, attotime::from_hz(60)) // timer 2, ?? Hz
2279   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer2", subsino2_state, am188em_timer2_irq, attotime::from_hz(60))
22792280
22802281   MCFG_MACHINE_RESET_OVERRIDE(subsino2_state,am188em)
22812282   MCFG_NVRAM_ADD_0FILL("nvram")
trunk/src/mame/drivers/ddealer.c
r18138r18139
158158   virtual void video_start();
159159   UINT32 screen_update_ddealer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
160160   INTERRUPT_GEN_MEMBER(ddealer_interrupt);
161   TIMER_DEVICE_CALLBACK_MEMBER(ddealer_mcu_sim);
161162};
162163
163164
r18138r18139
307308   return 0;
308309}
309310
310static TIMER_DEVICE_CALLBACK( ddealer_mcu_sim )
311TIMER_DEVICE_CALLBACK_MEMBER(ddealer_state::ddealer_mcu_sim)
311312{
312   ddealer_state *state = timer.machine().driver_data<ddealer_state>();
313313
314314   /*coin/credit simulation*/
315315   /*$fe002 is used,might be for multiple coins for one credit settings.*/
316   state->m_coin_input = (~(timer.machine().root_device().ioport("IN0")->read()));
316   m_coin_input = (~(machine().root_device().ioport("IN0")->read()));
317317
318   if (state->m_coin_input & 0x01)//coin 1
318   if (m_coin_input & 0x01)//coin 1
319319   {
320      if((state->m_input_pressed & 0x01) == 0)
321         state->m_mcu_shared_ram[0x000 / 2]++;
322      state->m_input_pressed = (state->m_input_pressed & 0xfe) | 1;
320      if((m_input_pressed & 0x01) == 0)
321         m_mcu_shared_ram[0x000 / 2]++;
322      m_input_pressed = (m_input_pressed & 0xfe) | 1;
323323   }
324324   else
325      state->m_input_pressed = (state->m_input_pressed & 0xfe);
325      m_input_pressed = (m_input_pressed & 0xfe);
326326
327   if (state->m_coin_input & 0x02)//coin 2
327   if (m_coin_input & 0x02)//coin 2
328328   {
329      if ((state->m_input_pressed & 0x02) == 0)
330         state->m_mcu_shared_ram[0x000 / 2]++;
331      state->m_input_pressed = (state->m_input_pressed & 0xfd) | 2;
329      if ((m_input_pressed & 0x02) == 0)
330         m_mcu_shared_ram[0x000 / 2]++;
331      m_input_pressed = (m_input_pressed & 0xfd) | 2;
332332   }
333333   else
334      state->m_input_pressed = (state->m_input_pressed & 0xfd);
334      m_input_pressed = (m_input_pressed & 0xfd);
335335
336   if (state->m_coin_input & 0x04)//service 1
336   if (m_coin_input & 0x04)//service 1
337337   {
338      if ((state->m_input_pressed & 0x04) == 0)
339         state->m_mcu_shared_ram[0x000 / 2]++;
340      state->m_input_pressed = (state->m_input_pressed & 0xfb) | 4;
338      if ((m_input_pressed & 0x04) == 0)
339         m_mcu_shared_ram[0x000 / 2]++;
340      m_input_pressed = (m_input_pressed & 0xfb) | 4;
341341   }
342342   else
343      state->m_input_pressed = (state->m_input_pressed & 0xfb);
343      m_input_pressed = (m_input_pressed & 0xfb);
344344
345345   /*0x104/2 is some sort of "start-lock",i.e. used on the girl selection.
346346      Without it,the game "steals" one credit if you press the start button on that.*/
347   if (state->m_mcu_shared_ram[0x000 / 2] > 0 && state->m_work_ram[0x104 / 2] & 1)
347   if (m_mcu_shared_ram[0x000 / 2] > 0 && m_work_ram[0x104 / 2] & 1)
348348   {
349      if (state->m_coin_input & 0x08)//start 1
349      if (m_coin_input & 0x08)//start 1
350350      {
351         if ((state->m_input_pressed & 0x08) == 0 && (~(state->m_work_ram[0x100 / 2] & 1)))
352            state->m_mcu_shared_ram[0x000 / 2]--;
353         state->m_input_pressed = (state->m_input_pressed & 0xf7) | 8;
351         if ((m_input_pressed & 0x08) == 0 && (~(m_work_ram[0x100 / 2] & 1)))
352            m_mcu_shared_ram[0x000 / 2]--;
353         m_input_pressed = (m_input_pressed & 0xf7) | 8;
354354      }
355355      else
356         state->m_input_pressed = (state->m_input_pressed & 0xf7);
356         m_input_pressed = (m_input_pressed & 0xf7);
357357
358      if (state->m_coin_input & 0x10)//start 2
358      if (m_coin_input & 0x10)//start 2
359359      {
360         if((state->m_input_pressed & 0x10) == 0 && (~(state->m_work_ram[0x100 / 2] & 2)))
361            state->m_mcu_shared_ram[0x000 / 2]--;
362         state->m_input_pressed = (state->m_input_pressed & 0xef) | 0x10;
360         if((m_input_pressed & 0x10) == 0 && (~(m_work_ram[0x100 / 2] & 2)))
361            m_mcu_shared_ram[0x000 / 2]--;
362         m_input_pressed = (m_input_pressed & 0xef) | 0x10;
363363      }
364364      else
365         state->m_input_pressed = (state->m_input_pressed & 0xef);
365         m_input_pressed = (m_input_pressed & 0xef);
366366   }
367367
368368   /*random number generators,controls order of cards*/
369   state->m_mcu_shared_ram[0x10 / 2] = timer.machine().rand() & 0xffff;
370   state->m_mcu_shared_ram[0x12 / 2] = timer.machine().rand() & 0xffff;
371   state->m_mcu_shared_ram[0x14 / 2] = timer.machine().rand() & 0xffff;
372   state->m_mcu_shared_ram[0x16 / 2] = timer.machine().rand() & 0xffff;
369   m_mcu_shared_ram[0x10 / 2] = machine().rand() & 0xffff;
370   m_mcu_shared_ram[0x12 / 2] = machine().rand() & 0xffff;
371   m_mcu_shared_ram[0x14 / 2] = machine().rand() & 0xffff;
372   m_mcu_shared_ram[0x16 / 2] = machine().rand() & 0xffff;
373373}
374374
375375
r18138r18139
646646   MCFG_PALETTE_LENGTH(0x400)
647647
648648
649   MCFG_TIMER_ADD_PERIODIC("coinsim", ddealer_mcu_sim, attotime::from_hz(10000)) // not real, but for simulating the MCU
649   MCFG_TIMER_DRIVER_ADD_PERIODIC("coinsim", ddealer_state, ddealer_mcu_sim, attotime::from_hz(10000))
650650
651651   MCFG_SPEAKER_STANDARD_MONO("mono")
652652   MCFG_SOUND_ADD("ymsnd", YM2203, 6000000 / 4)//guess
trunk/src/mame/drivers/aristmk4.c
r18138r18139
325325   TIMER_CALLBACK_MEMBER(note_input_reset);
326326   TIMER_CALLBACK_MEMBER(coin_input_reset);
327327   TIMER_CALLBACK_MEMBER(hopper_reset);
328   TIMER_DEVICE_CALLBACK_MEMBER(aristmk4_pf);
328329};
329330
330331/* Partial Cashcade protocol */
r18138r18139
16561657   }
16571658}
16581659
1659static TIMER_DEVICE_CALLBACK( aristmk4_pf )
1660TIMER_DEVICE_CALLBACK_MEMBER(aristmk4_state::aristmk4_pf)
16601661{
16611662   /*
16621663    IRQ generator pulses the NMI signal to CPU in the event of power down or power failure.
r18138r18139
16741675    Note: The use of 1 Hz in the timer is to avoid unintentional triggering the NMI ( ie.. hold down L for at least 1 second )
16751676    */
16761677
1677   if(timer.machine().root_device().ioport("powerfail")->read()) // send NMI signal if L pressed
1678   if(machine().root_device().ioport("powerfail")->read()) // send NMI signal if L pressed
16781679   {
1679   timer.machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE );
1680   machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE );
16801681   }
16811682}
16821683
r18138r18139
16871688   MCFG_CPU_VBLANK_INT_DRIVER("screen", aristmk4_state,  irq0_line_hold)
16881689
16891690   MCFG_NVRAM_ADD_0FILL("nvram")
1690   MCFG_TIMER_ADD_PERIODIC("power_fail", aristmk4_pf,attotime::from_hz(1)) // not real but required to simulate power failure to access robot test. How else can we do this ?
1691   MCFG_TIMER_DRIVER_ADD_PERIODIC("power_fail", aristmk4_state, aristmk4_pf, attotime::from_hz(1))
16911692
16921693   /* video hardware */
16931694   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/sothello.c
r18138r18139
6868   virtual void machine_reset();
6969   TIMER_CALLBACK_MEMBER(subcpu_suspend);
7070   TIMER_CALLBACK_MEMBER(subcpu_resume);
71   TIMER_DEVICE_CALLBACK_MEMBER(sothello_interrupt);
7172};
7273
7374
r18138r18139
324325    device.machine().device("maincpu")->execute().set_input_line(0, (i ? HOLD_LINE : CLEAR_LINE));
325326}
326327
327static TIMER_DEVICE_CALLBACK( sothello_interrupt )
328TIMER_DEVICE_CALLBACK_MEMBER(sothello_state::sothello_interrupt)
328329{
329   sothello_state *state = timer.machine().driver_data<sothello_state>();
330    state->m_v9938->interrupt();
330    m_v9938->interrupt();
331331}
332332
333333static void adpcm_int(device_t *device)
r18138r18139
369369    MCFG_CPU_ADD("maincpu",Z80, MAINCPU_CLOCK)
370370    MCFG_CPU_PROGRAM_MAP(maincpu_mem_map)
371371    MCFG_CPU_IO_MAP(maincpu_io_map)
372   MCFG_TIMER_ADD_SCANLINE("scantimer", sothello_interrupt, "screen", 0, 1)
372   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", sothello_state, sothello_interrupt, "screen", 0, 1)
373373
374374    MCFG_CPU_ADD("soundcpu",Z80, SOUNDCPU_CLOCK)
375375    MCFG_CPU_PROGRAM_MAP(soundcpu_mem_map)
trunk/src/mame/drivers/olibochu.c
r18138r18139
8787   virtual void video_start();
8888   virtual void palette_init();
8989   UINT32 screen_update_olibochu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
90   TIMER_DEVICE_CALLBACK_MEMBER(olibochu_scanline);
9091};
9192
9293
r18138r18139
432433   m_cmd = 0;
433434}
434435
435static TIMER_DEVICE_CALLBACK( olibochu_scanline )
436TIMER_DEVICE_CALLBACK_MEMBER(olibochu_state::olibochu_scanline)
436437{
437438   int scanline = param;
438439
439440   if(scanline == 248) // vblank-out irq
440      timer.machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xd7);   /* RST 10h - vblank */
441      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xd7);   /* RST 10h - vblank */
441442
442443   if(scanline == 0) // sprite buffer irq
443      timer.machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xcf);   /* RST 08h */
444      machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xcf);   /* RST 08h */
444445}
445446
446447static MACHINE_CONFIG_START( olibochu, olibochu_state )
r18138r18139
448449   /* basic machine hardware */
449450   MCFG_CPU_ADD("maincpu", Z80, 4000000)   /* 4 MHz ?? */
450451   MCFG_CPU_PROGRAM_MAP(olibochu_map)
451   MCFG_TIMER_ADD_SCANLINE("scantimer", olibochu_scanline, "screen", 0, 1)
452   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", olibochu_state, olibochu_scanline, "screen", 0, 1)
452453
453454   MCFG_CPU_ADD("audiocpu", Z80, 4000000)   /* 4 MHz ?? */
454455   MCFG_CPU_PROGRAM_MAP(olibochu_sound_map)
trunk/src/mame/drivers/tmaster.c
r18138r18139
184184   DECLARE_MACHINE_RESET(galgames);
185185   DECLARE_VIDEO_START(galgames);
186186   UINT32 screen_update_tmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
187   TIMER_DEVICE_CALLBACK_MEMBER(tm3k_interrupt);
187188};
188189
189190
r18138r18139
902903   m_duart68681 = machine().device( "duart68681" );
903904}
904905
905static TIMER_DEVICE_CALLBACK( tm3k_interrupt )
906TIMER_DEVICE_CALLBACK_MEMBER(tmaster_state::tm3k_interrupt)
906907{
907   tmaster_state *state = timer.machine().driver_data<tmaster_state>();
908908   int scanline = param;
909909
910910   if(scanline == 0) // vblank, FIXME
911      state->m_maincpu->set_input_line(3, HOLD_LINE);
911      m_maincpu->set_input_line(3, HOLD_LINE);
912912   else if((scanline % 16) == 0)
913      state->m_maincpu->set_input_line(1, HOLD_LINE);
913      m_maincpu->set_input_line(1, HOLD_LINE);
914914
915915   // lev 2 triggered at the end of the blit
916916}
r18138r18139
927927static MACHINE_CONFIG_START( tm3k, tmaster_state )
928928   MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz / 2) /* 12MHz */
929929   MCFG_CPU_PROGRAM_MAP(tmaster_map)
930   MCFG_TIMER_ADD_SCANLINE("scantimer", tm3k_interrupt, "screen", 0, 1)
930   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tmaster_state, tm3k_interrupt, "screen", 0, 1)
931931
932932   MCFG_MACHINE_RESET_OVERRIDE(tmaster_state,tmaster)
933933
r18138r18139
981981static MACHINE_CONFIG_START( galgames, tmaster_state )
982982   MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz / 2)
983983   MCFG_CPU_PROGRAM_MAP(galgames_map)
984   MCFG_TIMER_ADD_SCANLINE("scantimer", tm3k_interrupt, "screen", 0, 1)
984   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tmaster_state, tm3k_interrupt, "screen", 0, 1)
985985
986986   // 5 EEPROMs on the motherboard (for BIOS + 4 Carts)
987987   MCFG_EEPROM_ADD(GALGAMES_EEPROM_BIOS,  galgames_eeprom_interface)
trunk/src/mame/drivers/acommand.c
r18138r18139
9393   TILE_GET_INFO_MEMBER(ac_get_tx_tile_info);
9494   virtual void video_start();
9595   UINT32 screen_update_acommand(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
96   TIMER_DEVICE_CALLBACK_MEMBER(acommand_scanline);
9697};
9798
9899
r18138r18139
585586   GFXDECODE_ENTRY( "gfx3", 0, tilelayout, 0x1800, 256 )
586587GFXDECODE_END
587588
588static TIMER_DEVICE_CALLBACK( acommand_scanline )
589TIMER_DEVICE_CALLBACK_MEMBER(acommand_state::acommand_scanline)
589590{
590591   int scanline = param;
591592
592593   if(scanline == 240) // vblank-out irq
593      timer.machine().device("maincpu")->execute().set_input_line(2, HOLD_LINE);
594      machine().device("maincpu")->execute().set_input_line(2, HOLD_LINE);
594595
595596   if(scanline == 0) // vblank-in irq? (update palette and layers)
596      timer.machine().device("maincpu")->execute().set_input_line(3, HOLD_LINE);
597      machine().device("maincpu")->execute().set_input_line(3, HOLD_LINE);
597598}
598599
599600static MACHINE_CONFIG_START( acommand, acommand_state )
r18138r18139
601602   /* basic machine hardware */
602603   MCFG_CPU_ADD("maincpu",M68000,12000000)
603604   MCFG_CPU_PROGRAM_MAP(acommand_map)
604   MCFG_TIMER_ADD_SCANLINE("scantimer", acommand_scanline, "screen", 0, 1)
605   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", acommand_state, acommand_scanline, "screen", 0, 1)
605606
606607   /* video hardware */
607608   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mess/drivers/vg5k.c
r18138r18139
8989   DECLARE_WRITE8_MEMBER ( cassette_w );
9090   DECLARE_DRIVER_INIT(vg5k);
9191   TIMER_CALLBACK_MEMBER(z80_irq_clear);
92   TIMER_DEVICE_CALLBACK_MEMBER(z80_irq);
93   TIMER_DEVICE_CALLBACK_MEMBER(vg5k_scanline);
9294};
9395
9496
r18138r18139
281283}
282284
283285
284static TIMER_DEVICE_CALLBACK( z80_irq )
286TIMER_DEVICE_CALLBACK_MEMBER(vg5k_state::z80_irq)
285287{
286   vg5k_state *state = timer.machine().driver_data<vg5k_state>();
287   timer.machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
288   machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
288289
289   timer.machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(vg5k_state::z80_irq_clear),state));
290   machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(vg5k_state::z80_irq_clear),this));
290291}
291292
292static TIMER_DEVICE_CALLBACK( vg5k_scanline )
293TIMER_DEVICE_CALLBACK_MEMBER(vg5k_state::vg5k_scanline)
293294{
294   vg5k_state *vg5k = timer.machine().driver_data<vg5k_state>();
295
296   vg5k->m_ef9345->update_scanline((UINT16)param);
295   m_ef9345->update_scanline((UINT16)param);
297296}
298297
299298
r18138r18139
377376   MCFG_CPU_PROGRAM_MAP(vg5k_mem)
378377   MCFG_CPU_IO_MAP(vg5k_io)
379378
380   MCFG_TIMER_ADD_SCANLINE("vg5k_scanline", vg5k_scanline, "screen", 0, 10)
379   MCFG_TIMER_DRIVER_ADD_SCANLINE("vg5k_scanline", vg5k_state, vg5k_scanline, "screen", 0, 10)
381380
382   MCFG_TIMER_ADD_PERIODIC("irq_timer", z80_irq, attotime::from_msec(20))
381   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", vg5k_state, z80_irq, attotime::from_msec(20))
383382
384383   MCFG_EF9345_ADD("ef9345", vg5k_ef9345_config)
385384
trunk/src/mess/drivers/h8.c
r18138r18139
4444   UINT8 m_irq_ctl;
4545   UINT8 m_ff_b;
4646   virtual void machine_reset();
47   TIMER_DEVICE_CALLBACK_MEMBER(h8_irq_pulse);
4748};
4849
4950
r18138r18139
5253#define H8_IRQ_PULSE (H8_BEEP_FRQ / 2)
5354
5455
55static TIMER_DEVICE_CALLBACK( h8_irq_pulse )
56TIMER_DEVICE_CALLBACK_MEMBER(h8_state::h8_irq_pulse)
5657{
57   h8_state *state = timer.machine().driver_data<h8_state>();
58   if (state->m_irq_ctl & 1)
59      timer.machine().device("maincpu")->execute().set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xcf);
58   if (m_irq_ctl & 1)
59      machine().device("maincpu")->execute().set_input_line_and_vector(INPUT_LINE_IRQ0, ASSERT_LINE, 0xcf);
6060}
6161
6262READ8_MEMBER( h8_state::h8_f0_r )
r18138r18139
225225   MCFG_CPU_IO_MAP(h8_io)
226226   MCFG_CPU_CONFIG(h8_cpu_config)
227227
228   MCFG_TIMER_ADD_PERIODIC("h8_timer", h8_irq_pulse, attotime::from_hz(H8_IRQ_PULSE) )
228   MCFG_TIMER_DRIVER_ADD_PERIODIC("h8_timer", h8_state, h8_irq_pulse, attotime::from_hz(H8_IRQ_PULSE))
229229
230230   /* video hardware */
231231   MCFG_DEFAULT_LAYOUT(layout_h8)
trunk/src/mess/drivers/prestige.c
r18138r18139
111111   DECLARE_READ8_MEMBER( mouse_r );
112112   DECLARE_WRITE8_MEMBER( mouse_w );
113113   virtual void palette_init();
114   TIMER_DEVICE_CALLBACK_MEMBER(irq_timer);
114115};
115116
116117
r18138r18139
469470    return 0;
470471}
471472
472static TIMER_DEVICE_CALLBACK( irq_timer )
473TIMER_DEVICE_CALLBACK_MEMBER(prestige_state::irq_timer)
473474{
474   timer.machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
475   machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
475476}
476477
477478static MACHINE_CONFIG_START( prestige, prestige_state )
r18138r18139
480481    MCFG_CPU_PROGRAM_MAP(prestige_mem)
481482    MCFG_CPU_IO_MAP(prestige_io)
482483
483   MCFG_TIMER_ADD_PERIODIC("irq_timer", irq_timer, attotime::from_msec(10))
484   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", prestige_state, irq_timer, attotime::from_msec(10))
484485
485486    /* video hardware */
486487    MCFG_SCREEN_ADD("screen", LCD)
trunk/src/mess/drivers/pc8801.c
r18138r18139
453453   DECLARE_MACHINE_RESET(pc8801_cdrom);
454454   INTERRUPT_GEN_MEMBER(pc8801_vrtc_irq);
455455   TIMER_CALLBACK_MEMBER(pc8801fd_upd765_tc_to_zero);
456   TIMER_DEVICE_CALLBACK_MEMBER(pc8801_rtc_irq);
456457};
457458
458459
r18138r18139
23382339      pc8801_raise_irq(device->machine(),1<<(4),1);
23392340}
23402341
2341static TIMER_DEVICE_CALLBACK( pc8801_rtc_irq )
2342/*
2343TIMER_DEVICE_CALLBACK_MEMBER(pc8801_state::pc8801_rtc_irq)
23422344{
2343   pc8801_state *state = timer.machine().driver_data<pc8801_state>();
2344   if(state->m_timer_irq_mask)
2345      pc8801_raise_irq(timer.machine(),1<<(2),1);
2345   if(m_timer_irq_mask)
2346      pc8801_raise_irq(machine(),1<<(2),1);
23462347}
2348*/
23472349
23482350INTERRUPT_GEN_MEMBER(pc8801_state::pc8801_vrtc_irq)
23492351{
r18138r18139
24002402   }
24012403}
24022404
2403static TIMER_DEVICE_CALLBACK( pc8801_rtc_irq )
2405TIMER_DEVICE_CALLBACK_MEMBER(pc8801_state::pc8801_rtc_irq)
24042406{
2405   pc8801_state *state = timer.machine().driver_data<pc8801_state>();
2406   if(state->m_timer_irq_mask && state->m_i8214_irq_level >= 3)
2407   if(m_timer_irq_mask && m_i8214_irq_level >= 3)
24072408   {
2408      state->m_timer_irq_latch = 1;
2409      m_timer_irq_latch = 1;
24092410      //IRQ_LOG(("timer\n"));
2410      timer.machine().device("maincpu")->execute().set_input_line(0,HOLD_LINE);
2411      machine().device("maincpu")->execute().set_input_line(0,HOLD_LINE);
24112412   }
24122413}
24132414
r18138r18139
27132714   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
27142715   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
27152716
2716   MCFG_TIMER_ADD_PERIODIC("rtc_timer", pc8801_rtc_irq, attotime::from_hz(600))
2717   MCFG_TIMER_DRIVER_ADD_PERIODIC("rtc_timer", pc8801_state, pc8801_rtc_irq, attotime::from_hz(600))
27172718MACHINE_CONFIG_END
27182719
27192720static MACHINE_CONFIG_DERIVED( pc8801fh, pc8801 )
trunk/src/mess/drivers/csc.c
r18138r18139
4646   DECLARE_READ_LINE_MEMBER( pia1_cb1_r );
4747
4848   UINT8 m_selector;
49   TIMER_DEVICE_CALLBACK_MEMBER(irq_timer);
4950};
5051
5152
r18138r18139
173174}
174175
175176
176static TIMER_DEVICE_CALLBACK( irq_timer )
177TIMER_DEVICE_CALLBACK_MEMBER(csc_state::irq_timer)
177178{
178   timer.machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
179   timer.machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
179   machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
180   machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
180181}
181182
182183/* Address maps */
r18138r18139
315316
316317   MCFG_DEFAULT_LAYOUT(layout_vsc)
317318
318   MCFG_TIMER_ADD_PERIODIC("irq_timer", irq_timer, attotime::from_hz(38400/64))
319   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", csc_state, irq_timer, attotime::from_hz(38400/64))
319320
320321   MCFG_PIA6821_ADD("pia0", pia0_config)
321322   MCFG_PIA6821_ADD("pia1", pia1_config)
trunk/src/mess/drivers/rex6000.c
r18138r18139
116116   UINT8 identify_bank_type(UINT32 bank);
117117   virtual void palette_init();
118118   DECLARE_INPUT_CHANGED_MEMBER(trigger_irq);
119   TIMER_DEVICE_CALLBACK_MEMBER(irq_timer1);
120   TIMER_DEVICE_CALLBACK_MEMBER(irq_timer2);
121   TIMER_DEVICE_CALLBACK_MEMBER(sec_timer);
119122};
120123
121124
r18138r18139
512515   return 0;
513516}
514517
515static TIMER_DEVICE_CALLBACK( irq_timer1 )
518TIMER_DEVICE_CALLBACK_MEMBER(rex6000_state::irq_timer1)
516519{
517   rex6000_state *state = timer.machine().driver_data<rex6000_state>();
518520
519   if (!(state->m_irq_mask & IRQ_FLAG_IRQ2))
521   if (!(m_irq_mask & IRQ_FLAG_IRQ2))
520522   {
521      state->m_irq_flag |= IRQ_FLAG_IRQ2;
523      m_irq_flag |= IRQ_FLAG_IRQ2;
522524
523      state->m_maincpu->set_input_line(0, HOLD_LINE);
525      m_maincpu->set_input_line(0, HOLD_LINE);
524526   }
525527
526528}
527529
528static TIMER_DEVICE_CALLBACK( irq_timer2 )
530TIMER_DEVICE_CALLBACK_MEMBER(rex6000_state::irq_timer2)
529531{
530   rex6000_state *state = timer.machine().driver_data<rex6000_state>();
531532
532   if (!(state->m_irq_mask & IRQ_FLAG_IRQ1))
533   if (!(m_irq_mask & IRQ_FLAG_IRQ1))
533534   {
534      state->m_irq_flag |= IRQ_FLAG_IRQ1;
535      m_irq_flag |= IRQ_FLAG_IRQ1;
535536
536      state->m_maincpu->set_input_line(0, HOLD_LINE);
537      m_maincpu->set_input_line(0, HOLD_LINE);
537538   }
538539}
539540
540static TIMER_DEVICE_CALLBACK( sec_timer )
541TIMER_DEVICE_CALLBACK_MEMBER(rex6000_state::sec_timer)
541542{
542   rex6000_state *state = timer.machine().driver_data<rex6000_state>();
543543
544   if (!(state->m_irq_mask & IRQ_FLAG_1HZ))
544   if (!(m_irq_mask & IRQ_FLAG_1HZ))
545545   {
546      state->m_irq_flag |= IRQ_FLAG_1HZ;
546      m_irq_flag |= IRQ_FLAG_1HZ;
547547
548      state->m_maincpu->set_input_line(0, HOLD_LINE);
548      m_maincpu->set_input_line(0, HOLD_LINE);
549549   }
550550}
551551
r18138r18139
650650    MCFG_CPU_PROGRAM_MAP(rex6000_mem)
651651    MCFG_CPU_IO_MAP(rex6000_io)
652652
653   MCFG_TIMER_ADD_PERIODIC("sec_timer", sec_timer, attotime::from_hz(1))
654   MCFG_TIMER_ADD_PERIODIC("irq_timer1", irq_timer1, attotime::from_hz(32))
655   MCFG_TIMER_ADD_PERIODIC("irq_timer2", irq_timer2, attotime::from_hz(4096))
653   MCFG_TIMER_DRIVER_ADD_PERIODIC("sec_timer", rex6000_state, sec_timer, attotime::from_hz(1))
654   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer1", rex6000_state, irq_timer1, attotime::from_hz(32))
655   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer2", rex6000_state, irq_timer2, attotime::from_hz(4096))
656656
657657    /* video hardware */
658658    MCFG_SCREEN_ADD("screen", LCD)
trunk/src/mess/drivers/mmodular.c
r18138r18139
195195   DECLARE_MACHINE_START(risc);
196196   DECLARE_MACHINE_RESET(academy);
197197   DECLARE_PALETTE_INIT(chess_lcd);
198   TIMER_DEVICE_CALLBACK_MEMBER(cause_nmi);
199   TIMER_DEVICE_CALLBACK_MEMBER(cause_M6502_irq);
200   TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq6);
201   TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq2);
202   TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq_academy);
198203};
199204
200205static HD44780_INTERFACE( chess_display )
r18138r18139
811816   return data;
812817}
813818
814static TIMER_DEVICE_CALLBACK( cause_nmi )
819TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::cause_nmi)
815820{
816   timer.machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE);
821   machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE);
817822}
818823
819static TIMER_DEVICE_CALLBACK( cause_M6502_irq )
824TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::cause_M6502_irq)
820825{
821   timer.machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
822   timer.machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
826   machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
827   machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
823828
824829}
825830
r18138r18139
981986   logerror("Write to  RISC2500 1000000\n");
982987}
983988
984static TIMER_DEVICE_CALLBACK( timer_update_irq6 )
989TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::timer_update_irq6)
985990{
986   timer.machine().device("maincpu")->execute().set_input_line(6, HOLD_LINE);
991   machine().device("maincpu")->execute().set_input_line(6, HOLD_LINE);
987992}
988993
989static TIMER_DEVICE_CALLBACK( timer_update_irq2 )
994TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::timer_update_irq2)
990995{
991   timer.machine().device("maincpu")->execute().set_input_line(2, HOLD_LINE);
996   machine().device("maincpu")->execute().set_input_line(2, HOLD_LINE);
992997}
993998
994999
995static TIMER_DEVICE_CALLBACK( timer_update_irq_academy )
1000TIMER_DEVICE_CALLBACK_MEMBER(polgar_state::timer_update_irq_academy)
9961001{
9971002   if (academyallowNMI) {
998      timer.machine().device("maincpu")->execute().set_input_line(6, HOLD_LINE);
1003      machine().device("maincpu")->execute().set_input_line(6, HOLD_LINE);
9991004   }
10001005}
10011006
r18138r18139
15601565   MCFG_MACHINE_RESET_OVERRIDE(polgar_state, polgar )
15611566   MCFG_FRAGMENT_ADD( chess_common )
15621567
1563   MCFG_TIMER_ADD_PERIODIC("irq_timer", cause_nmi, attotime::from_hz(600))
1568   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_nmi, attotime::from_hz(600))
15641569   MCFG_TIMER_START_DELAY(attotime::from_hz(60))
15651570   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
15661571
r18138r18139
15771582   /* acia */
15781583//  MCFG_ACIA6551_ADD("acia65c51")
15791584
1580   MCFG_TIMER_ADD_PERIODIC("irq_timer", cause_M6502_irq, attotime::from_hz(600))
1585   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_M6502_irq, attotime::from_hz(600))
15811586   MCFG_TIMER_START_DELAY(attotime::from_hz(60))
15821587   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
15831588MACHINE_CONFIG_END
r18138r18139
15871592   MCFG_CPU_PROGRAM_MAP(alm32_mem)
15881593   MCFG_MACHINE_START_OVERRIDE(polgar_state,van32)
15891594   MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
1590   MCFG_TIMER_ADD_PERIODIC("int_timer", timer_update_irq6, attotime::from_hz(750))
1595   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750))
15911596   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
15921597
15931598   MCFG_FRAGMENT_ADD( chess_common )
r18138r18139
16001605   MCFG_CPU_PROGRAM_MAP(academy_mem)
16011606   MCFG_MACHINE_RESET_OVERRIDE(polgar_state, academy )
16021607   //MCFG_DEVICE_REMOVE("int_timer")
1603   MCFG_TIMER_ADD_PERIODIC("int_timer", timer_update_irq_academy, attotime::from_hz(600))
1608   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq_academy, attotime::from_hz(600))
16041609
16051610MACHINE_CONFIG_END
16061611
r18138r18139
16201625   MCFG_SOUND_ADD("beep", BEEP, 0)
16211626   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
16221627
1623   MCFG_TIMER_ADD_PERIODIC("irq_timer", cause_nmi, attotime::from_hz(600))
1628   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_nmi, attotime::from_hz(600))
16241629   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
16251630
16261631MACHINE_CONFIG_END
r18138r18139
16401645   /* acia */
16411646//  MCFG_ACIA6551_ADD("acia65c51")
16421647
1643   MCFG_TIMER_ADD_PERIODIC("int_timer", timer_update_irq2, attotime::from_hz(60))
1648   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq2, attotime::from_hz(60))
16441649   MCFG_TIMER_START_DELAY(attotime::from_hz(30))
16451650   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
16461651
r18138r18139
16521657   MCFG_CPU_PROGRAM_MAP(van16_mem)
16531658   MCFG_MACHINE_START_OVERRIDE(polgar_state,van16)
16541659   MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
1655   MCFG_TIMER_ADD_PERIODIC("int_timer", timer_update_irq6, attotime::from_hz(600))  // chess clock right, diags wrong
1656//  MCFG_TIMER_ADD_PERIODIC("int_timer", timer_update_irq6, attotime::from_hz(587))  // vv
1660   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(600))
1661   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(587))
16571662   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
16581663   MCFG_FRAGMENT_ADD( chess_common )
16591664   MCFG_NVRAM_ADD_0FILL("nvram")
r18138r18139
16701675   MCFG_CPU_PROGRAM_MAP(van32_mem)
16711676   MCFG_MACHINE_START_OVERRIDE(polgar_state,van32)
16721677   MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
1673   MCFG_TIMER_ADD_PERIODIC("int_timer", timer_update_irq6, attotime::from_hz(750))
1678   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750))
16741679   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
16751680
16761681   MCFG_FRAGMENT_ADD( chess_common )
r18138r18139
16951700   MCFG_CPU_PROGRAM_MAP(gen32_mem)
16961701   MCFG_MACHINE_START_OVERRIDE(polgar_state,van32)
16971702   MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
1698   MCFG_TIMER_ADD_PERIODIC("int_timer", timer_update_irq6, attotime::from_hz(375))
1699//  MCFG_TIMER_ADD_PERIODIC("int_timer", timer_update_irq6, attotime::from_hz(368.64))
1703   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(375))
1704   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(368.64))
17001705   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
17011706
17021707   MCFG_FRAGMENT_ADD( chess_common )
r18138r18139
17091714   MCFG_CPU_MODIFY("maincpu")
17101715   MCFG_CPU_CLOCK( XTAL_33_333MHz * 2 )
17111716   MCFG_DEVICE_REMOVE("int_timer")
1712   MCFG_TIMER_ADD_PERIODIC("int_timer", timer_update_irq6, attotime::from_hz(500))
1717   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(500))
17131718
17141719
17151720MACHINE_CONFIG_END
r18138r18139
17191724   MCFG_CPU_PROGRAM_MAP(bpl32_mem)
17201725   MCFG_MACHINE_START_OVERRIDE(polgar_state,van32)
17211726   MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
1722   MCFG_TIMER_ADD_PERIODIC("int_timer", timer_update_irq6, attotime::from_hz(750))
1727   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750))
17231728   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
17241729
17251730   MCFG_FRAGMENT_ADD( chess_common )
trunk/src/mess/drivers/nanos.c
r18138r18139
5757   virtual void machine_start();
5858   virtual void video_start();
5959   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
60   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
6061};
6162
6263
r18138r18139
348349   return 0;
349350}
350351
351static TIMER_DEVICE_CALLBACK(keyboard_callback)
352TIMER_DEVICE_CALLBACK_MEMBER(nanos_state::keyboard_callback)
352353{
353   nanos_state *state = timer.machine().driver_data<nanos_state>();
354354   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6" };
355355
356356   int i;
357357   UINT8 code;
358358   UINT8 key_code = 0;
359   UINT8 shift = timer.machine().root_device().ioport("LINEC")->read() & 0x02 ? 1 : 0;
360   UINT8 ctrl =  timer.machine().root_device().ioport("LINEC")->read() & 0x01 ? 1 : 0;
361   state->m_key_pressed = 0xff;
359   UINT8 shift = machine().root_device().ioport("LINEC")->read() & 0x02 ? 1 : 0;
360   UINT8 ctrl =  machine().root_device().ioport("LINEC")->read() & 0x01 ? 1 : 0;
361   m_key_pressed = 0xff;
362362   for(i = 0; i < 7; i++)
363363   {
364364
365      code =   timer.machine().root_device().ioport(keynames[i])->read();
365      code =   machine().root_device().ioport(keynames[i])->read();
366366      if (code != 0)
367367      {
368368         if (i==0 && shift==0) {
r18138r18139
424424               case 7: key_code = 0x0A; break; // LF
425425            }
426426         }
427         state->m_last_code = key_code;
427         m_last_code = key_code;
428428      }
429429   }
430430   if (key_code==0){
431      state->m_key_pressed = 0xf7;
431      m_key_pressed = 0xf7;
432432   }
433433}
434434
r18138r18139
548548   MCFG_RAM_ADD(RAM_TAG)
549549   MCFG_RAM_DEFAULT_SIZE("64K")
550550
551   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", keyboard_callback, attotime::from_hz(24000))
551   MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", nanos_state, keyboard_callback, attotime::from_hz(24000))
552552MACHINE_CONFIG_END
553553
554554/* ROM definition */
trunk/src/mess/drivers/z9001.c
r18138r18139
6565   //virtual void machine_start();
6666   virtual void video_start();
6767   UINT32 screen_update_z9001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
68   TIMER_DEVICE_CALLBACK_MEMBER(timer_callback);
6869};
6970
7071static ADDRESS_MAP_START(z9001_mem, AS_PROGRAM, 8, z9001_state)
r18138r18139
142143
143144
144145// temporary (prevent freezing when you type an invalid filename)
145static TIMER_DEVICE_CALLBACK( timer_callback )
146TIMER_DEVICE_CALLBACK_MEMBER(z9001_state::timer_callback)
146147{
147   z9001_state *state = timer.machine().driver_data<z9001_state>();
148   state->m_maincpu->space(AS_PROGRAM).write_byte(0x006a, 0);
148   m_maincpu->space(AS_PROGRAM).write_byte(0x006a, 0);
149149}
150150
151151void z9001_state::machine_reset()
r18138r18139
257257
258258   /* Devices */
259259   MCFG_ASCII_KEYBOARD_ADD(KEYBOARD_TAG, keyboard_intf)
260   MCFG_TIMER_ADD_PERIODIC("z9001_timer", timer_callback, attotime::from_msec(10))
260   MCFG_TIMER_DRIVER_ADD_PERIODIC("z9001_timer", z9001_state, timer_callback, attotime::from_msec(10))
261261   MCFG_Z80PIO_ADD( "z80pio1", XTAL_9_8304MHz / 4, pio1_intf )
262262   MCFG_Z80PIO_ADD( "z80pio2", XTAL_9_8304MHz / 4, pio2_intf )
263263   MCFG_Z80CTC_ADD( "z80ctc", XTAL_9_8304MHz / 4, ctc_intf )
trunk/src/mess/drivers/jr100.c
r18138r18139
4343   virtual void machine_reset();
4444   virtual void video_start();
4545   UINT32 screen_update_jr100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
46   TIMER_DEVICE_CALLBACK_MEMBER(sound_tick);
4647};
4748
4849
r18138r18139
279280   NULL
280281};
281282
282static TIMER_DEVICE_CALLBACK( sound_tick )
283TIMER_DEVICE_CALLBACK_MEMBER(jr100_state::sound_tick)
283284{
284   jr100_state *state = timer.machine().driver_data<jr100_state>();
285   device_t *speaker = timer.machine().device(SPEAKER_TAG);
286   speaker_level_w(speaker,state->m_speaker);
287   state->m_speaker = 0;
285   device_t *speaker = machine().device(SPEAKER_TAG);
286   speaker_level_w(speaker,m_speaker);
287   m_speaker = 0;
288288
289   via6522_device *via = timer.machine().device<via6522_device>("via");
290   double level = (timer.machine().device<cassette_image_device>(CASSETTE_TAG)->input());
289   via6522_device *via = machine().device<via6522_device>("via");
290   double level = (machine().device<cassette_image_device>(CASSETTE_TAG)->input());
291291   if (level > 0.0) {
292292      via->write_ca1(0);
293293      via->write_cb1(0);
r18138r18139
385385
386386   MCFG_CASSETTE_ADD( CASSETTE_TAG, jr100_cassette_interface )
387387
388   MCFG_TIMER_ADD_PERIODIC("sound_tick", sound_tick, attotime::from_hz(XTAL_14_31818MHz / 16))
388   MCFG_TIMER_DRIVER_ADD_PERIODIC("sound_tick", jr100_state, sound_tick, attotime::from_hz(XTAL_14_31818MHz / 16))
389389
390390   /* quickload */
391391   MCFG_QUICKLOAD_ADD("quickload", jr100, "prg", 2)
trunk/src/mess/drivers/mephisto.c
r18138r18139
9393   virtual void machine_start();
9494   virtual void machine_reset();
9595   DECLARE_MACHINE_START(mm2);
96   TIMER_DEVICE_CALLBACK_MEMBER(update_nmi);
97   TIMER_DEVICE_CALLBACK_MEMBER(update_nmi_r5);
98   TIMER_DEVICE_CALLBACK_MEMBER(update_irq);
9699};
97100
98101
r18138r18139
330333INPUT_PORTS_END
331334
332335
333static TIMER_DEVICE_CALLBACK( update_nmi )
336TIMER_DEVICE_CALLBACK_MEMBER(mephisto_state::update_nmi)
334337{
335   mephisto_state *state = timer.machine().driver_data<mephisto_state>();
336   if (state->m_allowNMI)
338   if (m_allowNMI)
337339   {
338      state->m_allowNMI = 0;
339      timer.machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE);
340      m_allowNMI = 0;
341      machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE);
340342   }
341   beep_set_state(state->m_beep, state->m_led_status&64?1:0);
343   beep_set_state(m_beep, m_led_status&64?1:0);
342344}
343345
344static TIMER_DEVICE_CALLBACK( update_nmi_r5 )
346TIMER_DEVICE_CALLBACK_MEMBER(mephisto_state::update_nmi_r5)
345347{
346   mephisto_state *state = timer.machine().driver_data<mephisto_state>();
347   timer.machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE);
348   beep_set_state(state->m_beep, state->m_led_status&64?1:0);
348   machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE);
349   beep_set_state(m_beep, m_led_status&64?1:0);
349350}
350351
351static TIMER_DEVICE_CALLBACK( update_irq )      //only mm2
352TIMER_DEVICE_CALLBACK_MEMBER(mephisto_state::update_irq)//only mm2
352353{
353   mephisto_state *state = timer.machine().driver_data<mephisto_state>();
354   timer.machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
355   timer.machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
354   machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
355   machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
356356
357   beep_set_state(state->m_beep, state->m_led_status&64?1:0);
357   beep_set_state(m_beep, m_led_status&64?1:0);
358358}
359359
360360void mephisto_state::machine_start()
r18138r18139
410410   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
411411   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
412412
413   MCFG_TIMER_ADD_PERIODIC("nmi_timer", update_nmi, attotime::from_hz(600))
413   MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", mephisto_state, update_nmi, attotime::from_hz(600))
414414   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
415415MACHINE_CONFIG_END
416416
r18138r18139
419419   MCFG_CPU_MODIFY("maincpu")
420420   MCFG_CPU_PROGRAM_MAP(rebel5_mem)
421421   MCFG_DEVICE_REMOVE("nmi_timer")
422   MCFG_TIMER_ADD_PERIODIC("nmi_timer_r5", update_nmi_r5, attotime::from_hz(600))
422   MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer_r5", mephisto_state, update_nmi_r5, attotime::from_hz(600))
423423
424424MACHINE_CONFIG_END
425425
r18138r18139
429429   MCFG_MACHINE_START_OVERRIDE(mephisto_state, mm2 )
430430
431431   MCFG_DEVICE_REMOVE("nmi_timer")
432   MCFG_TIMER_ADD_PERIODIC("irq_timer", update_irq, attotime::from_hz(450))
432   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", mephisto_state, update_irq, attotime::from_hz(450))
433433MACHINE_CONFIG_END
434434
435435static MACHINE_CONFIG_DERIVED( mm4tk, mephisto )
trunk/src/mess/drivers/supercon.c
r18138r18139
7373   virtual void machine_start();
7474   TIMER_CALLBACK_MEMBER(mouse_click);
7575   TIMER_CALLBACK_MEMBER(update_irq);
76   TIMER_DEVICE_CALLBACK_MEMBER(update_artwork);
7677};
7778
7879
r18138r18139
514515      m_selecting=FALSE;
515516}
516517
517static TIMER_DEVICE_CALLBACK( update_artwork )
518TIMER_DEVICE_CALLBACK_MEMBER(supercon_state::update_artwork)
518519{
519   mouse_update(timer.machine());
520   mouse_update(machine());
520521}
521522
522523TIMER_CALLBACK_MEMBER(supercon_state::update_irq)
r18138r18139
742743   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
743744   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
744745
745   MCFG_TIMER_ADD_PERIODIC("artwork_timer", update_artwork, attotime::from_hz(20))
746   MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", supercon_state, update_artwork, attotime::from_hz(20))
746747MACHINE_CONFIG_END
747748
748749/* ROM definition */
trunk/src/mess/drivers/mstation.c
r18138r18139
8888   virtual void machine_reset();
8989   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9090   virtual void palette_init();
91   TIMER_DEVICE_CALLBACK_MEMBER(mstation_1hz_timer);
92   TIMER_DEVICE_CALLBACK_MEMBER(mstation_kb_timer);
9193};
9294
9395READ8_MEMBER( mstation_state::flash_0x0000_read_handler )
r18138r18139
469471   refresh_ints();
470472}
471473
472static TIMER_DEVICE_CALLBACK( mstation_1hz_timer )
474TIMER_DEVICE_CALLBACK_MEMBER(mstation_state::mstation_1hz_timer)
473475{
474   mstation_state *state = timer.machine().driver_data<mstation_state>();
475476
476   state->m_irq |= (1<<4);
477   m_irq |= (1<<4);
477478
478   state->refresh_ints();
479   refresh_ints();
479480}
480481
481static TIMER_DEVICE_CALLBACK( mstation_kb_timer )
482TIMER_DEVICE_CALLBACK_MEMBER(mstation_state::mstation_kb_timer)
482483{
483   mstation_state *state = timer.machine().driver_data<mstation_state>();
484484
485   state->m_irq |= (1<<1);
485   m_irq |= (1<<1);
486486
487   state->refresh_ints();
487   refresh_ints();
488488}
489489
490490void mstation_state::palette_init()
r18138r18139
519519   MCFG_AMD_29F080_ADD("flash1")   //SST-28SF040
520520
521521   // IRQ 4 is generated every second, used for auto power off
522   MCFG_TIMER_ADD_PERIODIC("1hz_timer", mstation_1hz_timer, attotime::from_hz(1))
522   MCFG_TIMER_DRIVER_ADD_PERIODIC("1hz_timer", mstation_state, mstation_1hz_timer, attotime::from_hz(1))
523523
524524   // IRQ 1 is used for scan the kb and for cursor blinking
525   MCFG_TIMER_ADD_PERIODIC("kb_timer", mstation_kb_timer, attotime::from_hz(50))
525   MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer", mstation_state, mstation_kb_timer, attotime::from_hz(50))
526526
527527   MCFG_RP5C01_ADD("rtc", XTAL_32_768kHz, rtc_intf)
528528
trunk/src/mess/drivers/kim1.c
r18138r18139
124124   virtual void machine_start();
125125   virtual void machine_reset();
126126   DECLARE_INPUT_CHANGED_MEMBER(kim1_reset);
127   TIMER_DEVICE_CALLBACK_MEMBER(kim1_cassette_input);
128   TIMER_DEVICE_CALLBACK_MEMBER(kim1_update_leds);
127129};
128130
129131
r18138r18139
265267};
266268
267269
268static TIMER_DEVICE_CALLBACK( kim1_cassette_input )
270TIMER_DEVICE_CALLBACK_MEMBER(kim1_state::kim1_cassette_input)
269271{
270   kim1_state *state = timer.machine().driver_data<kim1_state>();
271   double tap_val = state->m_cass->input();
272   double tap_val = m_cass->input();
272273
273274   if ( tap_val <= 0 )
274275   {
275      if ( state->m_cassette_high_count )
276      if ( m_cassette_high_count )
276277      {
277         state->m_311_output = ( state->m_cassette_high_count < 8 ) ? 0x80 : 0;
278         state->m_cassette_high_count = 0;
278         m_311_output = ( m_cassette_high_count < 8 ) ? 0x80 : 0;
279         m_cassette_high_count = 0;
279280      }
280281   }
281282
282283   if ( tap_val > 0 )
283      state->m_cassette_high_count++;
284      m_cassette_high_count++;
284285}
285286
286287
287static TIMER_DEVICE_CALLBACK( kim1_update_leds )
288TIMER_DEVICE_CALLBACK_MEMBER(kim1_state::kim1_update_leds)
288289{
289   kim1_state *state = timer.machine().driver_data<kim1_state>();
290290   UINT8 i;
291291
292292   for ( i = 0; i < 6; i++ )
293293   {
294      if ( state->m_led_time[i] )
295         state->m_led_time[i]--;
294      if ( m_led_time[i] )
295         m_led_time[i]--;
296296      else
297297         output_set_digit_value( i, 0 );
298298   }
r18138r18139
348348   MCFG_MOS6530_ADD( "miot_u2", 1000000, kim1_u2_mos6530_interface )
349349   MCFG_MOS6530_ADD( "miot_u3", 1000000, kim1_u3_mos6530_interface )
350350   MCFG_CASSETTE_ADD( CASSETTE_TAG, kim1_cassette_interface )
351   MCFG_TIMER_ADD_PERIODIC("led_timer", kim1_update_leds, attotime::from_hz(60))
352   MCFG_TIMER_ADD_PERIODIC("cassette_timer", kim1_cassette_input, attotime::from_hz(44100))
351   MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", kim1_state, kim1_update_leds, attotime::from_hz(60))
352   MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", kim1_state, kim1_cassette_input, attotime::from_hz(44100))
353353MACHINE_CONFIG_END
354354
355355
trunk/src/mess/drivers/px4.c
r18138r18139
170170   TIMER_CALLBACK_MEMBER(ext_cassette_read);
171171   TIMER_CALLBACK_MEMBER(transmit_data);
172172   TIMER_CALLBACK_MEMBER(receive_data);
173   TIMER_DEVICE_CALLBACK_MEMBER(frc_tick);
174   TIMER_DEVICE_CALLBACK_MEMBER(upd7508_1sec_callback);
173175};
174176
175177
r18138r18139
344346}
345347
346348/* free running counter */
347static TIMER_DEVICE_CALLBACK( frc_tick )
349TIMER_DEVICE_CALLBACK_MEMBER(px4_state::frc_tick)
348350{
349   px4_state *px4 = timer.machine().driver_data<px4_state>();
350351
351   px4->m_frc_value++;
352   m_frc_value++;
352353
353   if (px4->m_frc_value == 0)
354   if (m_frc_value == 0)
354355   {
355      px4->m_isr |= INT3_OVF;
356      gapnit_interrupt(timer.machine());
356      m_isr |= INT3_OVF;
357      gapnit_interrupt(machine());
357358   }
358359}
359360
r18138r18139
919920    7508 RELATED
920921***************************************************************************/
921922
922static TIMER_DEVICE_CALLBACK( upd7508_1sec_callback )
923TIMER_DEVICE_CALLBACK_MEMBER(px4_state::upd7508_1sec_callback)
923924{
924   px4_state *px4 = timer.machine().driver_data<px4_state>();
925925
926926   /* adjust interrupt status */
927   px4->m_interrupt_status |= UPD7508_INT_ONE_SECOND;
927   m_interrupt_status |= UPD7508_INT_ONE_SECOND;
928928
929929   /* are interrupts enabled? */
930   if (px4->m_one_sec_int_enabled)
930   if (m_one_sec_int_enabled)
931931   {
932      px4->m_isr |= INT0_7508;
933      gapnit_interrupt(timer.machine());
932      m_isr |= INT0_7508;
933      gapnit_interrupt(machine());
934934   }
935935}
936936
r18138r18139
13761376
13771377   MCFG_PALETTE_LENGTH(2)
13781378
1379   MCFG_TIMER_ADD_PERIODIC("one_sec", upd7508_1sec_callback, attotime::from_seconds(1))
1380   MCFG_TIMER_ADD_PERIODIC("frc", frc_tick, attotime::from_hz(XTAL_7_3728MHz / 2 / 6))
1379   MCFG_TIMER_DRIVER_ADD_PERIODIC("one_sec", px4_state, upd7508_1sec_callback, attotime::from_seconds(1))
1380   MCFG_TIMER_DRIVER_ADD_PERIODIC("frc", px4_state, frc_tick, attotime::from_hz(XTAL_7_3728MHz / 2 / 6))
13811381
13821382   /* internal ram */
13831383   MCFG_RAM_ADD(RAM_TAG)
trunk/src/mess/drivers/chesstrv.c
r18138r18139
3434   UINT8 m_ram_addr;
3535   UINT8 *m_ram;
3636   UINT8 m_matrix;
37   //TIMER_DEVICE_CALLBACK_MEMBER(borisdpl_timer_interrupt);
3738};
3839
3940WRITE8_MEMBER( chesstrv_state::ram_addr_w )
r18138r18139
194195INPUT_PORTS_END
195196
196197/*
197static TIMER_DEVICE_CALLBACK( borisdpl_timer_interrupt )
198TIMER_DEVICE_CALLBACK_MEMBER(chesstrv_state::borisdpl_timer_interrupt)
198199{
199    timer.machine().device("maincpu")->execute().set_input_line_and_vector(F8_INPUT_LINE_INT_REQ, HOLD_LINE, 0x20);
200    machine().device("maincpu")->execute().set_input_line_and_vector(F8_INPUT_LINE_INT_REQ, HOLD_LINE, 0x20);
200201}
201202*/
202203
r18138r18139
227228   /* video hardware */
228229   MCFG_DEFAULT_LAYOUT( layout_borisdpl )
229230
230   //MCFG_TIMER_ADD_PERIODIC("timer_interrupt", borisdpl_timer_interrupt, attotime::from_hz(40))
231   //MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_interrupt", chesstrv_state, borisdpl_timer_interrupt, attotime::from_hz(40))
231232MACHINE_CONFIG_END
232233
233234
trunk/src/mess/drivers/babbage.c
r18138r18139
5656   bool m_step;
5757   virtual void machine_reset();
5858   virtual void machine_start();
59   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
5960};
6061
6162
r18138r18139
220221   { NULL }
221222};
222223
223static TIMER_DEVICE_CALLBACK( keyboard_callback )
224TIMER_DEVICE_CALLBACK_MEMBER(babbage_state::keyboard_callback)
224225{
225   babbage_state *state = timer.machine().driver_data<babbage_state>();
226226
227227   UINT8 i, j, inp;
228228   char kbdrow[6];
r18138r18139
231231   for (i = 0; i < 4; i++)
232232   {
233233      sprintf(kbdrow,"X%X",i);
234      inp = timer.machine().root_device().ioport(kbdrow)->read();
234      inp = machine().root_device().ioport(kbdrow)->read();
235235
236236      for (j = 0; j < 5; j++)
237237         if (BIT(inp, j))
r18138r18139
239239   }
240240
241241   /* make sure only one keystroke */
242   if (data != state->m_prev_key)
243      state->m_prev_key = data;
242   if (data != m_prev_key)
243      m_prev_key = data;
244244   else
245245      data = 0xff;
246246
247247   /* while key is down, activate strobe. When key released, deactivate strobe which causes an interrupt */
248248   if (data < 0xff)
249249   {
250      state->m_key = data;
251      state->m_pio_2->strobe(0, 0);
250      m_key = data;
251      m_pio_2->strobe(0, 0);
252252   }
253253   else
254      state->m_pio_2->strobe(0, 1);
254      m_pio_2->strobe(0, 1);
255255}
256256
257257
r18138r18139
276276   MCFG_Z80PIO_ADD( "z80pio_1", MAIN_CLOCK, babbage_z80pio1_intf )
277277   MCFG_Z80PIO_ADD( "z80pio_2", MAIN_CLOCK, babbage_z80pio2_intf )
278278
279   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", keyboard_callback, attotime::from_hz(30))
279   MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", babbage_state, keyboard_callback, attotime::from_hz(30))
280280MACHINE_CONFIG_END
281281
282282
trunk/src/mess/drivers/pc6001.c
r18138r18139
236236   INTERRUPT_GEN_MEMBER(pc6001_interrupt);
237237   INTERRUPT_GEN_MEMBER(pc6001sr_interrupt);
238238   TIMER_CALLBACK_MEMBER(audio_callback);
239   TIMER_DEVICE_CALLBACK_MEMBER(cassette_callback);
240   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
239241};
240242
241243
r18138r18139
20212023   return joy_press;
20222024}
20232025
2024static TIMER_DEVICE_CALLBACK(cassette_callback)
2026TIMER_DEVICE_CALLBACK_MEMBER(pc6001_state::cassette_callback)
20252027{
2026   pc6001_state *state = timer.machine().driver_data<pc6001_state>();
2027   if(state->m_cas_switch == 1)
2028   if(m_cas_switch == 1)
20282029   {
20292030      #if 0
20302031      static UINT8 cas_data_i = 0x80,cas_data_poll;
2031      //state->m_cur_keycode = gfx_data[state->m_cas_offset++];
2032      if((timer.machine().device<cassette_image_device>(CASSETTE_TAG))->input() > 0.03)
2032      //m_cur_keycode = gfx_data[m_cas_offset++];
2033      if((machine().device<cassette_image_device>(CASSETTE_TAG))->input() > 0.03)
20332034         cas_data_poll|= cas_data_i;
20342035      else
20352036         cas_data_poll&=~cas_data_i;
20362037      if(cas_data_i == 1)
20372038      {
2038         state->m_cur_keycode = cas_data_poll;
2039         m_cur_keycode = cas_data_poll;
20392040         cas_data_i = 0x80;
20402041         /* data ready, poll irq */
2041         state->m_irq_vector = 0x08;
2042         timer.machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
2042         m_irq_vector = 0x08;
2043         machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
20432044      }
20442045      else
20452046         cas_data_i>>=1;
20462047      #else
2047         UINT8 *cas_data = timer.machine().root_device().memregion("cas")->base();
2048         UINT8 *cas_data = machine().root_device().memregion("cas")->base();
20482049
2049         state->m_cur_keycode = cas_data[state->m_cas_offset++];
2050         popmessage("%04x %04x",state->m_cas_offset,state->m_cas_maxsize);
2051         if(state->m_cas_offset > state->m_cas_maxsize)
2050         m_cur_keycode = cas_data[m_cas_offset++];
2051         popmessage("%04x %04x",m_cas_offset,m_cas_maxsize);
2052         if(m_cas_offset > m_cas_maxsize)
20522053         {
2053            state->m_cas_offset = 0;
2054            state->m_cas_switch = 0;
2054            m_cas_offset = 0;
2055            m_cas_switch = 0;
20552056            if(IRQ_LOG) printf("Tape-E IRQ 0x12\n");
2056            state->m_irq_vector = 0x12;
2057            timer.machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
2057            m_irq_vector = 0x12;
2058            machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
20582059         }
20592060         else
20602061         {
20612062            if(IRQ_LOG) printf("Tape-D IRQ 0x08\n");
2062            state->m_irq_vector = 0x08;
2063            timer.machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
2063            m_irq_vector = 0x08;
2064            machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
20642065         }
20652066      #endif
20662067   }
20672068}
20682069
2069static TIMER_DEVICE_CALLBACK(keyboard_callback)
2070TIMER_DEVICE_CALLBACK_MEMBER(pc6001_state::keyboard_callback)
20702071{
2071   pc6001_state *state = timer.machine().driver_data<pc6001_state>();
2072   address_space &space = timer.machine().device("maincpu")->memory().space(AS_PROGRAM);
2073   UINT32 key1 = timer.machine().root_device().ioport("key1")->read();
2074   UINT32 key2 = timer.machine().root_device().ioport("key2")->read();
2075   UINT32 key3 = timer.machine().root_device().ioport("key3")->read();
2076//  UINT8 p1_key = timer.machine().root_device().ioport("P1")->read();
2072   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
2073   UINT32 key1 = machine().root_device().ioport("key1")->read();
2074   UINT32 key2 = machine().root_device().ioport("key2")->read();
2075   UINT32 key3 = machine().root_device().ioport("key3")->read();
2076//  UINT8 p1_key = machine().root_device().ioport("P1")->read();
20772077
2078   if(state->m_cas_switch == 0)
2078   if(m_cas_switch == 0)
20792079   {
2080      if((key1 != state->m_old_key1) || (key2 != state->m_old_key2) || (key3 != state->m_old_key3))
2080      if((key1 != m_old_key1) || (key2 != m_old_key2) || (key3 != m_old_key3))
20812081      {
2082         state->m_cur_keycode = check_keyboard_press(space.machine());
2082         m_cur_keycode = check_keyboard_press(space.machine());
20832083         if(IRQ_LOG) printf("KEY IRQ 0x02\n");
2084         state->m_irq_vector = 0x02;
2085         timer.machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
2086         state->m_old_key1 = key1;
2087         state->m_old_key2 = key2;
2088         state->m_old_key3 = key3;
2084         m_irq_vector = 0x02;
2085         machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
2086         m_old_key1 = key1;
2087         m_old_key2 = key2;
2088         m_old_key3 = key3;
20892089      }
20902090      #if 0
20912091      else /* joypad polling */
20922092      {
2093         state->m_cur_keycode = check_joy_press(space.machine());
2094         if(state->m_cur_keycode)
2093         m_cur_keycode = check_joy_press(space.machine());
2094         if(m_cur_keycode)
20952095         {
2096            state->m_irq_vector = 0x16;
2097            timer.machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
2096            m_irq_vector = 0x16;
2097            machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
20982098         }
20992099      }
21002100      #endif
r18138r18139
23682368//  MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
23692369
23702370   /* TODO: accurate timing on this */
2371   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", keyboard_callback, attotime::from_hz(250))
2372   MCFG_TIMER_ADD_PERIODIC("cassette_timer", cassette_callback, attotime::from_hz(1200/12)) //1200 bauds / (1 start bit -> 8 data bits -> 3 stop bits)
2371   MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", pc6001_state, keyboard_callback, attotime::from_hz(250))
2372   MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", pc6001_state, cassette_callback, attotime::from_hz(1200/12))
23732373MACHINE_CONFIG_END
23742374
23752375
trunk/src/mess/drivers/vt100.c
r18138r18139
5858   virtual void machine_reset();
5959   UINT32 screen_update_vt100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6060   INTERRUPT_GEN_MEMBER(vt100_vertical_interrupt);
61   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
6162};
6263
6364
r18138r18139
115116   return 0;
116117}
117118
118static TIMER_DEVICE_CALLBACK(keyboard_callback)
119TIMER_DEVICE_CALLBACK_MEMBER(vt100_state::keyboard_callback)
119120{
120   vt100_state *state = timer.machine().driver_data<vt100_state>();
121121   UINT8 i, code;
122122   char kbdrow[8];
123   if (state->m_key_scan)
123   if (m_key_scan)
124124   {
125125      for(i = 0; i < 16; i++)
126126      {
127127         sprintf(kbdrow,"LINE%X", i);
128         code =   timer.machine().root_device().ioport(kbdrow)->read();
128         code =   machine().root_device().ioport(kbdrow)->read();
129129         if (code < 0xff)
130130         {
131            state->m_keyboard_int = 1;
132            state->m_key_code = i | bit_sel(code);
133            timer.machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE);
131            m_keyboard_int = 1;
132            m_key_code = i | bit_sel(code);
133            machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE);
134134            break;
135135         }
136136      }
r18138r18139
436436   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
437437   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
438438
439   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", keyboard_callback, attotime::from_hz(800))
439   MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", vt100_state, keyboard_callback, attotime::from_hz(800))
440440MACHINE_CONFIG_END
441441
442442static MACHINE_CONFIG_DERIVED( vt180, vt100 )
trunk/src/mess/drivers/nakajies.c
r18138r18139
335335   UINT8   *m_bank_base[8];
336336   virtual void palette_init();
337337   DECLARE_INPUT_CHANGED_MEMBER(trigger_irq);
338   TIMER_DEVICE_CALLBACK_MEMBER(kb_timer);
338339};
339340
340341
r18138r18139
674675}
675676
676677
677static TIMER_DEVICE_CALLBACK( kb_timer )
678TIMER_DEVICE_CALLBACK_MEMBER(nakajies_state::kb_timer)
678679{
679   nakajies_state *state = timer.machine().driver_data<nakajies_state>();
680680
681   if (state->m_matrix > 0x09)
681   if (m_matrix > 0x09)
682682   {
683683      // reset the keyboard scan
684      state->m_matrix = 0;
685      state->m_irq_active |= 0x20;
684      m_matrix = 0;
685      m_irq_active |= 0x20;
686686   }
687687   else
688688   {
689689      // next row
690      state->m_matrix++;
691      state->m_irq_active |= 0x10;
690      m_matrix++;
691      m_irq_active |= 0x10;
692692   }
693693
694   state->nakajies_update_irqs(timer.machine());
694   nakajies_update_irqs(machine());
695695}
696696
697697
r18138r18139
759759   /* rtc */
760760   MCFG_RP5C01_ADD("rtc", XTAL_32_768kHz, rtc_intf)
761761
762   MCFG_TIMER_ADD_PERIODIC("kb_timer", kb_timer, attotime::from_hz(250))
762   MCFG_TIMER_DRIVER_ADD_PERIODIC("kb_timer", nakajies_state, kb_timer, attotime::from_hz(250))
763763MACHINE_CONFIG_END
764764
765765static MACHINE_CONFIG_DERIVED( dator3k, nakajies210 )
trunk/src/mess/drivers/smc777.c
r18138r18139
8888   virtual void palette_init();
8989   UINT32 screen_update_smc777(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9090   INTERRUPT_GEN_MEMBER(smc777_vblank_irq);
91   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
9192};
9293
9394
r18138r18139
930931   }
931932};
932933
933static TIMER_DEVICE_CALLBACK( keyboard_callback )
934TIMER_DEVICE_CALLBACK_MEMBER(smc777_state::keyboard_callback)
934935{
935   smc777_state *state = timer.machine().driver_data<smc777_state>();
936936   static const char *const portnames[11] = { "key0","key1","key2","key3","key4","key5","key6","key7", "key8", "key9", "keya" };
937937   int i,port_i,scancode;
938   UINT8 shift_mod = timer.machine().root_device().ioport("key_mod")->read() & 1;
939   UINT8 kana_mod = timer.machine().root_device().ioport("key_mod")->read() & 0x10;
938   UINT8 shift_mod = machine().root_device().ioport("key_mod")->read() & 1;
939   UINT8 kana_mod = machine().root_device().ioport("key_mod")->read() & 0x10;
940940   scancode = 0;
941941
942942   for(port_i=0;port_i<11;port_i++)
943943   {
944944      for(i=0;i<8;i++)
945945      {
946         if((timer.machine().root_device().ioport(portnames[port_i])->read()>>i) & 1)
946         if((machine().root_device().ioport(portnames[port_i])->read()>>i) & 1)
947947         {
948            state->m_keyb_press = smc777_keytable[shift_mod & 1][scancode];
949            if(kana_mod) { state->m_keyb_press|=0x80; }
950            state->m_keyb_press_flag = 1;
951            state->m_shift_press_flag = shift_mod & 1;
948            m_keyb_press = smc777_keytable[shift_mod & 1][scancode];
949            if(kana_mod) { m_keyb_press|=0x80; }
950            m_keyb_press_flag = 1;
951            m_shift_press_flag = shift_mod & 1;
952952            return;
953953         }
954954         scancode++;
r18138r18139
11091109   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
11101110   MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50)
11111111
1112   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", keyboard_callback, attotime::from_hz(240/32))
1112   MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", smc777_state, keyboard_callback, attotime::from_hz(240/32))
11131113MACHINE_CONFIG_END
11141114
11151115/* ROM definition */
trunk/src/mess/drivers/vboy.c
r18138r18139
150150   virtual void palette_init();
151151   UINT32 screen_update_vboy_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
152152   UINT32 screen_update_vboy_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
153   TIMER_DEVICE_CALLBACK_MEMBER(timer_main_tick);
154   TIMER_DEVICE_CALLBACK_MEMBER(timer_pad_tick);
155   TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineL);
156   TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineR);
153157};
154158
155159
r18138r18139
12131217    }
12141218}
12151219
1216static TIMER_DEVICE_CALLBACK( timer_main_tick )
1220TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::timer_main_tick)
12171221{
1218   vboy_state *state = timer.machine().driver_data<vboy_state>();
12191222
1220    state->m_timer_tick();
1223    m_timer_tick();
12211224}
12221225
1223static TIMER_DEVICE_CALLBACK( timer_pad_tick )
1226TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::timer_pad_tick)
12241227{
1225   vboy_state *state = timer.machine().driver_data<vboy_state>();
12261228
1227   if((state->m_vboy_regs.kcr & 0x80) == 0)
1228      state->m_maincpu->set_input_line(0, HOLD_LINE);
1229   if((m_vboy_regs.kcr & 0x80) == 0)
1230      m_maincpu->set_input_line(0, HOLD_LINE);
12291231}
12301232
12311233void vboy_state::palette_init()
r18138r18139
12991301
13001302}
13011303
1302static TIMER_DEVICE_CALLBACK( vboy_scanlineL )
1304TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::vboy_scanlineL)
13031305{
1304   vboy_state *state = timer.machine().driver_data<vboy_state>();
13051306   int scanline = param;
13061307
1307   state->m_scanline_tick(scanline,0);
1308   m_scanline_tick(scanline,0);
13081309}
13091310
13101311#if 0
1311static TIMER_DEVICE_CALLBACK( vboy_scanlineR )
1312TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::vboy_scanlineR)
13121313{
1313   vboy_state *state = timer.machine().driver_data<vboy_state>();
13141314   int scanline = param;
13151315
1316   //state->m_scanline_tick(scanline,1);
1316   //m_scanline_tick(scanline,1);
13171317}
13181318#endif
13191319
r18138r18139
14251425   MCFG_CPU_ADD( "maincpu", V810, XTAL_20MHz )
14261426   MCFG_CPU_PROGRAM_MAP(vboy_mem)
14271427   MCFG_CPU_IO_MAP(vboy_io)
1428   MCFG_TIMER_ADD_SCANLINE("scantimer_l", vboy_scanlineL, "3dleft", 0, 1)
1429   //MCFG_TIMER_ADD_SCANLINE("scantimer_r", vboy_scanlineR, "3dright", 0, 1)
1428   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer_l", vboy_state, vboy_scanlineL, "3dleft", 0, 1)
1429   //MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer_r", vboy_state, vboy_scanlineR, "3dright", 0, 1)
14301430
14311431
14321432    // programmable timer
1433   MCFG_TIMER_ADD("timer_main", timer_main_tick)
1433   MCFG_TIMER_DRIVER_ADD("timer_main", vboy_state, timer_main_tick)
14341434
14351435    // pad ready, which should be once per VBL
1436   MCFG_TIMER_ADD_PERIODIC("timer_pad", timer_pad_tick, attotime::from_hz(50.038029f))
1436   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_pad", vboy_state, timer_pad_tick, attotime::from_hz(50.038029f))
14371437
14381438   /* video hardware */
14391439   MCFG_DEFAULT_LAYOUT(layout_vboy)
trunk/src/mess/drivers/bml3.c
r18138r18139
115115   UINT32 screen_update_bml3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
116116   INTERRUPT_GEN_MEMBER(bml3_irq);
117117   INTERRUPT_GEN_MEMBER(bml3_timer_firq);
118   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
118119};
119120
120121#define mc6845_h_char_total    (m_crtc_vreg[0])
r18138r18139
575576   NULL      /* update address callback */
576577};
577578
578static TIMER_DEVICE_CALLBACK( keyboard_callback )
579TIMER_DEVICE_CALLBACK_MEMBER(bml3_state::keyboard_callback)
579580{
580   bml3_state *state = timer.machine().driver_data<bml3_state>();
581581   static const char *const portnames[3] = { "key1","key2","key3" };
582582   int i,port_i,scancode;
583583   scancode = 0;
r18138r18139
586586   {
587587      for(i=0;i<32;i++)
588588      {
589         if((timer.machine().root_device().ioport(portnames[port_i])->read()>>i) & 1)
589         if((machine().root_device().ioport(portnames[port_i])->read()>>i) & 1)
590590         {
591591            {
592               state->m_keyb_press = scancode;
593               state->m_keyb_press_flag = 1;
594               timer.machine().device("maincpu")->execute().set_input_line(M6809_IRQ_LINE, HOLD_LINE);
592               m_keyb_press = scancode;
593               m_keyb_press_flag = 1;
594               machine().device("maincpu")->execute().set_input_line(M6809_IRQ_LINE, HOLD_LINE);
595595               return;
596596            }
597597         }
r18138r18139
907907
908908   /* Devices */
909909   MCFG_MC6845_ADD("crtc", H46505, XTAL_1MHz, mc6845_intf)
910   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", keyboard_callback, attotime::from_hz(240/8))
910   MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", bml3_state, keyboard_callback, attotime::from_hz(240/8))
911911   MCFG_MC6843_ADD( "mc6843", bml3_6843_if )
912912   MCFG_PIA6821_ADD("pia6821", bml3_pia_config)
913913   MCFG_ACIA6850_ADD("acia6850", bml3_acia_if)
trunk/src/mess/drivers/exelv.c
r18138r18139
105105   UINT8   m_wx318;   /* data of 74ls374 labeled wx318 */
106106   UINT8   m_wx319;   /* data of 74sl374 labeled wx319 */
107107   virtual void palette_init();
108   TIMER_DEVICE_CALLBACK_MEMBER(exelv_hblank_interrupt);
108109};
109110
110111
111static TIMER_DEVICE_CALLBACK( exelv_hblank_interrupt )
112TIMER_DEVICE_CALLBACK_MEMBER(exelv_state::exelv_hblank_interrupt)
112113{
113   exelv_state *exelv = timer.machine().driver_data<exelv_state>();
114   exelv->m_tms3556->interrupt(timer.machine());
114   m_tms3556->interrupt(machine());
115115}
116116
117117#ifdef UNUSED_FUNCTION
r18138r18139
530530   MCFG_CPU_ADD("maincpu", TMS7000_EXL, XTAL_4_9152MHz)   /* TMS7020 */
531531   MCFG_CPU_PROGRAM_MAP(tms7020_mem)
532532   MCFG_CPU_IO_MAP(tms7020_port)
533   MCFG_TIMER_ADD_SCANLINE("scantimer", exelv_hblank_interrupt, "screen", 0, 1)
533   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", exelv_state, exelv_hblank_interrupt, "screen", 0, 1)
534534
535535   MCFG_CPU_ADD("tms7041", TMS7000, XTAL_4_9152MHz)
536536   MCFG_CPU_PROGRAM_MAP(tms7041_map)
r18138r18139
570570   MCFG_CPU_ADD("maincpu", TMS7000_EXL, XTAL_4_9152MHz)   /* TMS7040 */
571571   MCFG_CPU_PROGRAM_MAP(tms7040_mem)
572572   MCFG_CPU_IO_MAP(tms7020_port)
573   MCFG_TIMER_ADD_SCANLINE("scantimer", exelv_hblank_interrupt, "screen", 0, 1)
573   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", exelv_state, exelv_hblank_interrupt, "screen", 0, 1)
574574
575575   MCFG_CPU_ADD("tms7042", TMS7000, XTAL_4_9152MHz)
576576   MCFG_CPU_PROGRAM_MAP(tms7042_map)
trunk/src/mess/drivers/scorpion.c
r18138r18139
167167   DECLARE_WRITE8_MEMBER(scorpion_port_1ffd_w);
168168   DECLARE_MACHINE_START(scorpion);
169169   DECLARE_MACHINE_RESET(scorpion);
170   TIMER_DEVICE_CALLBACK_MEMBER(nmi_check_callback);
170171};
171172
172173/****************************************************************************************************/
r18138r18139
272273   return address;
273274}
274275
275static TIMER_DEVICE_CALLBACK(nmi_check_callback)
276TIMER_DEVICE_CALLBACK_MEMBER(scorpion_state::nmi_check_callback)
276277{
277   spectrum_state *state = timer.machine().driver_data<spectrum_state>();
278278
279   if ((timer.machine().root_device().ioport("NMI")->read() & 1)==1)
279   if ((machine().root_device().ioport("NMI")->read() & 1)==1)
280280   {
281      state->m_port_1ffd_data |= 0x02;
282      scorpion_update_memory(timer.machine());
283      timer.machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
281      m_port_1ffd_data |= 0x02;
282      scorpion_update_memory(machine());
283      machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
284284   }
285285}
286286
r18138r18139
421421   MCFG_RAM_MODIFY(RAM_TAG)
422422   MCFG_RAM_DEFAULT_SIZE("256K")
423423
424   MCFG_TIMER_ADD_PERIODIC("nmi_timer", nmi_check_callback, attotime::from_hz(50))
424   MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", scorpion_state, nmi_check_callback, attotime::from_hz(50))
425425MACHINE_CONFIG_END
426426
427427static MACHINE_CONFIG_DERIVED( profi, scorpion )
trunk/src/mess/drivers/iq151.c
r18138r18139
9797   DECLARE_DRIVER_INIT(iq151);
9898   INTERRUPT_GEN_MEMBER(iq151_vblank_interrupt);
9999   DECLARE_INPUT_CHANGED_MEMBER(iq151_break);
100   TIMER_DEVICE_CALLBACK_MEMBER(cassette_timer);
100101};
101102
102103READ8_MEMBER(iq151_state::keyboard_row_r)
r18138r18139
334335   return pic8259_acknowledge(state->m_pic);
335336}
336337
337static TIMER_DEVICE_CALLBACK( cassette_timer )
338TIMER_DEVICE_CALLBACK_MEMBER(iq151_state::cassette_timer)
338339{
339   iq151_state *state = timer.machine().driver_data<iq151_state>();
340340
341   state->m_cassette_clk ^= 1;
341   m_cassette_clk ^= 1;
342342
343   state->m_cassette->output((state->m_cassette_data & 1) ^ (state->m_cassette_clk & 1) ? +1 : -1);
343   m_cassette->output((m_cassette_data & 1) ^ (m_cassette_clk & 1) ? +1 : -1);
344344}
345345
346346DRIVER_INIT_MEMBER(iq151_state,iq151)
r18138r18139
457457   MCFG_I8255_ADD("ppi8255", iq151_ppi8255_intf)
458458
459459   MCFG_CASSETTE_ADD( CASSETTE_TAG, iq151_cassette_interface )
460   MCFG_TIMER_ADD_PERIODIC("cassette_timer", cassette_timer, attotime::from_hz(2000))
460   MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", iq151_state, cassette_timer, attotime::from_hz(2000))
461461
462462   /* cartridge */
463463   MCFG_IQ151_CARTRIDGE_ADD("slot1", iq151_cart_interface, iq151_cart, NULL, NULL)
trunk/src/mess/drivers/4004clk.c
r18138r18139
2929   UINT16 m_nixie[16];
3030   UINT8 m_timer;
3131   virtual void machine_start();
32   TIMER_DEVICE_CALLBACK_MEMBER(timer_callback);
3233};
3334
3435READ8_MEMBER(nixieclock_state::data_r)
r18138r18139
124125
125126*/
126127
127static TIMER_DEVICE_CALLBACK(timer_callback)
128TIMER_DEVICE_CALLBACK_MEMBER(nixieclock_state::timer_callback)
128129{
129   nixieclock_state *state = timer.machine().driver_data<nixieclock_state>();
130   i4004_set_test(timer.machine().device("maincpu"),state->m_timer);
131   state->m_timer^=1;
130   i4004_set_test(machine().device("maincpu"),m_timer);
131   m_timer^=1;
132132}
133133
134134void nixieclock_state::machine_start()
r18138r18139
157157   MCFG_SOUND_ADD("dac", DAC, 0)
158158   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
159159
160   MCFG_TIMER_ADD_PERIODIC("4004clk_timer", timer_callback, attotime::from_hz(120))
160   MCFG_TIMER_DRIVER_ADD_PERIODIC("4004clk_timer", nixieclock_state, timer_callback, attotime::from_hz(120))
161161MACHINE_CONFIG_END
162162
163163/* ROM definition */
trunk/src/mess/drivers/multi8.c
r18138r18139
6969   virtual void video_start();
7070   virtual void palette_init();
7171   UINT32 screen_update_multi8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
72   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
7273};
7374
7475#define mc6845_h_char_total    (m_crtc_vreg[0])
r18138r18139
482483   PORT_BIT(0x00000010,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("GRPH") PORT_CODE(KEYCODE_LALT)
483484INPUT_PORTS_END
484485
485static TIMER_DEVICE_CALLBACK( keyboard_callback )
486TIMER_DEVICE_CALLBACK_MEMBER(multi8_state::keyboard_callback)
486487{
487   multi8_state *state = timer.machine().driver_data<multi8_state>();
488488   static const char *const portnames[3] = { "key1","key2","key3" };
489489   int i,port_i,scancode;
490   UINT8 keymod = timer.machine().root_device().ioport("key_modifiers")->read() & 0x1f;
490   UINT8 keymod = machine().root_device().ioport("key_modifiers")->read() & 0x1f;
491491   scancode = 0;
492492
493   state->m_shift_press_flag = ((keymod & 0x02) >> 1);
493   m_shift_press_flag = ((keymod & 0x02) >> 1);
494494
495495   for(port_i=0;port_i<3;port_i++)
496496   {
497497      for(i=0;i<32;i++)
498498      {
499         if((timer.machine().root_device().ioport(portnames[port_i])->read()>>i) & 1)
499         if((machine().root_device().ioport(portnames[port_i])->read()>>i) & 1)
500500         {
501501            //key_flag = 1;
502            if(!state->m_shift_press_flag)  // shift not pressed
502            if(!m_shift_press_flag)  // shift not pressed
503503            {
504504               if(scancode >= 0x41 && scancode < 0x5b)
505505                  scancode += 0x20;  // lowercase
r18138r18139
521521               if(scancode == 0x3c)
522522                  scancode = 0x3e;
523523            }
524            state->m_keyb_press = scancode;
525            state->m_keyb_press_flag = 1;
524            m_keyb_press = scancode;
525            m_keyb_press_flag = 1;
526526            return;
527527         }
528528         scancode++;
r18138r18139
684684   MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50)
685685
686686   /* Devices */
687   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", keyboard_callback, attotime::from_hz(240/32))
687   MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", multi8_state, keyboard_callback, attotime::from_hz(240/32))
688688   MCFG_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/2, mc6845_intf)   /* unknown clock, hand tuned to get ~60 fps */
689689   MCFG_I8255_ADD( "ppi8255_0", ppi8255_intf_0 )
690690MACHINE_CONFIG_END
trunk/src/mess/drivers/junior.c
r18138r18139
4848   virtual void machine_start();
4949   virtual void machine_reset();
5050   DECLARE_INPUT_CHANGED_MEMBER(junior_reset);
51   TIMER_DEVICE_CALLBACK_MEMBER(junior_update_leds);
5152};
5253
5354
r18138r18139
192193};
193194
194195
195static TIMER_DEVICE_CALLBACK( junior_update_leds )
196TIMER_DEVICE_CALLBACK_MEMBER(junior_state::junior_update_leds)
196197{
197   junior_state *state = timer.machine().driver_data<junior_state>();
198198   int i;
199199
200200   for ( i = 0; i < 6; i++ )
201201   {
202      if ( state->m_led_time[i] )
203         state->m_led_time[i]--;
202      if ( m_led_time[i] )
203         m_led_time[i]--;
204204      else
205205         output_set_digit_value( i, 0 );
206206   }
r18138r18139
235235
236236   /* Devices */
237237   MCFG_RIOT6532_ADD("riot", XTAL_1MHz, junior_riot_interface)
238   MCFG_TIMER_ADD_PERIODIC("led_timer", junior_update_leds, attotime::from_hz(50))
238   MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", junior_state, junior_update_leds, attotime::from_hz(50))
239239MACHINE_CONFIG_END
240240
241241
trunk/src/mess/drivers/pegasus.c
r18138r18139
8181   virtual void video_start();
8282   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8383   DECLARE_DRIVER_INIT(pegasus);
84   TIMER_DEVICE_CALLBACK_MEMBER(pegasus_firq);
8485};
8586
86static TIMER_DEVICE_CALLBACK( pegasus_firq )
87TIMER_DEVICE_CALLBACK_MEMBER(pegasus_state::pegasus_firq)
8788{
88   device_t *cpu = timer.machine().device( "maincpu" );
89   device_t *cpu = machine().device( "maincpu" );
8990   cpu->execute().set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
9091}
9192
r18138r18139
494495   MCFG_CPU_ADD("maincpu", M6809E, XTAL_4MHz)   // actually a 6809C - 4MHZ clock coming in, 1MHZ internally
495496   MCFG_CPU_PROGRAM_MAP(pegasus_mem)
496497
497   MCFG_TIMER_ADD_PERIODIC("pegasus_firq", pegasus_firq, attotime::from_hz(400))   // controls accuracy of the clock (ctrl-P)
498   MCFG_TIMER_DRIVER_ADD_PERIODIC("pegasus_firq", pegasus_state, pegasus_firq, attotime::from_hz(400))
498499
499500   /* video hardware */
500501   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mess/drivers/mk1.c
r18138r18139
5656   UINT8 m_f8[2];
5757   UINT8 m_led[4];
5858   virtual void machine_start();
59   TIMER_DEVICE_CALLBACK_MEMBER(mk1_update_leds);
5960};
6061
6162
r18138r18139
146147INPUT_PORTS_END
147148
148149
149static TIMER_DEVICE_CALLBACK( mk1_update_leds )
150TIMER_DEVICE_CALLBACK_MEMBER(mk1_state::mk1_update_leds)
150151{
151   mk1_state *state = timer.machine().driver_data<mk1_state>();
152152   UINT8 i;
153153
154154   for ( i = 0; i < 4; i++ )
155155   {
156      output_set_digit_value( i, state->m_led[i] >> 1 );
157      output_set_led_value( i, state->m_led[i] & 0x01 );
158      state->m_led[i] = 0;
156      output_set_digit_value( i, m_led[i] >> 1 );
157      output_set_led_value( i, m_led[i] & 0x01 );
158      m_led[i] = 0;
159159   }
160160}
161161
r18138r18139
192192   /* video hardware */
193193   MCFG_DEFAULT_LAYOUT( layout_mk1 )
194194
195   MCFG_TIMER_ADD_PERIODIC("led_timer", mk1_update_leds, attotime::from_hz(30))
195   MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", mk1_state, mk1_update_leds, attotime::from_hz(30))
196196MACHINE_CONFIG_END
197197
198198
trunk/src/mess/drivers/bigbord2.c
r18138r18139
145145   required_device<device_t> m_floppy3;
146146   required_device<device_t> m_beeper;
147147   DECLARE_DRIVER_INIT(bigbord2);
148   TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick);
148149};
149150
150151/* Status port
r18138r18139
405406
406407/* Z80 CTC */
407408
408static TIMER_DEVICE_CALLBACK( ctc_tick )
409TIMER_DEVICE_CALLBACK_MEMBER(bigbord2_state::ctc_tick)
409410{
410   bigbord2_state *state = timer.machine().driver_data<bigbord2_state>();
411411
412   state->m_ctcb->trg0(1);
413   state->m_ctcb->trg1(1);
414   state->m_ctcb->trg0(0);
415   state->m_ctcb->trg1(0);
412   m_ctcb->trg0(1);
413   m_ctcb->trg1(1);
414   m_ctcb->trg0(0);
415   m_ctcb->trg1(0);
416416}
417417
418418WRITE_LINE_MEMBER( bigbord2_state::frame )
r18138r18139
696696   MCFG_PALETTE_INIT(black_and_white)
697697
698698   /* keyboard */
699   MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(MAIN_CLOCK))
699   MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", bigbord2_state, ctc_tick, attotime::from_hz(MAIN_CLOCK))
700700
701701   /* devices */
702702   MCFG_Z80DMA_ADD(Z80DMA_TAG, MAIN_CLOCK, dma_intf)
trunk/src/mess/drivers/pc100.c
r18138r18139
6565   virtual void video_start();
6666   UINT32 screen_update_pc100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6767   INTERRUPT_GEN_MEMBER(pc100_vblank_irq);
68   TIMER_DEVICE_CALLBACK_MEMBER(pc100_600hz_irq);
69   TIMER_DEVICE_CALLBACK_MEMBER(pc100_100hz_irq);
70   TIMER_DEVICE_CALLBACK_MEMBER(pc100_50hz_irq);
71   TIMER_DEVICE_CALLBACK_MEMBER(pc100_10hz_irq);
6872};
6973
7074void pc100_state::video_start()
r18138r18139
348352   pic8259_ir4_w(machine().device("pic8259"), 1);
349353}
350354
351static TIMER_DEVICE_CALLBACK( pc100_600hz_irq )
355TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_600hz_irq)
352356{
353   pc100_state *state = timer.machine().driver_data<pc100_state>();
354357
355   if(state->m_timer_mode == 0)
356      pic8259_ir2_w(timer.machine().device("pic8259"), 1);
358   if(m_timer_mode == 0)
359      pic8259_ir2_w(machine().device("pic8259"), 1);
357360}
358361
359static TIMER_DEVICE_CALLBACK( pc100_100hz_irq )
362TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_100hz_irq)
360363{
361   pc100_state *state = timer.machine().driver_data<pc100_state>();
362364
363   if(state->m_timer_mode == 1)
364      pic8259_ir2_w(timer.machine().device("pic8259"), 1);
365   if(m_timer_mode == 1)
366      pic8259_ir2_w(machine().device("pic8259"), 1);
365367}
366368
367static TIMER_DEVICE_CALLBACK( pc100_50hz_irq )
369TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_50hz_irq)
368370{
369   pc100_state *state = timer.machine().driver_data<pc100_state>();
370371
371   if(state->m_timer_mode == 2)
372      pic8259_ir2_w(timer.machine().device("pic8259"), 1);
372   if(m_timer_mode == 2)
373      pic8259_ir2_w(machine().device("pic8259"), 1);
373374}
374375
375static TIMER_DEVICE_CALLBACK( pc100_10hz_irq )
376TIMER_DEVICE_CALLBACK_MEMBER(pc100_state::pc100_10hz_irq)
376377{
377   pc100_state *state = timer.machine().driver_data<pc100_state>();
378378
379   if(state->m_timer_mode == 3)
380      pic8259_ir2_w(timer.machine().device("pic8259"), 1);
379   if(m_timer_mode == 3)
380      pic8259_ir2_w(machine().device("pic8259"), 1);
381381}
382382
383383#define MASTER_CLOCK 6988800
r18138r18139
401401   MCFG_PALETTE_LENGTH(16)
402402//  MCFG_PALETTE_INIT(black_and_white)
403403
404   MCFG_TIMER_ADD_PERIODIC("600hz", pc100_600hz_irq, attotime::from_hz(MASTER_CLOCK/600))
405   MCFG_TIMER_ADD_PERIODIC("100hz", pc100_100hz_irq, attotime::from_hz(MASTER_CLOCK/100))
406   MCFG_TIMER_ADD_PERIODIC("50hz", pc100_50hz_irq, attotime::from_hz(MASTER_CLOCK/50))
407   MCFG_TIMER_ADD_PERIODIC("10hz", pc100_10hz_irq, attotime::from_hz(MASTER_CLOCK/10))
404   MCFG_TIMER_DRIVER_ADD_PERIODIC("600hz", pc100_state, pc100_600hz_irq, attotime::from_hz(MASTER_CLOCK/600))
405   MCFG_TIMER_DRIVER_ADD_PERIODIC("100hz", pc100_state, pc100_100hz_irq, attotime::from_hz(MASTER_CLOCK/100))
406   MCFG_TIMER_DRIVER_ADD_PERIODIC("50hz", pc100_state, pc100_50hz_irq, attotime::from_hz(MASTER_CLOCK/50))
407   MCFG_TIMER_DRIVER_ADD_PERIODIC("10hz", pc100_state, pc100_10hz_irq, attotime::from_hz(MASTER_CLOCK/10))
408408   MCFG_I8255_ADD( "ppi8255_2", pc100_ppi8255_interface_2 )
409409   MCFG_PIC8259_ADD( "pic8259", pc100_pic8259_config )
410410MACHINE_CONFIG_END
trunk/src/mess/drivers/h89.c
r18138r18139
4141
4242   UINT8 m_port_f2;
4343   virtual void machine_reset();
44   TIMER_DEVICE_CALLBACK_MEMBER(h89_irq_timer);
4445};
4546
4647
r18138r18139
9798{
9899}
99100
100static TIMER_DEVICE_CALLBACK( h89_irq_timer )
101TIMER_DEVICE_CALLBACK_MEMBER(h89_state::h89_irq_timer)
101102{
102   h89_state *state = timer.machine().driver_data<h89_state>();
103103
104   if (state->m_port_f2 & 0x02)
105      state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf);
104   if (m_port_f2 & 0x02)
105      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf);
106106}
107107
108108WRITE8_MEMBER( h89_state::port_f2_w )
r18138r18139
149149
150150   MCFG_SERIAL_TERMINAL_ADD(TERMINAL_TAG, terminal_intf, 9600)
151151
152   MCFG_TIMER_ADD_PERIODIC("irq_timer", h89_irq_timer, attotime::from_hz(100))
152   MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", h89_state, h89_irq_timer, attotime::from_hz(100))
153153MACHINE_CONFIG_END
154154
155155/* ROM definition */
trunk/src/mess/drivers/mycom.c
r18138r18139
110110   virtual void machine_start();
111111   virtual void video_start();
112112   DECLARE_DRIVER_INIT(mycom);
113   TIMER_DEVICE_CALLBACK_MEMBER(mycom_kbd);
113114};
114115
115116
r18138r18139
4724730x0d,0x0d,0x38,0x28,0x49,0x69,0x4b,0x6b,0x2c,0x3c,0x39,0x39,0x36,0x36,0x33,0x33,0x12,0x12,
4734740x07,0x07,0x39,0x29,0x4f,0x6f,0x4c,0x6c,0x2e,0x3e,0x63,0x63,0x66,0x66,0x61,0x61,0x2f,0x3f };
474475
475static TIMER_DEVICE_CALLBACK( mycom_kbd )
476TIMER_DEVICE_CALLBACK_MEMBER(mycom_state::mycom_kbd)
476477{
477   mycom_state *state = timer.machine().driver_data<mycom_state>();
478478   UINT8 x, y, scancode = 0;
479479   UINT16 pressed[9];
480480   char kbdrow[3];
481   UINT8 modifiers = timer.machine().root_device().ioport("XX")->read();
481   UINT8 modifiers = machine().root_device().ioport("XX")->read();
482482   UINT8 shift_pressed = (modifiers & 2) >> 1;
483   state->m_keyb_press_flag = 0;
483   m_keyb_press_flag = 0;
484484
485485   /* see what is pressed */
486486   for (x = 0; x < 9; x++)
487487   {
488488      sprintf(kbdrow,"X%d",x);
489      pressed[x] = (timer.machine().root_device().ioport(kbdrow)->read());
489      pressed[x] = (machine().root_device().ioport(kbdrow)->read());
490490   }
491491
492492   /* find what has changed */
r18138r18139
500500            if (BIT(pressed[x], y))
501501            {
502502               scancode = ((x + y * 9) << 1) + shift_pressed + 1;
503               state->m_keyb_press_flag = 1;
504               state->m_keyb_press = mycom_keyval[scancode];
503               m_keyb_press_flag = 1;
504               m_keyb_press = mycom_keyval[scancode];
505505            }
506506         }
507507      }
508508   }
509509
510   if (state->m_keyb_press_flag)
510   if (m_keyb_press_flag)
511511   {
512      if (modifiers & 1) state->m_keyb_press &= 0xbf;
513      if (modifiers & 4) state->m_keyb_press |= 0x80;
512      if (modifiers & 1) m_keyb_press &= 0xbf;
513      if (modifiers & 4) m_keyb_press |= 0x80;
514514   }
515515}
516516
r18138r18139
619619   MCFG_FD1771_ADD("fdc", wd1771_intf)
620620   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(mycom_floppy_interface)
621621
622   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", mycom_kbd, attotime::from_hz(20))
622   MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", mycom_state, mycom_kbd, attotime::from_hz(20))
623623MACHINE_CONFIG_END
624624
625625/* ROM definition */
trunk/src/mess/drivers/mk2.c
r18138r18139
7373   DECLARE_WRITE8_MEMBER(mk2_write_b);
7474   UINT8 m_led[5];
7575   virtual void machine_start();
76   TIMER_DEVICE_CALLBACK_MEMBER(update_leds);
7677};
7778
7879
r18138r18139
112113INPUT_PORTS_END
113114
114115
115static TIMER_DEVICE_CALLBACK( update_leds )
116TIMER_DEVICE_CALLBACK_MEMBER(mk2_state::update_leds)
116117{
117   mk2_state *state = timer.machine().driver_data<mk2_state>();
118118   int i;
119119
120120   for (i=0; i<4; i++)
121      output_set_digit_value(i, state->m_led[i]);
121      output_set_digit_value(i, m_led[i]);
122122
123   output_set_led_value(0, BIT(state->m_led[4], 3));
124   output_set_led_value(1, BIT(state->m_led[4], 5));
125   output_set_led_value(2, BIT(state->m_led[4], 4));
126   output_set_led_value(3, BIT(state->m_led[4], 4) ? 0 : 1);
123   output_set_led_value(0, BIT(m_led[4], 3));
124   output_set_led_value(1, BIT(m_led[4], 5));
125   output_set_led_value(2, BIT(m_led[4], 4));
126   output_set_led_value(3, BIT(m_led[4], 4) ? 0 : 1);
127127
128   state->m_led[0]= state->m_led[1]= state->m_led[2]= state->m_led[3]= state->m_led[4]= 0;
128   m_led[0]= m_led[1]= m_led[2]= m_led[3]= m_led[4]= 0;
129129}
130130
131131void mk2_state::machine_start()
r18138r18139
207207   MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0)
208208   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
209209
210   MCFG_TIMER_ADD_PERIODIC("led_timer", update_leds, attotime::from_hz(60))
210   MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", mk2_state, update_leds, attotime::from_hz(60))
211211MACHINE_CONFIG_END
212212
213213
trunk/src/mess/drivers/eacc.c
r18138r18139
7676   required_device<device_t> m_pia;
7777   required_shared_ptr<UINT8> m_p_nvram;
7878   virtual void machine_reset();
79   TIMER_DEVICE_CALLBACK_MEMBER(eacc_cb1);
80   TIMER_DEVICE_CALLBACK_MEMBER(eacc_nmi);
7981private:
8082   UINT8 m_digit;
8183};
r18138r18139
132134   m_cb2 = 0;
133135}
134136
135static TIMER_DEVICE_CALLBACK( eacc_cb1 )
137TIMER_DEVICE_CALLBACK_MEMBER(eacc_state::eacc_cb1)
136138{
137   eacc_state *state = timer.machine().driver_data<eacc_state>();
138   state->m_cb1 ^= 1; // 15hz
139   if (state->m_cb2)
140      state->m_maincpu->set_input_line(M6800_IRQ_LINE, ASSERT_LINE);
139   m_cb1 ^= 1; // 15hz
140   if (m_cb2)
141      m_maincpu->set_input_line(M6800_IRQ_LINE, ASSERT_LINE);
141142}
142143
143static TIMER_DEVICE_CALLBACK( eacc_nmi )
144TIMER_DEVICE_CALLBACK_MEMBER(eacc_state::eacc_nmi)
144145{
145   eacc_state *state = timer.machine().driver_data<eacc_state>();
146146
147   if (state->m_cb2)
147   if (m_cb2)
148148   {
149      state->m_nmi = true;
150      state->m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
149      m_nmi = true;
150      m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
151151   }
152152}
153153
r18138r18139
261261
262262   MCFG_PIA6821_ADD("pia", eacc_mc6821_intf)
263263   MCFG_NVRAM_ADD_0FILL("nvram")
264   MCFG_TIMER_ADD_PERIODIC("eacc_nmi", eacc_nmi, attotime::from_hz(600) )
265   MCFG_TIMER_ADD_PERIODIC("eacc_cb1", eacc_cb1, attotime::from_hz(30) )
264   MCFG_TIMER_DRIVER_ADD_PERIODIC("eacc_nmi", eacc_state, eacc_nmi, attotime::from_hz(600))
265   MCFG_TIMER_DRIVER_ADD_PERIODIC("eacc_cb1", eacc_state, eacc_cb1, attotime::from_hz(30))
266266MACHINE_CONFIG_END
267267
268268
trunk/src/mess/drivers/d6800.c
r18138r18139
8080   virtual void machine_reset();
8181public:   
8282   UINT32 screen_update_d6800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
83   TIMER_DEVICE_CALLBACK_MEMBER(d6800_p);
8384};
8485
8586
r18138r18139
182183
183184/* PIA6821 Interface */
184185
185static TIMER_DEVICE_CALLBACK( d6800_p )
186TIMER_DEVICE_CALLBACK_MEMBER(d6800_state::d6800_p)
186187{
187   d6800_state *state = timer.machine().driver_data<d6800_state>();
188   state->m_rtc++;
189   state->m_maincpu->set_input_line(M6800_IRQ_LINE, (state->m_rtc > 0xf8) ? ASSERT_LINE : CLEAR_LINE);
188   m_rtc++;
189   m_maincpu->set_input_line(M6800_IRQ_LINE, (m_rtc > 0xf8) ? ASSERT_LINE : CLEAR_LINE);
190190}
191191
192192
r18138r18139
383383   /* devices */
384384   MCFG_PIA6821_ADD("pia", d6800_mc6821_intf)
385385   MCFG_CASSETTE_ADD(CASSETTE_TAG, d6800_cassette_interface)
386   MCFG_TIMER_ADD_PERIODIC("d6800_p", d6800_p, attotime::from_hz(40000) )
386   MCFG_TIMER_DRIVER_ADD_PERIODIC("d6800_p", d6800_state, d6800_p, attotime::from_hz(40000))
387387
388388   /* quickload */
389389   MCFG_QUICKLOAD_ADD("quickload", d6800, "ch8", 1)
trunk/src/mess/drivers/rainbow.c
r18138r18139
133133public:   
134134   UINT32 screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
135135   INTERRUPT_GEN_MEMBER(vblank_irq);
136   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick);
136137};
137138
138139void rainbow_state::machine_start()
r18138r18139
390391    update_kbd_irq();
391392}
392393
393static TIMER_DEVICE_CALLBACK( keyboard_tick )
394TIMER_DEVICE_CALLBACK_MEMBER(rainbow_state::keyboard_tick)
394395{
395   rainbow_state *state = timer.machine().driver_data<rainbow_state>();
396396
397    state->m_kbd8251->transmit_clock();
398    state->m_kbd8251->receive_clock();
397    m_kbd8251->transmit_clock();
398    m_kbd8251->receive_clock();
399399}
400400
401401static const vt_video_interface video_interface =
r18138r18139
488488   MCFG_SOFTWARE_LIST_ADD("flop_list","rainbow")
489489
490490   MCFG_I8251_ADD("kbdser", i8251_intf)
491   MCFG_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, attotime::from_hz(4800))
491   MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", rainbow_state, keyboard_tick, attotime::from_hz(4800))
492492
493493    MCFG_LK201_ADD()
494494MACHINE_CONFIG_END
trunk/src/mess/drivers/pce220.c
r18138r18139
9494   DECLARE_PALETTE_INIT(pce220);
9595   DECLARE_INPUT_CHANGED_MEMBER(kb_irq);
9696   DECLARE_INPUT_CHANGED_MEMBER(on_irq);
97   TIMER_DEVICE_CALLBACK_MEMBER(pce220_timer_callback);
9798};
9899
99100class pcg850v_state : public pce220_state
r18138r18139
900901   m_lcd_read_mode = 0;
901902}
902903
903static TIMER_DEVICE_CALLBACK(pce220_timer_callback)
904TIMER_DEVICE_CALLBACK_MEMBER(pce220_state::pce220_timer_callback)
904905{
905   pce220_state *state = timer.machine().driver_data<pce220_state>();
906906
907   state->m_timer_status = !state->m_timer_status;
907   m_timer_status = !m_timer_status;
908908
909   if (state->m_irq_mask & IRQ_FLAG_TIMER)
909   if (m_irq_mask & IRQ_FLAG_TIMER)
910910   {
911      state->m_maincpu->set_input_line(0, HOLD_LINE );
911      m_maincpu->set_input_line(0, HOLD_LINE );
912912
913      state->m_irq_flag = (state->m_irq_flag & 0xfb) | (state->m_timer_status<<2);
913      m_irq_flag = (m_irq_flag & 0xfb) | (m_timer_status<<2);
914914   }
915915}
916916
r18138r18139
945945   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
946946   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
947947
948   MCFG_TIMER_ADD_PERIODIC("pce220_timer", pce220_timer_callback, attotime::from_msec(468))
948   MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pce220_state, pce220_timer_callback, attotime::from_msec(468))
949949
950950   MCFG_NVRAM_ADD_0FILL("nvram")
951951
r18138r18139
980980   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
981981   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
982982
983   MCFG_TIMER_ADD_PERIODIC("pce220_timer", pce220_timer_callback, attotime::from_msec(468))
983   MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pce220_state, pce220_timer_callback, attotime::from_msec(468))
984984
985985   MCFG_NVRAM_ADD_0FILL("nvram")
986986
trunk/src/mess/drivers/mc10.c
r18138r18139
7575   DECLARE_WRITE8_MEMBER( mc10_port2_w );
7676   DECLARE_READ8_MEMBER( mc10_mc6847_videoram_r );
7777   DECLARE_DRIVER_INIT(mc10);
78   TIMER_DEVICE_CALLBACK_MEMBER(alice32_scanline);
7879};
7980
8081
r18138r18139
223224   return m_ram_base[offset];
224225}
225226
226static TIMER_DEVICE_CALLBACK( alice32_scanline )
227TIMER_DEVICE_CALLBACK_MEMBER(mc10_state::alice32_scanline)
227228{
228   mc10_state *state = timer.machine().driver_data<mc10_state>();
229229
230   state->m_ef9345->update_scanline((UINT16)param);
230   m_ef9345->update_scanline((UINT16)param);
231231}
232232
233233/***************************************************************************
r18138r18139
551551   MCFG_PALETTE_LENGTH(8)
552552
553553   MCFG_EF9345_ADD("ef9345", alice32_ef9345_config)
554   MCFG_TIMER_ADD_SCANLINE("alice32_sl", alice32_scanline, "screen", 0, 10)
554   MCFG_TIMER_DRIVER_ADD_SCANLINE("alice32_sl", mc10_state, alice32_scanline, "screen", 0, 10)
555555
556556   /* sound hardware */
557557   MCFG_SPEAKER_STANDARD_MONO("mono")
trunk/src/mess/drivers/fk1.c
r18138r18139
5252   UINT8 m_int_vector;
5353   virtual void machine_reset();
5454   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
55   TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
56   TIMER_DEVICE_CALLBACK_MEMBER(vsync_callback);
5557};
5658
5759
r18138r18139
382384      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
383385INPUT_PORTS_END
384386
385static TIMER_DEVICE_CALLBACK(keyboard_callback)
387TIMER_DEVICE_CALLBACK_MEMBER(fk1_state::keyboard_callback)
386388{
387   fk1_state *state = timer.machine().driver_data<fk1_state>();
388389
389   if (timer.machine().root_device().ioport("LINE0")->read())
390   if (machine().root_device().ioport("LINE0")->read())
390391   {
391      state->m_int_vector = 6;
392      timer.machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE);
392      m_int_vector = 6;
393      machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE);
393394   }
394395}
395396
r18138r18139
412413   return state->m_int_vector * 2;
413414}
414415
415static TIMER_DEVICE_CALLBACK( vsync_callback )
416TIMER_DEVICE_CALLBACK_MEMBER(fk1_state::vsync_callback)
416417{
417   fk1_state *state = timer.machine().driver_data<fk1_state>();
418418
419   state->m_int_vector = 3;
420   timer.machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE);
419   m_int_vector = 3;
420   machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE);
421421}
422422
423423
r18138r18139
482482   MCFG_RAM_ADD(RAM_TAG)
483483   MCFG_RAM_DEFAULT_SIZE("80K") // 64 + 16
484484
485   MCFG_TIMER_ADD_PERIODIC("keyboard_timer", keyboard_callback, attotime::from_hz(24000))
486   MCFG_TIMER_ADD_PERIODIC("vsync_timer", vsync_callback, attotime::from_hz(50))
485   MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", fk1_state, keyboard_callback, attotime::from_hz(24000))
486   MCFG_TIMER_DRIVER_ADD_PERIODIC("vsync_timer", fk1_state, vsync_callback, attotime::from_hz(50))
487487MACHINE_CONFIG_END
488488
489489/* ROM definition */
trunk/src/mess/drivers/pasogo.c
r18138r18139
7171   virtual void palette_init();
7272   UINT32 screen_update_pasogo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7373   INTERRUPT_GEN_MEMBER(pasogo_interrupt);
74   TIMER_DEVICE_CALLBACK_MEMBER(vg230_timer);
7475};
7576
7677
77static TIMER_DEVICE_CALLBACK( vg230_timer )
78TIMER_DEVICE_CALLBACK_MEMBER(pasogo_state::vg230_timer)
7879{
79   pasogo_state *state = timer.machine().driver_data<pasogo_state>();
80   vg230_t *vg230 = &state->m_vg230;
80   vg230_t *vg230 = &m_vg230;
8181
8282   vg230->rtc.seconds+=1;
8383   if (vg230->rtc.seconds>=60)
r18138r18139
532532   MCFG_CARTSLOT_INTERFACE("pasogo_cart")
533533   MCFG_SOFTWARE_LIST_ADD("cart_list","pasogo")
534534
535   MCFG_TIMER_ADD_PERIODIC("vg230_timer", vg230_timer, attotime::from_hz(1))
535   MCFG_TIMER_DRIVER_ADD_PERIODIC("vg230_timer", pasogo_state, vg230_timer, attotime::from_hz(1))
536536MACHINE_CONFIG_END
537537
538538
trunk/src/mess/drivers/glasgow.c
r18138r18139
8585   virtual void machine_start();
8686   virtual void machine_reset();
8787   DECLARE_MACHINE_START(dallas32);
88   TIMER_DEVICE_CALLBACK_MEMBER(update_nmi);
89   TIMER_DEVICE_CALLBACK_MEMBER(update_nmi32);
8890};
8991
9092
r18138r18139
273275   m_beeper = data;
274276}
275277
276static TIMER_DEVICE_CALLBACK( update_nmi )
278TIMER_DEVICE_CALLBACK_MEMBER(glasgow_state::update_nmi)
277279{
278   timer.machine().device("maincpu")->execute().set_input_line(7, HOLD_LINE);
280   machine().device("maincpu")->execute().set_input_line(7, HOLD_LINE);
279281}
280282
281static TIMER_DEVICE_CALLBACK( update_nmi32 )
283TIMER_DEVICE_CALLBACK_MEMBER(glasgow_state::update_nmi32)
282284{
283   timer.machine().device("maincpu")->execute().set_input_line(6, HOLD_LINE);
285   machine().device("maincpu")->execute().set_input_line(6, HOLD_LINE);
284286}
285287
286288void glasgow_state::machine_start()
r18138r18139
514516   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
515517   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
516518
517   MCFG_TIMER_ADD_PERIODIC("nmi_timer", update_nmi, attotime::from_hz(50))
519   MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", glasgow_state, update_nmi, attotime::from_hz(50))
518520   MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
519521MACHINE_CONFIG_END
520522
r18138r18139
531533   MCFG_MACHINE_START_OVERRIDE(glasgow_state, dallas32 )
532534
533535   MCFG_DEVICE_REMOVE("nmi_timer")
534   MCFG_TIMER_ADD_PERIODIC("nmi_timer", update_nmi32, attotime::from_hz(50))
536   MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", glasgow_state, update_nmi32, attotime::from_hz(50))
535537
536538MACHINE_CONFIG_END
537539

Previous 199869 Revisions Next


© 1997-2024 The MAME Team