SM83: Fix runloop early exit when event happens outside FETCH

This commit is contained in:
Vicki Pfau 2021-03-16 01:58:19 -07:00
parent 5cd21c6798
commit 2e6f8b4af9
1 changed files with 4 additions and 3 deletions

View File

@ -178,10 +178,11 @@ void SM83Tick(struct SM83Core* cpu) {
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;
}
}