当前位置:网站首页>汇编语言段定义
汇编语言段定义
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
边栏推荐
- 字节跳动技术面试官现身说法:我最想pick什么样的候选人
- Detailed explanation of FLV format
- 姚班智班齐上阵,竞赛高手聚一堂,这是什么神仙编程大赛?
- LeetCode 1561. The maximum number of coins you can get
- 字节跳动新程序员成长秘诀:那些闪闪发光的宝藏mentor们
- Cmake Express
- Eureka high availability
- DS18B20數字溫度計系統設計
- Simple records of business system migration from Oracle to opengauss database
- 字节跳动多篇论文入选 CVPR 2021,精选干货都在这里了
猜你喜欢

~84 form supplement

~86m rabbit practice

Data config problem: the reference to entity 'useunicode' must end with ';' delimiter.

Train 100 pictures for 1 hour, and the style of the photos changes at will. There is a demo at the end of the article | siggraph 2021

Ffmpeg command line use
![[graduation project] QT from introduction to practice: realize imitation of QQ communication, which is also the last blog post in school.](/img/ef/2072aac5f85c7daf39174784dec7ee.jpg)
[graduation project] QT from introduction to practice: realize imitation of QQ communication, which is also the last blog post in school.

LeetCode 1558. Get the minimum number of function calls of the target array

The most lost road I have ever walked through is the brain circuit of ByteDance programmers

Solr new core

~Introduction to form 80
随机推荐
(multiple methods, need to continue to see) 7-11 go deep into the tiger's Den
Educational Codeforces Round 122 (Rated for Div. 2)
How to configure hosts when setting up Eureka
Two weeks' experience of intermediate software designer in the crash soft exam
Error occurred during initialization of VM Could not reserve enough space for object heap
CMake速成
Restful style interface design
~84 form supplement
我走过最迷的路,是字节跳动程序员的脑回路
7-12 inventory code base
was unable to send heartbeat
Cartesian tree (modified)
Full record of ByteDance technology newcomer training: a guide to the new growth of school recruitment
Fdog series (4): use the QT framework to imitate QQ to realize the login interface, interface chapter.
~79 Movie card exercise
Business system compatible database oracle/postgresql (opengauss) /mysql Trivia
Usage of insert() in vector
ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021
7-10 punch in strategy
Eureka high availability








