all repos — mgba @ 773e0d26ffd5e15c99d50bc6e5cb66fe167d85f4

mGBA Game Boy Advance Emulator

GB Memory: Better emulate 0xFEA0 region on DMG, MGB and AGB
Vicki Pfau vi@endrift.com
Sat, 06 Jul 2019 16:13:39 -0700
commit

773e0d26ffd5e15c99d50bc6e5cb66fe167d85f4

parent

c471d03c7dfcd5048599aa5ab37b1e6e9fefae4b

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

jump to
M CHANGESCHANGES

@@ -34,6 +34,7 @@ - GB Audio: Deschedule channel 3 when disabled (fixes mgba.io/i/1463)

- GB Audio: Deschedule channel 1 when disabled by sweep (fixes mgba.io/i/1467) - GBA Memory: Fix STM/LDM to invalid VRAM - GB: Fix savedata initialization (fixes mgba.io/i/1473, mgba.io/i/1478) + - GB Memory: Better emulate 0xFEA0 region on DMG, MGB and AGB Other fixes: - Qt: Fix some Qt display driver race conditions - Core: Improved lockstep driver reliability (Le Hoang Quyen)
M src/gb/memory.csrc/gb/memory.c

@@ -234,7 +234,7 @@ enum GBBus accessBus = block[address >> 13];

if (dmaBus != GB_BUS_CPU && dmaBus == accessBus) { return 0xFF; } - if (address >= GB_BASE_OAM && address < GB_BASE_UNUSABLE) { + if (address >= GB_BASE_OAM && address < GB_BASE_IO) { return 0xFF; } }

@@ -471,6 +471,17 @@ return 0xFF;

} if (address < GB_BASE_IO) { mLOG(GB_MEM, GAME_ERROR, "Attempt to read from unusable memory: %04X", address); + if (gb->video.mode < 2) { + switch (gb->model) { + case GB_MODEL_AGB: + return (address & 0xF0) | ((address >> 4) & 0xF); + case GB_MODEL_CGB: + // TODO: R/W behavior + return 0x00; + default: + return 0x00; + } + } return 0xFF; } if (address < GB_BASE_HRAM) {