练习12 编写0号中断的处理程序
编写0号中断的处理程序,使得在除法溢出发生时,在屏幕中间显示字符串"divide error!",然后返回到DOS
assume cs:codesg
codesg segment
;安装中断程序
start:
mov ax,cs
mov ds,ax
mov si,offset sub
mov ax,0
mov es,ax
mov di,200H
mov cx,offset sub-offset subend
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
;设置中断程序
sub: jmp s
db "divide error!"
s: mov ax,cs
mov ds,ax
mov si,offset sub+2
mov ax,0b800H
mov es,ax
mov di,12*160+36*2
mov cx,13
s0: mov al,ds:[si]
mov es:[di],al
inc si
add di,2
loop s
mov ax,4c00H
int 21H
codese ends
end start