SM83: Fix runloop early exit when event happens outside FETCH
Vicki Pfau vi@endrift.com
Tue, 16 Mar 2021 01:58:19 -0700
1 files changed,
4 insertions(+),
3 deletions(-)
jump to
M
src/sm83/sm83.c
→
src/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; } }