all repos — mgba @ d53b1c784f416be73cb1310076feb11e5675f060

mGBA Game Boy Advance Emulator

Mirror SRAM across 0x0F000000
Jeffrey Pfau jeffrey@endrift.com
Sat, 23 Nov 2013 16:22:26 -0800
commit

d53b1c784f416be73cb1310076feb11e5675f060

parent

bc03872ab515112e5d18513240105d2ce2d93d88

2 files changed, 14 insertions(+), 6 deletions(-)

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

@@ -170,6 +170,7 @@ LOAD_32(value, address & (SIZE_CART0 - 1), gbaMemory->rom);

} break; case BASE_CART_SRAM: + case BASE_CART_SRAM_MIRROR: GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Load32: 0x%08X", address); break; default:

@@ -251,6 +252,7 @@ LOAD_16(value, address & (SIZE_CART0 - 1), gbaMemory->rom);

} break; case BASE_CART_SRAM: + case BASE_CART_SRAM_MIRROR: GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Load16: 0x%08X", address); break; default:

@@ -319,6 +321,7 @@ value = ((int8_t*) gbaMemory->rom)[address & (SIZE_CART0 - 1)];

} break; case BASE_CART_SRAM: + case BASE_CART_SRAM_MIRROR: wait = gbaMemory->waitstates16[address >> BASE_OFFSET]; if (gbaMemory->savedata.type == SAVEDATA_NONE) { GBASavedataInitSRAM(&gbaMemory->savedata);

@@ -375,6 +378,7 @@ case BASE_CART0:

GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store32: 0x%08X", address); break; case BASE_CART_SRAM: + case BASE_CART_SRAM_MIRROR: GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store32: 0x%08X", address); break; default:

@@ -430,6 +434,7 @@ }

GBASavedataWriteEEPROM(&gbaMemory->savedata, value, 1); break; case BASE_CART_SRAM: + case BASE_CART_SRAM_MIRROR: GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store16: 0x%08X", address); break; default:

@@ -476,6 +481,7 @@ case BASE_CART0:

GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store8: 0x%08X", address); break; case BASE_CART_SRAM: + case BASE_CART_SRAM_MIRROR: if (gbaMemory->savedata.type == SAVEDATA_NONE) { if (address == SAVEDATA_FLASH_BASE) { GBASavedataInitFlash(&gbaMemory->savedata);

@@ -517,10 +523,10 @@ int ws2 = (parameters & 0x0300) >> 8;

int ws2seq = (parameters & 0x0400) >> 10; int prefetch = parameters & 0x4000; - memory->waitstates16[REGION_CART_SRAM] = GBA_ROM_WAITSTATES[sram]; - memory->waitstatesSeq16[REGION_CART_SRAM] = GBA_ROM_WAITSTATES[sram]; - memory->waitstates32[REGION_CART_SRAM] = 2 * GBA_ROM_WAITSTATES[sram] + 1; - memory->waitstatesSeq32[REGION_CART_SRAM] = 2 * GBA_ROM_WAITSTATES[sram] + 1; + memory->waitstates16[REGION_CART_SRAM] = memory->waitstates16[REGION_CART_SRAM_MIRROR] = GBA_ROM_WAITSTATES[sram]; + memory->waitstatesSeq16[REGION_CART_SRAM] = memory->waitstatesSeq16[REGION_CART_SRAM_MIRROR] = GBA_ROM_WAITSTATES[sram]; + memory->waitstates32[REGION_CART_SRAM] = memory->waitstates32[REGION_CART_SRAM_MIRROR] = 2 * GBA_ROM_WAITSTATES[sram] + 1; + memory->waitstatesSeq32[REGION_CART_SRAM] = memory->waitstatesSeq32[REGION_CART_SRAM_MIRROR] = 2 * GBA_ROM_WAITSTATES[sram] + 1; memory->waitstates16[REGION_CART0] = memory->waitstates16[REGION_CART0_EX] = GBA_ROM_WAITSTATES[ws0]; memory->waitstates16[REGION_CART1] = memory->waitstates16[REGION_CART1_EX] = GBA_ROM_WAITSTATES[ws1];
M src/gba/gba-memory.hsrc/gba/gba-memory.h

@@ -22,7 +22,8 @@ REGION_CART1 = 0xA,

REGION_CART1_EX = 0xB, REGION_CART2 = 0xC, REGION_CART2_EX = 0xD, - REGION_CART_SRAM = 0xE + REGION_CART_SRAM = 0xE, + REGION_CART_SRAM_MIRROR = 0xF }; enum GBAMemoryBase {

@@ -39,7 +40,8 @@ BASE_CART1 = 0x0A000000,

BASE_CART1_EX = 0x0B000000, BASE_CART2 = 0x0C000000, BASE_CART2_EX = 0x0D000000, - BASE_CART_SRAM = 0x0E000000 + BASE_CART_SRAM = 0x0E000000, + BASE_CART_SRAM_MIRROR = 0x0F000000 }; enum {