(1) 安装自己编写的7ch中断程序(myjumpn.asm),即将功能处理程序拷贝到内存 0:200h处,并将中断向量表的7ch项做相应的设置(段地址,偏移地址)
assume cs:code
code segment
start:
mov ax , cs
mov ds , ax
mov si , offset myjumpn
mov ax , 0
mov es , ax
mov di , 200h
mov cx , offset myjumpnend - offset myjumpn //功能程序的大小
cld //用该命令将功能程序复制到内存0:200h处
rep movsb
mov ax , 0
mov es , ax
mov word ptr es:[7ch*4] , 200h //设置中断向量表7ch项对应的中断处理程序的偏移地址
mov word ptr es:[7ch*4+2] , 0 //设置中断向量表7ch项对应的中断处理程序的段地址
mov ax , 4c00h
int 21h
myjumpn: //真正处理中断的功能程序
push bp
mov bp , sp
add [bp+2] , bx //简单改变ip,实现跳转
pop bp
iret
myjumpnend: nop
code ends
end start
(2)先编译并运行myjumpn.exe ,此时我们的7ch中断程序就在内存准备就绪,接下来编写一个调用程序:
assume cs:code
data segment
db 'conversation',0
data ends
code segment
start:
mov ax , data
mov ds , ax
mov si , 0
mov ax , 0b800h
mov es , ax
mov di , 12*160+20*2
s:
cmp byte ptr [si] , 0
je ok
mov al , [si]
mov es:[di] , al
inc di
mov byte ptr es:[di] , 2
inc si
inc di
mov bx , offset s - offset ok
int 7ch //调用我们的中断处理程序,实现跳转到s处
ok:
mov ax , 4c00h
int 21h
code ends
end start