all repos — mgba @ ad7146a801324caee68c5bbef25ea448bc962fa1

mGBA Game Boy Advance Emulator

GB I/O: Add BANK register name
Vicki Pfau vi@endrift.com
Wed, 09 Sep 2020 22:23:11 -0700
commit

ad7146a801324caee68c5bbef25ea448bc962fa1

parent

94fc963c89460a508e6c569aadaf715981768fa1

3 files changed, 8 insertions(+), 6 deletions(-)

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

@@ -87,6 +87,7 @@ // CGB

REG_KEY0 = 0x4C, REG_KEY1 = 0x4D, REG_VBK = 0x4F, + REG_BANK = 0x50, REG_HDMA1 = 0x51, REG_HDMA2 = 0x52, REG_HDMA3 = 0x53,
M src/gb/io.csrc/gb/io.c

@@ -56,6 +56,7 @@ [REG_WX] = "WX",

[REG_KEY0] = "KEY0", [REG_KEY1] = "KEY1", [REG_VBK] = "VBK", + [REG_BANK] = "BANK", [REG_HDMA1] = "HDMA1", [REG_HDMA2] = "HDMA2", [REG_HDMA3] = "HDMA3",

@@ -185,10 +186,10 @@ GBIOWrite(gb, REG_NR50, 0x77);

GBIOWrite(gb, REG_NR51, 0xF3); if (!gb->biosVf) { GBIOWrite(gb, REG_LCDC, 0x91); - gb->memory.io[0x50] = 1; + gb->memory.io[REG_BANK] = 1; } else { GBIOWrite(gb, REG_LCDC, 0x00); - gb->memory.io[0x50] = 0xFF; + gb->memory.io[REG_BANK] = 0xFF; } GBIOWrite(gb, REG_SCY, 0x00); GBIOWrite(gb, REG_SCX, 0x00);

@@ -459,8 +460,8 @@ case REG_STAT:

GBVideoWriteSTAT(&gb->video, value); value = gb->video.stat; break; - case 0x50: - if (gb->memory.io[0x50] != 0xFF) { + case REG_BANK: + if (gb->memory.io[REG_BANK] != 0xFF) { break; } GBUnmapBIOS(gb);
M src/gb/serialize.csrc/gb/serialize.c

@@ -139,7 +139,7 @@ if (ucheck16 >= 0x40) {

mLOG(GB_STATE, WARN, "Savestate is corrupted: OCPS is out of range"); } bool differentBios = !gb->biosVf || gb->model != state->model; - if (state->io[0x50] == 0xFF) { + if (state->io[REG_BANK] == 0xFF) { if (differentBios) { mLOG(GB_STATE, WARN, "Incompatible savestate, please restart with correct BIOS in %s mode", GBModelToName(state->model)); error = true;

@@ -206,7 +206,7 @@ GBIODeserialize(gb, state);

GBTimerDeserialize(&gb->timer, state); GBAudioDeserialize(&gb->audio, state); - if (gb->memory.io[0x50] == 0xFF) { + if (gb->memory.io[REG_BANK] == 0xFF) { GBMapBIOS(gb); } else { GBUnmapBIOS(gb);