emu: Operand trait over u8/u16, d8_as_d16 argtype

This commit is contained in:
2021-03-17 21:38:13 -07:00
parent ae1f3da4b2
commit dcf96ec5b3
5 changed files with 63 additions and 56 deletions

View File

@@ -112,6 +112,11 @@ macro_rules! step {
step!(@arg $cookie, &d8)
} };
(@d8_as_d16 $cookie:tt, $cpu:expr, $bus:expr, $prefix:tt, $modrm:tt) => { {
let d8 = i8088::next_ip($cpu.cs.get(), &mut $cpu.ip, $bus);
step!(@arg $cookie, &(d8 as u16))
} };
(@d16 $cookie:tt, $cpu:expr, $bus:expr, $prefix:tt, $modrm:tt) => { {
let d16 = i8088::next_ip16($cpu.cs.get(), &mut $cpu.ip, $bus);
step!(@arg $cookie, &d16)
@@ -350,20 +355,20 @@ impl i8088 {
0x26 => nop[seg=es, prefix] / 2,
0x2E => nop[seg=cs, prefix] / 2,
0x36 => nop[seg=ss, prefix] / 2,
0x38 _ => cmpb[flags, modrm8, r8] / "3/24+",
0x39 _ => cmpw[flags, modrm16, r16] / "3/24+",
0x3A _ => cmpb[flags, r8, modrm8] / "3/24+",
0x3B _ => cmpw[flags, r16, modrm16] / "3/24+",
0x3C => cmpb[flags, reglo=a, d8] / "3/24+",
0x3D => cmpw[flags, reg=a, d16] / "3/24+",
0x38 _ => cmp[flags, modrm8, r8] / "3/24+",
0x39 _ => cmp[flags, modrm16, r16] / "3/24+",
0x3A _ => cmp[flags, r8, modrm8] / "3/24+",
0x3B _ => cmp[flags, r16, modrm16] / "3/24+",
0x3C => cmp[flags, reglo=a, d8] / "3/24+",
0x3D => cmp[flags, reg=a, d16] / "3/24+",
0x3E => nop[seg=ds, prefix] / 2,
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
0x80: { 0x38 => cmpb[flags, modrm8, d8] / "4/23+", },
0x81: { 0x38 => cmpw[flags, modrm16, d16] / "4/23+", },
//0x83: { 0x38 => cmp?[flags, modrm16, d8] / "4/23+", },
0x80: { 0x38 => cmp[flags, modrm8, d8] / "4/23+", },
0x81: { 0x38 => cmp[flags, modrm16, d16] / "4/23+", },
0x83: { 0x38 => cmp[flags, modrm16, d8_as_d16] / "4/23+", },
0x88 _ => mov[modrm8, r8] / "2/13+",
0x89 _ => mov[modrm16, r16] / "2/13+",
0x8A _ => mov[r8, modrm8] / "2/12+",