some small cleanup (nw)

This commit is contained in:
Miodrag Milanovic 2014-03-21 21:11:32 +00:00
parent b62e42c596
commit e0c6a203b8
9 changed files with 38 additions and 101 deletions

View File

@ -66,7 +66,7 @@ void ttl74123_device::device_start()
{ {
m_output_changed.resolve(m_output_changed_cb, *this); 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 */ /* register for state saving */
save_item(NAME(m_a)); save_item(NAME(m_a));
@ -137,13 +137,7 @@ int ttl74123_device::timer_running()
TIMER_CALLBACK( output_callback ) TIMER_CALLBACK( output_callback )
-------------------------------------------------*/ -------------------------------------------------*/
TIMER_CALLBACK( ttl74123_device::output_callback ) TIMER_CALLBACK_MEMBER( ttl74123_device::output_callback )
{
ttl74123_device *dev = reinterpret_cast<ttl74123_device*>(ptr);
dev->output(param);
}
void ttl74123_device::output(INT32 param)
{ {
m_output_changed(0, param); m_output_changed(0, param);
} }
@ -157,7 +151,7 @@ void ttl74123_device::set_output()
{ {
int output = timer_running(); 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); 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( clear_callback )
-------------------------------------------------*/ -------------------------------------------------*/
TIMER_CALLBACK( ttl74123_device::clear_callback ) TIMER_CALLBACK_MEMBER( ttl74123_device::clear_callback )
{
ttl74123_device *dev = reinterpret_cast<ttl74123_device*>(ptr);
dev->clear();
}
void ttl74123_device::clear()
{ {
int output = timer_running(); int output = timer_running();
m_output_changed(0, output); m_output_changed(0, output);
} }
//------------------------------------------------- //-------------------------------------------------
// start_pulse - begin timing // start_pulse - begin timing
//------------------------------------------------- //-------------------------------------------------
@ -221,13 +208,7 @@ void ttl74123_device::start_pulse()
// a_w - write register a data // a_w - write register a data
//------------------------------------------------- //-------------------------------------------------
WRITE8_DEVICE_HANDLER( ttl74123_a_w ) WRITE8_MEMBER( ttl74123_device::a_w )
{
ttl74123_device *dev = downcast<ttl74123_device *>(device);
dev->a_w(data);
}
void ttl74123_device::a_w(UINT8 data)
{ {
/* start/regtrigger pulse if B=HI and falling edge on A (while clear is HI) */ /* start/regtrigger pulse if B=HI and falling edge on A (while clear is HI) */
if (!data && m_a && m_b && m_clear) 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 // b_w - write register b data
//------------------------------------------------- //-------------------------------------------------
WRITE8_DEVICE_HANDLER( ttl74123_b_w ) WRITE8_MEMBER( ttl74123_device::b_w)
{
ttl74123_device *dev = downcast<ttl74123_device *>(device);
dev->b_w(data);
}
void ttl74123_device::b_w(UINT8 data)
{ {
/* start/regtrigger pulse if A=LO and rising edge on B (while clear is HI) */ /* start/regtrigger pulse if A=LO and rising edge on B (while clear is HI) */
if (data && !m_b && !m_a && m_clear) 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 // clear_w - write register clear data
//------------------------------------------------- //-------------------------------------------------
WRITE8_DEVICE_HANDLER( ttl74123_clear_w ) WRITE8_MEMBER( ttl74123_device::clear_w)
{
ttl74123_device *dev = downcast<ttl74123_device *>(device);
dev->clear_w(data);
}
void ttl74123_device::clear_w(UINT8 data)
{ {
/* start/regtrigger pulse if B=HI and A=LO and rising edge on clear */ /* start/regtrigger pulse if B=HI and A=LO and rising edge on clear */
if (data && !m_a && m_b && !m_clear) if (data && !m_a && m_b && !m_clear)
@ -292,13 +261,7 @@ void ttl74123_device::clear_w(UINT8 data)
// reset_w - reset device // reset_w - reset device
//------------------------------------------------- //-------------------------------------------------
WRITE8_DEVICE_HANDLER( ttl74123_reset_w ) WRITE8_MEMBER( ttl74123_device::reset_w)
{
ttl74123_device *dev = downcast<ttl74123_device *>(device);
dev->reset_w();
}
void ttl74123_device::reset_w()
{ {
set_output(); set_output();
} }

View File

@ -96,10 +96,10 @@ public:
// construction/destruction // construction/destruction
ttl74123_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ttl74123_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void a_w(UINT8 data); DECLARE_WRITE8_MEMBER(a_w);
void b_w(UINT8 data); DECLARE_WRITE8_MEMBER(b_w);
void clear_w(UINT8 data); DECLARE_WRITE8_MEMBER(clear_w);
void reset_w(); DECLARE_WRITE8_MEMBER(reset_w);
protected: protected:
// device-level overrides // device-level overrides
@ -109,8 +109,8 @@ protected:
virtual void device_post_load() { } virtual void device_post_load() { }
virtual void device_clock_changed() { } virtual void device_clock_changed() { }
static TIMER_CALLBACK( output_callback ); TIMER_CALLBACK_MEMBER( output_callback );
static TIMER_CALLBACK( clear_callback ); TIMER_CALLBACK_MEMBER( clear_callback );
private: private:
@ -129,15 +129,4 @@ private:
// device type definition // device type definition
extern const device_type TTL74123; 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 #endif

View File

@ -445,10 +445,3 @@ void i8257_device::i8257_drq_w(int channel, int state)
synchronize(TIMER_DRQ_SYNC, param); 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<i8257_device*>(device)->i8257_drq_w(0, state); }
WRITE_LINE_DEVICE_HANDLER( i8257_drq1_w ) { downcast<i8257_device*>(device)->i8257_drq_w(1, state); }
WRITE_LINE_DEVICE_HANDLER( i8257_drq2_w ) { downcast<i8257_device*>(device)->i8257_drq_w(2, state); }
WRITE_LINE_DEVICE_HANDLER( i8257_drq3_w ) { downcast<i8257_device*>(device)->i8257_drq_w(3, state); }

View File

@ -203,11 +203,6 @@ WRITE_LINE_MEMBER( rtc9701_device::write_bit )
} }
READ_LINE_DEVICE_HANDLER( rtc9701_read_bit )
{
return downcast<rtc9701_device *>(device)->read_bit();
}
READ_LINE_MEMBER( rtc9701_device::read_bit ) READ_LINE_MEMBER( rtc9701_device::read_bit )
{ {
if (rtc_state == RTC9701_RTC_READ) if (rtc_state == RTC9701_RTC_READ)

View File

@ -114,7 +114,6 @@ Notes (couriersud)
#include "cpu/m6502/m6502.h" #include "cpu/m6502/m6502.h"
#include "machine/rescap.h" #include "machine/rescap.h"
#include "sound/samples.h" #include "sound/samples.h"
#include "machine/74123.h"
#include "includes/m10.h" #include "includes/m10.h"
@ -138,8 +137,8 @@ WRITE8_MEMBER(m10_state::ic8j2_output_changed)
{ {
/* written from /Q to A with slight delight */ /* written from /Q to A with slight delight */
LOG(("ic8j2: %d\n", data)); LOG(("ic8j2: %d\n", data));
ttl74123_a_w(m_ic8j2, space, 0, data); m_ic8j2->a_w(space, 0, data);
ttl74123_a_w(m_ic8j1, space, 0, data); m_ic8j1->a_w(space, 0, data);
} }
static const ttl74123_interface ic8j1_intf = static const ttl74123_interface ic8j1_intf =
@ -191,9 +190,6 @@ PALETTE_INIT_MEMBER(m10_state,m10)
MACHINE_START_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_bottomline));
save_item(NAME(m_flip)); save_item(NAME(m_flip));
save_item(NAME(m_last)); save_item(NAME(m_last));
@ -466,8 +462,8 @@ READ8_MEMBER(m10_state::m10_a700_r)
{ {
//LOG(("rd:%d\n",m_screen->vpos())); //LOG(("rd:%d\n",m_screen->vpos()));
LOG(("clear\n")); LOG(("clear\n"));
ttl74123_clear_w(m_ic8j1, space, 0, 0); m_ic8j1->clear_w(space, 0, 0);
ttl74123_clear_w(m_ic8j1, space, 0, 1); m_ic8j1->clear_w(space, 0, 1);
return 0x00; return 0x00;
} }
@ -476,8 +472,8 @@ READ8_MEMBER(m10_state::m11_a700_r)
//LOG(("rd:%d\n",m_screen->vpos())); //LOG(("rd:%d\n",m_screen->vpos()));
//m_maincpu->set_input_line(0, CLEAR_LINE); //m_maincpu->set_input_line(0, CLEAR_LINE);
LOG(("clear\n")); LOG(("clear\n"));
ttl74123_clear_w(m_ic8j1, space, 0, 0); m_ic8j1->clear_w(space, 0, 0);
ttl74123_clear_w(m_ic8j1, space, 0, 1); m_ic8j1->clear_w(space, 0, 1);
return 0x00; return 0x00;
} }

View File

@ -95,7 +95,11 @@ public:
m_colorram2(*this, "colorram2"), m_colorram2(*this, "colorram2"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"), 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 */ /* memory pointers */
required_shared_ptr<UINT8> m_videoram1; required_shared_ptr<UINT8> m_videoram1;
@ -113,10 +117,11 @@ public:
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu; required_device<cpu_device> m_audiocpu;
required_device<cpu_device> m_audiocpu2; required_device<cpu_device> m_audiocpu2;
device_t *m_ic48_1; required_device<ttl74123_device> m_ic48_1;
mc6845_device *m_mc6845; required_device<mc6845_device> m_mc6845;
pia6821_device *m_pia1; required_device<pia6821_device> m_pia1;
pia6821_device *m_pia2; required_device<pia6821_device> m_pia2;
pen_t m_pens[NUM_PENS]; pen_t m_pens[NUM_PENS];
DECLARE_WRITE8_MEMBER(audio_1_command_w); DECLARE_WRITE8_MEMBER(audio_1_command_w);
DECLARE_WRITE8_MEMBER(audio_1_answer_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) 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() void nyny_state::machine_start()
{ {
m_ic48_1 = machine().device("ic48_1");
m_mc6845 = machine().device<mc6845_device>("crtc");
m_pia1 = machine().device<pia6821_device>("pia1");
m_pia2 = machine().device<pia6821_device>("pia2");
/* setup for save states */ /* setup for save states */
save_item(NAME(m_flipscreen)); save_item(NAME(m_flipscreen));
save_item(NAME(m_star_enable)); save_item(NAME(m_star_enable));

View File

@ -357,8 +357,7 @@ static MC6845_UPDATE_ROW( update_row )
WRITE_LINE_MEMBER(r2dtank_state::display_enable_changed) WRITE_LINE_MEMBER(r2dtank_state::display_enable_changed)
{ {
address_space &space = generic_space(); machine().device<ttl74123_device>("74123")->a_w(generic_space(), 0, state);
ttl74123_a_w(machine().device("74123"), space, 0, state);
} }

View File

@ -412,8 +412,7 @@ static MC6845_UPDATE_ROW( update_row )
WRITE_LINE_MEMBER(spiders_state::display_enable_changed) WRITE_LINE_MEMBER(spiders_state::display_enable_changed)
{ {
address_space &space = generic_space(); machine().device<ttl74123_device>("ic60")->a_w(generic_space(), 0, state);
ttl74123_a_w(machine().device("ic60"), space, 0, state);
} }

View File

@ -5,6 +5,7 @@
****************************************************************************/ ****************************************************************************/
#include "sound/samples.h" #include "sound/samples.h"
#include "machine/74123.h"
#define IREMM10_MASTER_CLOCK (12500000) #define IREMM10_MASTER_CLOCK (12500000)
@ -44,6 +45,8 @@ public:
m_colorram(*this, "colorram"), m_colorram(*this, "colorram"),
m_chargen(*this, "chargen"), m_chargen(*this, "chargen"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_ic8j1(*this, "ic8j1"),
m_ic8j2(*this, "ic8j2"),
m_samples(*this, "samples"), m_samples(*this, "samples"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"), m_screen(*this, "screen"),
@ -72,8 +75,8 @@ public:
/* devices */ /* devices */
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
device_t *m_ic8j1; optional_device<ttl74123_device> m_ic8j1;
device_t *m_ic8j2; optional_device<ttl74123_device> m_ic8j2;
required_device<samples_device> m_samples; required_device<samples_device> m_samples;
optional_device<gfxdecode_device> m_gfxdecode; optional_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen; required_device<screen_device> m_screen;