王爽 《汇编语言》 读书笔记 十六 直接定址表

本文详细介绍了汇编语言中直接定址表的概念,包括数据标号的使用,如何在不同段中访问数据标号,以及如何通过直接定址表实现子程序调用。内容涵盖标号的内存长度描述、ADD指令的合法操作数组合,以及通过映射关系实现的字符显示子程序。此外,还讨论了在特定地址编译程序时,如何处理间接位移以确保正确访问子程序的入口地址。
摘要由CSDN通过智能技术生成

第十六章  直接定址表


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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值