op code explaination required

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
iub

op code explaination required

Post 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
knicos

RE:op code explaination required

Post 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.
Post Reply