From 4763f79abf6bdbee004c3d239c3544b4355a8b9a Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Thu, 11 Jul 2019 00:02:39 +0300 Subject: [PATCH] arm: Impl MLA Former-commit-id: fe2c836bd09af165381537445dd288ca7bac24ce --- src/arm7tdmi/arm/exec.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/arm7tdmi/arm/exec.rs b/src/arm7tdmi/arm/exec.rs index 5bc5c4f..bdb1ddf 100644 --- a/src/arm7tdmi/arm/exec.rs +++ b/src/arm7tdmi/arm/exec.rs @@ -399,15 +399,15 @@ impl Core { return Err(CpuError::IllegalInstruction); } - if !insn.accumulate_flag() { - self.set_reg(insn.rn(), 0); - } else { - panic!("accumelate not implemented yet"); - } - let op1 = self.get_reg(rm) as i32; let op2 = self.get_reg(rs) as i32; - let result = (op1 * op2) as u32; + let mut result = (op1 * op2) as u32; + + if insn.accumulate_flag() { + result = result.wrapping_add(self.get_reg(rn)); + self.add_cycle(); + } + self.set_reg(rd, result); let m = self.get_required_multipiler_array_cycles(op2);