GB: Fix invalid STOP behavior on Game Boy Color
Jeffrey Pfau jeffrey@endrift.com
Sun, 25 Sep 2016 16:21:43 -0700
2 files changed,
7 insertions(+),
4 deletions(-)
M
CHANGES
→
CHANGES
@@ -15,6 +15,7 @@ - Qt: Fix directory set unloading when replacing the ROM
- GBA Savedata: Fix loading savestates with 512Mb Flash saves - Core: Fix importing save games as read-only - Util: Fix PNG identification on files too small to be a PNG + - GB: Fix invalid STOP behavior on Game Boy Color Misc: - All: Only update version info if needed - FFmpeg: Encoding cleanup
M
src/gb/gb.c
→
src/gb/gb.c
@@ -566,6 +566,12 @@ void GBStop(struct LR35902Core* cpu) {
struct GB* gb = (struct GB*) cpu->master; if (cpu->bus) { mLOG(GB, GAME_ERROR, "Hit illegal stop at address %04X:%02X\n", cpu->pc, cpu->bus); + } + if (gb->memory.io[REG_KEY1] & 1) { + gb->doubleSpeed ^= 1; + gb->memory.io[REG_KEY1] &= 1; + gb->memory.io[REG_KEY1] |= gb->doubleSpeed << 7; + } else if (cpu->bus) { if (cpu->components && cpu->components[CPU_COMPONENT_DEBUGGER]) { struct mDebuggerEntryInfo info = { .address = cpu->pc - 1,@@ -576,10 +582,6 @@ }
// Hang forever gb->memory.ime = 0; cpu->pc -= 2; - } else if (gb->memory.io[REG_KEY1] & 1) { - gb->doubleSpeed ^= 1; - gb->memory.io[REG_KEY1] &= 1; - gb->memory.io[REG_KEY1] |= gb->doubleSpeed << 7; } // TODO: Actually stop }