assume cs:code
code segment
start: ;装载9号中断
mov ax,cs ;source address
mov ds,ax
mov si,offset do9h
mov ax,0 ;destination address
mov es,ax
mov di,204h
;compute the length of INT 9H,and give the result to CX,
;then install it into RAM
mov cx,offset do9hend-offset do9h
cld
rep movsb
mov ax,0
mov es,ax
;store the preveniet INTERRUPT VECTOR to es:[200h]
push es:[9*4+2]
push es:[9*4]
pop es:[200h]
pop es:[202h]
;alter the 9th INTERRUPT VECTOR TABLE
cli
mov word ptr es:[9*4],204h
mov word ptr es:[9*4+2],0
sti
mov ax,4c00h ;program return to OS
int 21h
do9h: ;名称:9号中断
;功能:在DOS下,按下‘A’f键后,除非不松开,如果松开,就显示满屏幕的“A”;其他键照常处理。
;参数:无
;返回值:无
push ax
push es
push di
push cx
check: mov cx,0
mov ax,0b800h
in al,60h
cmp al,1Eh ;检测到a键的通码后如果再次检测不是a键通码则显示满屏A
jz one
jcxz pre9
jmp show
one: mov cx,1
jmp check
show:
mov es,ax
mov si,160*5+40
add cl,30h
mov es:[si],cl
mov cx,0
mov ax,0b800h
mov es,ax
mov di,0
mov cx,2000
do9hs: mov byte ptr es:[di],'A'
add di,2
loop do9hs
jmp over
pre9: pushf
call dword ptr cs:[200h];调用原来的9号中断处理程序
over:
pop cx
pop di
pop es
pop ax
iret
do9hend:nop
code ends
end start |