summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2022-02-10 16:12:01 -0600
committer cracyc <cracyc@users.noreply.github.com>2022-02-10 16:12:01 -0600
commit02cd26d37ee11191f3e311e19e805d872cb1e3a4 (patch)
tree8f4e959d3127753460e549cfa248be9cadd0fc4a
parent36d87db7518c438290940b69a7b9fafb6e82a9cb (diff)
pit8253: prevent elapsed_cycles from going negative
-rw-r--r--src/devices/machine/pit8253.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/devices/machine/pit8253.cpp b/src/devices/machine/pit8253.cpp
index e3becf3d613..f09684f782a 100644
--- a/src/devices/machine/pit8253.cpp
+++ b/src/devices/machine/pit8253.cpp
@@ -507,7 +507,7 @@ void pit_counter_device::simulate(int64_t elapsed_cycles)
}
}
- if (elapsed_cycles > 0 && m_phase == 3)
+ if (elapsed_cycles >= adjusted_value && m_phase == 3)
{
/* Reload counter, output goes high */
elapsed_cycles -= adjusted_value;