当前位置:网站首页>汇编语言段定义
汇编语言段定义
2022-07-06 09:29:00 【My71】
段定义三步走
段定义
关键字:segment(开始) ends(结束)
段名:不得超过八个字符。一般情况下,
- code 表示代码段。
- data 表示数据段
语法
段名 segment 段名 ends
段关联
关键字:assume
类型:CS(代码段)、DS(数据段)、SS(堆栈段)、ES(附加段)
语法:
assume 类型:段名例:定义一个代码段 code,定义一个数据段 data
code segment assume cs:code,ds:data code ends data segment data ends
段传送
传送是将段中的数据传到指定的段寄存器中。例如,讲 data 中的数据传到 DS 数据段中,在关联的时候并没有真正的传递数据。
代码段在定义时不需要段传送,其他段都需要手动传送。
通过 mov 不能将段直接传递给段寄存器,可以间接行传送。
…… mov ax,data mov ds,ax ……这段代码表示,现将 data 数据段存到 ax 中,再将 ax 中的数据存到 ds 中。
数据段
开辟空间的伪指令
- db:开辟一个字节空间。
- dw:开辟一个字空间。(两个字节)
- dup:循环存字符
存储数据
- 存储 10 进制数据时,直接写入。
- 存储字符数据时用单引号扩起来,最终在 debug 模式下现实的是该字符 ASCII 码16进制表现形式。
语法格式
无地址符号


有地址符号


代码演示
使用 db 定义 5 个奇数,将第一个数存到 AH 中,最后一个数存到 AL 中。


最终,AX=0109,恰好是 AH 与 AL 的拼接。
使用 dw 定义 5 个奇数,存入 AX 中。


利用 dup 开辟三个单字节空间
data segment str db 3 dup(5) data ends code segment assume cs:code,ds:data main: mov ax,data mov ds,ax edit: mov ah,4ch int 21h code ends end main
边栏推荐
- Codeforces Global Round 19
- was unable to send heartbeat
- Fdog series (4): use the QT framework to imitate QQ to realize the login interface, interface chapter.
- ~75 background
- Shell_ 05_ operator
- Many papers on ByteDance have been selected into CVPR 2021, and the selected dry goods are here
- QT system learning series: 1.2 style sheet sub control lookup
- TCP的三次握手和四次挥手
- MP4格式详解
- Yao BanZhi and his team came together, and the competition experts gathered together. What fairy programming competition is this?
猜你喜欢

J'ai traversé le chemin le plus fou, le circuit cérébral d'un programmeur de saut d'octets

7-10 punch in strategy

~73 other text styles

字节跳动开源GAN模型压缩框架,算力最高节省97.8%丨ICCV 2021

Shell_ 06_ Judgment and circulation

When it comes to Google i/o, this is how ByteDance is applied to flutter

这116名学生,用3天时间复刻了字节跳动内部真实技术项目

谢邀,人在工区,刚交代码,在下字节跳动实习生

搭建flutter环境入坑集合

Thank you for your invitation. I'm in the work area. I just handed in the code. I'm an intern in the next ByteDance
随机推荐
The 116 students spent three days reproducing the ByteDance internal real technology project
Thank you for your invitation. I'm in the work area. I just handed in the code. I'm an intern in the next ByteDance
Mp4 format details
~85 transition
Li Kou leetcode 280 weekly match
Typescript basic operations
JS time function Daquan detailed explanation ----- AHAO blog
The QT program compiled on CentOS lacks a MySQL driven solution
After the subscript is used to assign a value to the string type, the cout output variable is empty.
Redis standalone startup
字节跳动开源GAN模型压缩框架,算力最高节省97.8%丨ICCV 2021
Solr new core
Which is more important for programming, practice or theory [there are some things recently, I don't have time to write an article, so I'll post an article on hydrology, and I'll fill in later]
Error occurred during initialization of VM Could not reserve enough space for object heap
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)
LeetCode 1641. Count the number of Lexicographic vowel strings
TypeScript基本操作
Record the error reason: terminate called after throwing an instance
Sublime text code formatting operation
Basic principles of video compression coding and audio compression coding








