当前位置:网站首页>Assembly language - Wang Shuang Chapter 13 int instruction - Notes
Assembly language - Wang Shuang Chapter 13 int instruction - Notes
2022-06-27 05:52:00 【Holding hands to listen to falling flowers】
Write interrupt routines that are called by the provider
Question 1 : To write 、 Installation interrupted 7ch Interrupt routine for
function : Seek one word Square of type data
Parameters :(ax)= Data to be calculated
Return value :dx、ax The high value of the results stored in 16 Bit and low 16 position
Application, for example, : seek 2*3456^2
assume cs:code
code segment
start: mov ax, 3456 ;(ax)=3456
int 7ch ; Call interrupt 7ch Interrupt routine for , Calculation ax The square of the data in
add ax, ax
adc dx, dx ;dx:ax Store results , Multiply the result by 2
mov ax, 4c00h
int 21h
code ends
end start
We need to do the following 3 Part of the work
(1) Write procedures to achieve the function of square ; Be careful : At the end of the interrupt routine , To use iret Instructions .
(2) Erection sequence , Install it in the 0:200 It's about ;
(3) Set interrupt vector table , Save the entry address of the program in 7ch In table items , Make it an interruption 7ch Interrupt routine for .
assume cs:code
code segment
start: mov ax, cs
mov ds, ax
mov si, offset sqr ; Set up ds:si Specify the source address
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

Question two : To write 、 Installation interrupted 7ch Interrupt routine for
function : Make one all letters , With 0 a null-terminated string , Convert to uppercase
Parameters :ds:si Point to the first address of the string
Application, for example, : take data The string in the section is converted to uppercase
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
The installation procedure is as follows :
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
In the interrupt routine capital Registers are used in si and cx, Writing interrupt routines has the same problem as writing subroutines , Is to avoid register conflicts . Attention should be paid to saving and restoring the values of registers used in the process .
Question two : use 7ch Interrupt routine complete loop Function of instruction









边栏推荐
猜你喜欢

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

IAR Systems全面支持芯驰科技9系列芯片

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

How JQ gets the ID name of an element

Win 10 如何打开环境变量窗口

Zener diode zener diode sod123 package positive and negative distinction

重映像(STM32)

Asp. Net core6 websocket simple case

使用域名转发mqtt协议,避坑指南

Ad22 Gerber files Click to open the Gerber step interface. Official solutions to problems
随机推荐
C语言实现定时器
Basic concepts of neo4j graph database
Avoid asteroids
js实现双向数据绑定
STM32 reads IO high and low level status
论文解读(LG2AR)《Learning Graph Augmentations to Learn Graph Representations》
Leetcode298 weekly race record
Remapping (STM32)
Execution rules of pytest framework
[FPGA] UART serial port_ V1.1
STM32 MCU pin_ How to configure the pin of single chip microcomputer as pull-up input
What is BFC? What's the usage?
leetcode298周赛记录
软件测试年终总结报告模板
jq怎么获取倒数的元素
重映像(STM32)
leetcode299周赛记录
Pytest框架的执行规则
Formation and release of function stack frame
创建一个基础WDM驱动,并使用MFC调用驱动