diff --git a/CHANGES b/CHANGES index 4ade8403e..c504f037d 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,7 @@ Misc: - Qt: Handle a game crash without crashing - Qt: Set default log level to FATAL, ERROR and WARN - Qt: Clarify some phrasing in the menus + - GBA Memory: Implement 16- and 32-bit loads from SRAM 0.1.0: (2014-12-13) - Initial release diff --git a/src/gba/gba-memory.c b/src/gba/gba-memory.c index 330495e4d..da0031c53 100644 --- a/src/gba/gba-memory.c +++ b/src/gba/gba-memory.c @@ -222,8 +222,10 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) { } #define LOAD_SRAM \ - GBALog(gba, GBA_LOG_STUB, "Unimplemented memory Load32: 0x%08X", address); \ - value = 0xFFFFFFFF; + wait = memory->waitstatesNonseq16[address >> BASE_OFFSET]; \ + value = GBALoad8(cpu, address, 0); \ + value |= value << 8; \ + value |= value << 16; int32_t GBALoad32(struct ARMCore* cpu, uint32_t address, int* cycleCounter) { struct GBA* gba = (struct GBA*) cpu->master; @@ -352,8 +354,9 @@ int16_t GBALoad16(struct ARMCore* cpu, uint32_t address, int* cycleCounter) { break; case REGION_CART_SRAM: case REGION_CART_SRAM_MIRROR: - GBALog(gba, GBA_LOG_STUB, "Unimplemented memory Load16: 0x%08X", address); - value = 0xFFFF; + wait = memory->waitstatesNonseq16[address >> BASE_OFFSET]; + value = GBALoad8(cpu, address, 0); + value |= value << 8; break; default: GBALog(gba, GBA_LOG_GAME_ERROR, "Bad memory Load16: 0x%08X", address);