一个简单的中断驻留程序修改9号中断多打一个O,我发现如果把
mov dl, 'O '
mov ah,2
int 21h
改为
mov ah,0Eh
int 10h
mov al, 'O '
就没问题,难道在中断驻留程序中不能用int 21h吗
INT_VECTOR=9h
cseg segment
assume cs:cseg,ds:cseg
org 100h ;this line could be deleted for EXE,only for COM
begin:
jmp install
kbsave dd ?
newint9 proc near
sti ; 开中断, enable high level IRQ interrupt
push ax
push bx
push cx
push dx
push si
push di
push ds
push es
pushf
call dword ptr cs:kbsave ;EXCUTE OLD INT 9
mov dl, 'o '
mov ah,2
int 21h
exit:
pop es
pop ds
pop di
pop si
pop dx
pop cx
pop bx
pop ax
iret
newint9 endp
install proc near
xor ax,ax
mov es,ax
mov ax,word ptr es:[INT_VECTOR*4] ;save old int 9 vector
mov word ptr cs:kbsave,ax
mov ax,word ptr es:[INT_VECTOR*4+2]
mov word ptr cs:kbsave+2,ax
xor ax,ax
mov es,ax
mov ax,offset newint9 ;set new int 9 vector
mov word ptr es:[INT_VECTOR*4],ax
mov word ptr es:[INT_VECTOR*4+2],cs
MOV AX,3100H
LEA DX,install
ADD DX,100h ;must include PSP for EXE, as PSP!=CS for EXE
;but this line could be deleted for COM