;在dosbox中运行,显示全屏A后就卡住了,不能正常返回dosbox
;王爽实验15 编写一个新int9中断,功能按下A键后,除非不松开,如果松开就显示满屏幕的‘A’,其他键照常处理
assume cs:code
code segment
main: ; 安装程序到0:200h处
mov ax,0
mov es,ax
mov di,204h
mov ax,cs
mov ds,ax
mov si,newint9
mov cx,offset endint9- offset newint9
mov ax,es:[9*4] ;这4句 保存原int9 ip和cs到200h 202h处
mov es:[200h],ax
mov ax,es:[9*4+2]
mov es:[202h],ax
rep movsb ;复制新中断到204开始处
cli ;安装新中断
mov word ptr es:[9*4],204h
mov word ptr es:[9*4+2],0
sti
mov ax,4c00h
int 21h
newint9: ;新中断
push ax
push cx
push es
push di
in al,60h ;读键盘
cmp al,1Eh ;判断al是 A键扫描码1E吗
jne oldint9 ;不是按A键跳转 正常处理
s: ;是
in al,60h
cmp al,1eh+80h ;是否松开A键?
jne s ;如果没松开一直寻环
mov cx,0B800h ;松开,显示满屏A
mov es,cx
mov cx,2000
mov di,0
s1:
mov byte ptr es:[di],'A'
add di,2
loop s1
jmp exit
oldint9: ;不是则调用旧int9h
pushf
call dword ptr cs:[200h]
exit:
pop di
pop es
pop cx
pop ax
iret
endint9:nop
code ends
end main
------解决方案--------------------
我是在cmd里运行的。