all repos — mgba @ 4b6c00289c8d4d7b3a2a7f011503b02e0d67b053

mGBA Game Boy Advance Emulator

DS Memory: Add LDM/STM VRAM
Vicki Pfau vi@endrift.com
Thu, 16 Feb 2017 22:23:58 -0800
commit

4b6c00289c8d4d7b3a2a7f011503b02e0d67b053

parent

9c30435c9fd12dcf5e79af281d44c82daf295ef2

1 files changed, 21 insertions(+), 0 deletions(-)

jump to
M src/ds/memory.csrc/ds/memory.c

@@ -1042,6 +1042,18 @@ break;

case DS_REGION_IO: LDM_LOOP(value = DS9IORead32(ds, address)); break; + case DS_REGION_VRAM: + LDM_LOOP(unsigned mask = _selectVRAM(memory, address >> DS_VRAM_OFFSET); + value = 0; + int i = 0; + for (i = 0; i < 9; ++i) { + if (mask & (1 << i)) { + uint32_t newValue; + LOAD_32(newValue, address & _vramMask[i], memory->vramBank[i]); + value |= newValue; + } + }); + break; default: LDM_LOOP(if ((address & ~(DS9_SIZE_DTCM - 1)) == memory->dtcmBase) { LOAD_32(value, address & (DS9_SIZE_DTCM - 1), memory->dtcm);

@@ -1107,6 +1119,15 @@ } else if ((address & (DS_SIZE_RAM - 1)) < DS_SIZE_RAM) {

STORE_32(value, address & (DS_SIZE_RAM - 1), memory->ram); } else { mLOG(DS_MEM, STUB, "Unimplemented DS9 STM: %08X", address); + }); + break; + case DS_REGION_VRAM: + STM_LOOP(unsigned mask = _selectVRAM(memory, address >> DS_VRAM_OFFSET); + int i = 0; + for (i = 0; i < 9; ++i) { + if (mask & (1 << i)) { + STORE_32(value, address & _vramMask[i], memory->vramBank[i]); + } }); break; default: