实验代码 lab16.Asm 如下:
assume cs:code
code segment
start:
;将int 7ch写入内存0:200h中
;ds:si指向要安装的int 7ch中断例程
mov ax,cs
mov ds,ax
mov si,offset int7ch
;es:di指向复制目标地址0:200h
mov ax,0
mov es,ax
mov di,200h
;将ds:si复制到es:di中
mov cx,offset int7chend - offset int7ch
cld ;设置df=0,si di将inc
rep movsb
;修改中断向量表中的值,使int 7ch指向0:200h
mov ax,0
mov es,ax
cli ;设置中断向量表时,注意停止处理中断
mov word ptr es:[7ch*4],200h
mov word ptr es:[7ch*4+2],0
sti
;安装程序返回
mov ax,4c00h
int 21h
;编写int 7ch中断例程
int7ch:
jmp short int7chstart
table dw offset clear - offset int7ch + 200h
dw offset set_fore - offset int7ch + 200h
dw offset set_back - offset int7ch + 200h
dw offset scroll - offset int7ch + 200h
int7chstart:
push bx
push cx
push si
push di
push ds
push es
;判别&查询子程序地址
cmp ah,3
ja int7chret ;ah设置超过3,表明请求出错,程序直接返回
;用于1、2号功能,判断set_fore set_back中al设置是否正确
cmp ah,1
je judge_color
cmp ah,2
je judge_color
jmp find_add ;非1、2号功能,跳去查找