Fix timer clock computation

This commit is contained in:
Guy Perfect 2024-12-26 12:57:44 -06:00
parent 799ac9f51a
commit 4449acada0
1 changed files with 1 additions and 1 deletions

View File

@ -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 ?