A GameCube/Wii emulator and debugger written in Rust.
cmp
Layle2c241b46ead1
diff --git a/crates/gekko/build.rs b/crates/gekko/build.rsindex 493c73a..bc71556 100644--- a/crates/gekko/build.rs+++ b/crates/gekko/build.rs@@ -14,7 +14,8 @@ fn main() {.group("alu", ["ori", "addi", "addis"]).group("msr", ["mtmsr", "mfmsr"]).group("spr", ["mtspr", "mfspr"])- .group("store_load", ["stwu", "sth", "sthu"]);+ .group("store_load", ["stw", "stwu", "sth", "sthu", "lwz", "lwzu"])+ .group("compare", ["cmpi"]);// Always regenerate the LUT dispatch tablesbuilderdiff --git a/crates/gekko/src/cpu/interpreter.rs b/crates/gekko/src/cpu/interpreter.rsindex 048b8e2..0d8c81c 100644--- a/crates/gekko/src/cpu/interpreter.rs+++ b/crates/gekko/src/cpu/interpreter.rs@@ -136,10 +136,34 @@ pub fn store_load<const OP: u32>(ctx.cpu.gprs[instr.ra()] = addr;}}+ crate::cpu::lut::OP_LWZ | crate::cpu::lut::OP_LWZU => {+ let addr = ctx.cpu.gprs[instr.ra()].wrapping_add_signed(instr.disp());+ ctx.cpu.gprs[instr.rd()] = ctx.mmu.virt_read_u32(addr);+ if OP == crate::cpu::lut::OP_LWZU {+ ctx.cpu.gprs[instr.ra()] = addr;+ }+ }_ => todo!("Store/Load instruction with OP = {OP:#x}"),}}+pub fn compare<const OP: u32>(+ ctx: &mut crate::gekko::Gekko,+ instr: crate::cpu::semantics::Instruction,+) {+ match OP {+ crate::cpu::lut::OP_CMPI => {+ let result = (ctx.cpu.gprs[instr.ra()] as i32).cmp(&instr.simm());+ // ctx.cpu.cr[instr.bi() as usize] = match result {+ // std::cmp::Ordering::Less => 0b100,+ // std::cmp::Ordering::Equal => 0b010,+ // std::cmp::Ordering::Greater => 0b001,+ // };+ }+ _ => todo!("Compare instruction with OP = {OP:#x}"),+ }+}+#[rustfmt::skip] pub fn twi(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("twi") }#[rustfmt::skip] pub fn ps_cmpu0(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("ps_cmpu0") }#[rustfmt::skip] pub fn ps_cmpo0(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("ps_cmpo0") }@@ -178,7 +202,6 @@ pub fn store_load<const OP: u32>(#[rustfmt::skip] pub fn mulli(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("mulli") }#[rustfmt::skip] pub fn subfic(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("subfic") }#[rustfmt::skip] pub fn cmpli(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("cmpli") }-#[rustfmt::skip] pub fn cmpi(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("cmpi") }#[rustfmt::skip] pub fn addic(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("addic") }#[rustfmt::skip] pub fn addic_dot(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("addic_dot") }#[rustfmt::skip] pub fn bcx(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("bcx") }@@ -297,8 +320,6 @@ pub fn store_load<const OP: u32>(#[rustfmt::skip] pub fn tlbld(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("tlbld") }#[rustfmt::skip] pub fn tlbli(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("tlbli") }#[rustfmt::skip] pub fn dcbz(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("dcbz") }-#[rustfmt::skip] pub fn lwz(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("lwz") }-#[rustfmt::skip] pub fn lwzu(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("lwzu") }#[rustfmt::skip] pub fn lbz(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("lbz") }#[rustfmt::skip] pub fn lbzu(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("lbzu") }#[rustfmt::skip] pub fn stw(_ctx: &mut crate::gekko::Gekko, _instr: crate::cpu::semantics::Instruction) { todo!("stw") }