在中断驻留程序中不能用int 21h吗

vn68214 vn68214 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
一个简单的中断驻留程序修改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
MOV CL,4
SHR DX,CL ;convert byte to paragraph
INC DX ;consideration of the remainder
INT 21h
;mov DX,OFFSET INSTALL
;INT 27H
install endp
cseg ends
end begin
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
vn68214
汇编语言 21,500 成员 41,619 内容