当前位置:网站首页>汇编语言-王爽 第13章 int指令-笔记
汇编语言-王爽 第13章 int指令-笔记
2022-06-27 05:45:00 【执手听落花】
编写供应用程序调用的中断例程
问题一:编写、安装中断7ch的中断例程
功能:求一word型数据的平方
参数:(ax)= 要计算的数据
返回值:dx、ax中存放结果的高16位和低16位
应用举例:求2*3456^2
assume cs:code
code segment
start: mov ax, 3456 ;(ax)=3456
int 7ch ;调用中断7ch的中断例程,计算ax中的数据的平方
add ax, ax
adc dx, dx ;dx:ax存放结果,将结果乘以2
mov ax, 4c00h
int 21h
code ends
end start
我们要做的以下3部分的工作
(1)编写实现求平方功能的程序;注意:在中断例程的最后,要使用iret指令。
(2)安装程序,将其安装在0:200处;
(3)设置中断向量表,将程序的入口地址保存在7ch表项中,使其成为中断7ch的中断例程。
assume cs:code
code segment
start: mov ax, cs
mov ds, ax
mov si, offset sqr ;设置ds:si指定源地址
mov ax, 0
mov es, ax
mov di, 200h
mov cx, offset sqrend - offset sqr
cld
rep movsb
mov ax, 0
mov es, ax
mov word ptr es:[7ch*4], 200h
mov word ptr es:[7ch*4+2], 0
mov ax, 4c00h
int 21h
sqr: mul ax
iret
sqrend: nop
code ends
end start

问题二:编写、安装中断7ch的中断例程
功能:将一个全是字母,以0结尾的字符串,转化为大写
参数:ds:si指向字符串的首地址
应用举例:将data段中的字符串转化为大写
assume cs:code
data segment
db 'conversation', 0
data ends
code segment
start: mov ax, data
mov ds, ax
mov si, 0
int 7ch
mov ax, 4c00h
int 21h
code ends
end start
安装程序如下:
assume cs:code
data segment
db 'conversation', 0
data ends
code segment
start: mov ax, cs
mov ds, ax
mov si, offset captical
mov ax, 0
mov es, ax
mov di, 200h
mov cx, offset capitalend - offset capital
cld
rep movsb
mov ax, 0
mov es, ax
mov word ptr es:[7ch*4], 200h
mov word ptr es:[7ch*4+2], 0
mov ax, 4c00h
int 21h
captical: push cx
push si
change: mov cl, [si]
mov ch, 0
jcxz ok
and byte ptr[si], 11011111b
inc si
jmp short change
ok: pop si
pop cx
iret
capitalend: nop
code ends
end start
在中断例程capital中用到了寄存器si和cx,编写中断例程和编写子程序的时候具有同样的问题,就是要避免寄存器的冲突。应该注意历程中用到的寄存器的值的保存和恢复。
问题二:用7ch中断例程完成loop指令的功能









边栏推荐
- [collection] Introduction to basic knowledge of point cloud and functions of point cloud catalyst software
- EPICS记录参考5 -- 数组模拟输入记录Array Analog Input (aai)
- Dual position relay dls-34a dc0.5a 220VDC
- 树莓派4B上运行opcua协议DEMO接入kubeedge
- WebRTC系列-网络传输之7-ICE补充之提名(nomination)与ICE_Model
- Codeforces Round #802 (Div. 2)
- leetcode298周赛记录
- Some articles about component packaging and my experience
- QListWidget中的内容不显示
- Configuring the help class iconfiguration in C # NETCORE
猜你喜欢

Double position relay rxmd2-1mrk001984 dc220v

Open the door small example to learn ten use case diagrams

RTP 发送PS流工具(已经开源)

Implementation of easyexcel's function of merging cells with the same content and dynamic title
![[FPGA] design and implementation of frequency division and doubling based on FPGA](/img/84/75d473d3d8e670260ba16d06705c2f.png)
[FPGA] design and implementation of frequency division and doubling based on FPGA

【FPGA】基于bt1120时序设计实现棋盘格横纵向灰阶图数据输出

Avoid asteroids

竣达技术丨多品牌精密空调集中监控方案
![[nips 2017] pointnet++: deep feature learning of point set in metric space](/img/3e/0a47eecc27f236d629c611e683b37a.png)
[nips 2017] pointnet++: deep feature learning of point set in metric space

How win 10 opens the environment variables window
随机推荐
【FPGA】UART串口_V1.1
Unity中跨平台获取系统音量
1317. 将整数转换为两个无零整数的和
[collection] Introduction to basic knowledge of point cloud and functions of point cloud catalyst software
程序猿学习抖音短视频制作
认知篇----2022高考志愿该如何填报
C语言实现定时器
Wechat applet refreshes the current page
洛谷P4683 [IOI2008] Type Printer 题解
Redis4.0新特性-主动内存碎片整理
Go日志-Uber开源库zap使用
openstack实例重启状态就会变成错误处理方法,容器搭建的openstack重启计算节点compute服务方法,开机提示Give root password for maintenance处理方法
双位置继电器XJLS-8G/220
Spark 之 WholeStageCodegen
IAR systems fully supports Centrino technology 9 series chips
stm32单片机引脚_如何将单片机的引脚配置为上拉输入
Two position relay rxmvb2 r251 204 110dc
Wechat applet websocket use case
Experience oceanbase database under win10
开门小例子学习十种用例图