Fix THUMB 1

I didn't send this through the ALU :/


Former-commit-id: 40b4d23dcd769496e9dcd47bbf8d472b91e6a7bf
This commit is contained in:
Michel Heily 2019-07-08 20:58:22 +03:00
parent f7b2b48e5d
commit 9421281381

View file

@ -21,13 +21,19 @@ impl Core {
_bus: &mut Bus, _bus: &mut Bus,
insn: ThumbInstruction, insn: ThumbInstruction,
) -> CpuExecResult { ) -> CpuExecResult {
let result = self let op2 = self
.register_shift( .register_shift(
insn.rs(), insn.rs(),
ShiftedRegister::ByAmount(insn.offset5() as u8 as u32, insn.format1_op()), ShiftedRegister::ByAmount(insn.offset5() as u8 as u32, insn.format1_op()),
) )
.unwrap(); .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) Ok(CpuPipelineAction::IncPC)
} }