assume cs:code
stack segment
db 128 dup (0)
stack ends
code segment
start: mov ax,stack
mov ss,ax
mov sp,128
mov ax,code
mov ds,ax
mov si,offset int9
mov ax,0
mov es,ax
mov di,204h
mov cx,offset int9end-offset int9
cld
rep movsb
push es: [9*4] ;把原int9的地址存放在0:200h处
pop es:[200h]
push es:[9*4+2]
pop es:[202h]
cli
mov word ptr es:[9*4],204h ;设置中断向量的入口地址
mov word ptr es:[9*4+2],0
sti
mov ax,0b800h
mov es,ax
mov ah,'a'
s1: mov es:[160*12+40*2],ah
call delay
inc ah
cmp ah,'z'
jna s1
mov ax,0
mov es,ax
push es:[200h]
pop es:[9*4]
push es:[202h]
pop es:[9*4+2]
mov ax,4c00h
int 21h
int9: push ax
push bx
push cx
push es
in al,60h
pushf
call dword ptr cs:[200h]
cmp al,3bh
jne int9ret
mov bx,0b800h
mov bx,1
mov cx,2000
s: inc byte ptr es:[bx]
add bx,2
loop s
int9ret: pop es
pop cx
pop bx
pop ax
iret
int9end: nop
delay: push dx
push ax
mov dx,3000h
mov ax,0
s2: sub ax,1
cmp ax,0
jne s2
sub dx,1
cmp dx,0
jne s2
pop ax
pop dx
ret
code ends
end start
如果把调用原int9的程序
call dword ptr cs:[200h]
改为
mov bx,0
mov es,bx
call dword ptr es:[200h]
后,程序为什么不能正常运行了?
谢谢!! |