Z80 CTC ZC/TO goes high for one clock cycle [smf]

This commit is contained in:
smf- 2021-12-17 13:48:28 +00:00
parent 0b418d65ba
commit de4ac4e41d
2 changed files with 12 additions and 3 deletions

View File

@ -295,7 +295,8 @@ z80ctc_channel_device::z80ctc_channel_device(const machine_config &mconfig, cons
m_down(0),
m_extclk(0),
m_timer(nullptr),
m_int_state(0)
m_int_state(0),
m_zc_to_timer(nullptr)
{
}
@ -308,6 +309,7 @@ void z80ctc_channel_device::device_start()
{
// initialize state
m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80ctc_channel_device::timer_callback), this));
m_zc_to_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z80ctc_channel_device::zc_to_callback), this));
// register for save states
save_item(NAME(m_mode));
@ -529,10 +531,15 @@ TIMER_CALLBACK_MEMBER(z80ctc_channel_device::timer_callback)
m_device->interrupt_check();
}
// generate the clock pulse (FIXME: pulse width is based on bus clock)
// generate the clock pulse
m_device->m_zc_cb[m_index](1);
m_device->m_zc_cb[m_index](0);
m_zc_to_timer->adjust(m_device->clocks_to_attotime(1));
// reset the down counter
m_down = m_tconst;
}
TIMER_CALLBACK_MEMBER(z80ctc_channel_device::zc_to_callback)
{
m_device->m_zc_cb[m_index](0);
}

View File

@ -60,6 +60,7 @@ protected:
attotime period() const;
void trigger(bool state);
TIMER_CALLBACK_MEMBER(timer_callback);
TIMER_CALLBACK_MEMBER(zc_to_callback);
required_device<z80ctc_device> m_device; // pointer back to our device
int m_index; // our channel index
@ -69,6 +70,7 @@ protected:
bool m_extclk; // current signal from the external clock
emu_timer * m_timer; // array of active timers
u8 m_int_state; // interrupt status (for daisy chain)
emu_timer * m_zc_to_timer; // zc to pulse timer
};
// ======================> z80ctc_device