diff --git a/src/gba/gba-io.c b/src/gba/gba-io.c index 47fda35c9..3cc49113c 100644 --- a/src/gba/gba-io.c +++ b/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; +} diff --git a/src/gba/gba-io.h b/src/gba/gba-io.h index ad3cd77bc..9cb319b24 100644 --- a/src/gba/gba-io.h +++ b/src/gba/gba-io.h @@ -142,5 +142,6 @@ enum GBAIORegisters { }; void GBAIOWrite(struct GBA* gba, uint32_t address, uint16_t value); +uint16_t GBAIORead(struct GBA* gba, uint32_t address); #endif diff --git a/src/gba/gba-memory.c b/src/gba/gba-memory.c index 1dfa6daab..65155dd72 100644 --- a/src/gba/gba-memory.c +++ b/src/gba/gba-memory.c @@ -137,7 +137,7 @@ int16_t GBALoad16(struct ARMMemory* memory, uint32_t address) { 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 @@ uint16_t GBALoadU16(struct ARMMemory* memory, uint32_t address) { 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: