; 编写9号中断处理程序,该程序在原来9号中断处理程序的基础上新增如下功能:
; a:按下f3键,将从b8000h处开始的4000个字节复制到20000h处。
; b:按下f8键,将从20000h处开始的4000个字节复制到b8000h处。
; 注:以上9号中断处理程序需要被安装程序安装在安全区域,安装完毕后安装程序结束。
assume cs:code
stack segment
db 128 dup (0)
stack ends
code segment
start:mov ax,stack
mov ss,ax
mov sp,128
push cs
pop ds
mov ax,0
mov es,ax
mov si,offset int9 ;安装程序
mov di,204h
mov cx,offset int9end-offset int9
cld
rep movsb
push es:[9*4] ;保存原来int9在中断向量表的入口地址
pop es:[200h]
push es:[9*4+2]
pop es:[202h]
cli
mov word ptr es:[9*4],204h ;将新的int9入口地址添加到中断向量表
mov word ptr es:[9*4+2],0
sti
mov ax,4c00h
int 21h
int9:push ax
push di
push si
push ds
push es
push cx
in al,60h ;从60H号端口读出键盘输入
pushf
call dword ptr cs:[200h] ;调用原来的int9
cmp al,3dh ;F3的扫描码
jne next
mov ax,0b800h
mov ds,ax
mov si,0
mov ax,2000h
mov es,ax
mov di,0
mov cx,4000
cld
rep movsb
next:cmp al,40h ;F6的扫描码
jne return
mov ax,2000h
mov ds,ax
mov si,0
mov ax,0b800h
mov es,ax
mov di,0
mov cx,4000
cld
rep movsb