GB: Fix invalid STOP behavior on Game Boy Color

This commit is contained in:
Jeffrey Pfau 2016-09-25 16:21:43 -07:00
parent c877845bf7
commit e7c3b02897
2 changed files with 7 additions and 4 deletions

View File

@ -15,6 +15,7 @@ Bugfixes:
- 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

View File

@ -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 @@ void GBStop(struct LR35902Core* cpu) {
// 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
}