Fix thumb MUL not setting the flags

Former-commit-id: b43e35a7fa2894fcc5cef7eeae9d74123e40219b
This commit is contained in:
Michel Heily 2019-07-27 20:25:59 +03:00
parent 44426b5f0e
commit 477b4f45fd
2 changed files with 6 additions and 1 deletions

View file

@ -448,6 +448,8 @@ impl Core {
if insn.set_cond_flag() {
self.cpsr.set_N((result as i32) < 0);
self.cpsr.set_Z(result == 0);
self.cpsr.set_C(false);
self.cpsr.set_V(false);
}
Ok(())

View file

@ -85,7 +85,10 @@ impl Core {
for _ in 0..m {
self.add_cycle();
}
self.gpr[insn.rd()] = op1.wrapping_mul(op2) as u32;
let result = op1.wrapping_mul(op2) as u32;
self.cpsr.set_N((result as i32) < 0);
self.cpsr.set_Z(result == 0);
self.gpr[insn.rd()] = result;
Ok(())
}