emu: Fake opcode ASSERT for testing
This commit is contained in:
@@ -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+",
|
||||
|
||||
@@ -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<T: Debug + Eq>(loc: &impl RValue<T>, val: &impl RValue<T>) {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user