From 544d39f19d3707af33c889afb02c9a59dbabdf8c Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 26 Dec 2020 00:19:48 +0200 Subject: [PATCH] Further improvements to STOP timing --- Core/sm83_cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/sm83_cpu.c b/Core/sm83_cpu.c index e56040b5..cf73b31c 100644 --- a/Core/sm83_cpu.c +++ b/Core/sm83_cpu.c @@ -346,9 +346,10 @@ static void leave_stop_mode(GB_gameboy_t *gb) gb->vram_ppu_blocked = false; gb->cgb_palettes_ppu_blocked = false; /* The CPU takes more time to wake up then the other components */ - for (unsigned i = 0x2000; i--;) { + for (unsigned i = 0x1FFF; i--;) { GB_advance_cycles(gb, 0x10); } + GB_advance_cycles(gb, gb->cgb_double_speed? 0x10 : 0xF); GB_write_memory(gb, 0xFF00 + GB_IO_DIV, 0); }