I am playing a little bit with xed with in mind the purpose to write a little emulator of the intel 8086 and I want to use xed as the decoder. But when I am writing a little code in asm (compiled with nasm):
[CPU 8086]
mov al, 0x7F
xor bx, bx
xchg bx, bx
cli
hlt
and try to display some things to see if understand how xed works, I have this behavior :
0x0:0x0 (0x0)
MOV : length = 2
operand0: AL (REG0)
operand1: 7f (IMM0)
0x0:0x2 (0x2)
XOR : length = 3
operand0: BX (REG0)
operand1: BX (REG1)
operand2: (REG2)
0x0:0x5 (0x5)
XCHG : length = 3
operand0: BX (REG0)
operand1: BX (REG1)
0x0:0x8 (0x8)
CLI : length = 1
operand0: EFLAGS (REG0)
0x0:0x9 (0x9)
HLT : length = 1
I don't understand why I have 3 operands for xor and 1 operand for cli, and in general, there is many cases where the operands displayed don't match the number of operands specified by intel. What am I doing wrong ?
There is the code I used in a gist (I did my best to make it as minimal as possible)
[edit]
Things are a little bit more clear now: I compiled xor bx, bx
with nasm -f bin test.s
and my program gives me that :
0x0:0x0 (0x0)
XOR : length = 2
operand0: BX (REG0)
operand1: BX (REG1)
operand2: FLAGS (REG2)
The length of xor is 2 : that's right we are in 16 bits mode. There is 2 explicit operands : bx and bx thats right There is one implicit suppressed operand : flags (like @Peter Corde said)
Everything looks good now