diff options
Diffstat (limited to 'src/devices/bus/a2bus/a2echoii.cpp')
-rw-r--r-- | src/devices/bus/a2bus/a2echoii.cpp | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/devices/bus/a2bus/a2echoii.cpp b/src/devices/bus/a2bus/a2echoii.cpp index 15e0cb16697..6e911dc5bde 100644 --- a/src/devices/bus/a2bus/a2echoii.cpp +++ b/src/devices/bus/a2bus/a2echoii.cpp @@ -5,6 +5,7 @@ a2echoii.c Implementation of the Street Electronics Echo II speech card + Ready logic traced by Jonathan Gevaryahu *********************************************************************/ @@ -36,6 +37,7 @@ DEFINE_DEVICE_TYPE(A2BUS_ECHOII, a2bus_echoii_device, "a2echoii", "Street Electr MACHINE_CONFIG_START(a2bus_echoii_device::device_add_mconfig) SPEAKER(config, "echoii").front_center(); MCFG_DEVICE_ADD(TMS_TAG, TMS5220, 640000) // Note the Echo II card has a "FREQ" potentiometer which can be used to adjust the tms5220's clock frequency; 640khz is the '8khz' value according to the tms5220 datasheet + MCFG_TMS52XX_READYQ_HANDLER(WRITELINE(*this, a2bus_echoii_device, ready_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "echoii", 1.0) MACHINE_CONFIG_END @@ -61,10 +63,19 @@ a2bus_echoii_device::a2bus_echoii_device(const machine_config &mconfig, const ch void a2bus_echoii_device::device_start() { + m_timer = timer_alloc(0); + m_timer->adjust(attotime::never); + + save_item(NAME(m_latch)); + save_item(NAME(m_ready)); + save_item(NAME(m_byte_in_latch)); } void a2bus_echoii_device::device_reset() { + m_byte_in_latch = false; + m_ready = 0; + m_latch = 0; } uint8_t a2bus_echoii_device::read_c0nx(uint8_t offset) @@ -83,7 +94,15 @@ void a2bus_echoii_device::write_c0nx(uint8_t offset, uint8_t data) switch (offset) { case 0: - m_tms->data_w(data); + m_latch = data; + if (!m_ready) + { + m_tms->data_w(m_latch); + } + else + { + m_byte_in_latch = true; + } break; } } @@ -92,3 +111,21 @@ bool a2bus_echoii_device::take_c800() { return false; } + +void a2bus_echoii_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + m_tms->data_w(m_latch); + m_byte_in_latch = false; + m_timer->adjust(attotime::never); +} + +WRITE_LINE_MEMBER( a2bus_echoii_device::ready_w ) +{ + // if /Ready falls, write the byte in the latch if there is one + if ((m_ready) && (!state) && (m_byte_in_latch)) + { + m_timer->adjust(attotime::zero); + } + + m_ready = state; +} |