在中断驻留程序中不能用int 21h吗
一个简单的中断驻留程序修改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
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
...全文
相关推荐
汇编语言--新增INT21H的功能
#### 关键知识点详解##### INT 21H简介INT 21H是MS-DOS环境下常用的一个中断服务程序,用于执行各种输入输出操作。
汇编int 21h和int 16h调用详解
dos中断,软件中断,很详细,希望对你有帮助 int 16是一个软件中断,可以用来获取按键信息int 21是dos软中断指令,所以对应的是计算机中断硬件
INT 21H 功能调用一览表
INT 21H是IBM PC兼容机上的DOS和BIOS功能调用接口,通过它,程序员可以与操作系统进行交互,执行诸如输入输出、文件管理、系统时间等操作。
int21h的详细功能描述
**汇编语言中的中断服务INT 21h详解**在早期的DOS操作系统环境中,程序与硬件交互的主要方式之一就是通过中断服务。
INT-21H功能列表
INT-21H是早期IBM PC及其兼容机使用的中断向量之一,它为程序员提供了一套丰富的系统调用接口,用于实现基本的输入输出操作、文件管理以及设备控制等功能。这份文档列出了INT-21H的21个功能号


