all repos — mgba @ ff37b44a49659b06923defc5dca5a560c632bb43

mGBA Game Boy Advance Emulator

DS Memory: Allow 8-bit reads from VRAM
Vicki Pfau vi@endrift.com
Mon, 06 Mar 2017 14:21:00 -0800
commit

ff37b44a49659b06923defc5dca5a560c632bb43

parent

476a4767a373bd9091e6f4877e2409eb22b5e11d

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

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

@@ -967,6 +967,16 @@ mLOG(DS_MEM, STUB, "Unimplemented DS9 Load8: %08X", address);

case DS_REGION_IO: value = (DS9IORead(ds, address & 0xFFFE) >> ((address & 0x0001) << 3)) & 0xFF; break; + case DS_REGION_VRAM: { + unsigned mask = _selectVRAM(memory, address >> DS_VRAM_OFFSET); + int i = 0; + for (i = 0; i < 9; ++i) { + if (mask & (1 << i)) { + value |= ((uint8_t*) memory->vramBank[i])[address & _vramMask[i]]; + } + } + break; + } case DS9_REGION_BIOS: // TODO: Fix undersized BIOS // TODO: Fix masking