GB: Fix HALT bug
Vicki Pfau vi@endrift.com
Sat, 06 Jun 2020 17:57:26 -0700
2 files changed,
3 insertions(+),
3 deletions(-)
M
src/gb/core.c
→
src/gb/core.c
@@ -1082,9 +1082,9 @@ mVideoLogContextRewind(gbcore->logContext, core);
GBVideoProxyRendererShim(&gb->video, &gbcore->proxyRenderer); // Make sure CPU loop never spins - GBHalt(gb->cpu); gb->memory.ie = 0; gb->memory.ime = false; + GBHalt(gb->cpu); } static bool _GBVLPLoadROM(struct mCore* core, struct VFile* vf) {@@ -1115,9 +1115,9 @@ GBIODeserialize(gb, state);
GBAudioReset(&gb->audio); // Make sure CPU loop never spins - GBHalt(gb->cpu); gb->memory.ie = 0; gb->memory.ime = false; + GBHalt(gb->cpu); return true; }
M
src/gb/gb.c
→
src/gb/gb.c
@@ -749,7 +749,7 @@ struct GB* gb = (struct GB*) cpu->master;
if (!(gb->memory.ie & gb->memory.io[REG_IF] & 0x1F)) { cpu->cycles = cpu->nextEvent; cpu->halted = true; - } else { + } else if (!gb->memory.ime) { mLOG(GB, GAME_ERROR, "HALT bug"); cpu->executionState = SM83_CORE_HALT_BUG; }