diff --git a/src/emu/machine/74123.c b/src/emu/machine/74123.c index 2f4f2eac5bb..edd5261e34d 100644 --- a/src/emu/machine/74123.c +++ b/src/emu/machine/74123.c @@ -66,7 +66,7 @@ void ttl74123_device::device_start() { m_output_changed.resolve(m_output_changed_cb, *this); - m_timer = machine().scheduler().timer_alloc(FUNC(clear_callback), (void *)this); + m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ttl74123_device::clear_callback),this)); /* register for state saving */ save_item(NAME(m_a)); @@ -137,13 +137,7 @@ int ttl74123_device::timer_running() TIMER_CALLBACK( output_callback ) -------------------------------------------------*/ -TIMER_CALLBACK( ttl74123_device::output_callback ) -{ - ttl74123_device *dev = reinterpret_cast(ptr); - dev->output(param); -} - -void ttl74123_device::output(INT32 param) +TIMER_CALLBACK_MEMBER( ttl74123_device::output_callback ) { m_output_changed(0, param); } @@ -157,7 +151,7 @@ void ttl74123_device::set_output() { int output = timer_running(); - machine().scheduler().timer_set( attotime::zero, FUNC(output_callback ), output, (void *)this); + machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(ttl74123_device::output_callback ),this), output); if (LOG) logerror("74123 %s: Output: %d\n", tag(), output); } @@ -167,20 +161,13 @@ void ttl74123_device::set_output() TIMER_CALLBACK( clear_callback ) -------------------------------------------------*/ -TIMER_CALLBACK( ttl74123_device::clear_callback ) -{ - ttl74123_device *dev = reinterpret_cast(ptr); - dev->clear(); -} - -void ttl74123_device::clear() +TIMER_CALLBACK_MEMBER( ttl74123_device::clear_callback ) { int output = timer_running(); m_output_changed(0, output); } - //------------------------------------------------- // start_pulse - begin timing //------------------------------------------------- @@ -221,13 +208,7 @@ void ttl74123_device::start_pulse() // a_w - write register a data //------------------------------------------------- -WRITE8_DEVICE_HANDLER( ttl74123_a_w ) -{ - ttl74123_device *dev = downcast(device); - dev->a_w(data); -} - -void ttl74123_device::a_w(UINT8 data) +WRITE8_MEMBER( ttl74123_device::a_w ) { /* start/regtrigger pulse if B=HI and falling edge on A (while clear is HI) */ if (!data && m_a && m_b && m_clear) @@ -243,13 +224,7 @@ void ttl74123_device::a_w(UINT8 data) // b_w - write register b data //------------------------------------------------- -WRITE8_DEVICE_HANDLER( ttl74123_b_w ) -{ - ttl74123_device *dev = downcast(device); - dev->b_w(data); -} - -void ttl74123_device::b_w(UINT8 data) +WRITE8_MEMBER( ttl74123_device::b_w) { /* start/regtrigger pulse if A=LO and rising edge on B (while clear is HI) */ if (data && !m_b && !m_a && m_clear) @@ -265,13 +240,7 @@ void ttl74123_device::b_w(UINT8 data) // clear_w - write register clear data //------------------------------------------------- -WRITE8_DEVICE_HANDLER( ttl74123_clear_w ) -{ - ttl74123_device *dev = downcast(device); - dev->clear_w(data); -} - -void ttl74123_device::clear_w(UINT8 data) +WRITE8_MEMBER( ttl74123_device::clear_w) { /* start/regtrigger pulse if B=HI and A=LO and rising edge on clear */ if (data && !m_a && m_b && !m_clear) @@ -292,13 +261,7 @@ void ttl74123_device::clear_w(UINT8 data) // reset_w - reset device //------------------------------------------------- -WRITE8_DEVICE_HANDLER( ttl74123_reset_w ) -{ - ttl74123_device *dev = downcast(device); - dev->reset_w(); -} - -void ttl74123_device::reset_w() +WRITE8_MEMBER( ttl74123_device::reset_w) { set_output(); } diff --git a/src/emu/machine/74123.h b/src/emu/machine/74123.h index 019ed29b8b2..a000b43a516 100644 --- a/src/emu/machine/74123.h +++ b/src/emu/machine/74123.h @@ -96,10 +96,10 @@ public: // construction/destruction ttl74123_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - void a_w(UINT8 data); - void b_w(UINT8 data); - void clear_w(UINT8 data); - void reset_w(); + DECLARE_WRITE8_MEMBER(a_w); + DECLARE_WRITE8_MEMBER(b_w); + DECLARE_WRITE8_MEMBER(clear_w); + DECLARE_WRITE8_MEMBER(reset_w); protected: // device-level overrides @@ -109,8 +109,8 @@ protected: virtual void device_post_load() { } virtual void device_clock_changed() { } - static TIMER_CALLBACK( output_callback ); - static TIMER_CALLBACK( clear_callback ); + TIMER_CALLBACK_MEMBER( output_callback ); + TIMER_CALLBACK_MEMBER( clear_callback ); private: @@ -129,15 +129,4 @@ private: // device type definition extern const device_type TTL74123; - - -/*************************************************************************** - PROTOTYPES -***************************************************************************/ - -DECLARE_WRITE8_DEVICE_HANDLER( ttl74123_a_w ); -DECLARE_WRITE8_DEVICE_HANDLER( ttl74123_b_w ); -DECLARE_WRITE8_DEVICE_HANDLER( ttl74123_clear_w ); -DECLARE_WRITE8_DEVICE_HANDLER( ttl74123_reset_w ); /* reset the latch */ - #endif diff --git a/src/emu/machine/8257dma.c b/src/emu/machine/8257dma.c index 801aea36394..0a7ccaa6e8f 100644 --- a/src/emu/machine/8257dma.c +++ b/src/emu/machine/8257dma.c @@ -445,10 +445,3 @@ void i8257_device::i8257_drq_w(int channel, int state) synchronize(TIMER_DRQ_SYNC, param); } - -WRITE_LINE_DEVICE_HANDLER( i8257_hlda_w ) { } -WRITE_LINE_DEVICE_HANDLER( i8257_ready_w ) { } -WRITE_LINE_DEVICE_HANDLER( i8257_drq0_w ) { downcast(device)->i8257_drq_w(0, state); } -WRITE_LINE_DEVICE_HANDLER( i8257_drq1_w ) { downcast(device)->i8257_drq_w(1, state); } -WRITE_LINE_DEVICE_HANDLER( i8257_drq2_w ) { downcast(device)->i8257_drq_w(2, state); } -WRITE_LINE_DEVICE_HANDLER( i8257_drq3_w ) { downcast(device)->i8257_drq_w(3, state); } diff --git a/src/emu/machine/rtc9701.c b/src/emu/machine/rtc9701.c index 8a590a07c72..943e502bca3 100644 --- a/src/emu/machine/rtc9701.c +++ b/src/emu/machine/rtc9701.c @@ -203,11 +203,6 @@ WRITE_LINE_MEMBER( rtc9701_device::write_bit ) } -READ_LINE_DEVICE_HANDLER( rtc9701_read_bit ) -{ - return downcast(device)->read_bit(); -} - READ_LINE_MEMBER( rtc9701_device::read_bit ) { if (rtc_state == RTC9701_RTC_READ) diff --git a/src/mame/drivers/m10.c b/src/mame/drivers/m10.c index cf726c00242..09dc664eaed 100644 --- a/src/mame/drivers/m10.c +++ b/src/mame/drivers/m10.c @@ -114,7 +114,6 @@ Notes (couriersud) #include "cpu/m6502/m6502.h" #include "machine/rescap.h" #include "sound/samples.h" -#include "machine/74123.h" #include "includes/m10.h" @@ -138,8 +137,8 @@ WRITE8_MEMBER(m10_state::ic8j2_output_changed) { /* written from /Q to A with slight delight */ LOG(("ic8j2: %d\n", data)); - ttl74123_a_w(m_ic8j2, space, 0, data); - ttl74123_a_w(m_ic8j1, space, 0, data); + m_ic8j2->a_w(space, 0, data); + m_ic8j1->a_w(space, 0, data); } static const ttl74123_interface ic8j1_intf = @@ -191,9 +190,6 @@ PALETTE_INIT_MEMBER(m10_state,m10) MACHINE_START_MEMBER(m10_state,m10) { - m_ic8j1 = machine().device("ic8j1"); - m_ic8j2 = machine().device("ic8j2"); - save_item(NAME(m_bottomline)); save_item(NAME(m_flip)); save_item(NAME(m_last)); @@ -466,8 +462,8 @@ READ8_MEMBER(m10_state::m10_a700_r) { //LOG(("rd:%d\n",m_screen->vpos())); LOG(("clear\n")); - ttl74123_clear_w(m_ic8j1, space, 0, 0); - ttl74123_clear_w(m_ic8j1, space, 0, 1); + m_ic8j1->clear_w(space, 0, 0); + m_ic8j1->clear_w(space, 0, 1); return 0x00; } @@ -476,8 +472,8 @@ READ8_MEMBER(m10_state::m11_a700_r) //LOG(("rd:%d\n",m_screen->vpos())); //m_maincpu->set_input_line(0, CLEAR_LINE); LOG(("clear\n")); - ttl74123_clear_w(m_ic8j1, space, 0, 0); - ttl74123_clear_w(m_ic8j1, space, 0, 1); + m_ic8j1->clear_w(space, 0, 0); + m_ic8j1->clear_w(space, 0, 1); return 0x00; } diff --git a/src/mame/drivers/nyny.c b/src/mame/drivers/nyny.c index a0416e21fce..2e05343eff7 100644 --- a/src/mame/drivers/nyny.c +++ b/src/mame/drivers/nyny.c @@ -95,7 +95,11 @@ public: m_colorram2(*this, "colorram2"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), - m_audiocpu2(*this, "audio2"){ } + m_audiocpu2(*this, "audio2"), + m_ic48_1(*this, "ic48_1"), + m_mc6845(*this, "crtc"), + m_pia1(*this, "pia1"), + m_pia2(*this, "pia2") { } /* memory pointers */ required_shared_ptr m_videoram1; @@ -113,10 +117,11 @@ public: required_device m_maincpu; required_device m_audiocpu; required_device m_audiocpu2; - device_t *m_ic48_1; - mc6845_device *m_mc6845; - pia6821_device *m_pia1; - pia6821_device *m_pia2; + required_device m_ic48_1; + required_device m_mc6845; + required_device m_pia1; + required_device m_pia2; + pen_t m_pens[NUM_PENS]; DECLARE_WRITE8_MEMBER(audio_1_command_w); DECLARE_WRITE8_MEMBER(audio_1_answer_w); @@ -385,7 +390,7 @@ static MC6845_END_UPDATE( end_update ) WRITE_LINE_MEMBER(nyny_state::display_enable_changed) { - ttl74123_a_w(m_ic48_1, generic_space(), 0, state); + m_ic48_1->a_w(generic_space(), 0, state); } @@ -639,11 +644,6 @@ INPUT_PORTS_END void nyny_state::machine_start() { - m_ic48_1 = machine().device("ic48_1"); - m_mc6845 = machine().device("crtc"); - m_pia1 = machine().device("pia1"); - m_pia2 = machine().device("pia2"); - /* setup for save states */ save_item(NAME(m_flipscreen)); save_item(NAME(m_star_enable)); diff --git a/src/mame/drivers/r2dtank.c b/src/mame/drivers/r2dtank.c index 5bba46a6261..395fd946a3f 100644 --- a/src/mame/drivers/r2dtank.c +++ b/src/mame/drivers/r2dtank.c @@ -357,8 +357,7 @@ static MC6845_UPDATE_ROW( update_row ) WRITE_LINE_MEMBER(r2dtank_state::display_enable_changed) { - address_space &space = generic_space(); - ttl74123_a_w(machine().device("74123"), space, 0, state); + machine().device("74123")->a_w(generic_space(), 0, state); } diff --git a/src/mame/drivers/spiders.c b/src/mame/drivers/spiders.c index dcce1af032f..9371b691d52 100644 --- a/src/mame/drivers/spiders.c +++ b/src/mame/drivers/spiders.c @@ -412,8 +412,7 @@ static MC6845_UPDATE_ROW( update_row ) WRITE_LINE_MEMBER(spiders_state::display_enable_changed) { - address_space &space = generic_space(); - ttl74123_a_w(machine().device("ic60"), space, 0, state); + machine().device("ic60")->a_w(generic_space(), 0, state); } diff --git a/src/mame/includes/m10.h b/src/mame/includes/m10.h index d636bf23d35..ccd163cf770 100644 --- a/src/mame/includes/m10.h +++ b/src/mame/includes/m10.h @@ -5,6 +5,7 @@ ****************************************************************************/ #include "sound/samples.h" +#include "machine/74123.h" #define IREMM10_MASTER_CLOCK (12500000) @@ -44,6 +45,8 @@ public: m_colorram(*this, "colorram"), m_chargen(*this, "chargen"), m_maincpu(*this, "maincpu"), + m_ic8j1(*this, "ic8j1"), + m_ic8j2(*this, "ic8j2"), m_samples(*this, "samples"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), @@ -72,8 +75,8 @@ public: /* devices */ required_device m_maincpu; - device_t *m_ic8j1; - device_t *m_ic8j2; + optional_device m_ic8j1; + optional_device m_ic8j2; required_device m_samples; optional_device m_gfxdecode; required_device m_screen;