summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2018-06-05 23:00:16 -0400
committer arbee <rb6502@users.noreply.github.com>2018-06-05 23:00:16 -0400
commit1ca0d5264719f689685012f4079f042a417a2394 (patch)
tree1db8c4e12e5ade1d3127bd1f5cd88de8908c8933 /src/devices/bus
parent7faebc9f4d06ef64bb156b788f55d95b347f359f (diff)
Apple II: added buffering logic to the Echo II emulation [R. Belmont, Jonathan Gevaryahu]
Diffstat (limited to 'src/devices/bus')
-rw-r--r--src/devices/bus/a2bus/a2echoii.cpp39
-rw-r--r--src/devices/bus/a2bus/a2echoii.h9
2 files changed, 47 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;
+}
diff --git a/src/devices/bus/a2bus/a2echoii.h b/src/devices/bus/a2bus/a2echoii.h
index 3e1d17c35a2..7e304e5b5b9 100644
--- a/src/devices/bus/a2bus/a2echoii.h
+++ b/src/devices/bus/a2bus/a2echoii.h
@@ -36,11 +36,20 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// overrides of standard a2bus slot functions
virtual uint8_t read_c0nx(uint8_t offset) override;
virtual void write_c0nx(uint8_t offset, uint8_t data) override;
virtual bool take_c800() override;
+
+ DECLARE_WRITE_LINE_MEMBER( ready_w );
+
+private:
+ uint8_t m_latch;
+ int m_ready;
+ emu_timer *m_timer;
+ bool m_byte_in_latch;
};
// device type definition