all repos — mgba @ 36de596fdbe9190a52ab40318a02b9d37806ce35

mGBA Game Boy Advance Emulator

GB: Fix GBC games running on GBA with BIOS

GBC games can detect if they are running on a GBA by checking if the
low bit of register B is set to 1.  B is set in `GBSkipBIOS`, but
B was not updated when loading a real BIOS.  Load 1 into B after
unmapping the BIOS if the model is set to GBA.
Douglas Christman DouglasChristman@gmail.com
Thu, 29 Mar 2018 11:11:18 +0800
commit

36de596fdbe9190a52ab40318a02b9d37806ce35

parent

f28e20d4aab2e3f48feeec4cc576a05ae9aa144f

1 files changed, 4 insertions(+), 0 deletions(-)

jump to
M src/gb/gb.csrc/gb/gb.c

@@ -555,6 +555,10 @@ if (gb->memory.romBase < gb->memory.rom || gb->memory.romBase > &gb->memory.rom[gb->memory.romSize - 1]) {

free(gb->memory.romBase); gb->memory.romBase = gb->memory.rom; } + // XXX: Force AGB registers for AGB-mode + if (gb->model == GB_MODEL_AGB && gb->cpu->pc == 0x100) { + gb->cpu->b = 1; + } } void GBDetectModel(struct GB* gb) {