第十六章 直接定址表
16.1 描述了单元长度的标号
使用一种标号不但表示内存单元的地址,还表示了内存单元的长度,即表示了内存单元的长度,即表示次数标号处的单元是一个字单元还是一个字节单元,还是双字单元。
assume cs:code
code segment
a db 1, 2, 3, 4, 5, 6, 7, 8
b dw 0
start: mov si, 0
mov cx, 8
s: mov al, a[si]
mov ah, 0
add b, ax
inc si
loop s
mov ax, 4c00h
int 21h
code ends
end start
例如 b dw 0
指令 mov ax, b
等价于 mov ax, cs:[8]
mov b, 2
; mov word ptr cs:[8], 2
inc b
; inc word ptr cs:[8]
以下指令会引起编译错误
mov al, b
因为b代表了字单元,而al是8位寄存器。
称为数据标号。
注: ADD 指令 的两个操作数 ,op1 和 op2 两个都为寄存器, 一个内存地址 一个寄存器 一个内存地址 一个 立即数
一个寄存器 一个立即数 都是合法的。
两个都是内存地址 或者两个都是 立即数 非法 参考 x86 ADD指令
参考:http://x86.renejeschke.de/html/file_module_x86_id_5.html?spm=5176.100239.blogcont59019.4.e4ptjf
Description |
---|
Adds the first operand (destination operand) and the second operand (source operand) and stores the result in the destination operand. The destination operand can be a register or a memory location; the source operand can be an immediate, a register, or a memory location. (However, two memory operands cannot be used in one instruction.) When an immediate value is used as an operand, it is sign-extended to the length of the destination operand format. |