GB Memory: Better emulate 0xFEA0 region on DMG, MGB and AGB

This commit is contained in:
Vicki Pfau 2019-07-06 16:13:39 -07:00
parent c471d03c7d
commit 773e0d26ff
2 changed files with 13 additions and 1 deletions

View File

@ -34,6 +34,7 @@ Emulation fixes:
- GB Audio: Deschedule channel 1 when disabled by sweep (fixes mgba.io/i/1467) - GB Audio: Deschedule channel 1 when disabled by sweep (fixes mgba.io/i/1467)
- GBA Memory: Fix STM/LDM to invalid VRAM - GBA Memory: Fix STM/LDM to invalid VRAM
- GB: Fix savedata initialization (fixes mgba.io/i/1473, mgba.io/i/1478) - 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: Other fixes:
- Qt: Fix some Qt display driver race conditions - Qt: Fix some Qt display driver race conditions
- Core: Improved lockstep driver reliability (Le Hoang Quyen) - Core: Improved lockstep driver reliability (Le Hoang Quyen)

View File

@ -234,7 +234,7 @@ uint8_t GBLoad8(struct LR35902Core* cpu, uint16_t address) {
if (dmaBus != GB_BUS_CPU && dmaBus == accessBus) { if (dmaBus != GB_BUS_CPU && dmaBus == accessBus) {
return 0xFF; return 0xFF;
} }
if (address >= GB_BASE_OAM && address < GB_BASE_UNUSABLE) { if (address >= GB_BASE_OAM && address < GB_BASE_IO) {
return 0xFF; return 0xFF;
} }
} }
@ -471,6 +471,17 @@ uint8_t GBView8(struct LR35902Core* cpu, uint16_t address, int segment) {
} }
if (address < GB_BASE_IO) { if (address < GB_BASE_IO) {
mLOG(GB_MEM, GAME_ERROR, "Attempt to read from unusable memory: %04X", address); 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; return 0xFF;
} }
if (address < GB_BASE_HRAM) { if (address < GB_BASE_HRAM) {