diff options
author | WaluigiWare64 <68647953+WaluigiWare64@users.noreply.github.com> | 2020-08-05 15:06:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-05 15:06:15 +0100 |
commit | 6d71f9c83293006b02a96ce0f5a5f9f65a47cd18 (patch) | |
tree | 5558a3a2ae148e7e17fdd56ab0296b883da0aa09 /src/ARMInterpreter_ALU.cpp | |
parent | 7e5eafe345017dc93a68572528e896f896a6e175 (diff) | |
parent | e4b1526b477bc66996bce8f0a2f81c2f1cffba63 (diff) |
Merge branch 'master' into feature/zip-support
Diffstat (limited to 'src/ARMInterpreter_ALU.cpp')
-rw-r--r-- | src/ARMInterpreter_ALU.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ARMInterpreter_ALU.cpp b/src/ARMInterpreter_ALU.cpp index 545667a..2095432 100644 --- a/src/ARMInterpreter_ALU.cpp +++ b/src/ARMInterpreter_ALU.cpp @@ -126,6 +126,11 @@ namespace ARMInterpreter #define A_CALC_OP2_IMM \ u32 b = ROR(cpu->CurInstr&0xFF, (cpu->CurInstr>>7)&0x1E); +#define A_CALC_OP2_IMM_S \ + u32 b = ROR(cpu->CurInstr&0xFF, (cpu->CurInstr>>7)&0x1E); \ + if ((cpu->CurInstr>>7)&0x1E) \ + cpu->SetC(b & 0x80000000); + #define A_CALC_OP2_REG_SHIFT_IMM(shiftop) \ u32 b = cpu->R[cpu->CurInstr&0xF]; \ u32 s = (cpu->CurInstr>>7)&0x1F; \ @@ -186,7 +191,7 @@ void A_##x##_REG_ROR_REG(ARM* cpu) \ } \ void A_##x##_IMM_S(ARM* cpu) \ { \ - A_CALC_OP2_IMM \ + A_CALC_OP2_IMM##s \ A_##x##_S(0) \ } \ void A_##x##_REG_LSL_IMM_S(ARM* cpu) \ @@ -234,7 +239,7 @@ void A_##x##_REG_ROR_REG_S(ARM* cpu) \ \ void A_##x##_IMM(ARM* cpu) \ { \ - A_CALC_OP2_IMM \ + A_CALC_OP2_IMM##s \ A_##x(0) \ } \ void A_##x##_REG_LSL_IMM(ARM* cpu) \ @@ -1078,7 +1083,7 @@ void A_QDADD(ARM* cpu) u32 rm = cpu->R[cpu->CurInstr & 0xF]; u32 rn = cpu->R[(cpu->CurInstr >> 16) & 0xF]; - if (rn & 0x40000000) + if (OVERFLOW_ADD(rn, rn, rn<<1)) { rn = (rn & 0x80000000) ? 0x80000000 : 0x7FFFFFFF; cpu->CPSR |= 0x08000000; // CHECKME @@ -1104,7 +1109,7 @@ void A_QDSUB(ARM* cpu) u32 rm = cpu->R[cpu->CurInstr & 0xF]; u32 rn = cpu->R[(cpu->CurInstr >> 16) & 0xF]; - if (rn & 0x40000000) + if (OVERFLOW_ADD(rn, rn, rn<<1)) { rn = (rn & 0x80000000) ? 0x80000000 : 0x7FFFFFFF; cpu->CPSR |= 0x08000000; // CHECKME |