This commit is contained in:
Scott Stone 2018-06-05 23:05:17 -04:00
commit 5a4f15ae68
2 changed files with 47 additions and 1 deletions

View File

@ -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;
}

View File

@ -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