From 70a3aadb1c9759315527b22b04d35f0e3fbe9b2d Mon Sep 17 00:00:00 2001 From: Andrew Gardner Date: Tue, 21 May 2013 15:03:21 +0000 Subject: [PATCH] Removes more MAME anonymous timers. [Andrew Gardner] --- src/mame/drivers/midvunit.c | 8 +----- src/mame/drivers/tubep.c | 23 +++++++++++++++-- src/mame/includes/amiga.h | 10 ++++++++ src/mame/includes/astrocde.h | 10 +++++++- src/mame/includes/blstroid.h | 11 +++++++-- src/mame/includes/bublbobl.h | 11 +++++++-- src/mame/includes/cchasm.h | 9 ++++++- src/mame/includes/dcheese.h | 11 +++++++-- src/mame/includes/exidy.h | 9 ++++++- src/mame/includes/exidy440.h | 2 +- src/mame/includes/gameplan.h | 10 ++++++++ src/mame/includes/hyhoo.h | 9 ++++++- src/mame/includes/lethalj.h | 9 ++++++- src/mame/includes/m92.h | 9 ++++++- src/mame/includes/micro3d.h | 9 +++++++ src/mame/includes/midtunit.h | 10 +++++++- src/mame/includes/midvunit.h | 10 +++++++- src/mame/includes/midyunit.h | 10 ++++++++ src/mame/includes/nbmj8688.h | 9 ++++++- src/mame/includes/nbmj8891.h | 9 ++++++- src/mame/includes/nbmj8900.h | 9 ++++++- src/mame/includes/nbmj9195.h | 9 ++++++- src/mame/includes/niyanpai.h | 9 ++++++- src/mame/includes/opwolf.h | 9 +++++++ src/mame/includes/pastelg.h | 9 ++++++- src/mame/includes/segag80r.h | 9 ++++++- src/mame/includes/snes.h | 14 +++++++++++ src/mame/includes/stfight.h | 9 ++++++- src/mame/includes/tank8.h | 9 ++++++- src/mame/includes/triplhnt.h | 9 ++++++- src/mame/includes/tubep.h | 10 ++++++++ src/mame/includes/vectrex.h | 13 ++++++++++ src/mame/includes/volfied.h | 8 ++++++ src/mame/machine/amiga.c | 31 +++++++++++++++++++---- src/mame/machine/bublbobl.c | 31 +++++++++++++---------- src/mame/machine/micro3d.c | 20 ++++++++++++--- src/mame/machine/opwolf.c | 23 +++++++++++++++-- src/mame/machine/snes.c | 48 +++++++++++++++++++++++++++++------- src/mame/machine/stfight.c | 15 ++++++++--- src/mame/machine/vectrex.c | 41 ++++++++++++++++++++++++++---- src/mame/machine/volfied.c | 15 +++++++++-- src/mame/video/astrocde.c | 26 +++++++++++++------ src/mame/video/blstroid.c | 29 +++++++++++++--------- src/mame/video/cchasm.c | 15 ++++++++--- src/mame/video/dcheese.c | 28 ++++++++++++--------- src/mame/video/exidy.c | 22 +++++++++++------ src/mame/video/gameplan.c | 32 +++++++++++++++++++++--- src/mame/video/hyhoo.c | 14 ++++++++--- src/mame/video/lethalj.c | 14 ++++++++--- src/mame/video/m92.c | 18 ++++++++++---- src/mame/video/midtunit.c | 15 ++++++++--- src/mame/video/midvunit.c | 19 ++++++++++++-- src/mame/video/midyunit.c | 21 +++++++++++++--- src/mame/video/nbmj8688.c | 15 ++++++++--- src/mame/video/nbmj8891.c | 13 +++++++--- src/mame/video/nbmj8900.c | 13 +++++++--- src/mame/video/nbmj9195.c | 13 +++++++--- src/mame/video/niyanpai.c | 13 +++++++--- src/mame/video/pastelg.c | 14 ++++++++--- src/mame/video/segag80r.c | 13 +++++++--- src/mame/video/tank8.c | 13 +++++++--- src/mame/video/triplhnt.c | 13 +++++++--- src/mame/video/tubep.c | 8 +----- src/mame/video/vectrex.c | 27 +++++++++----------- 64 files changed, 761 insertions(+), 195 deletions(-) diff --git a/src/mame/drivers/midvunit.c b/src/mame/drivers/midvunit.c index 131ad437de7..04308e6b883 100644 --- a/src/mame/drivers/midvunit.c +++ b/src/mame/drivers/midvunit.c @@ -132,12 +132,6 @@ READ32_MEMBER(midvunit_state::midvunit_adc_r) } -TIMER_CALLBACK_MEMBER(midvunit_state::adc_ready) -{ - m_maincpu->set_input_line(3, ASSERT_LINE); -} - - WRITE32_MEMBER(midvunit_state::midvunit_adc_w) { static const char *const adcnames[] = { "WHEEL", "ACCEL", "BRAKE" }; @@ -148,7 +142,7 @@ WRITE32_MEMBER(midvunit_state::midvunit_adc_w) if (which < 0 || which > 2) logerror("adc_w: unexpected which = %02X\n", which + 4); m_adc_data = ioport(adcnames[which])->read_safe(0); - machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(midvunit_state::adc_ready),this)); + timer_set(attotime::from_msec(1), TIMER_ADC_READY); } else logerror("adc_w without enabling writes!\n"); diff --git a/src/mame/drivers/tubep.c b/src/mame/drivers/tubep.c index 16271c1a349..1239f325335 100644 --- a/src/mame/drivers/tubep.c +++ b/src/mame/drivers/tubep.c @@ -254,6 +254,25 @@ static ADDRESS_MAP_START( tubep_sound_portmap, AS_IO, 8, tubep_state ) ADDRESS_MAP_END +void tubep_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_SPRITE: + m_mcu->set_input_line(0, ASSERT_LINE); + break; + case TIMER_TUBEP_SCANLINE: + tubep_scanline_callback(ptr, param); + break; + case TIMER_RJAMMER_SCANLINE: + rjammer_scanline_callback(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in tubep_state::device_timer"); + } +} + + TIMER_CALLBACK_MEMBER(tubep_state::tubep_scanline_callback) { int scanline = param; @@ -336,7 +355,7 @@ void tubep_state::tubep_setup_save_state() MACHINE_START_MEMBER(tubep_state,tubep) { /* Create interrupt timer */ - m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tubep_state::tubep_scanline_callback),this)); + m_interrupt_timer = timer_alloc(TIMER_TUBEP_SCANLINE); tubep_setup_save_state(); } @@ -499,7 +518,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::rjammer_scanline_callback) MACHINE_START_MEMBER(tubep_state,rjammer) { /* Create interrupt timer */ - m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tubep_state::rjammer_scanline_callback),this)); + m_interrupt_timer = timer_alloc(TIMER_RJAMMER_SCANLINE); tubep_setup_save_state(); } diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h index db7171040c6..f17809c2fd8 100644 --- a/src/mame/includes/amiga.h +++ b/src/mame/includes/amiga.h @@ -373,6 +373,14 @@ struct autoconfig_device class amiga_state : public driver_device { public: + enum + { + TIMER_SCANLINE, + TIMER_AMIGA_IRQ, + TIMER_AMIGA_BLITTER, + TIMER_FINISH_SERIAL_WRITE + }; + amiga_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), /* accelerator cards may present an interesting challenge because the maincpu will be the one on the card instead */ @@ -492,6 +500,8 @@ public: DECLARE_WRITE16_MEMBER( amiga_ar23_mode_w ); void amiga_ar23_init( running_machine &machine, int ar3 ); +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/astrocde.h b/src/mame/includes/astrocde.h index 7b45382be3e..4e65e64a28c 100644 --- a/src/mame/includes/astrocde.h +++ b/src/mame/includes/astrocde.h @@ -17,6 +17,12 @@ class astrocde_state : public driver_device { public: + enum + { + TIMER_INTERRUPT_OFF, + TIMER_SCANLINE + }; + astrocde_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), @@ -125,7 +131,6 @@ public: DECLARE_PALETTE_INIT(profpac); UINT32 screen_update_astrocde(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_profpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(interrupt_off); TIMER_CALLBACK_MEMBER(scanline_callback); void profbank_banksw_restore(); inline int mame_vpos_to_astrocade_vpos(int scanline); @@ -139,6 +144,9 @@ public: required_device m_maincpu; optional_device m_subcpu; optional_device m_samples; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; /*----------- defined in audio/wow.c -----------*/ diff --git a/src/mame/includes/blstroid.h b/src/mame/includes/blstroid.h index 862d5abc435..c9c7adf351d 100644 --- a/src/mame/includes/blstroid.h +++ b/src/mame/includes/blstroid.h @@ -9,6 +9,12 @@ class blstroid_state : public atarigen_state { public: + enum + { + TIMER_IRQ_OFF, + TIMER_IRQ_ON + }; + blstroid_state(const machine_config &mconfig, device_type type, const char *tag) : atarigen_state(mconfig, type, tag), m_priorityram(*this, "priorityram") { } @@ -24,8 +30,9 @@ public: DECLARE_MACHINE_RESET(blstroid); DECLARE_VIDEO_START(blstroid); UINT32 screen_update_blstroid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(irq_off); - TIMER_CALLBACK_MEMBER(irq_on); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/bublbobl.h b/src/mame/includes/bublbobl.h index eac29c9aed5..d78012d3224 100644 --- a/src/mame/includes/bublbobl.h +++ b/src/mame/includes/bublbobl.h @@ -2,6 +2,12 @@ class bublbobl_state : public driver_device { public: + enum + { + TIMER_NMI, + TIMER_M68705_IRQ_ACK + }; + bublbobl_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), @@ -114,8 +120,9 @@ public: DECLARE_MACHINE_RESET(common); UINT32 screen_update_bublbobl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(bublbobl_m68705_interrupt); - TIMER_CALLBACK_MEMBER(nmi_callback); - TIMER_CALLBACK_MEMBER(bublbobl_m68705_irq_ack); void configure_banks( ); DECLARE_WRITE_LINE_MEMBER(irqhandler); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/cchasm.h b/src/mame/includes/cchasm.h index d70c737450b..8e97a4376d9 100644 --- a/src/mame/includes/cchasm.h +++ b/src/mame/includes/cchasm.h @@ -10,6 +10,11 @@ class cchasm_state : public driver_device { public: + enum + { + TIMER_REFRESH_END + }; + cchasm_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_ram(*this, "ram"), @@ -37,7 +42,6 @@ public: INPUT_CHANGED_MEMBER(cchasm_set_coin_flag); DECLARE_WRITE_LINE_MEMBER(cchasm_6840_irq); virtual void video_start(); - TIMER_CALLBACK_MEMBER(cchasm_refresh_end); DECLARE_WRITE_LINE_MEMBER(ctc_timer_1_w); DECLARE_WRITE_LINE_MEMBER(ctc_timer_2_w); void cchasm_refresh (); @@ -45,6 +49,9 @@ public: required_device m_audiocpu; required_device m_dac1; required_device m_dac2; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; /*----------- defined in audio/cchasm.c -----------*/ diff --git a/src/mame/includes/dcheese.h b/src/mame/includes/dcheese.h index bdd3c643a5c..af0631f3a0d 100644 --- a/src/mame/includes/dcheese.h +++ b/src/mame/includes/dcheese.h @@ -8,6 +8,12 @@ class dcheese_state : public driver_device { public: + enum + { + TIMER_BLITTER_SCANLINE, + TIMER_SIGNAL_IRQ + }; + dcheese_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), @@ -50,14 +56,15 @@ public: virtual void palette_init(); UINT32 screen_update_dcheese(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(dcheese_vblank); - TIMER_CALLBACK_MEMBER(blitter_scanline_callback); - TIMER_CALLBACK_MEMBER(dcheese_signal_irq_callback); void dcheese_signal_irq(int which); void update_irq_state(); IRQ_CALLBACK_MEMBER(irq_callback); void update_scanline_irq(); void do_clear( ); void do_blit( ); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; /*----------- defined in drivers/dcheese.c -----------*/ diff --git a/src/mame/includes/exidy.h b/src/mame/includes/exidy.h index 5b7ca041bd4..576ad0d6857 100644 --- a/src/mame/includes/exidy.h +++ b/src/mame/includes/exidy.h @@ -22,6 +22,11 @@ class exidy_state : public driver_device { public: + enum + { + TIMER_COLLISION_IRQ + }; + exidy_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), @@ -70,7 +75,6 @@ public: DECLARE_MACHINE_START(teetert); UINT32 screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(exidy_vblank_interrupt); - TIMER_CALLBACK_MEMBER(collision_irq_callback); void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp); inline void latch_condition(int collision); inline void set_1_color(int index, int which); @@ -80,6 +84,9 @@ public: void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); void check_collision(); required_device m_maincpu; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; /*----------- defined in video/exidy.c -----------*/ diff --git a/src/mame/includes/exidy440.h b/src/mame/includes/exidy440.h index da5d60fc2e4..90ea6705b46 100644 --- a/src/mame/includes/exidy440.h +++ b/src/mame/includes/exidy440.h @@ -1,6 +1,6 @@ /************************************************************************* - Exidy 440 hardware + Exidy 440 hardware *************************************************************************/ diff --git a/src/mame/includes/gameplan.h b/src/mame/includes/gameplan.h index a7ede2cc2de..2ba08373f69 100644 --- a/src/mame/includes/gameplan.h +++ b/src/mame/includes/gameplan.h @@ -25,6 +25,13 @@ driver by Chris Moore class gameplan_state : public driver_device { public: + enum + { + TIMER_CLEAR_SCREEN_DONE, + TIMER_VIA_IRQ_DELAYED, + TIMER_VIA_0_CAL + }; + gameplan_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_trvquest_question(*this, "trvquest_q"), @@ -89,6 +96,9 @@ public: DECLARE_READ8_MEMBER(trvquest_question_r); DECLARE_WRITE8_MEMBER(trvquest_coin_w); DECLARE_WRITE8_MEMBER(trvquest_misc_w); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; /*----------- defined in video/gameplan.c -----------*/ diff --git a/src/mame/includes/hyhoo.h b/src/mame/includes/hyhoo.h index 3d27706e1e6..9b42eafccb4 100644 --- a/src/mame/includes/hyhoo.h +++ b/src/mame/includes/hyhoo.h @@ -1,6 +1,11 @@ class hyhoo_state : public driver_device { public: + enum + { + TIMER_BLITTER + }; + hyhoo_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_clut(*this, "clut"), @@ -25,7 +30,9 @@ public: DECLARE_DRIVER_INIT(hyhoo); virtual void video_start(); UINT32 screen_update_hyhoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(blitter_timer_callback); void hyhoo_gfxdraw(); required_device m_maincpu; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/lethalj.h b/src/mame/includes/lethalj.h index 8b623dc8439..66bfef54fb3 100644 --- a/src/mame/includes/lethalj.h +++ b/src/mame/includes/lethalj.h @@ -7,6 +7,11 @@ class lethalj_state : public driver_device { public: + enum + { + TIMER_GEN_EXT1_INT + }; + lethalj_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") { } @@ -30,9 +35,11 @@ public: DECLARE_DRIVER_INIT(ripribit); DECLARE_DRIVER_INIT(cclownz); virtual void video_start(); - TIMER_CALLBACK_MEMBER(gen_ext1_int); inline void get_crosshair_xy(int player, int *x, int *y); required_device m_maincpu; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; /*----------- defined in video/lethalj.c -----------*/ diff --git a/src/mame/includes/m92.h b/src/mame/includes/m92.h index f85d801ae0c..de8f2151eb2 100644 --- a/src/mame/includes/m92.h +++ b/src/mame/includes/m92.h @@ -18,6 +18,11 @@ struct pf_layer_info class m92_state : public driver_device { public: + enum + { + TIMER_SPRITEBUFFER + }; + m92_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_spriteram(*this, "spriteram"), @@ -79,7 +84,6 @@ public: DECLARE_VIDEO_START(ppan); UINT32 screen_update_m92(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_ppan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(spritebuffer_callback); TIMER_DEVICE_CALLBACK_MEMBER(m92_scanline_interrupt); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); void ppan_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -87,6 +91,9 @@ public: void m92_draw_tiles(bitmap_ind16 &bitmap,const rectangle &cliprect); void m92_sprite_interrupt(); optional_device m_oki; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; /*----------- defined in drivers/m92.c -----------*/ diff --git a/src/mame/includes/micro3d.h b/src/mame/includes/micro3d.h index 35447ebc416..4b14cad71c1 100644 --- a/src/mame/includes/micro3d.h +++ b/src/mame/includes/micro3d.h @@ -15,6 +15,12 @@ class micro3d_state : public driver_device { public: + enum + { + TIMER_MAC_DONE, + TIMER_ADC_DONE + }; + micro3d_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_shared_ram(*this, "shared_ram"), @@ -127,6 +133,9 @@ public: required_device m_audiocpu; required_device m_drmath; required_device m_vgb; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; struct micro3d_vtx diff --git a/src/mame/includes/midtunit.h b/src/mame/includes/midtunit.h index 1e024378477..4748d74efa0 100644 --- a/src/mame/includes/midtunit.h +++ b/src/mame/includes/midtunit.h @@ -10,6 +10,11 @@ class midtunit_state : public driver_device { public: + enum + { + TIMER_DMA + }; + midtunit_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_nvram(*this, "nvram"), @@ -66,7 +71,6 @@ public: DECLARE_DRIVER_INIT(mk2); DECLARE_MACHINE_RESET(midtunit); DECLARE_VIDEO_START(midtunit); - TIMER_CALLBACK_MEMBER(dma_callback); required_device m_maincpu; void register_state_saving(); void init_tunit_generic(int sound); @@ -91,7 +95,11 @@ public: UINT8 jdredd_prot_index; UINT8 jdredd_prot_max; +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; + + /*----------- defined in video/midtunit.c -----------*/ extern UINT8 midtunit_gfx_rom_large; diff --git a/src/mame/includes/midvunit.h b/src/mame/includes/midvunit.h index a51710158fb..c5edd4c1683 100644 --- a/src/mame/includes/midvunit.h +++ b/src/mame/includes/midvunit.h @@ -37,6 +37,12 @@ private: class midvunit_state : public driver_device { public: + enum + { + TIMER_ADC_READY, + TIMER_SCANLINE + }; + midvunit_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_nvram(*this, "nvram"), @@ -121,7 +127,9 @@ public: virtual void video_start(); DECLARE_MACHINE_RESET(midvplus); UINT32 screen_update_midvunit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(adc_ready); TIMER_CALLBACK_MEMBER(scanline_timer_cb); required_device m_maincpu; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/midyunit.h b/src/mame/includes/midyunit.h index 7e3979f88ed..f848c4591b2 100644 --- a/src/mame/includes/midyunit.h +++ b/src/mame/includes/midyunit.h @@ -32,6 +32,12 @@ struct dma_state_t class midyunit_state : public driver_device { public: + enum + { + TIMER_DMA, + TIMER_AUTOERASE_LINE + }; + midyunit_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_narc_sound(*this, "narcsnd"), @@ -116,7 +122,11 @@ public: required_device m_maincpu; optional_device m_audiocpu; optional_device m_oki; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; + /*----------- defined in video/midyunit.c -----------*/ void midyunit_to_shiftreg(address_space &space, UINT32 address, UINT16 *shiftreg); void midyunit_from_shiftreg(address_space &space, UINT32 address, UINT16 *shiftreg); diff --git a/src/mame/includes/nbmj8688.h b/src/mame/includes/nbmj8688.h index ba733971cbe..7d54130dee9 100644 --- a/src/mame/includes/nbmj8688.h +++ b/src/mame/includes/nbmj8688.h @@ -1,6 +1,11 @@ class nbmj8688_state : public driver_device { public: + enum + { + TIMER_BLITTER + }; + nbmj8688_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") { } @@ -93,7 +98,6 @@ public: UINT32 screen_update_mbmj8688(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mbmj8688_lcd0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mbmj8688_lcd1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(blitter_timer_callback); void update_pixel(int x, int y); void writeram_low(int x, int y, int color); void writeram_high(int x, int y, int color); @@ -102,4 +106,7 @@ public: void nbmj8688_HD61830B_instr_w(address_space &space,int offset,int data,int chip); void nbmj8688_HD61830B_data_w(address_space &space,int offset,int data,int chip); required_device m_maincpu; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/nbmj8891.h b/src/mame/includes/nbmj8891.h index 1b3990e60d7..5f93f42b1f1 100644 --- a/src/mame/includes/nbmj8891.h +++ b/src/mame/includes/nbmj8891.h @@ -1,6 +1,11 @@ class nbmj8891_state : public driver_device { public: + enum + { + TIMER_BLITTER + }; + nbmj8891_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") { } @@ -75,10 +80,12 @@ public: virtual void video_start(); DECLARE_VIDEO_START(nbmj8891_1layer); UINT32 screen_update_nbmj8891(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(blitter_timer_callback); void nbmj8891_vramflip(int vram); void update_pixel0(int x, int y); void update_pixel1(int x, int y); void nbmj8891_gfxdraw(); required_device m_maincpu; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/nbmj8900.h b/src/mame/includes/nbmj8900.h index 6cb7a9984ae..27121cd199f 100644 --- a/src/mame/includes/nbmj8900.h +++ b/src/mame/includes/nbmj8900.h @@ -1,6 +1,11 @@ class nbmj8900_state : public driver_device { public: + enum + { + TIMER_BLITTER + }; + nbmj8900_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") { } @@ -46,10 +51,12 @@ public: DECLARE_DRIVER_INIT(ohpaipee); virtual void video_start(); UINT32 screen_update_nbmj8900(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(blitter_timer_callback); void nbmj8900_vramflip(int vram); void update_pixel0(int x, int y); void update_pixel1(int x, int y); void nbmj8900_gfxdraw(); required_device m_maincpu; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/nbmj9195.h b/src/mame/includes/nbmj9195.h index cdf4b7bdbe3..6f1e7321a6d 100644 --- a/src/mame/includes/nbmj9195.h +++ b/src/mame/includes/nbmj9195.h @@ -9,6 +9,11 @@ class nbmj9195_state : public driver_device { public: + enum + { + TIMER_BLITTER + }; + nbmj9195_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu"), @@ -117,7 +122,6 @@ public: DECLARE_VIDEO_START(nbmj9195_nb22090); UINT32 screen_update_nbmj9195(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(ctc0_trg1); - TIMER_CALLBACK_MEMBER(blitter_timer_callback); int nbmj9195_blitter_r(int offset, int vram); void nbmj9195_blitter_w(int offset, int data, int vram); void nbmj9195_clutsel_w(int data); @@ -133,4 +137,7 @@ public: required_device m_maincpu; required_device m_dac1; required_device m_dac2; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/niyanpai.h b/src/mame/includes/niyanpai.h index 8138b980ce4..23ced156402 100644 --- a/src/mame/includes/niyanpai.h +++ b/src/mame/includes/niyanpai.h @@ -4,6 +4,11 @@ class niyanpai_state : public driver_device { public: + enum + { + TIMER_BLITTER + }; + niyanpai_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu"), @@ -85,7 +90,6 @@ public: virtual void video_start(); UINT32 screen_update_niyanpai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(niyanpai_interrupt); - TIMER_CALLBACK_MEMBER(blitter_timer_callback); int niyanpai_blitter_r(int vram, int offset); void niyanpai_blitter_w(int vram, int offset, int data); void niyanpai_clutsel_w(int vram, int data); @@ -97,4 +101,7 @@ public: required_device m_maincpu; required_device m_dac1; required_device m_dac2; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/opwolf.h b/src/mame/includes/opwolf.h index a23e7ac7fe6..f4097f81166 100644 --- a/src/mame/includes/opwolf.h +++ b/src/mame/includes/opwolf.h @@ -9,6 +9,12 @@ class opwolf_state : public driver_device { public: + enum + { + TIMER_OPWOLF, + TIMER_CCHIP + }; + opwolf_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_cchip_ram(*this, "cchip_ram"), @@ -88,4 +94,7 @@ public: void opwolf_msm5205_vck(device_t *device, int chip); DECLARE_WRITE_LINE_MEMBER(opwolf_msm5205_vck_1); DECLARE_WRITE_LINE_MEMBER(opwolf_msm5205_vck_2); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/pastelg.h b/src/mame/includes/pastelg.h index 1b8f2f639f1..ab98ff36bb7 100644 --- a/src/mame/includes/pastelg.h +++ b/src/mame/includes/pastelg.h @@ -1,6 +1,11 @@ class pastelg_state : public driver_device { public: + enum + { + TIMER_BLITTER + }; + pastelg_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") { } @@ -36,11 +41,13 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_pastelg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(blitter_timer_callback); int pastelg_blitter_src_addr_r(address_space &space); void pastelg_vramflip(); void pastelg_gfxdraw(); required_device m_maincpu; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; /*----------- defined in video/pastelg.c -----------*/ diff --git a/src/mame/includes/segag80r.h b/src/mame/includes/segag80r.h index 06f39bf9644..26468ac23b9 100644 --- a/src/mame/includes/segag80r.h +++ b/src/mame/includes/segag80r.h @@ -10,6 +10,11 @@ class segag80r_state : public driver_device { public: + enum + { + TIMER_VBLANK_LATCH_CLEAR + }; + segag80r_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_mainram(*this, "mainram"), @@ -104,7 +109,6 @@ public: UINT32 screen_update_segag80r(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(segag80r_vblank_start); INTERRUPT_GEN_MEMBER(sindbadm_vblank_start); - TIMER_CALLBACK_MEMBER(vblank_latch_clear); DECLARE_WRITE8_MEMBER(sega005_sound_a_w); DECLARE_WRITE8_MEMBER(sega005_sound_b_w); DECLARE_WRITE8_MEMBER(monsterb_sound_a_w); @@ -126,6 +130,9 @@ public: required_device m_maincpu; optional_device m_audiocpu; optional_device m_samples; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h index e1a1b13c0a8..f6e9c9ba783 100644 --- a/src/mame/includes/snes.h +++ b/src/mame/includes/snes.h @@ -578,6 +578,17 @@ struct snes_superscope class snes_state : public driver_device { public: + enum + { + TIMER_NMI_TICK, + TIMER_HIRQ_TICK, + TIMER_RESET_OAM_ADDRESS, + TIMER_RESET_HDMA, + TIMER_UPDATE_IO, + TIMER_SCANLINE_TICK, + TIMER_HBLANK_TICK + }; + snes_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), @@ -704,6 +715,9 @@ public: void snes_init_timers(); virtual void machine_start(); virtual void machine_reset(); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; /* Special chips, checked at init and used in memory handlers */ diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h index f8de2ebb55a..d4c62bf7929 100644 --- a/src/mame/includes/stfight.h +++ b/src/mame/includes/stfight.h @@ -3,6 +3,11 @@ class stfight_state : public driver_device { public: + enum + { + TIMER_STFIGHT_INTERRUPT_1 + }; + stfight_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_text_char_ram(*this, "text_char_ram"), @@ -51,11 +56,13 @@ public: virtual void palette_init(); UINT32 screen_update_stfight(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(stfight_vb_interrupt); - TIMER_CALLBACK_MEMBER(stfight_interrupt_1); DECLARE_WRITE8_MEMBER(stfight_adpcm_control_w); void set_pens(); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(stfight_adpcm_int); required_device m_maincpu; required_device m_msm; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/tank8.h b/src/mame/includes/tank8.h index 7a799538aac..cbd2a87f3b9 100644 --- a/src/mame/includes/tank8.h +++ b/src/mame/includes/tank8.h @@ -26,6 +26,11 @@ class tank8_state : public driver_device { public: + enum + { + TIMER_COLLISION + }; + tank8_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_video_ram(*this, "video_ram"), @@ -63,7 +68,6 @@ public: virtual void palette_init(); UINT32 screen_update_tank8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void screen_eof_tank8(screen_device &screen, bool state); - TIMER_CALLBACK_MEMBER(tank8_collision_callback); void set_pens(colortable_t *colortable); inline int get_x_pos(int n); inline int get_y_pos(int n); @@ -72,6 +76,9 @@ public: void tank8_set_collision(int index); required_device m_maincpu; required_device m_discrete; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; /*----------- defined in audio/tank8.c -----------*/ diff --git a/src/mame/includes/triplhnt.h b/src/mame/includes/triplhnt.h index ae6234dcade..d1087a650ca 100644 --- a/src/mame/includes/triplhnt.h +++ b/src/mame/includes/triplhnt.h @@ -19,6 +19,11 @@ class triplhnt_state : public driver_device { public: + enum + { + TIMER_HIT + }; + triplhnt_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_playfield_ram(*this, "playfield_ram"), @@ -54,13 +59,15 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_triplhnt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(triplhnt_hit_callback); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); void triplhnt_set_collision(int code); void triplhnt_update_misc(address_space &space, int offset); required_device m_maincpu; required_device m_discrete; required_device m_samples; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/tubep.h b/src/mame/includes/tubep.h index fcc313640c0..3050c288f56 100644 --- a/src/mame/includes/tubep.h +++ b/src/mame/includes/tubep.h @@ -3,6 +3,13 @@ class tubep_state : public driver_device { public: + enum + { + TIMER_TUBEP_SCANLINE, + TIMER_RJAMMER_SCANLINE, + TIMER_SPRITE + }; + tubep_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_textram(*this, "textram"), @@ -97,6 +104,9 @@ public: required_device m_slave; required_device m_mcu; optional_device m_msm; + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/includes/vectrex.h b/src/mame/includes/vectrex.h index 62984e93eee..b755c6bcf0b 100644 --- a/src/mame/includes/vectrex.h +++ b/src/mame/includes/vectrex.h @@ -24,6 +24,17 @@ struct vectrex_point class vectrex_state : public driver_device { public: + enum + { + TIMER_VECTREX_IMAGER_CHANGE_COLOR, + TIMER_UPDATE_LEVEL, + TIMER_VECTREX_IMAGER_EYE, + TIMER_LIGHTPEN_TRIGGER, + TIMER_VECTREX_REFRESH, + TIMER_VECTREX_ZERO_INTEGRATORS, + TIMER_UPDATE_SIGNAL + }; + vectrex_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_gce_vectorram(*this, "gce_vectorram"), @@ -105,6 +116,8 @@ public: DECLARE_WRITE_LINE_MEMBER(vectrex_via_irq); protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + required_device m_maincpu; required_device m_via6522_0; required_device m_dac; diff --git a/src/mame/includes/volfied.h b/src/mame/includes/volfied.h index 7876780ab29..ca793195fbc 100644 --- a/src/mame/includes/volfied.h +++ b/src/mame/includes/volfied.h @@ -8,6 +8,11 @@ class volfied_state : public driver_device { public: + enum + { + TIMER_VOLFIED + }; + volfied_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), @@ -53,4 +58,7 @@ public: void volfied_cchip_init( ); void volfied_cchip_reset( ); DECLARE_WRITE_LINE_MEMBER(irqhandler); + +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index cb9958c5024..f28a4999d6e 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -250,8 +250,8 @@ void amiga_machine_config(running_machine &machine, const amiga_machine_interfac } /* setup the timers */ - state->m_irq_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(amiga_state::amiga_irq_proc),state)); - state->m_blitter_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(amiga_state::amiga_blitter_proc),state)); + state->m_irq_timer = state->timer_alloc(amiga_state::TIMER_AMIGA_IRQ); + state->m_blitter_timer = state->timer_alloc(amiga_state::TIMER_AMIGA_BLITTER); state->m_sound_device = machine.device("amiga"); } @@ -298,10 +298,31 @@ MACHINE_RESET_MEMBER(amiga_state,amiga) (*m_intf->reset_callback)(machine()); /* start the scanline timer */ - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(amiga_state::scanline_callback),this)); + timer_set(machine().primary_screen->time_until_pos(0), TIMER_SCANLINE); } +void amiga_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_SCANLINE: + scanline_callback(ptr, param); + break; + case TIMER_AMIGA_IRQ: + amiga_irq_proc(ptr, param); + break; + case TIMER_AMIGA_BLITTER: + amiga_blitter_proc(ptr, param); + break; + case TIMER_FINISH_SERIAL_WRITE: + finish_serial_write(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in amiga_state::device_timer"); + } +} + /************************************* * @@ -350,7 +371,7 @@ TIMER_CALLBACK_MEMBER(amiga_state::scanline_callback) /* set timer for next line */ scanline = (scanline + 1) % machine().primary_screen->height(); - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(amiga_state::scanline_callback),this), scanline); + timer_set(machine().primary_screen->time_until_pos(scanline), TIMER_SCANLINE, scanline); } @@ -1320,7 +1341,7 @@ WRITE16_MEMBER( amiga_state::amiga_custom_w ) if (state->m_intf->serdat_w != NULL) (*state->m_intf->serdat_w)(space.machine(), data); CUSTOM_REG(REG_SERDATR) &= ~0x3000; - space.machine().scheduler().timer_set(amiga_get_serial_char_period(space.machine()), timer_expired_delegate(FUNC(amiga_state::finish_serial_write),state)); + timer_set(amiga_get_serial_char_period(space.machine()), TIMER_FINISH_SERIAL_WRITE); break; case REG_BLTSIZE: diff --git a/src/mame/machine/bublbobl.c b/src/mame/machine/bublbobl.c index dac3ec9aca8..8aa1c3ea4fc 100644 --- a/src/mame/machine/bublbobl.c +++ b/src/mame/machine/bublbobl.c @@ -84,18 +84,29 @@ READ8_MEMBER(bublbobl_state::tokiob_mcu_r) } -TIMER_CALLBACK_MEMBER(bublbobl_state::nmi_callback) +void bublbobl_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - if (m_sound_nmi_enable) - m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); - else - m_pending_nmi = 1; + switch (id) + { + case TIMER_NMI: + if (m_sound_nmi_enable) + m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + else + m_pending_nmi = 1; + break; + case TIMER_M68705_IRQ_ACK: + m_mcu->set_input_line(0, CLEAR_LINE); + break; + default: + assert_always(FALSE, "Unknown id in bublbobl_state::device_timer"); + } } + WRITE8_MEMBER(bublbobl_state::bublbobl_sound_command_w) { soundlatch_byte_w(space, offset, data); - machine().scheduler().synchronize(timer_expired_delegate(FUNC(bublbobl_state::nmi_callback),this), data); + synchronize(TIMER_NMI, data); } WRITE8_MEMBER(bublbobl_state::bublbobl_sh_nmi_disable_w) @@ -360,16 +371,10 @@ READ8_MEMBER(bublbobl_state::boblbobl_ic43_b_r) The following is ENTIRELY GUESSWORK!!! ***************************************************************************/ -TIMER_CALLBACK_MEMBER(bublbobl_state::bublbobl_m68705_irq_ack) -{ - m_mcu->set_input_line(0, CLEAR_LINE); -} - INTERRUPT_GEN_MEMBER(bublbobl_state::bublbobl_m68705_interrupt) { device.execute().set_input_line(0, ASSERT_LINE); - - machine().scheduler().timer_set(attotime::from_msec(1000/60), timer_expired_delegate(FUNC(bublbobl_state::bublbobl_m68705_irq_ack),this)); /* TODO: understand how this is ack'ed */ + timer_set(attotime::from_msec(1000/60), TIMER_M68705_IRQ_ACK); /* TODO: understand how this is ack'ed */ } diff --git a/src/mame/machine/micro3d.c b/src/mame/machine/micro3d.c index 7d07611db35..5a41356dc4f 100644 --- a/src/mame/machine/micro3d.c +++ b/src/mame/machine/micro3d.c @@ -258,13 +258,27 @@ INLINE INT64 normalised_multiply(INT32 a, INT32 b) return result >> 14; } +void micro3d_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_MAC_DONE: + mac_done_callback(ptr, param); + break; + case TIMER_ADC_DONE: + adc_done_callback(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in micro3d_state::device_timer"); + } +} + TIMER_CALLBACK_MEMBER(micro3d_state::mac_done_callback) { m_drmath->set_input_line(AM29000_INTR0, ASSERT_LINE); m_mac_stat = 0; } - WRITE32_MEMBER(micro3d_state::micro3d_mac1_w) { m_vtx_addr = (data & 0x3ffff); @@ -464,7 +478,7 @@ WRITE32_MEMBER(micro3d_state::micro3d_mac2_w) /* TODO: Calculate a better estimate for timing */ if (m_mac_stat) - machine().scheduler().timer_set(attotime::from_hz(MAC_CLK) * mac_cycles, timer_expired_delegate(FUNC(micro3d_state::mac_done_callback),this)); + timer_set(attotime::from_hz(MAC_CLK) * mac_cycles, TIMER_MAC_DONE); m_mrab11 = mrab11; m_vtx_addr = vtx_addr; @@ -524,7 +538,7 @@ WRITE16_MEMBER(micro3d_state::micro3d_adc_w) return; } - machine().scheduler().timer_set(attotime::from_usec(40), timer_expired_delegate(FUNC(micro3d_state::adc_done_callback),this), data & ~4); + timer_set(attotime::from_usec(40), TIMER_ADC_DONE, data & ~4); } CUSTOM_INPUT_MEMBER(micro3d_state::botss_hwchk_r) diff --git a/src/mame/machine/opwolf.c b/src/mame/machine/opwolf.c index 6180527e301..4986c4e8ca6 100644 --- a/src/mame/machine/opwolf.c +++ b/src/mame/machine/opwolf.c @@ -273,6 +273,22 @@ static const UINT16 *const level_data_lookup[] = }; + void opwolf_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_OPWOLF: + opwolf_timer_callback(ptr, param); + break; + case TIMER_CCHIP: + cchip_timer(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in opwolf_state::device_timer"); + } +} + + TIMER_CALLBACK_MEMBER(opwolf_state::opwolf_timer_callback) { // Level data command @@ -683,7 +699,7 @@ TIMER_CALLBACK_MEMBER(opwolf_state::cchip_timer) { // Simulate time for command to execute (exact timing unknown, this is close) m_current_cmd = 0xf5; - machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(80000), timer_expired_delegate(FUNC(opwolf_state::opwolf_timer_callback),this)); + timer_set(m_maincpu->cycles_to_attotime(80000), TIMER_OPWOLF); } m_cchip_last_7a = m_cchip_ram[0x7a]; @@ -698,6 +714,9 @@ TIMER_CALLBACK_MEMBER(opwolf_state::cchip_timer) // These are set every frame m_cchip_ram[0x64] = 0; m_cchip_ram[0x66] = 0; + + // Pulse the timer + timer_set(attotime::from_hz(60), TIMER_CCHIP); } /************************************* @@ -737,5 +756,5 @@ void opwolf_state::opwolf_cchip_init( ) m_cchip_coins_for_credit[1] = 1; m_cchip_credits_for_coin[1] = 1; - machine().scheduler().timer_pulse(attotime::from_hz(60), timer_expired_delegate(FUNC(opwolf_state::cchip_timer),this)); + timer_set(attotime::from_hz(60), TIMER_CCHIP); } diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index a68ef5b0d86..a543ab1eda1 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -50,6 +50,36 @@ UINT32 snes_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co Timers *************************************/ +void snes_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_NMI_TICK: + snes_nmi_tick(ptr, param); + break; + case TIMER_HIRQ_TICK: + snes_hirq_tick_callback(ptr, param); + break; + case TIMER_RESET_OAM_ADDRESS: + snes_reset_oam_address(ptr, param); + break; + case TIMER_RESET_HDMA: + snes_reset_hdma(ptr, param); + break; + case TIMER_UPDATE_IO: + snes_update_io(ptr, param); + break; + case TIMER_SCANLINE_TICK: + snes_scanline_tick(ptr, param); + break; + case TIMER_HBLANK_TICK: + snes_hblank_tick(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in snes_state::device_timer"); + } +} + TIMER_CALLBACK_MEMBER(snes_state::snes_nmi_tick) { @@ -155,7 +185,7 @@ TIMER_CALLBACK_MEMBER(snes_state::snes_scanline_tick) /* Start of VBlank */ if (m_ppu.m_beam.current_vert == m_ppu.m_beam.last_visible_line) { - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(m_ppu.m_beam.current_vert, 10), timer_expired_delegate(FUNC(snes_state::snes_reset_oam_address),this)); + timer_set(machine().primary_screen->time_until_pos(m_ppu.m_beam.current_vert, 10), TIMER_RESET_OAM_ADDRESS); SNES_CPU_REG(HVBJOY) |= 0x81; /* Set vblank bit to on & indicate controllers being read */ SNES_CPU_REG(RDNMI) |= 0x80; /* Set NMI occurred bit */ @@ -559,7 +589,7 @@ WRITE8_MEMBER( snes_state::snes_w_io ) return; case HDMAEN: /* HDMA channel designation */ if (data) //if a HDMA is enabled, data is inited at the next scanline - space.machine().scheduler().timer_set(space.machine().primary_screen->time_until_pos(m_ppu.m_beam.current_vert + 1), timer_expired_delegate(FUNC(snes_state::snes_reset_hdma),this)); + timer_set(space.machine().primary_screen->time_until_pos(m_ppu.m_beam.current_vert + 1), TIMER_RESET_HDMA); SNES_CPU_REG(HDMAEN) = data; return; case TIMEUP: // IRQ Flag is cleared on both read and write @@ -995,19 +1025,19 @@ READ8_MEMBER(snes_state::nss_oldjoy2_read) void snes_state::snes_init_timers() { /* init timers and stop them */ - m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_scanline_tick),this)); + m_scanline_timer = timer_alloc(TIMER_SCANLINE_TICK); m_scanline_timer->adjust(attotime::never); - m_hblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_hblank_tick),this)); + m_hblank_timer = timer_alloc(TIMER_HBLANK_TICK); m_hblank_timer->adjust(attotime::never); - m_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_nmi_tick),this)); + m_nmi_timer = timer_alloc(TIMER_NMI_TICK); m_nmi_timer->adjust(attotime::never); - m_hirq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_hirq_tick_callback),this)); + m_hirq_timer = timer_alloc(TIMER_HIRQ_TICK); m_hirq_timer->adjust(attotime::never); - //m_div_timer = machine().scheduler().timer_alloc(FUNC(snes_div_callback)); + //m_div_timer = timer_alloc(TIMER_DIV); //m_div_timer->adjust(attotime::never); - //m_mult_timer = machine().scheduler().timer_alloc(FUNC(snes_mult_callback)); + //m_mult_timer = timer_alloc(TIMER_MULT); //m_mult_timer->adjust(attotime::never); - m_io_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(snes_state::snes_update_io),this)); + m_io_timer = timer_alloc(TIMER_UPDATE_IO); m_io_timer->adjust(attotime::never); // SNES hcounter has a 0-339 range. hblank starts at counter 260. diff --git a/src/mame/machine/stfight.c b/src/mame/machine/stfight.c index 19e4b16458b..cddf5ed88bf 100644 --- a/src/mame/machine/stfight.c +++ b/src/mame/machine/stfight.c @@ -109,17 +109,24 @@ WRITE8_MEMBER(stfight_state::stfight_bank_w) * CPU 1 timed interrupt - 60Hz??? */ -TIMER_CALLBACK_MEMBER(stfight_state::stfight_interrupt_1) +void stfight_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - // Do a RST08 - m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); + switch (id) + { + case TIMER_STFIGHT_INTERRUPT_1: + // Do a RST08 + m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); + break; + default: + assert_always(FALSE, "Unknown id in stfight_state::device_timer"); + } } INTERRUPT_GEN_MEMBER(stfight_state::stfight_vb_interrupt) { // Do a RST10 device.execute().set_input_line_and_vector(0, HOLD_LINE, 0xd7); - machine().scheduler().timer_set(attotime::from_hz(120), timer_expired_delegate(FUNC(stfight_state::stfight_interrupt_1),this)); + timer_set(attotime::from_hz(120), TIMER_STFIGHT_INTERRUPT_1); } /* diff --git a/src/mame/machine/vectrex.c b/src/mame/machine/vectrex.c index 47a029b5057..a55e3843c73 100644 --- a/src/mame/machine/vectrex.c +++ b/src/mame/machine/vectrex.c @@ -58,6 +58,37 @@ int vectrex_state::vectrex_verify_cart(char *data) } +void vectrex_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_VECTREX_IMAGER_CHANGE_COLOR: + vectrex_imager_change_color(ptr, param); + break; + case TIMER_UPDATE_LEVEL: + update_level(ptr, param); + break; + case TIMER_VECTREX_IMAGER_EYE: + vectrex_imager_eye(ptr, param); + break; + case TIMER_LIGHTPEN_TRIGGER: + lightpen_trigger(ptr, param); + break; + case TIMER_VECTREX_REFRESH: + vectrex_refresh(ptr, param); + break; + case TIMER_VECTREX_ZERO_INTEGRATORS: + vectrex_zero_integrators(ptr, param); + break; + case TIMER_UPDATE_SIGNAL: + update_signal(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in vectrex_state::device_timer"); + } +} + + /********************************************************************* ROM load and id functions @@ -287,19 +318,19 @@ TIMER_CALLBACK_MEMBER(vectrex_state::vectrex_imager_eye) { m_imager_status = param; coffset = param > 1? 3: 0; - machine().scheduler().timer_set (attotime::from_double(rtime * m_imager_angles[0]), timer_expired_delegate(FUNC(vectrex_state::vectrex_imager_change_color),this), m_imager_colors[coffset+2]); - machine().scheduler().timer_set (attotime::from_double(rtime * m_imager_angles[1]), timer_expired_delegate(FUNC(vectrex_state::vectrex_imager_change_color),this), m_imager_colors[coffset+1]); - machine().scheduler().timer_set (attotime::from_double(rtime * m_imager_angles[2]), timer_expired_delegate(FUNC(vectrex_state::vectrex_imager_change_color),this), m_imager_colors[coffset]); + timer_set(attotime::from_double(rtime * m_imager_angles[0]), TIMER_VECTREX_IMAGER_CHANGE_COLOR, m_imager_colors[coffset+2]); + timer_set(attotime::from_double(rtime * m_imager_angles[1]), TIMER_VECTREX_IMAGER_CHANGE_COLOR, m_imager_colors[coffset+1]); + timer_set(attotime::from_double(rtime * m_imager_angles[2]), TIMER_VECTREX_IMAGER_CHANGE_COLOR, m_imager_colors[coffset]); if (param == 2) { - machine().scheduler().timer_set (attotime::from_double(rtime * 0.50), timer_expired_delegate(FUNC(vectrex_state::vectrex_imager_eye),this), 1); + timer_set(attotime::from_double(rtime * 0.50), TIMER_VECTREX_IMAGER_EYE, 1); /* Index hole sensor is connected to IO7 which triggers also CA1 of VIA */ m_via6522_0->write_ca1(1); m_via6522_0->write_ca1(0); m_imager_pinlevel |= 0x80; - machine().scheduler().timer_set (attotime::from_double(rtime / 360.0), timer_expired_delegate(FUNC(vectrex_state::update_level),this), 0, &m_imager_pinlevel); + timer_set(attotime::from_double(rtime / 360.0), TIMER_UPDATE_LEVEL, 0, &m_imager_pinlevel); } } } diff --git a/src/mame/machine/volfied.c b/src/mame/machine/volfied.c index d37a6901c95..aecde231582 100644 --- a/src/mame/machine/volfied.c +++ b/src/mame/machine/volfied.c @@ -277,6 +277,17 @@ static const UINT16 *const palette_data_lookup[] = palette_data_11 }; +void volfied_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_VOLFIED: + volfied_timer_callback(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in volfied_state::device_timer"); + } +} TIMER_CALLBACK_MEMBER(volfied_state::volfied_timer_callback) { @@ -387,12 +398,12 @@ WRITE16_MEMBER(volfied_state::volfied_cchip_ram_w) // Palette request cmd - verified to take around 122242 68000 cycles to complete if (m_current_cmd >= 0x1 && m_current_cmd < 0x12) { - machine().scheduler().timer_set(downcast(&space.device())->cycles_to_attotime(122242), timer_expired_delegate(FUNC(volfied_state::volfied_timer_callback),this)); + timer_set(downcast(&space.device())->cycles_to_attotime(122242), TIMER_VOLFIED); } // Unknown cmd - verified to take around 105500 68000 cycles to complete else if (m_current_cmd >= 0x81 && m_current_cmd < 0x92) { - machine().scheduler().timer_set(downcast(&space.device())->cycles_to_attotime(105500), timer_expired_delegate(FUNC(volfied_state::volfied_timer_callback),this)); + timer_set(downcast(&space.device())->cycles_to_attotime(105500), TIMER_VOLFIED); } else { diff --git a/src/mame/video/astrocde.c b/src/mame/video/astrocde.c index 7e265437add..c6545a0227b 100644 --- a/src/mame/video/astrocde.c +++ b/src/mame/video/astrocde.c @@ -165,9 +165,9 @@ PALETTE_INIT_MEMBER(astrocde_state,profpac) void astrocde_state::video_start() { /* allocate timers */ - m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(astrocde_state::scanline_callback),this)); + m_scanline_timer = timer_alloc(TIMER_SCANLINE); m_scanline_timer->adjust(machine().primary_screen->time_until_pos(1), 1); - m_intoff_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(astrocde_state::interrupt_off),this)); + m_intoff_timer = timer_alloc(TIMER_INTERRUPT_OFF); /* register for save states */ init_savestate(); @@ -181,9 +181,9 @@ void astrocde_state::video_start() VIDEO_START_MEMBER(astrocde_state,profpac) { /* allocate timers */ - m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(astrocde_state::scanline_callback),this)); + m_scanline_timer = timer_alloc(TIMER_SCANLINE); m_scanline_timer->adjust(machine().primary_screen->time_until_pos(1), 1); - m_intoff_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(astrocde_state::interrupt_off),this)); + m_intoff_timer = timer_alloc(TIMER_INTERRUPT_OFF); /* allocate videoram */ m_profpac_videoram = auto_alloc_array(machine(), UINT16, 0x4000 * 4); @@ -372,9 +372,19 @@ UINT32 astrocde_state::screen_update_profpac(screen_device &screen, bitmap_ind16 * *************************************/ -TIMER_CALLBACK_MEMBER(astrocde_state::interrupt_off) +void astrocde_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - m_maincpu->set_input_line(0, CLEAR_LINE); + switch (id) + { + case TIMER_INTERRUPT_OFF: + m_maincpu->set_input_line(0, CLEAR_LINE); + break; + case TIMER_SCANLINE: + scanline_callback(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in astrocde_state::device_timer"); + } } @@ -428,14 +438,14 @@ TIMER_CALLBACK_MEMBER(astrocde_state::scanline_callback) if ((m_interrupt_enabl & 0x04) == 0) { m_maincpu->set_input_line_and_vector(0, HOLD_LINE, m_interrupt_vector); - machine().scheduler().timer_set(machine().primary_screen->time_until_vblank_end(), timer_expired_delegate(FUNC(astrocde_state::interrupt_off),this)); + timer_set(machine().primary_screen->time_until_vblank_end(), TIMER_INTERRUPT_OFF); } /* mode 1 means assert for 1 instruction */ else { m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, m_interrupt_vector); - machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(1), timer_expired_delegate(FUNC(astrocde_state::interrupt_off),this)); + timer_set(m_maincpu->cycles_to_attotime(1), TIMER_INTERRUPT_OFF); } } diff --git a/src/mame/video/blstroid.c b/src/mame/video/blstroid.c index ec32d0bec86..605e77ab5d3 100644 --- a/src/mame/video/blstroid.c +++ b/src/mame/video/blstroid.c @@ -87,19 +87,24 @@ VIDEO_START_MEMBER(blstroid_state,blstroid) * *************************************/ -TIMER_CALLBACK_MEMBER(blstroid_state::irq_off) +void blstroid_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - /* clear the interrupt */ address_space &space = m_maincpu->space(AS_PROGRAM); - scanline_int_ack_w(space, 0, 0); -} - -TIMER_CALLBACK_MEMBER(blstroid_state::irq_on) -{ - /* generate the interrupt */ - scanline_int_gen(m_maincpu); - update_interrupts(); + switch (id) + { + case TIMER_IRQ_OFF: + /* clear the interrupt */ + scanline_int_ack_w(space, 0, 0); + break; + case TIMER_IRQ_ON: + /* generate the interrupt */ + scanline_int_gen(m_maincpu); + update_interrupts(); + break; + default: + assert_always(FALSE, "Unknown id in blstroid_state::device_timer"); + } } @@ -127,8 +132,8 @@ void blstroid_state::scanline_update(screen_device &screen, int scanline) period_on = screen.time_until_pos(vpos + 7, width * 0.9); period_off = screen.time_until_pos(vpos + 8, width * 0.9); - screen.machine().scheduler().timer_set(period_on, timer_expired_delegate(FUNC(blstroid_state::irq_on), this)); - screen.machine().scheduler().timer_set(period_off, timer_expired_delegate(FUNC(blstroid_state::irq_off), this)); + timer_set(period_on, TIMER_IRQ_ON); + timer_set(period_off, TIMER_IRQ_OFF); } } diff --git a/src/mame/video/cchasm.c b/src/mame/video/cchasm.c index 7832c5d423f..5f2ab0ac644 100644 --- a/src/mame/video/cchasm.c +++ b/src/mame/video/cchasm.c @@ -18,12 +18,19 @@ #define LENGTH 7 - -TIMER_CALLBACK_MEMBER(cchasm_state::cchasm_refresh_end) +void cchasm_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - m_maincpu->set_input_line(2, ASSERT_LINE); + switch (id) + { + case TIMER_REFRESH_END: + m_maincpu->set_input_line(2, ASSERT_LINE); + break; + default: + assert_always(FALSE, "Unknown id in cchasm_state::device_timer"); + } } + void cchasm_state::cchasm_refresh () { int pc = 0; @@ -97,7 +104,7 @@ void cchasm_state::cchasm_refresh () } } /* Refresh processor runs with 6 MHz */ - machine().scheduler().timer_set (attotime::from_hz(6000000) * total_length, timer_expired_delegate(FUNC(cchasm_state::cchasm_refresh_end),this)); + timer_set(attotime::from_hz(6000000) * total_length, TIMER_REFRESH_END); } diff --git a/src/mame/video/dcheese.c b/src/mame/video/dcheese.c index c45144f619b..45ebe8683b4 100644 --- a/src/mame/video/dcheese.c +++ b/src/mame/video/dcheese.c @@ -69,16 +69,20 @@ void dcheese_state::update_scanline_irq() } -TIMER_CALLBACK_MEMBER(dcheese_state::blitter_scanline_callback) +void dcheese_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - dcheese_signal_irq(3); - update_scanline_irq(); -} - - -TIMER_CALLBACK_MEMBER(dcheese_state::dcheese_signal_irq_callback) -{ - dcheese_signal_irq(param); + switch (id) + { + case TIMER_BLITTER_SCANLINE: + dcheese_signal_irq(3); + update_scanline_irq(); + break; + case TIMER_SIGNAL_IRQ: + dcheese_signal_irq(param); + break; + default: + assert_always(FALSE, "Unknown id in dcheese_state::device_timer"); + } } @@ -94,7 +98,7 @@ void dcheese_state::video_start() m_dstbitmap = auto_bitmap_ind16_alloc(machine(), DSTBITMAP_WIDTH, DSTBITMAP_HEIGHT); /* create a timer */ - m_blitter_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(dcheese_state::blitter_scanline_callback),this)); + m_blitter_timer = timer_alloc(TIMER_BLITTER_SCANLINE); /* register for saving */ save_item(NAME(m_blitter_color)); @@ -145,7 +149,7 @@ void dcheese_state::do_clear( ) memset(&m_dstbitmap->pix16(y % DSTBITMAP_HEIGHT), 0, DSTBITMAP_WIDTH * 2); /* signal an IRQ when done (timing is just a guess) */ - machine().scheduler().timer_set(machine().primary_screen->scan_period(), timer_expired_delegate(FUNC(dcheese_state::dcheese_signal_irq_callback),this), 1); + timer_set(machine().primary_screen->scan_period(), TIMER_SIGNAL_IRQ, 1); } @@ -199,7 +203,7 @@ void dcheese_state::do_blit( ) } /* signal an IRQ when done (timing is just a guess) */ - machine().scheduler().timer_set(machine().primary_screen->scan_period() / 2, timer_expired_delegate(FUNC(dcheese_state::dcheese_signal_irq_callback),this), 2); + timer_set(machine().primary_screen->scan_period() / 2, TIMER_SIGNAL_IRQ, 2); /* these extra parameters are written but they are always zero, so I don't know what they do */ if (m_blitter_xparam[8] != 0 || m_blitter_xparam[9] != 0 || m_blitter_xparam[10] != 0 || m_blitter_xparam[11] != 0 || diff --git a/src/mame/video/exidy.c b/src/mame/video/exidy.c index 9a30c0a47a1..0dbd6c5506e 100644 --- a/src/mame/video/exidy.c +++ b/src/mame/video/exidy.c @@ -255,13 +255,21 @@ void exidy_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) ***************************************************************************/ -TIMER_CALLBACK_MEMBER(exidy_state::collision_irq_callback) +void exidy_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - /* latch the collision bits */ - latch_condition(param); + switch (id) + { + case TIMER_COLLISION_IRQ: + /* latch the collision bits */ + latch_condition(param); - /* set the IRQ line */ - m_maincpu->set_input_line(0, ASSERT_LINE); + /* set the IRQ line */ + m_maincpu->set_input_line(0, ASSERT_LINE); + + break; + default: + assert_always(FALSE, "Unknown id in exidy_state::device_timer"); + } } @@ -327,7 +335,7 @@ void exidy_state::check_collision() /* if we got one, trigger an interrupt */ if ((current_collision_mask & m_collision_mask) && (count++ < 128)) - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(org_1_x + sx, org_1_y + sy), timer_expired_delegate(FUNC(exidy_state::collision_irq_callback),this), current_collision_mask); + timer_set(machine().primary_screen->time_until_pos(org_1_x + sx, org_1_y + sy), TIMER_COLLISION_IRQ, current_collision_mask); } if (m_motion_object_2_vid.pix16(sy, sx) != 0xff) @@ -335,7 +343,7 @@ void exidy_state::check_collision() /* check for background collision (M2CHAR) */ if (m_background_bitmap.pix16(org_2_y + sy, org_2_x + sx) != 0) if ((m_collision_mask & 0x08) && (count++ < 128)) - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(org_2_x + sx, org_2_y + sy), timer_expired_delegate(FUNC(exidy_state::collision_irq_callback),this), 0x08); + timer_set(machine().primary_screen->time_until_pos(org_2_x + sx, org_2_y + sy), TIMER_COLLISION_IRQ, 0x08); } } } diff --git a/src/mame/video/gameplan.c b/src/mame/video/gameplan.c index ae2322b3229..86cdfd82f35 100644 --- a/src/mame/video/gameplan.c +++ b/src/mame/video/gameplan.c @@ -30,6 +30,32 @@ driver by Chris Moore +/************************************* + * + * Timer handling + * + *************************************/ + +void gameplan_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_CLEAR_SCREEN_DONE: + clear_screen_done_callback(ptr, param); + break; + case TIMER_VIA_IRQ_DELAYED: + via_irq_delayed(ptr, param); + break; + case TIMER_VIA_0_CAL: + via_0_ca1_timer_callback(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in gameplan_state::device_timer"); + } +} + + + /************************************* * * Palette handling @@ -191,7 +217,7 @@ WRITE_LINE_MEMBER(gameplan_state::video_command_trigger_w) /* set a timer for an arbitrarily short period. The real time it takes to clear to screen is not important to the software */ - machine().scheduler().synchronize(timer_expired_delegate(FUNC(gameplan_state::clear_screen_done_callback),this)); + synchronize(TIMER_CLEAR_SCREEN_DONE); break; } @@ -210,7 +236,7 @@ WRITE_LINE_MEMBER(gameplan_state::via_irq) /* Kaos sits in a tight loop polling the VIA irq flags register, but that register is cleared by the irq handler. Therefore, I wait a bit before triggering the irq to leave time for the program to see the flag change. */ - machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(gameplan_state::via_irq_delayed),this), state); + timer_set(attotime::from_usec(50), TIMER_VIA_IRQ_DELAYED, state); } @@ -274,7 +300,7 @@ VIDEO_START_MEMBER(gameplan_state,common) m_videoram_size = (HBSTART - HBEND) * (VBSTART - VBEND); m_videoram = auto_alloc_array(machine(), UINT8, m_videoram_size); - m_via_0_ca1_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gameplan_state::via_0_ca1_timer_callback),this)); + m_via_0_ca1_timer = timer_alloc(TIMER_VIA_0_CAL); /* register for save states */ save_pointer(NAME(m_videoram), m_videoram_size); diff --git a/src/mame/video/hyhoo.c b/src/mame/video/hyhoo.c index 968293ada7f..260d134375e 100644 --- a/src/mame/video/hyhoo.c +++ b/src/mame/video/hyhoo.c @@ -52,10 +52,16 @@ WRITE8_MEMBER(hyhoo_state::hyhoo_romsel_w) } } - -TIMER_CALLBACK_MEMBER(hyhoo_state::blitter_timer_callback) +void hyhoo_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - nb1413m3_busyflag = 1; + switch (id) + { + case TIMER_BLITTER: + nb1413m3_busyflag = 1; + break; + default: + assert_always(FALSE, "Unknown id in hyhoo_state::device_timer"); + } } void hyhoo_state::hyhoo_gfxdraw() @@ -214,7 +220,7 @@ void hyhoo_state::hyhoo_gfxdraw() } nb1413m3_busyflag = 0; - machine().scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(hyhoo_state::blitter_timer_callback),this)); + timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, TIMER_BLITTER); } diff --git a/src/mame/video/lethalj.c b/src/mame/video/lethalj.c index b4320fdb5e2..31b12344362 100644 --- a/src/mame/video/lethalj.c +++ b/src/mame/video/lethalj.c @@ -93,13 +93,19 @@ void lethalj_state::video_start() * *************************************/ -TIMER_CALLBACK_MEMBER(lethalj_state::gen_ext1_int) +void lethalj_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - m_maincpu->set_input_line(0, ASSERT_LINE); + switch (id) + { + case TIMER_GEN_EXT1_INT: + m_maincpu->set_input_line(0, ASSERT_LINE); + break; + default: + assert_always(FALSE, "Unknown id in lethalj_state::device_timer"); + } } - void lethalj_state::do_blit() { int dsty = (INT16)m_blitter_data[1]; @@ -152,7 +158,7 @@ WRITE16_MEMBER(lethalj_state::lethalj_blitter_w) else do_blit(); - machine().scheduler().timer_set(attotime::from_hz(XTAL_32MHz) * ((m_blitter_data[5] + 1) * (m_blitter_data[7] + 1)), timer_expired_delegate(FUNC(lethalj_state::gen_ext1_int),this)); + timer_set(attotime::from_hz(XTAL_32MHz) * ((m_blitter_data[5] + 1) * (m_blitter_data[7] + 1)), TIMER_GEN_EXT1_INT); } /* clear the IRQ on offset 0 */ diff --git a/src/mame/video/m92.c b/src/mame/video/m92.c index 444761f8688..d6880deb196 100644 --- a/src/mame/video/m92.c +++ b/src/mame/video/m92.c @@ -44,13 +44,21 @@ /*****************************************************************************/ -TIMER_CALLBACK_MEMBER(m92_state::spritebuffer_callback) +void m92_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - m_sprite_buffer_busy = 1; - if (m_game_kludge!=2) /* Major Title 2 doesn't like this interrupt!? */ - m92_sprite_interrupt(); + switch (id) + { + case TIMER_SPRITEBUFFER: + m_sprite_buffer_busy = 1; + if (m_game_kludge!=2) /* Major Title 2 doesn't like this interrupt!? */ + m92_sprite_interrupt(); + break; + default: + assert_always(FALSE, "Unknown id in m92_state::device_timer"); + } } + WRITE16_MEMBER(m92_state::m92_spritecontrol_w) { COMBINE_DATA(&m_spritecontrol[offset]); @@ -81,7 +89,7 @@ WRITE16_MEMBER(m92_state::m92_spritecontrol_w) /* Pixel clock is 26.6666MHz (some boards 27MHz??), we have 0x800 bytes, or 0x400 words to copy from spriteram to the buffer. It seems safe to assume 1 word can be copied per clock. */ - machine().scheduler().timer_set(attotime::from_hz(XTAL_26_66666MHz) * 0x400, timer_expired_delegate(FUNC(m92_state::spritebuffer_callback),this)); + timer_set(attotime::from_hz(XTAL_26_66666MHz) * 0x400, TIMER_SPRITEBUFFER); } // logerror("%04x: m92_spritecontrol_w %08x %08x\n",space.device().safe_pc(),offset,data); } diff --git a/src/mame/video/midtunit.c b/src/mame/video/midtunit.c index 43c21d01467..c62acfb6218 100644 --- a/src/mame/video/midtunit.c +++ b/src/mame/video/midtunit.c @@ -588,10 +588,17 @@ DECLARE_BLITTER_SET(dma_draw_noskip_noscale, dma_state.bpp, EXTRACTGEN, SKIP * *************************************/ -TIMER_CALLBACK_MEMBER(midtunit_state::dma_callback) +void midtunit_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - dma_register[DMA_COMMAND] &= ~0x8000; /* tell the cpu we're done */ - m_maincpu->set_input_line(0, ASSERT_LINE); + switch (id) + { + case TIMER_DMA: + dma_register[DMA_COMMAND] &= ~0x8000; /* tell the cpu we're done */ + m_maincpu->set_input_line(0, ASSERT_LINE); + break; + default: + assert_always(FALSE, "Unknown id in midtunit_state::device_timer"); + } } @@ -791,7 +798,7 @@ if (LOG_DMA) /* signal we're done */ skipdma: - machine().scheduler().timer_set(attotime::from_nsec(41 * pixels), timer_expired_delegate(FUNC(midtunit_state::dma_callback),this)); + timer_set(attotime::from_nsec(41 * pixels), TIMER_DMA); g_profiler.stop(); } diff --git a/src/mame/video/midvunit.c b/src/mame/video/midvunit.c index 0180edf6d92..a83e00ce2a6 100644 --- a/src/mame/video/midvunit.c +++ b/src/mame/video/midvunit.c @@ -34,6 +34,21 @@ midvunit_renderer::midvunit_renderer(midvunit_state &state) * *************************************/ +void midvunit_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_ADC_READY: + m_maincpu->set_input_line(3, ASSERT_LINE); + break; + case TIMER_SCANLINE: + scanline_timer_cb(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in midvunit_state::device_timer"); + } +} + TIMER_CALLBACK_MEMBER(midvunit_state::scanline_timer_cb) { int scanline = param; @@ -42,7 +57,7 @@ TIMER_CALLBACK_MEMBER(midvunit_state::scanline_timer_cb) { m_maincpu->set_input_line(0, ASSERT_LINE); m_scanline_timer->adjust(machine().primary_screen->time_until_pos(scanline + 1), scanline); - machine().scheduler().timer_set(attotime::from_hz(25000000), timer_expired_delegate(FUNC(midvunit_state::scanline_timer_cb),this), -1); + timer_set(attotime::from_hz(25000000), TIMER_SCANLINE, -1); } else m_maincpu->set_input_line(0, CLEAR_LINE); @@ -51,7 +66,7 @@ TIMER_CALLBACK_MEMBER(midvunit_state::scanline_timer_cb) void midvunit_state::video_start() { - m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(midvunit_state::scanline_timer_cb),this)); + m_scanline_timer = timer_alloc(TIMER_SCANLINE); m_poly = auto_alloc(machine(), midvunit_renderer(*this)); diff --git a/src/mame/video/midyunit.c b/src/mame/video/midyunit.c index 99dca968f8a..6d68b79fac9 100644 --- a/src/mame/video/midyunit.c +++ b/src/mame/video/midyunit.c @@ -354,10 +354,25 @@ static void dma_draw(running_machine &machine, UINT16 command) /************************************* * - * DMA finished callback + * Timer callbacks * *************************************/ +void midyunit_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_DMA: + dma_callback(ptr, param); + break; + case TIMER_AUTOERASE_LINE: + autoerase_line(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in midyunit_state::device_timer"); + } +} + TIMER_CALLBACK_MEMBER(midyunit_state::dma_callback) { m_dma_register[DMA_COMMAND] &= ~0x8000; /* tell the cpu we're done */ @@ -515,7 +530,7 @@ if (LOG_DMA) } /* signal we're done */ - machine().scheduler().timer_set(attotime::from_nsec(41 * dma_state.width * dma_state.height), timer_expired_delegate(FUNC(midyunit_state::dma_callback),this)); + timer_set(attotime::from_nsec(41 * dma_state.width * dma_state.height), TIMER_DMA); g_profiler.stop(); } @@ -555,5 +570,5 @@ void midyunit_scanline_update(screen_device &screen, bitmap_ind16 &bitmap, int s /* if this is the last update of the screen, set a timer to clear out the final line */ /* (since we update one behind) */ if (scanline == screen.visible_area().max_y) - screen.machine().scheduler().timer_set(screen.time_until_pos(scanline + 1), timer_expired_delegate(FUNC(midyunit_state::autoerase_line),state), params->rowaddr); + state->timer_set(screen.time_until_pos(scanline + 1), midyunit_state::TIMER_AUTOERASE_LINE, params->rowaddr); } diff --git a/src/mame/video/nbmj8688.c b/src/mame/video/nbmj8688.c index 1c6bb7ce126..4965776401c 100644 --- a/src/mame/video/nbmj8688.c +++ b/src/mame/video/nbmj8688.c @@ -263,9 +263,16 @@ void nbmj8688_state::writeram_high(int x, int y, int color) update_pixel(x, y); } -TIMER_CALLBACK_MEMBER(nbmj8688_state::blitter_timer_callback) +void nbmj8688_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - nb1413m3_busyflag = 1; + switch (id) + { + case TIMER_BLITTER: + nb1413m3_busyflag = 1; + break; + default: + assert_always(FALSE, "Unknown id in nbmj8688_state::device_timer"); + } } void nbmj8688_state::mbmj8688_gfxdraw(int gfxtype) @@ -523,9 +530,9 @@ void nbmj8688_state::mbmj8688_gfxdraw(int gfxtype) nb1413m3_busyflag = 0; if (gfxtype == GFXTYPE_8BIT) - machine().scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(nbmj8688_state::blitter_timer_callback),this)); + timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, TIMER_BLITTER); else - machine().scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(nbmj8688_state::blitter_timer_callback),this)); + timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, TIMER_BLITTER); } diff --git a/src/mame/video/nbmj8891.c b/src/mame/video/nbmj8891.c index 908f9d34f3f..60cf574bf12 100644 --- a/src/mame/video/nbmj8891.c +++ b/src/mame/video/nbmj8891.c @@ -304,9 +304,16 @@ void nbmj8891_state::update_pixel1(int x, int y) m_tmpbitmap1.pix16(y, x) = (color == 0x7f) ? 0xff : color; } -TIMER_CALLBACK_MEMBER(nbmj8891_state::blitter_timer_callback) +void nbmj8891_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - nb1413m3_busyflag = 1; + switch (id) + { + case TIMER_BLITTER: + nb1413m3_busyflag = 1; + break; + default: + assert_always(FALSE, "Unknown id in nbmj8891_state::device_timer"); + } } void nbmj8891_state::nbmj8891_gfxdraw() @@ -465,7 +472,7 @@ void nbmj8891_state::nbmj8891_gfxdraw() } nb1413m3_busyflag = 0; - machine().scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(nbmj8891_state::blitter_timer_callback),this)); + timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, TIMER_BLITTER); } /****************************************************************************** diff --git a/src/mame/video/nbmj8900.c b/src/mame/video/nbmj8900.c index 48357e3b146..e0e6f38937f 100644 --- a/src/mame/video/nbmj8900.c +++ b/src/mame/video/nbmj8900.c @@ -196,9 +196,16 @@ void nbmj8900_state::update_pixel1(int x, int y) m_tmpbitmap1.pix16(y, x) = machine().pens[color]; } -TIMER_CALLBACK_MEMBER(nbmj8900_state::blitter_timer_callback) +void nbmj8900_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - nb1413m3_busyflag = 1; + switch (id) + { + case TIMER_BLITTER: + nb1413m3_busyflag = 1; + break; + default: + assert_always(FALSE, "Unknown id in nbmj8900_state::device_timer"); + } } void nbmj8900_state::nbmj8900_gfxdraw() @@ -349,7 +356,7 @@ void nbmj8900_state::nbmj8900_gfxdraw() } nb1413m3_busyflag = 0; - machine().scheduler().timer_set(attotime::from_nsec(2500) * nb1413m3_busyctr, timer_expired_delegate(FUNC(nbmj8900_state::blitter_timer_callback),this)); + timer_set(attotime::from_nsec(2500) * nb1413m3_busyctr, TIMER_BLITTER); } /****************************************************************************** diff --git a/src/mame/video/nbmj9195.c b/src/mame/video/nbmj9195.c index ff4b8b7bd80..cd8185c1a94 100644 --- a/src/mame/video/nbmj9195.c +++ b/src/mame/video/nbmj9195.c @@ -188,9 +188,16 @@ void nbmj9195_state::update_pixel(int vram, int x, int y) m_tmpbitmap[vram].pix16(y, x) = color; } -TIMER_CALLBACK_MEMBER(nbmj9195_state::blitter_timer_callback) +void nbmj9195_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - m_nb19010_busyflag = 1; + switch (id) + { + case TIMER_BLITTER: + m_nb19010_busyflag = 1; + break; + default: + assert_always(FALSE, "Unknown id in nbmj9195_state::device_timer"); + } } void nbmj9195_state::nbmj9195_gfxdraw(int vram) @@ -350,7 +357,7 @@ void nbmj9195_state::nbmj9195_gfxdraw(int vram) m_nb19010_busyflag = 0; /* 1650ns per count */ - machine().scheduler().timer_set(attotime::from_nsec(m_nb19010_busyctr * 1650), timer_expired_delegate(FUNC(nbmj9195_state::blitter_timer_callback),this)); + timer_set(attotime::from_nsec(m_nb19010_busyctr * 1650), TIMER_BLITTER); } /****************************************************************************** diff --git a/src/mame/video/niyanpai.c b/src/mame/video/niyanpai.c index 8211a1e1037..d9576d4087d 100644 --- a/src/mame/video/niyanpai.c +++ b/src/mame/video/niyanpai.c @@ -160,9 +160,16 @@ void niyanpai_state::update_pixel(int vram, int x, int y) m_tmpbitmap[vram].pix16(y, x) = color; } -TIMER_CALLBACK_MEMBER(niyanpai_state::blitter_timer_callback) +void niyanpai_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - m_nb19010_busyflag = 1; + switch (id) + { + case TIMER_BLITTER: + m_nb19010_busyflag = 1; + break; + default: + assert_always(FALSE, "Unknown id in niyanpai_state::device_timer"); + } } void niyanpai_state::niyanpai_gfxdraw(int vram) @@ -317,7 +324,7 @@ void niyanpai_state::niyanpai_gfxdraw(int vram) } m_nb19010_busyflag = 0; - machine().scheduler().timer_set(attotime::from_nsec(1000 * m_nb19010_busyctr), timer_expired_delegate(FUNC(niyanpai_state::blitter_timer_callback),this)); + timer_set(attotime::from_nsec(1000 * m_nb19010_busyctr), TIMER_BLITTER); } /****************************************************************************** diff --git a/src/mame/video/pastelg.c b/src/mame/video/pastelg.c index 8876f2a265c..18d2654e6fa 100644 --- a/src/mame/video/pastelg.c +++ b/src/mame/video/pastelg.c @@ -143,11 +143,19 @@ void pastelg_state::pastelg_vramflip() m_flipscreen_old = m_flipscreen; } -TIMER_CALLBACK_MEMBER(pastelg_state::blitter_timer_callback) +void pastelg_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - nb1413m3_busyflag = 1; + switch (id) + { + case TIMER_BLITTER: + nb1413m3_busyflag = 1; + break; + default: + assert_always(FALSE, "Unknown id in pastelg_state::device_timer"); + } } + void pastelg_state::pastelg_gfxdraw() { UINT8 *GFX = memregion("gfx1")->base(); @@ -268,7 +276,7 @@ void pastelg_state::pastelg_gfxdraw() } nb1413m3_busyflag = 0; - machine().scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(pastelg_state::blitter_timer_callback),this)); + timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, TIMER_BLITTER); } /****************************************************************************** diff --git a/src/mame/video/segag80r.c b/src/mame/video/segag80r.c index 26bcd9b0e0c..78392faee35 100644 --- a/src/mame/video/segag80r.c +++ b/src/mame/video/segag80r.c @@ -19,9 +19,16 @@ enum { spaceod_bg_detect_tile_color = 1 }; * *************************************/ -TIMER_CALLBACK_MEMBER(segag80r_state::vblank_latch_clear) +void segag80r_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - m_vblank_latch = 0; + switch (id) + { + case TIMER_VBLANK_LATCH_CLEAR: + m_vblank_latch = 0; + break; + default: + assert_always(FALSE, "Unknown id in segag80r_state::device_timer"); + } } @@ -30,7 +37,7 @@ void segag80r_state::vblank_latch_set() /* set a timer to mimic the 555 timer that drives the EDGINT signal */ /* the 555 is run in monostable mode with R=56000 and C=1000pF */ m_vblank_latch = 1; - machine().scheduler().timer_set(PERIOD_OF_555_MONOSTABLE(CAP_P(1000), RES_K(56)), timer_expired_delegate(FUNC(segag80r_state::vblank_latch_clear),this)); + timer_set(PERIOD_OF_555_MONOSTABLE(CAP_P(1000), RES_K(56)), TIMER_VBLANK_LATCH_CLEAR); /* latch the current flip state at the same time */ m_video_flip = m_video_control & 1; diff --git a/src/mame/video/tank8.c b/src/mame/video/tank8.c index 71bdfce2970..c3c1cf97d04 100644 --- a/src/mame/video/tank8.c +++ b/src/mame/video/tank8.c @@ -166,9 +166,16 @@ void tank8_state::draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect) } -TIMER_CALLBACK_MEMBER(tank8_state::tank8_collision_callback) +void tank8_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - tank8_set_collision(param); + switch (id) + { + case TIMER_COLLISION: + tank8_set_collision(param); + break; + default: + assert_always(FALSE, "Unknown id in tank8_state::device_timer"); + } } @@ -267,7 +274,7 @@ void tank8_state::screen_eof_tank8(screen_device &screen, bool state) index |= 0x80; /* collision on right side */ } - machine().scheduler().timer_set(screen.time_until_pos(y, x), timer_expired_delegate(FUNC(tank8_state::tank8_collision_callback),this), index); + timer_set(screen.time_until_pos(y, x), TIMER_COLLISION, index); _state = 1; } diff --git a/src/mame/video/triplhnt.c b/src/mame/video/triplhnt.c index 4a7a3c46b52..cfb3f10a48d 100644 --- a/src/mame/video/triplhnt.c +++ b/src/mame/video/triplhnt.c @@ -24,9 +24,16 @@ void triplhnt_state::video_start() } -TIMER_CALLBACK_MEMBER(triplhnt_state::triplhnt_hit_callback) +void triplhnt_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - triplhnt_set_collision(param); + switch (id) + { + case TIMER_HIT: + triplhnt_set_collision(param); + break; + default: + assert_always(FALSE, "Unknown id in triplhnt_state::device_timer"); + } } @@ -98,7 +105,7 @@ void triplhnt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec } if (hit_line != 999 && hit_code != 999) - machine().scheduler().timer_set(machine().primary_screen->time_until_pos(hit_line), timer_expired_delegate(FUNC(triplhnt_state::triplhnt_hit_callback),this), hit_code); + timer_set(machine().primary_screen->time_until_pos(hit_line), TIMER_HIT, hit_code); } diff --git a/src/mame/video/tubep.c b/src/mame/video/tubep.c index 38d29053e01..5a8aabe469c 100644 --- a/src/mame/video/tubep.c +++ b/src/mame/video/tubep.c @@ -423,12 +423,6 @@ WRITE8_MEMBER(tubep_state::tubep_background_c000_w) } -TIMER_CALLBACK_MEMBER(tubep_state::sprite_timer_callback) -{ - m_mcu->set_input_line(0, ASSERT_LINE); -} - - void tubep_state::draw_sprite() { UINT32 XDOT; @@ -557,7 +551,7 @@ WRITE8_MEMBER(tubep_state::tubep_sprite_control_w) m_mcu->set_input_line(0, CLEAR_LINE); /* 2.assert /SINT again after this time */ - machine().scheduler().timer_set( attotime::from_hz(19968000/8) * ((m_XSize+1)*(m_YSize+1)), timer_expired_delegate(FUNC(tubep_state::sprite_timer_callback),this)); + timer_set( attotime::from_hz(19968000/8) * ((m_XSize+1)*(m_YSize+1)), TIMER_SPRITE); /* 3.clear of /SINT starts sprite drawing circuit */ draw_sprite(); diff --git a/src/mame/video/vectrex.c b/src/mame/video/vectrex.c index d4c0a1d8661..97c3cc0f944 100644 --- a/src/mame/video/vectrex.c +++ b/src/mame/video/vectrex.c @@ -264,15 +264,12 @@ void vectrex_state::video_start() m_imager_freq = 1; vector_add_point_function = &vectrex_state::vectrex_add_point; - m_imager_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vectrex_state::vectrex_imager_eye),this)); - m_imager_timer->adjust( - attotime::from_hz(m_imager_freq), - 2, - attotime::from_hz(m_imager_freq)); + m_imager_timer = timer_alloc(TIMER_VECTREX_IMAGER_EYE); + m_imager_timer->adjust(attotime::from_hz(m_imager_freq), 2, attotime::from_hz(m_imager_freq)); - m_lp_t = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vectrex_state::lightpen_trigger),this)); + m_lp_t = timer_alloc(TIMER_LIGHTPEN_TRIGGER); - m_refresh = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vectrex_state::vectrex_refresh),this)); + m_refresh = timer_alloc(TIMER_VECTREX_REFRESH); VIDEO_START_CALL_LEGACY(vector); } @@ -286,7 +283,7 @@ void vectrex_state::video_start() void vectrex_state::vectrex_multiplexer(int mux) { - machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_state::update_signal),this), m_via_out[PORTA], &m_analog[mux]); + timer_set(attotime::from_nsec(ANALOG_DELAY), TIMER_UPDATE_SIGNAL, m_via_out[PORTA], &m_analog[mux]); if (mux == A_AUDIO) m_dac->write_unsigned8(m_via_out[PORTA]); @@ -341,7 +338,7 @@ WRITE8_MEMBER(vectrex_state::v_via_pb_w) if (!(data & 0x1) && (m_via_out[PORTB] & 0x1)) { /* MUX has been enabled */ - machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_state::update_signal),this)); + timer_set(attotime::from_nsec(ANALOG_DELAY), TIMER_UPDATE_SIGNAL); } } else @@ -374,7 +371,7 @@ WRITE8_MEMBER(vectrex_state::v_via_pb_w) vectrex_multiplexer((data >> 1) & 0x3); m_via_out[PORTB] = data; - machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_state::update_signal),this), data & 0x80, &m_ramp); + timer_set(attotime::from_nsec(ANALOG_DELAY), TIMER_UPDATE_SIGNAL, data & 0x80, &m_ramp); } @@ -382,7 +379,7 @@ WRITE8_MEMBER(vectrex_state::v_via_pa_w) { /* DAC output always goes to Y integrator */ m_via_out[PORTA] = data; - machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_state::update_signal),this), data, &m_analog[A_Y]); + timer_set(attotime::from_nsec(ANALOG_DELAY), TIMER_UPDATE_SIGNAL, data, &m_analog[A_Y]); if (!(m_via_out[PORTB] & 0x1)) vectrex_multiplexer((m_via_out[PORTB] >> 1) & 0x3); @@ -392,7 +389,7 @@ WRITE8_MEMBER(vectrex_state::v_via_pa_w) WRITE8_MEMBER(vectrex_state::v_via_ca2_w) { if (data == 0) - machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_state::vectrex_zero_integrators),this)); + timer_set(attotime::from_nsec(ANALOG_DELAY), TIMER_VECTREX_ZERO_INTEGRATORS); } @@ -415,11 +412,11 @@ WRITE8_MEMBER(vectrex_state::v_via_cb2_w) dx = abs(m_pen_x - m_x_int); dy = abs(m_pen_y - m_y_int); if (dx < 500000 && dy < 500000 && data > 0) - machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(vectrex_state::lightpen_trigger),this)); + timer_set(attotime::zero, TIMER_LIGHTPEN_TRIGGER); } } - machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(vectrex_state::update_signal),this), data, &m_blank); + timer_set(attotime::zero, TIMER_UPDATE_SIGNAL, data, &m_blank); m_cb2 = data; } } @@ -458,7 +455,7 @@ VIDEO_START_MEMBER(vectrex_state,raaspec) m_y_max = visarea.max_y << 16; vector_add_point_function = &vectrex_state::vectrex_add_point; - m_refresh = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vectrex_state::vectrex_refresh),this)); + m_refresh = timer_alloc(TIMER_VECTREX_REFRESH); VIDEO_START_CALL_LEGACY(vector); }