diff options
Diffstat (limited to 'src/devices/machine/f3853.cpp')
-rw-r--r-- | src/devices/machine/f3853.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/devices/machine/f3853.cpp b/src/devices/machine/f3853.cpp index 45511f334ab..26b06b858db 100644 --- a/src/devices/machine/f3853.cpp +++ b/src/devices/machine/f3853.cpp @@ -106,8 +106,9 @@ void f3851_device::device_resolve_objects() void f3853_device::device_start() { // lookup table for 3851/3853 lfsr timer + m_value_to_cycle[0xff] = 0xff; uint8_t reg = 0xfe; // Known to get 0xfe after 255 cycles - for(int i = reg; i >= 0; i--) + for (int i = reg; i >= 0; i--) { m_value_to_cycle[reg] = i; reg = reg << 1 | (BIT(reg,7) ^ BIT(reg,5) ^ BIT(reg,4) ^ BIT(reg,3) ^ 1); @@ -189,25 +190,27 @@ IRQ_CALLBACK_MEMBER(f3853_device::int_acknowledge) void f3853_device::timer_start(uint8_t value) { - attotime period = (value != 0xff) ? attotime::from_hz(clock()) * (m_value_to_cycle[value] * m_prescaler) : attotime::never; + attotime period = (value != 0xff) ? attotime::from_hz(clock()) * (m_prescaler * m_value_to_cycle[value]) : attotime::never; m_timer->adjust(period); } TIMER_CALLBACK_MEMBER(f3853_device::timer_callback) { - if(m_timer_int_enable) + if (m_timer_int_enable) { m_request_flipflop = true; set_interrupt_request_line(); } - timer_start(0xfe); + + // next timeout after 255 timer counts (prescaler doesn't reset) + m_timer->adjust(attotime::from_hz(clock()) * (m_prescaler * 0xff)); } WRITE_LINE_MEMBER(f3853_device::ext_int_w) { - if(m_external_interrupt_line && !state && m_external_int_enable) + if (m_external_interrupt_line && !state && m_external_int_enable) { m_request_flipflop = true; } |