all repos — mgba @ fe5a8d62544784df009447cac69519e869025b7d

mGBA Game Boy Advance Emulator

Add function for loading from I/O
Jeffrey Pfau jeffrey@endrift.com
Sun, 14 Apr 2013 23:30:11 -0700
commit

fe5a8d62544784df009447cac69519e869025b7d

parent

ecc4775c311cb2c9cef70c8d4a4dc53fedeb2a38

3 files changed, 13 insertions(+), 3 deletions(-)

jump to
M src/gba/gba-io.csrc/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.hsrc/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.csrc/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: