Permalink
Browse files
GB, GBA: Fix interrupted cores from restarting early
- Loading branch information...
Showing
with
8 additions
and
9 deletions.
-
+4
−4
src/gb/gb.c
-
+4
−5
src/gba/gba.c
|
|
@@ -644,17 +644,17 @@ void GBProcessEvents(struct LR35902Core* cpu) { |
|
|
} while (gb->cpuBlocked);
|
|
|
cpu->nextEvent = nextEvent;
|
|
|
|
|
|
- if (gb->earlyExit) {
|
|
|
- gb->earlyExit = false;
|
|
|
- break;
|
|
|
- }
|
|
|
if (cpu->halted) {
|
|
|
cpu->cycles = cpu->nextEvent;
|
|
|
if (!gb->memory.ie || !gb->memory.ime) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ if (gb->earlyExit) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
} while (cpu->cycles >= cpu->nextEvent);
|
|
|
+ gb->earlyExit = false;
|
|
|
}
|
|
|
|
|
|
void GBSetInterrupts(struct LR35902Core* cpu, bool enable) {
|
|
|
|
|
|
@@ -264,11 +264,6 @@ static void GBAProcessEvents(struct ARMCore* cpu) { |
|
|
} while (gba->cpuBlocked);
|
|
|
|
|
|
cpu->nextEvent = nextEvent;
|
|
|
-
|
|
|
- if (gba->earlyExit) {
|
|
|
- gba->earlyExit = false;
|
|
|
- break;
|
|
|
- }
|
|
|
if (cpu->halted) {
|
|
|
cpu->cycles = nextEvent;
|
|
|
if (!gba->memory.io[REG_IME >> 1] || !gba->memory.io[REG_IE >> 1]) {
|
|
|
@@ -280,7 +275,11 @@ static void GBAProcessEvents(struct ARMCore* cpu) { |
|
|
mLOG(GBA, FATAL, "Negative cycles will pass: %i", nextEvent);
|
|
|
}
|
|
|
#endif
|
|
|
+ if (gba->earlyExit) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ gba->earlyExit = false;
|
|
|
#ifndef NDEBUG
|
|
|
if (gba->cpuBlocked) {
|
|
|
mLOG(GBA, FATAL, "CPU is blocked!");
|
|
|
|
0 comments on commit
aa0f988