当前位置:网站首页>第六章-包含多个段的程序
第六章-包含多个段的程序
2022-06-12 08:42:00 【皮卡乒的皮卡乓】
第六章-包含多个段的程序
6.1 在代码段中使用数据
dw即define word,定义字型数据,数据用逗号分隔。
dw 数据
定义的数据在代码段,偏移地址为0,2,4.。。。。即:cs:0,cs:2…
assume cs:code
code segment
dw 0123h,0456h,0789h,0abcH,0defh,0fedh,0cbah,0987h
start:
mov bx,0
mov ax,0
mov cx,8
s: add ax,cs:[bx]
add bx,2
loop s
mov ax, 4c00h
int 21h
code ends
end start
6.2 在代码段中使用栈
assume cs:code
code segment
dw 0123h,0456h,0789h,0abcH,0defh,0fedh,0cbah,0987h
dw 0,0,0,0,0,0,0,0
start:
mov ax, cs
mov ss, ax
mov sp, 32
mov bx, 0
mov cx, 8
s: push cs:[0]
add bx, 2
loop s
mov bx, 0
mov cx, 8
s0: pop cs:[bx]
add bx,2
loop s0
mov ax, 4c00h
int 21h
code ends
end start
6.3将数据、代码、栈放入不同的段
assmue cs:code,ds:data,ss:stack
data segment
dw 0123h,0456h,0789h,0abcH,0defh,0fedh,0cbah,0987h
data ends
stack segment
dw 0,0,0,0,0,0,0,0
stack ends
code segment
start:
start:
mov ax, stack
mov ss, ax
mov sp, 16 ;设置栈顶ss:sp指向stack:16
mov ax, data
mov ds, ax ;希望用ds:bx访问data段中的内容;ds指向data段
mov bx, 0 ;ds:bx指向data段中的第一个单元
mov cx, 8
s: push cs:[0]
add bx, 2
loop s
mov bx, 0
mov cx, 8
s0: pop cs:[bx]
add bx,2
loop s0
mov ax, 4c00h
int 21h
code ends
end start
边栏推荐
- Background attribute compound writing
- Query in MySQL
- Knee joint
- 进制GB和GiB的区别
- Where does the driving force of MES system come from? What problems should be paid attention to in model selection?
- 2022.6.11-----leetcode. nine hundred and twenty-six
- FDA审查人员称Moderna COVID疫苗对5岁以下儿童安全有效
- 三国杀周边--------猪国杀题解
- Loading circling effect during loading
- 根据有效期显示距离当前还剩多少天有效期
猜你喜欢

Hands on learning and deep learning -- simple implementation of softmax regression

MPLS的原理与配置

What exactly is APS? You will know after reading the article
![[dynamic memory management] malloc & calloc and realloc and written test questions and flexible array](/img/d2/a6276d8415c46124920395df5651d1.png)
[dynamic memory management] malloc & calloc and realloc and written test questions and flexible array

【动态内存管理】malloc&calloc和realloc和笔试题和柔性数组
![[advanced pointer III] implement C language quick sorting function qsort & callback function](/img/f0/3729db83ba3eb15c7df0958858ece9.png)
[advanced pointer III] implement C language quick sorting function qsort & callback function

Regular expressions in JS

This article is required for the popularization of super complete MES system knowledge
![[essence] explain in detail the memory management mechanism in QT](/img/7d/0d83158c6b0574dd3b3547b47af67e.jpg)
[essence] explain in detail the memory management mechanism in QT
![[advanced pointer 2] array parameter transfer & pointer parameter transfer & function pointer & function pointer array & callback function](/img/90/447d601a8c338cdd5a6674a2dc59ae.png)
[advanced pointer 2] array parameter transfer & pointer parameter transfer & function pointer & function pointer array & callback function
随机推荐
Union selector
Where does the driving force of MES system come from? What problems should be paid attention to in model selection?
Vscode download slow solution
(P14) use of the override keyword
Configuration and principle of MSTP
Wechat applet image saving function
The electrical fire detector monitors each power circuit in real time
What is the quality traceability function of MES system pursuing?
Vscade debug TS
Shell基本语法--算数运算
【数据存储】浮点型数据在内存中的存储
报错:文件夹在另一个程序中打开无法删除怎么办
Why should enterprises implement MES? What are the specific operating procedures?
When converting tensor to ndarray in tensorflow, the run or Eval function is constantly called in the loop, and the code runs more and more slowly!
根据有效期显示距离当前还剩多少天有效期
MSTP的配置与原理
Difference between binary GB and gib
Judge whether the object is empty
Ankerui fire emergency lighting and evacuation indication system
ctfshow web4