all repos — mgba @ b48b868cfb8bb03bf7445c93b9534207393eebdb

mGBA Game Boy Advance Emulator

Write to VRAM
Jeffrey Pfau jeffrey@endrift.com
Mon, 22 Apr 2013 01:59:25 -0700
commit

b48b868cfb8bb03bf7445c93b9534207393eebdb

parent

f136d8165a9ece1ff7ccc23541019569ad9c36be

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

jump to
M src/gba/gba-memory.csrc/gba/gba-memory.c

@@ -292,6 +292,10 @@ gbaMemory->p->video.palette[(address & (SIZE_PALETTE_RAM - 1)) >> 1] = value;

gbaMemory->p->video.palette[((address & (SIZE_PALETTE_RAM - 1)) >> 1) + 1] = value >> 16; break; case BASE_VRAM: + if ((address & OFFSET_MASK) < SIZE_VRAM - 2) { + gbaMemory->p->video.vram[(address & 0x0001FFFF) >> 1] = value; + gbaMemory->p->video.vram[((address & 0x0001FFFF) >> 1) + 1] = value >> 16; + } break; case BASE_OAM: break;

@@ -323,6 +327,9 @@ case BASE_PALETTE_RAM:

gbaMemory->p->video.palette[(address & (SIZE_PALETTE_RAM - 1)) >> 1] = value; break; case BASE_VRAM: + if ((address & OFFSET_MASK) < SIZE_VRAM) { + gbaMemory->p->video.vram[(address & 0x0001FFFF) >> 1] = value; + } break; case BASE_OAM: break;