The ADD
instruction documentation from this page has the following table with various encodings:
I believe that imm8
means an immediate value whose size is 8 bits (for example: BYTE 123
).
And I believe that r32
means a register whose size is 32 bits (for example: EAX
)
But what does r/m8
mean? Does it mean that I can use a register whose size is 8 bits (for example: AL]
) or a memory location whose size is 8 bits (for example: BYTE [myvar]
)?
a one-byte operand that is either the contents of a byte register (AL, BL, CL, DL, AH, BH, CH, DH), or a byte from memory. r/m16: a word register or memory operand used for instructions whose operand-size attribute is 16 bits.
Encoding of instruction must include opcode, operands & addressing information. Encoding: represent entire instruction as a binary value. number of bytes needed depends on how much information must be encoded.
The spare/register field contains either an opcode extension or the register code for another operand (see /r above). The r/m field encodes which register is used.
Scaled indexed addressing mode uses the second byte (namely, SIB byte) that follows the MOD-REG-R/M byte in the instruction format. The MOD field still specifies the displacement size of zero, one, or four bytes.
That web page is a html conversion of the official intel documentation. You should read that instead, especially since it has a section 3.1.1.3 Instruction Column in the Opcode Summary Table which says:
r/m8 -- A byte operand that is either the contents of a byte general-purpose register (AL, CL, DL, BL, AH, CH, DH, BH, BPL, SPL, DIL and SIL) or a byte from memory. Byte registers R8L - R15L are available using REX.R in 64-bit mode.
So yes, it means what you said.
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