all repos — mgba @ b8b7ec0b12cdfa3aab1da32e06e8868e76ed9dbb

mGBA Game Boy Advance Emulator

GBA Memory: Fix DMAs from BIOS while not in BIOS

DMAs appear to have special protections against reading from the BIOS, causing
BIOS reads to be entirely zero. This behavior needs confirmation on hardware,
but seems to make sense.
Jeffrey Pfau jeffrey@endrift.com
Sun, 25 Oct 2015 14:18:07 -0700
commit

b8b7ec0b12cdfa3aab1da32e06e8868e76ed9dbb

parent

b5afb04ca5ca25eed8a78bc206bc2dbe245f71af

2 files changed, 12 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -6,6 +6,7 @@ - Booting of multiboot images

Bugfixes: - Util: Fix PowerPC PNG read/write pixel order - Qt: Use safer isLoaded check in GameController + - GBA Memory: Fix DMAs from BIOS while not in BIOS Misc: - Qt: Window size command line options are now supported - Qt: Increase usability of key mapper
M src/gba/memory.csrc/gba/memory.c

@@ -330,7 +330,12 @@ if (memory->activeRegion == REGION_BIOS) { \

LOAD_32(value, address, memory->bios); \ } else { \ GBALog(gba, GBA_LOG_GAME_ERROR, "Bad BIOS Load32: 0x%08X", address); \ - value = memory->biosPrefetch; \ + if (memory->activeDMA) { \ + /* TODO: Test on hardware */ \ + value = 0; \ + } else { \ + value = memory->biosPrefetch; \ + } \ } \ } else { \ GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load32: 0x%08X", address); \

@@ -446,7 +451,11 @@ if (memory->activeRegion == REGION_BIOS) {

LOAD_16(value, address, memory->bios); } else { GBALog(gba, GBA_LOG_GAME_ERROR, "Bad BIOS Load16: 0x%08X", address); - value = (memory->biosPrefetch >> ((address & 2) * 8)) & 0xFFFF; + if (memory->activeDMA) { + value = 0; + } else { + value = (memory->biosPrefetch >> ((address & 2) * 8)) & 0xFFFF; + } } } else { GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load16: 0x%08X", address);