all repos — mgba @ a0505ee7d77261d656a1193c00326bb5f3b8d4af

mGBA Game Boy Advance Emulator

Pepper memory access functions with warnings
Jeffrey Pfau jeffrey@endrift.com
Tue, 24 Sep 2013 23:10:51 -0700
commit

a0505ee7d77261d656a1193c00326bb5f3b8d4af

parent

1a3f28d2b0effdf42300a69ccb159b037acaf85b

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

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

@@ -121,6 +121,7 @@ int wait = 0;

switch (address & ~OFFSET_MASK) { case BASE_BIOS: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Load32: 0x%08X", address); break; case BASE_WORKING_RAM: value = gbaMemory->wram[(address & (SIZE_WORKING_RAM - 1)) >> 2];

@@ -153,8 +154,10 @@ value = gbaMemory->rom[(address & (SIZE_CART0 - 1)) >> 2];

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

@@ -178,6 +181,7 @@ int wait = 0;

switch (address & ~OFFSET_MASK) { case BASE_BIOS: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Load16: 0x%08X", address); break; case BASE_WORKING_RAM: value = ((int16_t*) gbaMemory->wram)[(address & (SIZE_WORKING_RAM - 1)) >> 1];

@@ -217,8 +221,10 @@ value = ((uint16_t*) gbaMemory->rom)[(address & (SIZE_CART0 - 1)) >> 1];

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

@@ -239,6 +245,7 @@ int wait = 0;

switch (address & ~OFFSET_MASK) { case BASE_BIOS: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Load8: 0x%08X", address); break; case BASE_WORKING_RAM: value = ((int8_t*) gbaMemory->wram)[address & (SIZE_WORKING_RAM - 1)];

@@ -254,8 +261,10 @@ case BASE_PALETTE_RAM:

value = ((int8_t*) gbaMemory->p->video.renderer->palette)[address & (SIZE_PALETTE_RAM - 1)]; break; case BASE_VRAM: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Load8: 0x%08X", address); break; case BASE_OAM: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Load8: 0x%08X", address); break; case BASE_CART0: case BASE_CART0_EX:

@@ -278,7 +287,9 @@ value = gbaMemory->savedata.data[address & (SIZE_CART_SRAM - 1)];

} else if (gbaMemory->savedata.type == SAVEDATA_FLASH512 || gbaMemory->savedata.type == SAVEDATA_FLASH1M) { value = GBASavedataReadFlash(&gbaMemory->savedata, address); } + break; default: + GBALog(gbaMemory->p, GBA_LOG_GAME_ERROR, "Bad memory Load8: 0x%08x", address); break; }

@@ -319,10 +330,13 @@ gbaMemory->p->video.renderer->writeOAM(gbaMemory->p->video.renderer, (address & (SIZE_OAM - 4)) >> 1);

gbaMemory->p->video.renderer->writeOAM(gbaMemory->p->video.renderer, ((address & (SIZE_OAM - 4)) >> 1) + 1); break; case BASE_CART0: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store32: 0x%08X", address); break; case BASE_CART_SRAM: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store32: 0x%08X", address); break; default: + GBALog(gbaMemory->p, GBA_LOG_GAME_ERROR, "Bad memory Store32: 0x%08X", address); break; }

@@ -360,6 +374,7 @@ gbaMemory->p->video.oam.raw[(address & (SIZE_OAM - 1)) >> 1] = value;

gbaMemory->p->video.renderer->writeOAM(gbaMemory->p->video.renderer, (address & (SIZE_OAM - 1)) >> 1); break; case BASE_CART0: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store16: 0x%08X", address); break; case BASE_CART2_EX: if (gbaMemory->savedata.type == SAVEDATA_NONE) {

@@ -369,8 +384,10 @@ }

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

@@ -395,12 +412,16 @@ case BASE_IO:

GBAIOWrite8(gbaMemory->p, address & (SIZE_IO - 1), value); break; case BASE_PALETTE_RAM: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store8: 0x%08X", address); break; case BASE_VRAM: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store8: 0x%08X", address); break; case BASE_OAM: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store8: 0x%08X", address); break; case BASE_CART0: + GBALog(gbaMemory->p, GBA_LOG_STUB, "Unimplemented memory Store8: 0x%08X", address); break; case BASE_CART_SRAM: if (gbaMemory->savedata.type == SAVEDATA_NONE) {

@@ -419,6 +440,7 @@ }

wait = gbaMemory->waitstates16[REGION_CART_SRAM]; break; default: + GBALog(gbaMemory->p, GBA_LOG_GAME_ERROR, "Bad memory Store8: 0x%08X", address); break; }