all repos — mgba @ dec7b6902ee871452345ec0284391a7b19029e4a

mGBA Game Boy Advance Emulator

GB IO: Use correct lockout register
Vicki Pfau vi@endrift.com
Wed, 08 Nov 2017 01:07:38 -0800
commit

dec7b6902ee871452345ec0284391a7b19029e4a

parent

d054be88c7c48e42b0a3e33a9c47b281d97fc478

2 files changed, 5 insertions(+), 1 deletions(-)

jump to
M include/mgba/internal/gb/io.hinclude/mgba/internal/gb/io.h

@@ -84,6 +84,7 @@ REG_WY = 0x4A,

REG_WX = 0x4B, // CGB + REG_UNK4C = 0x4C, REG_KEY1 = 0x4D, REG_VBK = 0x4F, REG_HDMA1 = 0x51,
M src/gb/io.csrc/gb/io.c

@@ -174,6 +174,7 @@ }

GBIOWrite(gb, REG_WY, 0x00); GBIOWrite(gb, REG_WX, 0x00); if (gb->model >= GB_MODEL_CGB) { + GBIOWrite(gb, REG_UNK4C, 0); GBIOWrite(gb, REG_JOYP, 0xFF); GBIOWrite(gb, REG_VBK, 0); GBIOWrite(gb, REG_BCPS, 0);

@@ -424,7 +425,7 @@ 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; } - if (gb->model >= GB_MODEL_CGB && gb->memory.io[0x6C]) { + if (gb->model >= GB_MODEL_CGB && gb->memory.io[REG_UNK4C] < 0x80) { gb->model = GB_MODEL_DMG; GBVideoDisableCGB(&gb->video); }

@@ -436,6 +437,8 @@ return;

default: if (gb->model >= GB_MODEL_CGB) { switch (address) { + case REG_UNK4C: + break; case REG_KEY1: value &= 0x1; value |= gb->memory.io[address] & 0x80;