From 40a0a0eb117f40fd3210f14fc9a188cb775e0988 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 6 Oct 2013 12:28:48 -0700 Subject: [PATCH] Fix reading 32-bit unaligned IO registers --- src/gba/gba-memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gba/gba-memory.c b/src/gba/gba-memory.c index 7b4c6dac1..ee2047228 100644 --- a/src/gba/gba-memory.c +++ b/src/gba/gba-memory.c @@ -143,7 +143,7 @@ int32_t GBALoad32(struct ARMMemory* memory, uint32_t address, int* cycleCounter) value = gbaMemory->iwram[(address & (SIZE_WORKING_IRAM - 1)) >> 2]; break; case BASE_IO: - value = GBAIORead(gbaMemory->p, address & (SIZE_IO - 1)) | (GBAIORead(gbaMemory->p, (address & (SIZE_IO - 1)) | 2) << 16); + value = GBAIORead(gbaMemory->p, (address & (SIZE_IO - 1)) & ~2) | (GBAIORead(gbaMemory->p, (address & (SIZE_IO - 1)) | 2) << 16); break; case BASE_PALETTE_RAM: value = ((int32_t*) gbaMemory->p->video.palette)[(address & (SIZE_PALETTE_RAM - 1)) >> 2];