Page 1 of 1

op code explaination required

Posted: Thu Jan 15, 2004 12:00 am
by iub
the opcode in the listing file generated by nasm for instruction
mov [120h],bx
is
891E2001

89 is for moving r16 to r/m16 (r is register and m is memory)

2001 is memory location

can you please give description of middle byte 1E

RE:op code explaination required

Posted: Thu Jan 15, 2004 12:00 am
by knicos
1E specifies which register (BX in this case) and the address mode to use.

bits 7-6: Mod (00)
bits 5-3: Reg (BX = 011)
bits 2-0: R/M (16bit addr = 110)

Mod and R/M encode the addressing mode (32 combinations, 8 registers and 24 address modes).

1E happens to mean that a 16bit displacement is used.