mirror of https://github.com/mgba-emu/mgba.git
GB: Fix invalid STOP behavior on Game Boy Color
This commit is contained in:
parent
c877845bf7
commit
e7c3b02897
1
CHANGES
1
CHANGES
|
@ -15,6 +15,7 @@ Bugfixes:
|
||||||
- GBA Savedata: Fix loading savestates with 512Mb Flash saves
|
- GBA Savedata: Fix loading savestates with 512Mb Flash saves
|
||||||
- Core: Fix importing save games as read-only
|
- Core: Fix importing save games as read-only
|
||||||
- Util: Fix PNG identification on files too small to be a PNG
|
- Util: Fix PNG identification on files too small to be a PNG
|
||||||
|
- GB: Fix invalid STOP behavior on Game Boy Color
|
||||||
Misc:
|
Misc:
|
||||||
- All: Only update version info if needed
|
- All: Only update version info if needed
|
||||||
- FFmpeg: Encoding cleanup
|
- FFmpeg: Encoding cleanup
|
||||||
|
|
10
src/gb/gb.c
10
src/gb/gb.c
|
@ -566,6 +566,12 @@ void GBStop(struct LR35902Core* cpu) {
|
||||||
struct GB* gb = (struct GB*) cpu->master;
|
struct GB* gb = (struct GB*) cpu->master;
|
||||||
if (cpu->bus) {
|
if (cpu->bus) {
|
||||||
mLOG(GB, GAME_ERROR, "Hit illegal stop at address %04X:%02X\n", cpu->pc, 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]) {
|
if (cpu->components && cpu->components[CPU_COMPONENT_DEBUGGER]) {
|
||||||
struct mDebuggerEntryInfo info = {
|
struct mDebuggerEntryInfo info = {
|
||||||
.address = cpu->pc - 1,
|
.address = cpu->pc - 1,
|
||||||
|
@ -576,10 +582,6 @@ void GBStop(struct LR35902Core* cpu) {
|
||||||
// Hang forever
|
// Hang forever
|
||||||
gb->memory.ime = 0;
|
gb->memory.ime = 0;
|
||||||
cpu->pc -= 2;
|
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
|
// TODO: Actually stop
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue