马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 trump 于 2014-7-3 10:31 编辑
编写0号中断的处理程序,使得在除法溢出发生时,在屏幕中间显示字符串"divide error!",然后返回到DOS。assume cs:codesg
codesg segment
start:
mov ax,cs
mov ds,ax
mov si,offset do_start
mov ax,0
mov es,ax
mov di,200h
mov cx,offset do_end - offset do_start
cld
rep movsb
mov ax,0
mov ds,ax
mov ds:[0],200h
mov ds:[2],0
mov ax,4c00h
int 21h
do_start:
jmp main
db 'divide error!',0
main:
mov ax,0
mov ds,ax
mov si,202h
mov ax,0b800h
mov es,ax
mov di,160*12+36*2
s_start:
mov cl,ds:[si]
mov ch,0
jcxz s_end
mov es:[di],cl
inc si
add di,2
jmp s_start
s_end:
iret
do_end:
nop
codesg ends
end start
|