kp64.cpp: Better workaround

This commit is contained in:
AJR 2022-06-16 09:59:48 -04:00
parent 32c507d34d
commit b1a3c44e47

View File

@ -189,11 +189,13 @@ u16 kp64_device::count_value() const noexcept
void kp64_device::reload_count()
{
m_count = BIT(m_status, 5) ? 0xffff : m_cr;
if (BIT(m_status, 0)) {
if(m_cr == 0)
m_cr = 0xffff;
m_count_timer->adjust(clocks_to_attotime(u32(m_count) + 1));
if (BIT(m_status, 0))
{
// hng64 network MCU configures this supposedly invalid value and thrashes the scheduler if the timer is enabled
if (m_count == 0)
logerror("%s: Zero reload value specified for timer\n", machine().describe_context());
else
m_count_timer->adjust(clocks_to_attotime(u32(m_count) + 1));
}
// Count is now started whether or not it was before