Permalink
Browse files

GBA Memory: Make WRAM+IWRAM one allocation

  • Loading branch information...
endrift committed Dec 29, 2017
1 parent f5ef07b commit 178017a9e0ae8ad56a1273b95bbe6e071cf7ee40
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/gba/memory.c
View
@@ -87,16 +87,15 @@ void GBAMemoryInit(struct GBA* gba) {
memset(&gba->memory.agbPrintCtx, 0, sizeof(gba->memory.agbPrintCtx));
gba->memory.agbPrintBuffer = NULL;
- gba->memory.iwram = anonymousMemoryMap(SIZE_WORKING_IRAM);
- gba->memory.wram = anonymousMemoryMap(SIZE_WORKING_RAM);
+ gba->memory.wram = anonymousMemoryMap(SIZE_WORKING_RAM + SIZE_WORKING_IRAM);
+ gba->memory.iwram = &gba->memory.wram[SIZE_WORKING_RAM >> 2];
GBADMAInit(gba);
GBAVFameInit(&gba->memory.vfame);
}
void GBAMemoryDeinit(struct GBA* gba) {
- mappedMemoryFree(gba->memory.wram, SIZE_WORKING_RAM);
- mappedMemoryFree(gba->memory.iwram, SIZE_WORKING_IRAM);
+ mappedMemoryFree(gba->memory.wram, SIZE_WORKING_RAM + SIZE_WORKING_IRAM);
if (gba->memory.rom) {
mappedMemoryFree(gba->memory.rom, gba->memory.romSize);
}

0 comments on commit 178017a

Please sign in to comment.