当前位置:网站首页>汇编语言段定义
汇编语言段定义
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
边栏推荐
- 7-8 likes (need to continue to improve)
- 「博士毕业一年,我拿下 ACL Best Paper」
- LeetCode 1638. Count the number of substrings with only one character difference
- 100张图训练1小时,照片风格随意变,文末有Demo试玩|SIGGRAPH 2021
- Ffmpeg command line use
- LeetCode 1447. Simplest fraction
- I'm "fixing movies" in ByteDance
- redux使用说明
- Error: case label `15 'not within a switch statement
- Redis standalone startup
猜你喜欢

CMake速成

亮相Google I/O,字节跳动是这样应用Flutter的

The QT program compiled on CentOS lacks a MySQL driven solution
![Story of [Kun Jintong]: talk about Chinese character coding and common character sets](/img/d5/9a9e3a0ba57328749d80ec71cb9467.png)
Story of [Kun Jintong]: talk about Chinese character coding and common character sets

~86m rabbit practice

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

~82 style of table

Cmake Express

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

Hbuilder x format shortcut key settings
随机推荐
~84 form supplement
Chapter III principles of MapReduce framework
Fdog series (V): use QT to imitate QQ to realize login interface to main interface, function chapter.
Many papers on ByteDance have been selected into CVPR 2021, and the selected dry goods are here
~86m rabbit practice
LeetCode1556. Thousand separated number
Shell_ 07_ Functions and regular expressions
7-4 harmonic average
Saw local status change event StatusChangeEvent [timestamp=1644048792587, current=DOWN, previous=UP]
Some instructions on whether to call destructor when QT window closes and application stops
LeetCode 1558. Get the minimum number of function calls of the target array
ByteDance 2022 school recruitment R & D advance approval publicity meeting, students' top 10 issues
这群程序员中的「广告狂人」,把抖音广告做成了AR游戏
Erlang installation
LeetCode 1566. Repeat the pattern with length m at least k times
7-7 ring the stupid bell
~77 linear gradient
DS18B20数字温度计系统设计
@RequestMapping、@GetMapping
Story of [Kun Jintong]: talk about Chinese character coding and common character sets








