The instruction length is related to the addressing method. The rule or principle is as follows:
1. commands without operands. The instruction length is 1 byte. For example
ES:
DS:
CBW
Xlat
.
2. the operand only involves the register instruction. The instruction length is 2 bytes. For example
MoV Al, [Si]
MoV ax, [bx + Si]
MoV ds, ax
.
3. the operand refers to the memory address instruction. The instruction length is 3 bytes. For example
MoV Al, [bx + 1]
MoV ax, [bx + Si + 3]
Lea Di, [1234]
MoV [2345], ax
.
4. the operand refers to the immediate number instruction. The instruction length is Register Type + 2.
8-bit register, register type = 1; 16-bit register, register type = 2. For example
MoV Al, 8; Instruction length: 2
MoV ax, 8; Instruction length: 3
.
5. Jump commands are divided into 2, 3, and 5 bytes in three cases.
1. Jump within a segment, command length = (target address-Current Instruction address) + 1
The JMP command occupies 1 byte.
(Target address-current address of the instruction) if it can be expressed in 1 byte, it occupies 1 byte and the overall instruction length is 2 byte. For example:
0113 JMP 0185; 0185 H-0113 H = 72 h, expressed in 1 byte for 72 h
If two bytes are required, the command occupies two bytes and the overall command is three bytes. For example
0113 JMP 0845; 0845 H-0113 H = 732 H, H must be expressed in 2 bytes
2. Inter-segment jump. The instruction length is 5 bytes. For example
JMP 1234: 5678