all repos — mgba @ d8bee5d34bf4f5a44b7eff4c57948b03154531c0

mGBA Game Boy Advance Emulator

GBA Memory: Return misaligned addresses from LDM/STM
Jeffrey Pfau jeffrey@endrift.com
Sat, 01 Nov 2014 14:40:13 -0700
commit

d8bee5d34bf4f5a44b7eff4c57948b03154531c0

parent

3ad2047855d038006998af37fcf9f957ec450a5a

1 files changed, 4 insertions(+), 2 deletions(-)

jump to
M src/gba/gba-memory.csrc/gba/gba-memory.c

@@ -676,6 +676,7 @@ if (direction & LSM_B) {

address += offset; } + uint32_t addressMisalign = address & 0x3; address &= 0xFFFFFFFC; switch (address >> BASE_OFFSET) {

@@ -744,7 +745,7 @@ if (direction & LSM_D) {

address -= (popcount << 2) + 4; } - return address; + return address | addressMisalign; } #define STM_LOOP_BEGIN \

@@ -780,6 +781,7 @@ if (direction & LSM_B) {

address += offset; } + uint32_t addressMisalign = address & 0x3; address &= 0xFFFFFFFC; switch (address >> BASE_OFFSET) {

@@ -848,7 +850,7 @@ if (direction & LSM_D) {

address -= (popcount << 2) + 4; } - return address; + return address | addressMisalign; } void GBAAdjustWaitstates(struct GBA* gba, uint16_t parameters) {