Add function for loading from I/O
Jeffrey Pfau jeffrey@endrift.com
Sun, 14 Apr 2013 23:30:11 -0700
3 files changed,
13 insertions(+),
3 deletions(-)
M
src/gba/gba-io.c
→
src/gba/gba-io.c
@@ -3,7 +3,16 @@
void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value) { switch (address) { default: - GBALog(GBA_LOG_STUB, "Stub I/O register: %03x", address); + GBALog(GBA_LOG_STUB, "Stub I/O register write: %03x", address); + break; + } +} + +uint16_t GBAIORead(struct GBA* gba, uint32_t address) { + switch (address) { + default: + GBALog(GBA_LOG_STUB, "Stub I/O register read: %03x", address); break; } + return 0; }
M
src/gba/gba-io.h
→
src/gba/gba-io.h
@@ -142,5 +142,6 @@ REG_HALTCNT = 0x301
}; void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value); +uint16_t GBAIORead(struct GBA* gba, uint32_t address); #endif
M
src/gba/gba-memory.c
→
src/gba/gba-memory.c
@@ -137,7 +137,7 @@ return ((int16_t*) gbaMemory->wram)[(address & (SIZE_WORKING_RAM - 1)) >> 1];
case BASE_WORKING_IRAM: return ((int16_t*) gbaMemory->iwram)[(address & (SIZE_WORKING_IRAM - 1)) >> 1]; case BASE_IO: - break; + return GBAIORead(gbaMemory->p, address & (SIZE_IO - 1)); case BASE_PALETTE_RAM: break; case BASE_VRAM:@@ -171,7 +171,7 @@ return ((uint16_t*) gbaMemory->wram)[(address & (SIZE_WORKING_RAM - 1)) >> 1];
case BASE_WORKING_IRAM: return ((uint16_t*) gbaMemory->iwram)[(address & (SIZE_WORKING_IRAM - 1)) >> 1]; case BASE_IO: - break; + return GBAIORead(gbaMemory->p, address & (SIZE_IO - 1)); case BASE_PALETTE_RAM: break; case BASE_VRAM: