From 7d32bea42e0aa3d1f3e6188bfde5ea4ef2880b1c Mon Sep 17 00:00:00 2001 From: Osso13 Date: Thu, 15 Jan 2015 18:03:43 +0100 Subject: [PATCH] nb1413m3_device: anonymous timer isn't anonymous anymore (nw) --- src/mame/includes/nb1413m3.h | 12 ++++++++---- src/mame/machine/nb1413m3.c | 26 +++++++++++++++----------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/mame/includes/nb1413m3.h b/src/mame/includes/nb1413m3.h index 414b2ae09de..b9cc02a33c6 100644 --- a/src/mame/includes/nb1413m3.h +++ b/src/mame/includes/nb1413m3.h @@ -129,6 +129,11 @@ public: // (static) configuration helpers static void set_type(device_t &device, int type) { downcast(device).m_nb1413m3_type = type; } + + enum + { + TIMER_CB + }; DECLARE_WRITE8_MEMBER( nmi_clock_w ); DECLARE_READ8_MEMBER( sndrom_r ); @@ -161,10 +166,10 @@ public: protected: // device-level overrides - virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); - + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + private: int m_74ls193_counter; @@ -176,9 +181,8 @@ private: int m_gfxradr_h; int m_gfxrombank; int m_outcoin_enable; - + emu_timer *m_timer_cb; TIMER_CALLBACK_MEMBER( timer_callback ); - }; /* used in: hyhoo.c, niyanpai.c, pastelg.c, nbmj8688.c, nbmj8891.c, nbmj8991.c, nbmj9195.c*/ diff --git a/src/mame/machine/nb1413m3.c b/src/mame/machine/nb1413m3.c index a919ccad469..d74bc6163ed 100644 --- a/src/mame/machine/nb1413m3.c +++ b/src/mame/machine/nb1413m3.c @@ -42,15 +42,6 @@ nb1413m3_device::nb1413m3_device(const machine_config &mconfig, const char *tag, { } -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void nb1413m3_device::device_config_complete() -{ -} //------------------------------------------------- // device_start - device-specific startup @@ -58,7 +49,8 @@ void nb1413m3_device::device_config_complete() void nb1413m3_device::device_start() { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(nb1413m3_device::timer_callback), this)); + m_timer_cb = timer_alloc(TIMER_CB); + synchronize(TIMER_CB); save_item(NAME(m_nb1413m3_type)); save_item(NAME(m_sndrombank1)); @@ -105,10 +97,22 @@ void nb1413m3_device::device_reset() DEVICE HANDLERS *****************************************************************************/ +void nb1413m3_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_CB: + timer_callback(ptr, param); + break; + default: + assert_always(FALSE, "Unknown id in nb1413m3_device::device_timer"); + } +} + /* TODO: is all of this actually programmable? */ TIMER_CALLBACK_MEMBER( nb1413m3_device::timer_callback ) { - machine().scheduler().timer_set(attotime::from_hz(NB1413M3_TIMER_BASE) * 256, timer_expired_delegate(FUNC(nb1413m3_device::timer_callback), this)); + m_timer_cb->adjust(attotime::from_hz(NB1413M3_TIMER_BASE) * 256); m_74ls193_counter++; m_74ls193_counter &= 0x0f;