Assume the following x86-32 instruction:
add ebx,1
There are (at least) two ways to assemble this opcode:
81 c3 01 00 00 00
or
83 c3 01
The first keeps 1 as a 4 bytes dword the second keeps 1 as a byte
Is there an instruction that keeps 1 as 2 bytes? If no why?
You have stumbled upon a quirk of the x86 instruction set. Intel included a group of instructions under the stem 83
, whose first operand is of type Ev
, and whose second operand is an immediate byte that is interpreted as being the same size as the Ev
operand. So for 83 c3 01
, the 01
is interpreted as a 32-bit value; for 66 83 c3 01
, the 01 is interpreted as a 16-bit value (and the destination is the 16-bit ax
register). The push
mnemonic coded under the stem 6A
behaves in the same way with respect to the size of its single operand.
The broader answer to your question is no, there is no encoding where a 16-bit constant is interpreted as a 32-bit one.
Source: I wrote a disassembler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With