diff --git a/CHANGES b/CHANGES index a9b07285d..ececa866b 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,7 @@ Bugfixes: - GBA BIOS: Fix CpuSet on 0x01XXXXXX addresses - GBA Memory: Fix DMA behavior for SRAM accesses - GBA Memory: Fix Store8 to OBJ VRAM + - GBA Memory: Fix alignment of LDM/STM on SRAM Misc: - GBA Audio: Implement missing flags on SOUNDCNT_X register diff --git a/src/gba/memory.c b/src/gba/memory.c index c2f735d1a..dec21bf16 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -1095,7 +1095,9 @@ uint32_t GBALoadMultiple(struct ARMCore* cpu, uint32_t address, int mask, enum L } uint32_t addressMisalign = address & 0x3; - address &= 0xFFFFFFFC; + if (address >> BASE_OFFSET < REGION_CART_SRAM) { + address &= 0xFFFFFFFC; + } switch (address >> BASE_OFFSET) { case REGION_BIOS: @@ -1208,7 +1210,9 @@ uint32_t GBAStoreMultiple(struct ARMCore* cpu, uint32_t address, int mask, enum } uint32_t addressMisalign = address & 0x3; - address &= 0xFFFFFFFC; + if (address >> BASE_OFFSET < REGION_CART_SRAM) { + address &= 0xFFFFFFFC; + } switch (address >> BASE_OFFSET) { case REGION_WORKING_RAM: