all repos — mgba @ 0332db8961ef1b11b4f9e0326d3683b8e5d17730

mGBA Game Boy Advance Emulator

GB Memory: Support running from blocked memory
Vicki Pfau vi@endrift.com
Wed, 05 Dec 2018 19:39:29 -0800
commit

0332db8961ef1b11b4f9e0326d3683b8e5d17730

parent

42f65db3960834394438017cea28547f41560d25

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

jump to
M CHANGESCHANGES

@@ -6,6 +6,7 @@ - GBA BIOS: Fix multiboot entry point (fixes Magic Floor)

Misc: - GBA Savedata: EEPROM performance fixes - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash + - GB Memory: Support running from blocked memory 0.7.0: (Future) Features:
M src/gb/memory.csrc/gb/memory.c

@@ -45,6 +45,8 @@ GB_BUS_RAM, // 0xC000

GB_BUS_CPU // 0xE000 }; +static const uint8_t _blockedRegion[1] = { 0xFF }; + static void _pristineCow(struct GB* gba); static uint8_t GBFastLoad8(struct LR35902Core* cpu, uint16_t address) {

@@ -91,6 +93,15 @@ break;

default: cpu->memory.cpuLoad8 = GBLoad8; break; + } + if (gb->memory.dmaRemaining) { + const enum GBBus* block = gb->model < GB_MODEL_CGB ? _oamBlockDMG : _oamBlockCGB; + enum GBBus dmaBus = block[memory->dmaSource >> 13]; + enum GBBus accessBus = block[address >> 13]; + if ((dmaBus != GB_BUS_CPU && dmaBus == accessBus) || (address >= GB_BASE_OAM && address < GB_BASE_UNUSABLE)) { + cpu->memory.activeRegion = _blockedRegion; + cpu->memory.activeMask = 0; + } } }