emu: XCHG op
This commit is contained in:
@@ -473,6 +473,8 @@ impl i8088 {
|
||||
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+", },
|
||||
0x86 _ => xchg[r8, modrm8] / "4/25+", // XCHG r8, r/m8
|
||||
0x87 _ => xchg[r16, modrm16] / "4/25+", // XCHG r16, r/m16
|
||||
0x88 _ => mov[modrm8, r8] / "2/13+", // MOV r/m8, r8
|
||||
0x89 _ => mov[modrm16, r16] / "2/13+", // MOV r/m16, r16
|
||||
0x8A _ => mov[r8, modrm8] / "2/12+", // MOV r8, r/m8
|
||||
@@ -488,6 +490,13 @@ impl i8088 {
|
||||
0x18 => mov[reg=ds, modrm16] / "2/12+", }, // MOV ds, r/m16
|
||||
0x8F: { 0x00 => pop_modrm[regval=ss, reg=sp, modrm16, convert, bus] / "12/25+" }, // POP r/m16
|
||||
0x90 => nop[] / 3,
|
||||
0x91 => xchg[reg=a, reg=c] / 3, // XCHG ax, cx
|
||||
0x92 => xchg[reg=a, reg=d] / 3, // XCHG ax, dx
|
||||
0x93 => xchg[reg=a, reg=b] / 3, // XCHG ax, bx
|
||||
0x94 => xchg[reg=a, reg=sp] / 3, // XCHG ax, sp
|
||||
0x95 => xchg[reg=a, reg=bp] / 3, // XCHG ax, bp
|
||||
0x96 => xchg[reg=a, reg=si] / 3, // XCHG ax, si
|
||||
0x97 => xchg[reg=a, reg=di] / 3, // XCHG ax, di
|
||||
0x9C => push[bus, regval=ss, reg=sp, flags] / 14, // PUSHF
|
||||
0x9D => pop[bus, regval=ss, reg=sp, flags] / 12, // POPF
|
||||
// 0x9E SAHF not implemented
|
||||
|
||||
@@ -618,3 +618,9 @@ where RVal: RValue<T>,
|
||||
dst.write(val.read());
|
||||
});
|
||||
}
|
||||
|
||||
pub fn xchg<T, Dst: LValue<T>, Src: LValue<T>>(mut dst: Dst, mut src: Src) {
|
||||
let tmp = src.read();
|
||||
src.write(dst.read());
|
||||
dst.write(tmp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user