From 90d57bf8ce6f7e69267f0353d06229a5ebf1ee3a Mon Sep 17 00:00:00 2001 From: luigi__ Date: Thu, 6 Aug 2009 22:20:18 +0000 Subject: [PATCH] CPU (THUMB): LSR instruction now deals correctly with carryflag. For instance this fixes bugs with CpuSet SWI when "Emulate SWIs by BIOS" is enabled. --- desmume/src/thumb_instructions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desmume/src/thumb_instructions.cpp b/desmume/src/thumb_instructions.cpp index 4ae2c8888..3fcb9990e 100644 --- a/desmume/src/thumb_instructions.cpp +++ b/desmume/src/thumb_instructions.cpp @@ -81,7 +81,7 @@ TEMPLATE static u32 FASTCALL OP_LSR() { const u32 &i = cpu->instruction; u32 v = (i>>6) & 0x1F; - cpu->CPSR.bits.C = BIT_N(cpu->R[REG_NUM(i, 0)], v-1); + cpu->CPSR.bits.C = BIT_N(cpu->R[REG_NUM(i, 3)], v-1); cpu->R[REG_NUM(i, 0)] = (cpu->R[REG_NUM(i, 3)] >> v); cpu->CPSR.bits.N = BIT31(cpu->R[REG_NUM(i, 0)]); cpu->CPSR.bits.Z = cpu->R[REG_NUM(i, 0)] == 0;