;程序名称:p15
;任务:安装一个新的int 9中断例程,在DOS下,按下"A"键后,除非不再松开,如果松开,就显示满屏幕的"A",其它键照常处理。
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]
pop es:[200h] ;将原int 9入口的偏移地址转存200
push es:[9*4].2
pop es:[202h] ;将原int 9入口的段地址转存202
cli ;将IF置0
mov word ptr es:[9*4],204h ;将中断向量表中的入口偏移地址
;改为新int9的
mov word ptr es:[9*4].2,0 ;将中断向量表中的入口段地址
;改为新int9的
sti ;将标志寄存器械IF置1
mov ax,4c00h
int 21h
int9: push ax
push bx
push cx
push es
in al,60h
pushf
call dword ptr cs:[200h] ;当原int 9执行时(cs)=0
cmp al,1eh+80h ;按下"A"时扫描码(即通码)为1eh,
;松开为断码=1eh+80h
jne int9ret
mov ax,0b800h
mov es,ax
mov bx,0
mov cx,2000
s: mov byte ptr es:[bx],'A'
add bx,2
loop s
int9ret: pop es
pop cx
pop bx
pop ax
iret
int9end: nop
code ends
end start
- [游客] 为啥简版的int 13h之后不用 jmp 也行。 08/31 00:14
- [hky987654321] 是的,按压F1的次数 >=15 ,有“按下“→”键会出现光斑落在年份的百位数上”的现象。 这与缓冲 08/09 11:12
- [游客] 为什么多次按F1后,按下“→”键会出现光斑落在年份的百位数上? 08/02 21:42
- [游客] 懂了。 07/30 10:54
- [hky987654321] -1就是FFh。用-1兼济了ffff:0和简洁的数据分隔这二者的需要。 [bp-2],是因为刚进入 07/29 11:43
- [游客] 也看不懂[bp-2] 07/12 10:49
- [游客] 不懂-1 07/09 17:55
- [游客] 16位现在只有教学意义,看一眼就好。 04/13 00:46
- [游客] 没搞错吧,课程2才351b 03/09 18:01
- [游客] 没想到实验14只用13条代码! 03/02 15:46