From a3de9c94b582dc37e3d45df107f1e7645ba0f59a Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 20 May 2019 23:57:48 -0700 Subject: [PATCH] GB: Fix HALT when IE and IF unused bits are set (fixes #1349) --- CHANGES | 1 + src/gb/gb.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 1f02892bd..e7ae8a925 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ Emulation fixes: - GBA: Fix RTC on non-standard sized ROMs (fixes mgba.io/i/1400) - GBA Memory: Prevent writing to mirrored BG VRAM (fixes mgba.io/i/743) - GBA Video: Fix sprite mosaic clamping (fixes mgba.io/i/1008) + - GB: Fix HALT when IE and IF unused bits are set (fixes mgba.io/i/1349) Other fixes: - Qt: More app metadata fixes - Qt: Fix load recent from archive (fixes mgba.io/i/1325) diff --git a/src/gb/gb.c b/src/gb/gb.c index fc3c174b0..5f5178a90 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -723,7 +723,7 @@ static void _enableInterrupts(struct mTiming* timing, void* user, uint32_t cycle void GBHalt(struct LR35902Core* cpu) { struct GB* gb = (struct GB*) cpu->master; - if (!(gb->memory.ie & gb->memory.io[REG_IF])) { + if (!(gb->memory.ie & gb->memory.io[REG_IF] & 0x1F)) { cpu->cycles = cpu->nextEvent; cpu->halted = true; } else if (gb->model < GB_MODEL_CGB) {