Fix thumb NEG instruction. Finally pass armwrestler!

This one took me quite a bit. :/


Former-commit-id: f08537dda5a62076c3faff31a898c0a585102526
This commit is contained in:
Michel Heily 2019-09-10 01:01:49 +03:00
parent 441482516e
commit fa211fa77e

View file

@ -1,5 +1,6 @@
use crate::core::arm7tdmi::bus::Bus; use crate::core::arm7tdmi::bus::Bus;
use crate::core::arm7tdmi::cpu::{Core, CpuExecResult}; use crate::core::arm7tdmi::cpu::{Core, CpuExecResult};
use crate::core::arm7tdmi::alu::AluOpCode;
use crate::core::arm7tdmi::*; use crate::core::arm7tdmi::*;
use crate::core::sysbus::SysBus; use crate::core::sysbus::SysBus;
@ -98,7 +99,11 @@ impl Core {
let rd = insn.rd(); let rd = insn.rd();
let (arm_alu_op, shft) = insn.alu_opcode(); let (arm_alu_op, shft) = insn.alu_opcode();
let op1 = self.get_reg(rd) as i32; let op1 = if arm_alu_op == AluOpCode::RSB {
self.get_reg(insn.rs()) as i32
} else {
self.get_reg(rd) as i32
};
let op2 = if let Some(shft) = shft { let op2 = if let Some(shft) = shft {
self.get_barrel_shifted_value(shft) self.get_barrel_shifted_value(shft)
} else { } else {