trunk/src/mame/drivers/m10.c
r22825 | r22826 | |
499 | 499 | if (param == 0) |
500 | 500 | { |
501 | 501 | m_maincpu->set_input_line(0, ASSERT_LINE); |
502 | | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(IREMM10_VBSTART + 16), timer_expired_delegate(FUNC(m10_state::interrupt_callback),this), 1); |
| 502 | timer_set(machine().primary_screen->time_until_pos(IREMM10_VBSTART + 16), TIMER_INTERRUPT, 1); |
503 | 503 | } |
504 | 504 | if (param == 1) |
505 | 505 | { |
506 | 506 | m_maincpu->set_input_line(0, ASSERT_LINE); |
507 | | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(IREMM10_VBSTART + 24), timer_expired_delegate(FUNC(m10_state::interrupt_callback),this), 2); |
| 507 | timer_set(machine().primary_screen->time_until_pos(IREMM10_VBSTART + 24), TIMER_INTERRUPT, 2); |
508 | 508 | } |
509 | 509 | if (param == -1) |
510 | 510 | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 511 | } |
511 | 512 | |
| 513 | void m10_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 514 | { |
| 515 | switch (id) |
| 516 | { |
| 517 | case TIMER_INTERRUPT: |
| 518 | interrupt_callback(ptr, param); |
| 519 | break; |
| 520 | default: |
| 521 | assert_always(FALSE, "Unknown id in m10_state::device_timer"); |
| 522 | } |
512 | 523 | } |
513 | 524 | |
514 | 525 | #if 0 |
515 | 526 | INTERRUPT_GEN_MEMBER(m10_state::m11_interrupt) |
516 | 527 | { |
517 | 528 | device.execute().set_input_line(0, ASSERT_LINE); |
518 | | //machine().scheduler().timer_set(machine.primary_screen->time_until_pos(IREMM10_VBEND), timer_expired_delegate(FUNC(m10_state::interrupt_callback),this), -1); |
| 529 | //timer_set(machine.primary_screen->time_until_pos(IREMM10_VBEND), TIMER_INTERRUPT, -1); |
519 | 530 | } |
520 | 531 | |
521 | 532 | INTERRUPT_GEN_MEMBER(m10_state::m10_interrupt) |
r22825 | r22826 | |
527 | 538 | INTERRUPT_GEN_MEMBER(m10_state::m15_interrupt) |
528 | 539 | { |
529 | 540 | device.execute().set_input_line(0, ASSERT_LINE); |
530 | | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(IREMM10_VBSTART + 1, 80), timer_expired_delegate(FUNC(m10_state::interrupt_callback),this), -1); |
| 541 | timer_set(machine().primary_screen->time_until_pos(IREMM10_VBSTART + 1, 80), TIMER_INTERRUPT, -1); |
531 | 542 | } |
532 | 543 | |
533 | 544 | /************************************* |
trunk/src/mame/drivers/mjsister.c
r22825 | r22826 | |
17 | 17 | class mjsister_state : public driver_device |
18 | 18 | { |
19 | 19 | public: |
| 20 | enum |
| 21 | { |
| 22 | TIMER_DAC |
| 23 | }; |
| 24 | |
20 | 25 | mjsister_state(const machine_config &mconfig, device_type type, const char *tag) |
21 | 26 | : driver_device(mconfig, type, tag), |
22 | 27 | m_maincpu(*this, "maincpu") { } |
r22825 | r22826 | |
58 | 63 | DECLARE_WRITE8_MEMBER(mjsister_input_sel1_w); |
59 | 64 | DECLARE_WRITE8_MEMBER(mjsister_input_sel2_w); |
60 | 65 | DECLARE_READ8_MEMBER(mjsister_keys_r); |
| 66 | TIMER_CALLBACK_MEMBER(dac_callback); |
61 | 67 | virtual void machine_start(); |
62 | 68 | virtual void machine_reset(); |
63 | 69 | virtual void video_start(); |
64 | 70 | UINT32 screen_update_mjsister(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
65 | | TIMER_CALLBACK_MEMBER(dac_callback); |
66 | 71 | void mjsister_redraw(); |
67 | 72 | void mjsister_plot0( int offset, UINT8 data ); |
68 | 73 | void mjsister_plot1( int offset, UINT8 data ); |
| 74 | |
| 75 | protected: |
| 76 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
69 | 77 | }; |
70 | 78 | |
71 | 79 | |
r22825 | r22826 | |
168 | 176 | * |
169 | 177 | *************************************/ |
170 | 178 | |
| 179 | void mjsister_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 180 | { |
| 181 | switch(id) |
| 182 | { |
| 183 | case TIMER_DAC: |
| 184 | dac_callback(ptr, param); |
| 185 | break; |
| 186 | default: |
| 187 | assert_always(FALSE, "Unknown id in mjsister_state::device_timer"); |
| 188 | } |
| 189 | } |
| 190 | |
171 | 191 | TIMER_CALLBACK_MEMBER(mjsister_state::dac_callback) |
172 | 192 | { |
173 | 193 | UINT8 *DACROM = memregion("samples")->base(); |
r22825 | r22826 | |
175 | 195 | m_dac->write_unsigned8(DACROM[(m_dac_bank * 0x10000 + m_dac_adr++) & 0x1ffff]); |
176 | 196 | |
177 | 197 | if (((m_dac_adr & 0xff00 ) >> 8) != m_dac_adr_e) |
178 | | machine().scheduler().timer_set(attotime::from_hz(MCLK) * 1024, timer_expired_delegate(FUNC(mjsister_state::dac_callback),this)); |
| 198 | timer_set(attotime::from_hz(MCLK) * 1024, TIMER_DAC); |
179 | 199 | else |
180 | 200 | m_dac_busy = 0; |
181 | 201 | } |
r22825 | r22826 | |
191 | 211 | m_dac_adr = m_dac_adr_s << 8; |
192 | 212 | |
193 | 213 | if (m_dac_busy == 0) |
194 | | machine().scheduler().synchronize(timer_expired_delegate(FUNC(mjsister_state::dac_callback),this)); |
| 214 | synchronize(TIMER_DAC); |
195 | 215 | |
196 | 216 | m_dac_busy = 1; |
197 | 217 | } |
trunk/src/mame/drivers/wgp.c
r22825 | r22826 | |
439 | 439 | INTERRUPTS |
440 | 440 | ***********************************************************/ |
441 | 441 | |
442 | | /* 68000 A */ |
443 | | |
444 | | #ifdef UNUSED_FUNCTION |
445 | | TIMER_CALLBACK_MEMBER(wgp_state::wgp_interrupt4) |
| 442 | void wgp_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
446 | 443 | { |
447 | | m_maincpu->set_input_line(4, HOLD_LINE); |
| 444 | switch (id) |
| 445 | { |
| 446 | /* 68000 A */ |
| 447 | case TIMER_WGP_INTERRUPT4: |
| 448 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 449 | break; |
| 450 | case TIMER_WGP_INTERRUPT6: |
| 451 | m_maincpu->set_input_line(6, HOLD_LINE); |
| 452 | break; |
| 453 | /* 68000 B */ |
| 454 | case TIMER_WGP_CPUB_INTERRUPT6: |
| 455 | m_subcpu->set_input_line(6, HOLD_LINE); /* assumes Z80 sandwiched between the 68Ks */ |
| 456 | break; |
| 457 | default: |
| 458 | assert_always(FALSE, "Unknown id in wgp_state::device_timer"); |
| 459 | } |
448 | 460 | } |
449 | | #endif |
450 | 461 | |
451 | | TIMER_CALLBACK_MEMBER(wgp_state::wgp_interrupt6) |
452 | | { |
453 | | m_maincpu->set_input_line(6, HOLD_LINE); |
454 | | } |
455 | 462 | |
456 | | /* 68000 B */ |
457 | | |
458 | | TIMER_CALLBACK_MEMBER(wgp_state::wgp_cpub_interrupt6) |
459 | | { |
460 | | m_subcpu->set_input_line(6, HOLD_LINE); /* assumes Z80 sandwiched between the 68Ks */ |
461 | | } |
462 | | |
463 | | |
464 | | |
465 | 463 | /***** Routines for particular games *****/ |
466 | 464 | |
467 | 465 | /* FWIW offset of 10000,10500 on ints can get CPUB obeying the |
r22825 | r22826 | |
469 | 467 | |
470 | 468 | INTERRUPT_GEN_MEMBER(wgp_state::wgp_cpub_interrupt) |
471 | 469 | { |
472 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(200000-500), timer_expired_delegate(FUNC(wgp_state::wgp_cpub_interrupt6),this)); |
| 470 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(200000-500), TIMER_WGP_CPUB_INTERRUPT6); |
473 | 471 | device.execute().set_input_line(4, HOLD_LINE); |
474 | 472 | } |
475 | 473 | |
r22825 | r22826 | |
592 | 590 | hardware has got the next a/d conversion ready. We set a token |
593 | 591 | delay of 10000 cycles although our inputs are always ready. */ |
594 | 592 | |
595 | | machine().scheduler().timer_set(downcast<cpu_device *>(&space.device())->cycles_to_attotime(10000), timer_expired_delegate(FUNC(wgp_state::wgp_interrupt6),this)); |
| 593 | timer_set(downcast<cpu_device *>(&space.device())->cycles_to_attotime(10000), TIMER_WGP_INTERRUPT6); |
596 | 594 | } |
597 | 595 | |
598 | 596 | |
trunk/src/mame/drivers/topspeed.c
r22825 | r22826 | |
319 | 319 | INTERRUPTS |
320 | 320 | ***********************************************************/ |
321 | 321 | |
322 | | /* 68000 A */ |
323 | | |
324 | | TIMER_CALLBACK_MEMBER(topspeed_state::topspeed_interrupt6) |
| 322 | void topspeed_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
325 | 323 | { |
326 | | m_maincpu->set_input_line(6, HOLD_LINE); |
| 324 | switch (id) |
| 325 | { |
| 326 | /* 68000 A */ |
| 327 | case TIMER_TOPSPEED_INTERRUPT6: |
| 328 | m_maincpu->set_input_line(6, HOLD_LINE); |
| 329 | break; |
| 330 | /* 68000 B */ |
| 331 | case TIMER_TOPSPEED_CPUB_INTERRUPT6: |
| 332 | m_subcpu->set_input_line(6, HOLD_LINE); /* assumes Z80 sandwiched between the 68Ks */ |
| 333 | break; |
| 334 | default: |
| 335 | assert_always(FALSE, "Unknown id in topspeed_state::device_timer"); |
| 336 | } |
327 | 337 | } |
328 | 338 | |
329 | | /* 68000 B */ |
330 | 339 | |
331 | | TIMER_CALLBACK_MEMBER(topspeed_state::topspeed_cpub_interrupt6) |
332 | | { |
333 | | m_subcpu->set_input_line(6, HOLD_LINE); /* assumes Z80 sandwiched between the 68Ks */ |
334 | | } |
335 | | |
336 | | |
337 | 340 | INTERRUPT_GEN_MEMBER(topspeed_state::topspeed_interrupt) |
338 | 341 | { |
339 | 342 | /* Unsure how many int6's per frame */ |
340 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(200000 - 500), timer_expired_delegate(FUNC(topspeed_state::topspeed_interrupt6),this)); |
| 343 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(200000 - 500), TIMER_TOPSPEED_INTERRUPT6); |
341 | 344 | device.execute().set_input_line(5, HOLD_LINE); |
342 | 345 | } |
343 | 346 | |
344 | 347 | INTERRUPT_GEN_MEMBER(topspeed_state::topspeed_cpub_interrupt) |
345 | 348 | { |
346 | 349 | /* Unsure how many int6's per frame */ |
347 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(200000 - 500), timer_expired_delegate(FUNC(topspeed_state::topspeed_cpub_interrupt6),this)); |
| 350 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(200000 - 500), TIMER_TOPSPEED_CPUB_INTERRUPT6); |
348 | 351 | device.execute().set_input_line(5, HOLD_LINE); |
349 | 352 | } |
350 | 353 | |
trunk/src/mame/drivers/gottlieb.c
r22825 | r22826 | |
236 | 236 | m_maincpu->space(AS_PROGRAM).install_write_handler(0x05806, 0x05806, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::laserdisc_select_w),this)); |
237 | 237 | |
238 | 238 | /* allocate a timer for serial transmission, and one for philips code processing */ |
239 | | m_laserdisc_bit_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gottlieb_state::laserdisc_bit_callback),this)); |
240 | | m_laserdisc_philips_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gottlieb_state::laserdisc_philips_callback),this)); |
| 239 | m_laserdisc_bit_timer = timer_alloc(TIMER_LASERDISC_BIT); |
| 240 | m_laserdisc_philips_timer = timer_alloc(TIMER_LASERDISC_PHILIPS); |
241 | 241 | |
242 | 242 | /* create some audio RAM */ |
243 | 243 | m_laserdisc_audio_buffer = auto_alloc_array(machine(), UINT8, AUDIORAM_SIZE); |
r22825 | r22826 | |
458 | 458 | |
459 | 459 | /* assert the line and set a timer for deassertion */ |
460 | 460 | m_laserdisc->control_w(ASSERT_LINE); |
461 | | machine().scheduler().timer_set(LASERDISC_CLOCK * 10, timer_expired_delegate(FUNC(gottlieb_state::laserdisc_bit_off_callback),this)); |
| 461 | timer_set(LASERDISC_CLOCK * 10, TIMER_LASERDISC_BIT_OFF); |
462 | 462 | |
463 | 463 | /* determine how long for the next command; there is a 555 timer with a |
464 | 464 | variable resistor controlling the timing of the pulses. Nominally, the |
r22825 | r22826 | |
644 | 644 | |
645 | 645 | |
646 | 646 | |
647 | | /************************************* |
648 | | * |
649 | | * Interrupt generation |
650 | | * |
651 | | *************************************/ |
| 647 | /************************************* |
| 648 | * |
| 649 | * Interrupt generation |
| 650 | * |
| 651 | *************************************/ |
652 | 652 | |
| 653 | void gottlieb_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 654 | { |
| 655 | switch (id) |
| 656 | { |
| 657 | case TIMER_LASERDISC_PHILIPS: |
| 658 | laserdisc_philips_callback(ptr, param); |
| 659 | break; |
| 660 | case TIMER_LASERDISC_BIT_OFF: |
| 661 | laserdisc_bit_off_callback(ptr, param); |
| 662 | break; |
| 663 | case TIMER_LASERDISC_BIT: |
| 664 | laserdisc_bit_callback(ptr, param); |
| 665 | break; |
| 666 | case TIMER_NMI_CLEAR: |
| 667 | nmi_clear(ptr, param); |
| 668 | break; |
| 669 | default: |
| 670 | assert_always(FALSE, "Unknown id in gottlieb_state::device_timer"); |
| 671 | } |
| 672 | } |
| 673 | |
653 | 674 | TIMER_CALLBACK_MEMBER(gottlieb_state::nmi_clear) |
654 | 675 | { |
655 | 676 | m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); |
r22825 | r22826 | |
660 | 681 | { |
661 | 682 | /* assert the NMI and set a timer to clear it at the first visible line */ |
662 | 683 | device.execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); |
663 | | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(gottlieb_state::nmi_clear),this)); |
| 684 | timer_set(machine().primary_screen->time_until_pos(0), TIMER_NMI_CLEAR); |
664 | 685 | |
665 | 686 | /* if we have a laserdisc, update it */ |
666 | 687 | if (m_laserdisc != NULL) |
trunk/src/mame/drivers/peplus.c
r22825 | r22826 | |
178 | 178 | class peplus_state : public driver_device |
179 | 179 | { |
180 | 180 | public: |
| 181 | enum |
| 182 | { |
| 183 | TIMER_ASSERT_LP |
| 184 | }; |
| 185 | |
181 | 186 | peplus_state(const machine_config &mconfig, device_type type, const char *tag) |
182 | 187 | : driver_device(mconfig, type, tag), |
183 | 188 | m_cmos_ram(*this, "cmos") , |
r22825 | r22826 | |
268 | 273 | virtual void video_start(); |
269 | 274 | virtual void palette_init(); |
270 | 275 | UINT32 screen_update_peplus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
271 | | TIMER_CALLBACK_MEMBER(assert_lp_cb); |
272 | 276 | void peplus_load_superdata(const char *bank_name); |
273 | 277 | void peplus_init(); |
274 | 278 | required_device<cpu_device> m_maincpu; |
| 279 | |
| 280 | protected: |
| 281 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
275 | 282 | }; |
276 | 283 | |
277 | 284 | static const UINT8 id_022[8] = { 0x00, 0x01, 0x04, 0x09, 0x13, 0x16, 0x18, 0x00 }; |
r22825 | r22826 | |
377 | 384 | /* Reset timing logic */ |
378 | 385 | } |
379 | 386 | |
380 | | TIMER_CALLBACK_MEMBER(peplus_state::assert_lp_cb) |
| 387 | void peplus_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
381 | 388 | { |
382 | | downcast<mc6845_device *>((device_t*)ptr)->assert_light_pen_input(); |
| 389 | switch (id) |
| 390 | { |
| 391 | case TIMER_ASSERT_LP: |
| 392 | downcast<mc6845_device *>((device_t*)ptr)->assert_light_pen_input(); |
| 393 | break; |
| 394 | default: |
| 395 | assert_always(FALSE, "Unknown id in peplus_state::device_timer"); |
| 396 | } |
383 | 397 | } |
384 | 398 | |
| 399 | |
385 | 400 | static void handle_lightpen( device_t *device ) |
386 | 401 | { |
387 | 402 | peplus_state *state = device->machine().driver_data<peplus_state>(); |
r22825 | r22826 | |
393 | 408 | xt = x_val * vis_area.width() / 1024 + vis_area.min_x; |
394 | 409 | yt = y_val * vis_area.height() / 1024 + vis_area.min_y; |
395 | 410 | |
396 | | device->machine().scheduler().timer_set(device->machine().primary_screen->time_until_pos(yt, xt), timer_expired_delegate(FUNC(peplus_state::assert_lp_cb),state), 0, device); |
| 411 | state->timer_set(device->machine().primary_screen->time_until_pos(yt, xt), peplus_state::TIMER_ASSERT_LP, 0, device); |
397 | 412 | } |
398 | 413 | |
399 | 414 | WRITE_LINE_MEMBER(peplus_state::crtc_vsync) |
trunk/src/mame/drivers/simpsons.c
r22825 | r22826 | |
119 | 119 | } |
120 | 120 | #endif |
121 | 121 | |
122 | | TIMER_CALLBACK_MEMBER(simpsons_state::nmi_callback) |
| 122 | |
| 123 | void simpsons_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
123 | 124 | { |
124 | | m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); |
| 125 | switch (id) |
| 126 | { |
| 127 | case TIMER_NMI: |
| 128 | m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); |
| 129 | break; |
| 130 | case TIMER_DMAEND: |
| 131 | if (m_firq_enabled) |
| 132 | m_maincpu->set_input_line(KONAMI_FIRQ_LINE, HOLD_LINE); |
| 133 | break; |
| 134 | default: |
| 135 | assert_always(FALSE, "Unknown id in simpsons_state::device_timer"); |
| 136 | } |
125 | 137 | } |
126 | 138 | |
| 139 | |
127 | 140 | WRITE8_MEMBER(simpsons_state::z80_arm_nmi_w) |
128 | 141 | { |
129 | 142 | m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); |
130 | | machine().scheduler().timer_set(attotime::from_usec(25), timer_expired_delegate(FUNC(simpsons_state::nmi_callback),this)); /* kludge until the K053260 is emulated correctly */ |
| 143 | timer_set(attotime::from_usec(25), TIMER_NMI); /* kludge until the K053260 is emulated correctly */ |
131 | 144 | } |
132 | 145 | |
133 | 146 | static ADDRESS_MAP_START( z80_map, AS_PROGRAM, 8, simpsons_state ) |
r22825 | r22826 | |
249 | 262 | if (num_inactive) do { *dst = 0; dst += 8; } while (--num_inactive); |
250 | 263 | } |
251 | 264 | |
252 | | TIMER_CALLBACK_MEMBER(simpsons_state::dmaend_callback) |
253 | | { |
254 | | if (m_firq_enabled) |
255 | | m_maincpu->set_input_line(KONAMI_FIRQ_LINE, HOLD_LINE); |
256 | | } |
257 | | |
258 | | |
259 | 265 | INTERRUPT_GEN_MEMBER(simpsons_state::simpsons_irq) |
260 | 266 | { |
261 | 267 | if (k053246_is_irq_enabled(m_k053246)) |
262 | 268 | { |
263 | 269 | simpsons_objdma(); |
264 | 270 | // 32+256us delay at 8MHz dotclock; artificially shortened since actual V-blank length is unknown |
265 | | machine().scheduler().timer_set(attotime::from_usec(30), timer_expired_delegate(FUNC(simpsons_state::dmaend_callback),this)); |
| 271 | timer_set(attotime::from_usec(30), TIMER_DMAEND); |
266 | 272 | } |
267 | 273 | |
268 | 274 | if (k052109_is_irq_enabled(m_k052109)) |
trunk/src/mame/drivers/kinst.c
r22825 | r22826 | |
139 | 139 | class kinst_state : public driver_device |
140 | 140 | { |
141 | 141 | public: |
| 142 | enum |
| 143 | { |
| 144 | TIMER_IRQ0_STOP |
| 145 | }; |
| 146 | |
142 | 147 | kinst_state(const machine_config &mconfig, device_type type, const char *tag) |
143 | 148 | : driver_device(mconfig, type, tag), |
144 | 149 | m_rambase(*this, "rambase"), |
r22825 | r22826 | |
166 | 171 | virtual void machine_reset(); |
167 | 172 | UINT32 screen_update_kinst(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
168 | 173 | INTERRUPT_GEN_MEMBER(irq0_start); |
169 | | TIMER_CALLBACK_MEMBER(irq0_stop); |
170 | 174 | required_device<cpu_device> m_maincpu; |
| 175 | |
| 176 | protected: |
| 177 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
171 | 178 | }; |
172 | 179 | |
173 | 180 | |
r22825 | r22826 | |
280 | 287 | * |
281 | 288 | *************************************/ |
282 | 289 | |
283 | | TIMER_CALLBACK_MEMBER(kinst_state::irq0_stop) |
| 290 | void kinst_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
284 | 291 | { |
285 | | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 292 | switch (id) |
| 293 | { |
| 294 | case TIMER_IRQ0_STOP: |
| 295 | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 296 | break; |
| 297 | default: |
| 298 | assert_always(FALSE, "Unknown id in kinst_state::device_timer"); |
| 299 | } |
286 | 300 | } |
287 | 301 | |
288 | 302 | |
289 | 303 | INTERRUPT_GEN_MEMBER(kinst_state::irq0_start) |
290 | 304 | { |
291 | 305 | device.execute().set_input_line(0, ASSERT_LINE); |
292 | | machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(kinst_state::irq0_stop),this)); |
| 306 | timer_set(attotime::from_usec(50), TIMER_IRQ0_STOP); |
293 | 307 | } |
294 | 308 | |
295 | 309 | |
trunk/src/mame/drivers/boxer.c
r22825 | r22826 | |
23 | 23 | class boxer_state : public driver_device |
24 | 24 | { |
25 | 25 | public: |
| 26 | enum |
| 27 | { |
| 28 | TIMER_POT_INTERRUPT, |
| 29 | TIMER_PERIODIC |
| 30 | }; |
| 31 | |
26 | 32 | boxer_state(const machine_config &mconfig, device_type type, const char *tag) |
27 | 33 | : driver_device(mconfig, type, tag), |
28 | 34 | m_tile_ram(*this, "tile_ram"), |
r22825 | r22826 | |
54 | 60 | TIMER_CALLBACK_MEMBER(pot_interrupt); |
55 | 61 | TIMER_CALLBACK_MEMBER(periodic_callback); |
56 | 62 | void draw_boxer( bitmap_ind16 &bitmap, const rectangle &cliprect ); |
| 63 | |
| 64 | protected: |
| 65 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
57 | 66 | }; |
58 | 67 | |
59 | 68 | /************************************* |
r22825 | r22826 | |
62 | 71 | * |
63 | 72 | *************************************/ |
64 | 73 | |
| 74 | void boxer_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 75 | { |
| 76 | switch(id) |
| 77 | { |
| 78 | case TIMER_POT_INTERRUPT: |
| 79 | pot_interrupt(ptr, param); |
| 80 | break; |
| 81 | case TIMER_PERIODIC: |
| 82 | periodic_callback(ptr, param); |
| 83 | break; |
| 84 | default: |
| 85 | assert_always(FALSE, "Unknown id in boxer_state::device_timer"); |
| 86 | } |
| 87 | } |
| 88 | |
65 | 89 | TIMER_CALLBACK_MEMBER(boxer_state::pot_interrupt) |
66 | 90 | { |
67 | 91 | int mask = param; |
r22825 | r22826 | |
96 | 120 | |
97 | 121 | for (i = 1; i < 256; i++) |
98 | 122 | if (mask[i] != 0) |
99 | | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(i), timer_expired_delegate(FUNC(boxer_state::pot_interrupt),this), mask[i]); |
| 123 | timer_set(machine().primary_screen->time_until_pos(i), TIMER_POT_INTERRUPT, mask[i]); |
100 | 124 | |
101 | 125 | m_pot_state = 0; |
102 | 126 | } |
r22825 | r22826 | |
106 | 130 | if (scanline >= 262) |
107 | 131 | scanline = 0; |
108 | 132 | |
109 | | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(boxer_state::periodic_callback),this), scanline); |
| 133 | timer_set(machine().primary_screen->time_until_pos(scanline), TIMER_PERIODIC, scanline); |
110 | 134 | } |
111 | 135 | |
112 | 136 | |
r22825 | r22826 | |
434 | 458 | |
435 | 459 | void boxer_state::machine_reset() |
436 | 460 | { |
437 | | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(boxer_state::periodic_callback),this)); |
| 461 | timer_set(machine().primary_screen->time_until_pos(0), TIMER_PERIODIC); |
438 | 462 | |
439 | 463 | m_pot_state = 0; |
440 | 464 | m_pot_latch = 0; |
trunk/src/mame/drivers/gcpinbal.c
r22825 | r22826 | |
47 | 47 | INTERRUPTS |
48 | 48 | ***********************************************************/ |
49 | 49 | |
50 | | TIMER_CALLBACK_MEMBER(gcpinbal_state::gcpinbal_interrupt1) |
| 50 | void gcpinbal_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
51 | 51 | { |
52 | | m_maincpu->set_input_line(1, HOLD_LINE); |
53 | | } |
54 | | |
55 | | #ifdef UNUSED_FUNCTION |
56 | | TIMER_CALLBACK_MEMBER(gcpinbal_state::gcpinbal_interrupt3) |
57 | | { |
58 | | // IRQ3 is from the M6585 |
59 | | // if (!ADPCM_playing(0)) |
| 52 | switch (id) |
60 | 53 | { |
61 | | m_maincpu->set_input_line(3, HOLD_LINE); |
| 54 | case TIMER_GCPINBAL_INTERRUPT1: |
| 55 | m_maincpu->set_input_line(1, HOLD_LINE); |
| 56 | break; |
| 57 | case TIMER_GCPINBAL_INTERRUPT3: |
| 58 | // IRQ3 is from the M6585 |
| 59 | //if (!ADPCM_playing(0)) |
| 60 | { |
| 61 | m_maincpu->set_input_line(3, HOLD_LINE); |
| 62 | } |
| 63 | break; |
| 64 | default: |
| 65 | assert_always(FALSE, "Unknown id in gcpinbal_state::device_timer"); |
62 | 66 | } |
63 | 67 | } |
64 | | #endif |
65 | 68 | |
66 | 69 | INTERRUPT_GEN_MEMBER(gcpinbal_state::gcpinbal_interrupt) |
67 | 70 | { |
68 | 71 | /* Unsure of actual sequence */ |
69 | 72 | |
70 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(500), timer_expired_delegate(FUNC(gcpinbal_state::gcpinbal_interrupt1),this)); |
71 | | // machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(1000), timer_expired_delegate(FUNC(gcpinbal_state::gcpinbal_interrupt3),this)); |
| 73 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(500), TIMER_GCPINBAL_INTERRUPT1); |
| 74 | // timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(1000), TIMER_GCPINBAL_INTERRUPT3); |
72 | 75 | device.execute().set_input_line(4, HOLD_LINE); |
73 | 76 | } |
74 | 77 | |
trunk/src/mame/drivers/taito_b.c
r22825 | r22826 | |
196 | 196 | membank("bank1")->set_entry((data - 1) & 3); |
197 | 197 | } |
198 | 198 | |
199 | | TIMER_CALLBACK_MEMBER(taitob_state::rsaga2_interrupt2) |
| 199 | void taitob_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
200 | 200 | { |
201 | | m_maincpu->set_input_line(2, HOLD_LINE); |
| 201 | switch (id) |
| 202 | { |
| 203 | case RSAGA2_INTERRUPT2: |
| 204 | m_maincpu->set_input_line(2, HOLD_LINE); |
| 205 | break; |
| 206 | case CRIMEC_INTERRUPT3: |
| 207 | m_maincpu->set_input_line(3, HOLD_LINE); |
| 208 | break; |
| 209 | case HITICE_INTERRUPT6: |
| 210 | m_maincpu->set_input_line(6, HOLD_LINE); |
| 211 | break; |
| 212 | case RAMBO3_INTERRUPT1: |
| 213 | m_maincpu->set_input_line(1, HOLD_LINE); |
| 214 | break; |
| 215 | case PBOBBLE_INTERRUPT5: |
| 216 | m_maincpu->set_input_line(5, HOLD_LINE); |
| 217 | break; |
| 218 | case VIOFIGHT_INTERRUPT1: |
| 219 | m_maincpu->set_input_line(1, HOLD_LINE); |
| 220 | break; |
| 221 | case MASTERW_INTERRUPT4: |
| 222 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 223 | break; |
| 224 | case SILENTD_INTERRUPT4: |
| 225 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 226 | break; |
| 227 | case SELFEENA_INTERRUPT4: |
| 228 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 229 | break; |
| 230 | case SBM_INTERRUPT5: |
| 231 | m_maincpu->set_input_line(5, HOLD_LINE); |
| 232 | break; |
| 233 | case REALPUNC_INTERRUPT3: |
| 234 | m_maincpu->set_input_line(3, HOLD_LINE); |
| 235 | break; |
| 236 | default: |
| 237 | assert_always(FALSE, "Unknown id in taitob_state::device_timer"); |
| 238 | } |
202 | 239 | } |
203 | 240 | |
| 241 | |
204 | 242 | INTERRUPT_GEN_MEMBER(taitob_state::rastansaga2_interrupt) |
205 | 243 | { |
206 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), timer_expired_delegate(FUNC(taitob_state::rsaga2_interrupt2),this)); |
| 244 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), RSAGA2_INTERRUPT2); |
207 | 245 | device.execute().set_input_line(4, HOLD_LINE); |
208 | 246 | } |
209 | 247 | |
210 | | |
211 | | TIMER_CALLBACK_MEMBER(taitob_state::crimec_interrupt3) |
212 | | { |
213 | | m_maincpu->set_input_line(3, HOLD_LINE); |
214 | | } |
215 | | |
216 | 248 | INTERRUPT_GEN_MEMBER(taitob_state::crimec_interrupt) |
217 | 249 | { |
218 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), timer_expired_delegate(FUNC(taitob_state::crimec_interrupt3),this)); |
| 250 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), CRIMEC_INTERRUPT3); |
219 | 251 | device.execute().set_input_line(5, HOLD_LINE); |
220 | 252 | } |
221 | 253 | |
222 | | |
223 | | TIMER_CALLBACK_MEMBER(taitob_state::hitice_interrupt6) |
224 | | { |
225 | | m_maincpu->set_input_line(6, HOLD_LINE); |
226 | | } |
227 | | |
228 | 254 | INTERRUPT_GEN_MEMBER(taitob_state::hitice_interrupt) |
229 | 255 | { |
230 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), timer_expired_delegate(FUNC(taitob_state::hitice_interrupt6),this)); |
| 256 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), HITICE_INTERRUPT6); |
231 | 257 | device.execute().set_input_line(4, HOLD_LINE); |
232 | 258 | } |
233 | 259 | |
234 | | |
235 | | TIMER_CALLBACK_MEMBER(taitob_state::rambo3_interrupt1) |
236 | | { |
237 | | m_maincpu->set_input_line(1, HOLD_LINE); |
238 | | } |
239 | | |
240 | 260 | INTERRUPT_GEN_MEMBER(taitob_state::rambo3_interrupt) |
241 | 261 | { |
242 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), timer_expired_delegate(FUNC(taitob_state::rambo3_interrupt1),this)); |
| 262 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), RAMBO3_INTERRUPT1); |
243 | 263 | device.execute().set_input_line(6, HOLD_LINE); |
244 | 264 | } |
245 | 265 | |
246 | | |
247 | | TIMER_CALLBACK_MEMBER(taitob_state::pbobble_interrupt5) |
248 | | { |
249 | | m_maincpu->set_input_line(5, HOLD_LINE); |
250 | | } |
251 | | |
252 | 266 | INTERRUPT_GEN_MEMBER(taitob_state::pbobble_interrupt) |
253 | 267 | { |
254 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), timer_expired_delegate(FUNC(taitob_state::pbobble_interrupt5),this)); |
| 268 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), PBOBBLE_INTERRUPT5); |
255 | 269 | device.execute().set_input_line(3, HOLD_LINE); |
256 | 270 | } |
257 | 271 | |
258 | | TIMER_CALLBACK_MEMBER(taitob_state::viofight_interrupt1) |
259 | | { |
260 | | m_maincpu->set_input_line(1, HOLD_LINE); |
261 | | } |
262 | | |
263 | 272 | INTERRUPT_GEN_MEMBER(taitob_state::viofight_interrupt) |
264 | 273 | { |
265 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), timer_expired_delegate(FUNC(taitob_state::viofight_interrupt1),this)); |
| 274 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), VIOFIGHT_INTERRUPT1); |
266 | 275 | device.execute().set_input_line(4, HOLD_LINE); |
267 | 276 | } |
268 | 277 | |
269 | | TIMER_CALLBACK_MEMBER(taitob_state::masterw_interrupt4) |
270 | | { |
271 | | m_maincpu->set_input_line(4, HOLD_LINE); |
272 | | } |
273 | | |
274 | 278 | INTERRUPT_GEN_MEMBER(taitob_state::masterw_interrupt) |
275 | 279 | { |
276 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), timer_expired_delegate(FUNC(taitob_state::masterw_interrupt4),this)); |
| 280 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), MASTERW_INTERRUPT4); |
277 | 281 | device.execute().set_input_line(5, HOLD_LINE); |
278 | 282 | } |
279 | 283 | |
280 | | TIMER_CALLBACK_MEMBER(taitob_state::silentd_interrupt4) |
281 | | { |
282 | | m_maincpu->set_input_line(4, HOLD_LINE); |
283 | | } |
284 | | |
285 | 284 | INTERRUPT_GEN_MEMBER(taitob_state::silentd_interrupt) |
286 | 285 | { |
287 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), timer_expired_delegate(FUNC(taitob_state::silentd_interrupt4),this)); |
| 286 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), SILENTD_INTERRUPT4); |
288 | 287 | device.execute().set_input_line(6, HOLD_LINE); |
289 | 288 | } |
290 | 289 | |
291 | | TIMER_CALLBACK_MEMBER(taitob_state::selfeena_interrupt4) |
292 | | { |
293 | | m_maincpu->set_input_line(4, HOLD_LINE); |
294 | | } |
295 | | |
296 | 290 | INTERRUPT_GEN_MEMBER(taitob_state::selfeena_interrupt) |
297 | 291 | { |
298 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), timer_expired_delegate(FUNC(taitob_state::selfeena_interrupt4),this)); |
| 292 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(5000), SELFEENA_INTERRUPT4); |
299 | 293 | device.execute().set_input_line(6, HOLD_LINE); |
300 | 294 | } |
301 | 295 | |
302 | | TIMER_CALLBACK_MEMBER(taitob_state::sbm_interrupt5)//4 |
303 | | { |
304 | | m_maincpu->set_input_line(5, HOLD_LINE); |
305 | | } |
306 | | |
307 | 296 | INTERRUPT_GEN_MEMBER(taitob_state::sbm_interrupt)//5 |
308 | 297 | { |
309 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(10000), timer_expired_delegate(FUNC(taitob_state::sbm_interrupt5),this)); |
| 298 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(10000), SBM_INTERRUPT5); |
310 | 299 | device.execute().set_input_line(4, HOLD_LINE); |
311 | 300 | } |
312 | 301 | |
313 | | TIMER_CALLBACK_MEMBER(taitob_state::realpunc_interrupt3)//3 |
314 | | { |
315 | | m_maincpu->set_input_line(3, HOLD_LINE); |
316 | | } |
317 | | |
318 | 302 | INTERRUPT_GEN_MEMBER(taitob_state::realpunc_interrupt)//2 |
319 | 303 | { |
320 | | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(10000), timer_expired_delegate(FUNC(taitob_state::realpunc_interrupt3),this)); |
| 304 | timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(10000), REALPUNC_INTERRUPT3); |
321 | 305 | device.execute().set_input_line(2, HOLD_LINE); |
322 | 306 | } |
323 | 307 | |
trunk/src/mame/includes/topspeed.h
r22825 | r22826 | |
9 | 9 | class topspeed_state : public driver_device |
10 | 10 | { |
11 | 11 | public: |
| 12 | enum |
| 13 | { |
| 14 | TIMER_TOPSPEED_INTERRUPT6, |
| 15 | TIMER_TOPSPEED_CPUB_INTERRUPT6 |
| 16 | }; |
| 17 | |
12 | 18 | topspeed_state(const machine_config &mconfig, device_type type, const char *tag) |
13 | 19 | : driver_device(mconfig, type, tag), |
14 | 20 | m_spritemap(*this, "spritemap"), |
r22825 | r22826 | |
68 | 74 | UINT32 screen_update_topspeed(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
69 | 75 | INTERRUPT_GEN_MEMBER(topspeed_interrupt); |
70 | 76 | INTERRUPT_GEN_MEMBER(topspeed_cpub_interrupt); |
71 | | TIMER_CALLBACK_MEMBER(topspeed_interrupt6); |
72 | | TIMER_CALLBACK_MEMBER(topspeed_cpub_interrupt6); |
73 | 77 | void topspeed_postload(); |
74 | 78 | void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); |
75 | 79 | void parse_control( ) /* assumes Z80 sandwiched between 68Ks */; |
r22825 | r22826 | |
77 | 81 | void topspeed_msm5205_clock(device_t *device, int chip); |
78 | 82 | DECLARE_WRITE_LINE_MEMBER(topspeed_msm5205_vck_1); |
79 | 83 | DECLARE_WRITE_LINE_MEMBER(topspeed_msm5205_vck_2); |
| 84 | |
| 85 | protected: |
| 86 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
80 | 87 | }; |
trunk/src/mame/includes/taito_b.h
r22825 | r22826 | |
4 | 4 | class taitob_state : public driver_device |
5 | 5 | { |
6 | 6 | public: |
| 7 | enum |
| 8 | { |
| 9 | RSAGA2_INTERRUPT2, |
| 10 | CRIMEC_INTERRUPT3, |
| 11 | HITICE_INTERRUPT6, |
| 12 | RAMBO3_INTERRUPT1, |
| 13 | PBOBBLE_INTERRUPT5, |
| 14 | VIOFIGHT_INTERRUPT1, |
| 15 | MASTERW_INTERRUPT4, |
| 16 | SILENTD_INTERRUPT4, |
| 17 | SELFEENA_INTERRUPT4, |
| 18 | SBM_INTERRUPT5, |
| 19 | REALPUNC_INTERRUPT3 |
| 20 | }; |
| 21 | |
7 | 22 | taitob_state(const machine_config &mconfig, device_type type, const char *tag) |
8 | 23 | : driver_device(mconfig, type, tag), |
9 | 24 | m_spriteram(*this, "spriteram"), |
r22825 | r22826 | |
91 | 106 | INTERRUPT_GEN_MEMBER(selfeena_interrupt); |
92 | 107 | INTERRUPT_GEN_MEMBER(sbm_interrupt); |
93 | 108 | INTERRUPT_GEN_MEMBER(realpunc_interrupt); |
94 | | TIMER_CALLBACK_MEMBER(rsaga2_interrupt2); |
95 | | TIMER_CALLBACK_MEMBER(crimec_interrupt3); |
96 | | TIMER_CALLBACK_MEMBER(hitice_interrupt6); |
97 | | TIMER_CALLBACK_MEMBER(rambo3_interrupt1); |
98 | | TIMER_CALLBACK_MEMBER(pbobble_interrupt5); |
99 | | TIMER_CALLBACK_MEMBER(viofight_interrupt1); |
100 | | TIMER_CALLBACK_MEMBER(masterw_interrupt4); |
101 | | TIMER_CALLBACK_MEMBER(silentd_interrupt4); |
102 | | TIMER_CALLBACK_MEMBER(selfeena_interrupt4); |
103 | | TIMER_CALLBACK_MEMBER(sbm_interrupt5); |
104 | | TIMER_CALLBACK_MEMBER(realpunc_interrupt3); |
105 | 109 | void hitice_clear_pixel_bitmap( ); |
106 | 110 | void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); |
107 | 111 | void draw_framebuffer( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); |
108 | 112 | void ryujin_patch(void); |
109 | 113 | void sbm_patch(void); |
110 | 114 | DECLARE_WRITE_LINE_MEMBER(irqhandler); |
| 115 | |
| 116 | protected: |
| 117 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
111 | 118 | }; |