GB MBC: Fix some MBC3 bit masking
Vicki Pfau vi@endrift.com
Sat, 12 Sep 2020 22:50:04 -0700
2 files changed,
6 insertions(+),
4 deletions(-)
M
CHANGES
→
CHANGES
@@ -19,6 +19,7 @@ - GB Audio: Fix serializing sweep time
- GB Audio: Fix deserializing audio channels 2 and 3 - GB Audio: Fix deserializing while audio was disabled (fixes mgba.io/i/1305) - GB MBC: Fix MBC1 mode changing behavior + - GB MBC: Fix some MBC3 bit masking - GB Video: Fix state after skipping BIOS (fixes mgba.io/i/1715 and mgba.io/i/1716) - GBA: Fix timing advancing too quickly in rare cases - GBA Audio: Fix deserializing SOUNDCNT_L
M
src/gb/mbc.c
→
src/gb/mbc.c
@@ -601,7 +601,7 @@ struct GBMemory* memory = &gb->memory;
int bank = value; switch (address >> 13) { case 0x0: - switch (value) { + switch (value & 0xF) { case 0: memory->sramAccess = false; break;@@ -625,11 +625,12 @@ }
GBMBCSwitchBank(gb, bank); break; case 0x2: - if (value < 8) { + bank &= 0xF; + if (bank < 8) { GBMBCSwitchSramBank(gb, value); memory->rtcAccess = false; - } else if (value <= 0xC) { - memory->activeRtcReg = value - 8; + } else if (bank <= 0xC) { + memory->activeRtcReg = bank - 8; memory->rtcAccess = true; } break;