实验十二
编写0号中断的处理程序,使得在除法溢出发生时,在屏幕中间显示字符串"divide error!"
中断处理程序
assume cs:code
code segment
start:
mov ax,cs
mov ds,ax
mov si,offset do0; 设置源地址
mov ax,0
mov es,ax
mov di,200h; 设置目的地址
mov cx,offset do0end-offset do0; 设置传输长度
cld
rep movsb
mov ax,0
mov es,ax
mov word ptr es:[0*4],200h; 修改中断向量表,使其指向我们设置的地址
mov word ptr es:[0*4+2],0
mov ax,4c00h
int 21h
do0:
jmp short do0start
db "divide error!"
do0start:
mov ax,cs
mov ds,ax
mov si,202h
mov ax,0b800h
mov es,ax
mov di,12*160+36*2; 指向屏幕中间
mov cx,13
s:
mov al,ds:[si]
mov es:[di],al
inc si
add di,2
loop s
mov ax,4c00h
int 21h
do0end:
nop
code ends
end start
测试程序
assume cs:code
code segment
start:
mov ax,1000h
mov bh,1
div bh
code ends
end start
标签:code,十二,mov,start,实验,cs,ax,es
From: https://www.cnblogs.com/alphadoiy/p/17584770.html