all repos — mgba @ 35be6c121b93ef43c9249b8497121d1eb18c1d0c

mGBA Game Boy Advance Emulator

GB: Fix HALT bug
Vicki Pfau vi@endrift.com
Sat, 06 Jun 2020 17:57:26 -0700
commit

35be6c121b93ef43c9249b8497121d1eb18c1d0c

parent

1db01d652bedd6aaf80bcb575af05bb66b836230

2 files changed, 3 insertions(+), 3 deletions(-)

jump to
M src/gb/core.csrc/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.csrc/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; }