From 34e5f3957151d62de22d0d264ec8a6a5d5800acc Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 23 May 2022 15:11:33 -0400 Subject: [PATCH] Ensure that running exactly up to a boundary gives the bus handler the next microcycle to contemplate. --- Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp b/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp index 53e84857e..1c1cfa83a 100644 --- a/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp +++ b/Processors/68000Mk2/Implementation/68000Mk2Implementation.hpp @@ -189,11 +189,11 @@ template ::run_for(HalfCycles duration) { // Accumulate the newly paid-in cycles. If this instance remains in deficit, exit. time_remaining_ += duration; - if(time_remaining_ <= HalfCycles(0)) return; + if(time_remaining_ < HalfCycles(0)) return; // Check whether all remaining time has been expended; if so then exit, having set this line up as // the next resumption point. -#define ConsiderExit() if(time_remaining_ <= HalfCycles(0)) { state_ = __COUNTER__+1; return; } [[fallthrough]]; case __COUNTER__: +#define ConsiderExit() if(time_remaining_ < HalfCycles(0)) { state_ = __COUNTER__+1; return; } [[fallthrough]]; case __COUNTER__: // Subtracts `n` half-cycles from `time_remaining_`; if permit_overrun is false, also ConsiderExit() #define Spend(n) time_remaining_ -= (n); if constexpr (!permit_overrun) ConsiderExit()