先决条件–寻址模式
1.直接寻址模式:
在直接寻址模式下,地址字段包含操作数的地址。
Effective Address(EA) = address field of operand
例子 –
将寄存器A的内容添加到累加器。
ADD A
在地址A的内存中查找操作数。只需一个内存引用即可访问数据。因此,无需其他计算即可得出有效地址。
2.隐式寻址模式:
在指令的定义中隐式指定了操作数。通常用于零地址或单地址指令。
示例1:
递增寄存器A的内容。
INC A
此处隐式指定了寄存器A既是源,也是目的地。
示例2:
清除标志寄存器的内容。
CLC
上面的指令是零地址指令的示例。
直接和隐式寻址模式之间的区别:
DIRECT ADDRESSING MODE | IMPLIED ADDRESSING MODE |
---|---|
Address fields contains the effective address of operand. | Effective address of operand is specified implicitly. |
Instruction size is larger since operand has to be explicitly specified. | Instruction size is smaller since operand is specified implicitly. |
It requires one reference to memory. | No memory references are required. |
Mostly used in 2 address instructions and more. | Mostly used in zero address and single address instructions. |
It is slower compared to implied mode. | It is a faster method. |
It has more range than implied mode. | It has less range than direct mode. |