all repos — mgba @ 11486fea776074def3be000ab57c0cb271cad1b7

mGBA Game Boy Advance Emulator

LR35902: Fix LR35902Run
Jeffrey Pfau jeffrey@endrift.com
Tue, 27 Sep 2016 21:31:49 -0700
commit

11486fea776074def3be000ab57c0cb271cad1b7

parent

82f503bc4e8673d06ab49ae91d7cb781557efe57

1 files changed, 5 insertions(+), 7 deletions(-)

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

@@ -156,8 +156,8 @@ }

} void LR35902Run(struct LR35902Core* cpu) { - bool running = 1; - while (running > 0 || cpu->executionState != LR35902_CORE_FETCH) { + bool running = true; + while (running || cpu->executionState != LR35902_CORE_FETCH) { _LR35902Step(cpu); if (cpu->cycles + 2 >= cpu->nextEvent) { int32_t diff = cpu->nextEvent - cpu->cycles;

@@ -165,7 +165,7 @@ cpu->cycles = cpu->nextEvent;

cpu->executionState += diff; cpu->irqh.processEvents(cpu); cpu->cycles += 2 - diff; - running = -1; + running = false; } else { cpu->cycles += 2; }

@@ -173,10 +173,8 @@ cpu->executionState = LR35902_CORE_FETCH;

cpu->instruction(cpu); ++cpu->cycles; if (cpu->cycles >= cpu->nextEvent) { - running = 0; + cpu->irqh.processEvents(cpu); + running = false; } - } - if (!running) { - cpu->irqh.processEvents(cpu); } }