From 9421281381e4da951c09e2600d8aea839cc86cea Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Mon, 8 Jul 2019 20:58:22 +0300 Subject: [PATCH] Fix THUMB 1 I didn't send this through the ALU :/ Former-commit-id: 40b4d23dcd769496e9dcd47bbf8d472b91e6a7bf --- src/arm7tdmi/thumb/exec.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/arm7tdmi/thumb/exec.rs b/src/arm7tdmi/thumb/exec.rs index 2043512..a5c66b0 100644 --- a/src/arm7tdmi/thumb/exec.rs +++ b/src/arm7tdmi/thumb/exec.rs @@ -21,13 +21,19 @@ impl Core { _bus: &mut Bus, insn: ThumbInstruction, ) -> CpuExecResult { - let result = self + let op2 = self .register_shift( insn.rs(), ShiftedRegister::ByAmount(insn.offset5() as u8 as u32, insn.format1_op()), ) .unwrap(); - self.gpr[insn.rd()] = result as u32; + + let rd = insn.rd(); + let op1 = self.get_reg(rd) as i32; + let result = self.alu(AluOpCode::MOV, op1, op2, true); + if let Some(result) = result { + self.set_reg(rd, result as u32); + } Ok(CpuPipelineAction::IncPC) }