From 4449acada0e2da1b55f1307c5e95f1da4847ec44 Mon Sep 17 00:00:00 2001 From: Guy Perfect Date: Thu, 26 Dec 2024 12:57:44 -0600 Subject: [PATCH] Fix timer clock computation --- core/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/timer.c b/core/timer.c index 4e479f7..06f2d11 100644 --- a/core/timer.c +++ b/core/timer.c @@ -7,7 +7,7 @@ /* Compute clocks until the next decrement to zero */ static uint32_t tmrGetUntil(VB *sim) { - uint32_t full = sim->tmr.reload * (sim->tmr.t_clk_sel ? 400 : 2000); + uint32_t full = (sim->tmr.reload + 1) * (sim->tmr.t_clk_sel ? 400 : 2000); uint32_t cur = sim->tmr.clocks + (sim->tmr.t_clk_sel ? 0 : 400 * (4 - sim->tmr.tick20)); return sim->tmr.counter == 0 ?