先决条件–寻址模式
1.直接寻址模式:
在直接寻址模式下,地址字段包含操作数的地址。
Effective Address (EA) = address field of operand
示例:将寄存器1001的内容添加到累加器。
Add (1001)
只需一个内存引用即可访问数据。因此,无需其他计算即可得出有效地址。
2.立即寻址模式:
在立即寻址模式下,操作数是指令的一部分。
Here the Operand = Address Field
示例:将5加到累加器上。
ADD 5
不需要内存引用即可获取数据。因此,无需其他计算即可得出有效地址。这是一种快速的方法。但是缺点是范围有限。
现在让我们比较直接和立即寻址模式。
Direct Addressing Mode | Immediate Addressing Mode |
---|---|
Address fields contains the effective address of operand | There is no address field as the operand is a part of the instruction. |
It requires one reference to memory. | It does not require any reference to memory. |
It is slower compared to immediate mode. | It is a faster process. |
It has more range than in immediate mode. | It has a limited range. |
Example: Add (1001) | Example: ADD 5 |