all repos — mgba @ 2e6f8b4af99f9598c5f958b9d036cd4937c08898

mGBA Game Boy Advance Emulator

SM83: Fix runloop early exit when event happens outside FETCH
Vicki Pfau vi@endrift.com
Tue, 16 Mar 2021 01:58:19 -0700
commit

2e6f8b4af99f9598c5f958b9d036cd4937c08898

parent

5cd21c67986f15cb079acd9c022f173f01ec680d

1 files changed, 4 insertions(+), 3 deletions(-)

jump to
M src/sm83/sm83.csrc/sm83/sm83.c

@@ -178,10 +178,11 @@

void SM83Run(struct SM83Core* cpu) { bool running = true; while (running || cpu->executionState != SM83_CORE_FETCH) { - if (cpu->cycles >= cpu->nextEvent) { + if (cpu->cycles < cpu->nextEvent) { + running = _SM83TickInternal(cpu) && running; + } else { cpu->irqh.processEvents(cpu); - break; + running = false; } - running = _SM83TickInternal(cpu) && running; } }