diff --git a/src/emu/i8088.rs b/src/emu/i8088.rs index c36c578..c5408fb 100644 --- a/src/emu/i8088.rs +++ b/src/emu/i8088.rs @@ -298,8 +298,10 @@ impl i8088 { 0x2e => nop[seg=cs, prefix] / 2, 0x36 => nop[seg=ss, prefix] / 2, 0x3e => nop[seg=ds, prefix] / 2, - 0x60 => show[cpu] / 0, // Fake opcode for debugging - 0x61 => peek[seg=ds, addr] / 0, // Fake opcode for debugging + 0x60 => show[cpu] / 0, // Fake opcode for debugging + 0x61 => peek[seg=ds, addr] / 0, // Fake opcode for debugging + 0x62 _ => assert[modrm8, d8] / 0, // Fake opcode for debugging + 0x63 _ => assert[modrm16, d16] / 0, // Fake opcode for debugging 0x88 _ => mov[modrm8, r8] / "2/13+", 0x89 _ => mov[modrm16, r16] / "2/13+", 0x8A _ => mov[r8, modrm8] / "2/12+", diff --git a/src/emu/operations.rs b/src/emu/operations.rs index d0c9118..9f52bc4 100644 --- a/src/emu/operations.rs +++ b/src/emu/operations.rs @@ -1,3 +1,5 @@ +use std::fmt::Debug; + use emu::byteorder::{ByteOrder, LittleEndian}; use emu::dos; use emu::i8088::i8088; @@ -5,6 +7,12 @@ use emu::operands::{Addr, Address, LValue, Reg, RValue}; use emu::pc::Bus; use emu::util::segoff_to_addr; +pub fn assert(loc: &impl RValue, val: &impl RValue) { + assert_eq!(loc.read(), val.read(), + "ASSERT instruction failed: {:#2X?} != {:#2X?}", loc.read(), val.read()); + println!("ASSERT pass: {:#2X?} == {:#2X?}", loc.read(), val.read()); +} + pub fn show(cpu: &mut i8088) { println!("{:#X?}", cpu); }