aboutsummaryrefslogtreecommitdiff
path: root/src/ARMInterpreter_ALU.cpp
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2020-05-30 02:40:51 +0200
committerArisotura <thetotalworm@gmail.com>2020-05-30 02:40:51 +0200
commit5eb01f1f15d81fc908b9ed3819213442b8c4bd3e (patch)
tree0566df9ba03eff43361c06981b8730416ff78714 /src/ARMInterpreter_ALU.cpp
parentf9ac26078b7d88803ea7079490f419b4a0bfe660 (diff)
parente8f4735c7fb4d9fc142a4571e99672ca750be66b (diff)
begin renovating melonDSi
Diffstat (limited to 'src/ARMInterpreter_ALU.cpp')
-rw-r--r--src/ARMInterpreter_ALU.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ARMInterpreter_ALU.cpp b/src/ARMInterpreter_ALU.cpp
index f23d6b2..d60d8f8 100644
--- a/src/ARMInterpreter_ALU.cpp
+++ b/src/ARMInterpreter_ALU.cpp
@@ -106,12 +106,12 @@ namespace ARMInterpreter
x = ROR(x, (s&0x1F));
#define LSL_REG_S(x, s) \
- if (s > 31) { cpu->SetC(x & (1<<0)); x = 0; } \
- else if (s > 0) { cpu->SetC(x & (1<<(32-s))); x <<= s; }
+ if (s > 31) { cpu->SetC((s>32) ? 0 : (x & (1<<0))); x = 0; } \
+ else if (s > 0) { cpu->SetC(x & (1<<(32-s))); x <<= s; }
#define LSR_REG_S(x, s) \
- if (s > 31) { cpu->SetC(x & (1<<31)); x = 0; } \
- else if (s > 0) { cpu->SetC(x & (1<<(s-1))); x >>= s; }
+ if (s > 31) { cpu->SetC((s>32) ? 0 : (x & (1<<31))); x = 0; } \
+ else if (s > 0) { cpu->SetC(x & (1<<(s-1))); x >>= s; }
#define ASR_REG_S(x, s) \
if (s > 31) { cpu->SetC(x & (1<<31)); x = ((s32)x) >> 31; } \
@@ -134,7 +134,7 @@ namespace ARMInterpreter
#define A_CALC_OP2_REG_SHIFT_REG(shiftop) \
u32 b = cpu->R[cpu->CurInstr&0xF]; \
if ((cpu->CurInstr&0xF)==15) b += 4; \
- shiftop(b, cpu->R[(cpu->CurInstr>>8)&0xF]);
+ shiftop(b, (cpu->R[(cpu->CurInstr>>8)&0xF] & 0xFF));
#define A_IMPLEMENT_ALU_OP(x,s) \