From 4ce643d5eb2be9e122d0901898e043f934c7705a Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sun, 10 Oct 2021 16:53:07 +0300 Subject: [PATCH] Fix timer bug; fixes #409 --- Core/timing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/timing.c b/Core/timing.c index a755ac5..786dbc9 100644 --- a/Core/timing.c +++ b/Core/timing.c @@ -434,7 +434,7 @@ void GB_emulate_timer_glitch(GB_gameboy_t *gb, uint8_t old_tac, uint8_t new_tac) /* The bit used for overflow testing must have been 1 */ if (gb->div_counter & old_clocks) { /* And now either the timer must be disabled, or the new bit used for overflow testing be 0. */ - if (!(new_tac & 4) || gb->div_counter & new_clocks) { + if (!(new_tac & 4) || !(gb->div_counter & new_clocks)) { increase_tima(gb); } }