diff options
Diffstat (limited to 'src/devices/machine/cdp1852.cpp')
-rw-r--r-- | src/devices/machine/cdp1852.cpp | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/src/devices/machine/cdp1852.cpp b/src/devices/machine/cdp1852.cpp index bf5b06b4e72..8957590f4e4 100644 --- a/src/devices/machine/cdp1852.cpp +++ b/src/devices/machine/cdp1852.cpp @@ -41,9 +41,9 @@ enum cdp1852_device::cdp1852_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, CDP1852, tag, owner, clock), - m_read_mode(*this), + m_read_mode(*this, 0), m_write_sr(*this), - m_read_data(*this), + m_read_data(*this, 0), m_write_data(*this), m_new_data(false), m_data(0), m_clock_active(true), m_sr(false), m_next_sr(false), @@ -59,15 +59,9 @@ cdp1852_device::cdp1852_device(const machine_config &mconfig, const char *tag, d void cdp1852_device::device_start() { - // resolve callbacks - m_read_mode.resolve_safe(0); - m_write_sr.resolve_safe(); - m_read_data.resolve_safe(0); - m_write_data.resolve_safe(); - // allocate timers - m_update_do_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cdp1852_device::update_do), this)); - m_update_sr_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cdp1852_device::update_sr), this)); + m_update_do_timer = timer_alloc(FUNC(cdp1852_device::update_do), this); + m_update_sr_timer = timer_alloc(FUNC(cdp1852_device::update_sr), this); // register for state saving save_item(NAME(m_new_data)); @@ -107,9 +101,9 @@ void cdp1852_device::device_reset() // clock_w - clock write //------------------------------------------------- -WRITE_LINE_MEMBER(cdp1852_device::clock_w) +void cdp1852_device::clock_w(int state) { - if (m_clock_active != bool(state)) + if (m_clock_active == bool(state)) return; m_clock_active = bool(state); @@ -122,7 +116,7 @@ WRITE_LINE_MEMBER(cdp1852_device::clock_w) m_data = m_read_data(0); // signal processor - set_sr_line(0); + set_sr_line(false); } else { @@ -165,7 +159,18 @@ void cdp1852_device::set_sr_line(bool state) TIMER_CALLBACK_MEMBER(cdp1852_device::update_do) { - m_write_data(param); + if (!m_read_mode()) + { + // input data into register + m_data = param; + + // signal processor + set_sr_line(false); + } + else + { + m_write_data(param); + } } @@ -183,7 +188,7 @@ TIMER_CALLBACK_MEMBER(cdp1852_device::update_sr) // read - data read //------------------------------------------------- -READ8_MEMBER(cdp1852_device::read) +uint8_t cdp1852_device::read() { if (!m_read_mode() && m_clock_active) { @@ -198,10 +203,10 @@ READ8_MEMBER(cdp1852_device::read) //------------------------------------------------- -// write - data write +// write - data write (synchronous) //------------------------------------------------- -WRITE8_MEMBER(cdp1852_device::write) +void cdp1852_device::write(uint8_t data) { if (m_read_mode() && m_clock_active) { @@ -211,3 +216,20 @@ WRITE8_MEMBER(cdp1852_device::write) m_new_data = true; } } + + +//------------------------------------------------- +// write_strobe - data write with asynchronous +// clock strobe +//------------------------------------------------- + +void cdp1852_device::write_strobe(uint8_t data) +{ + if (!m_read_mode()) + { + // output data + m_update_do_timer->adjust(attotime::zero, data); + + m_clock_active = false; + } +} |