内容:
安装一个新的int9中断例程,功能:在DOS下,按下“D”键后,除非不再松开,如果松开,就显示满屏幕的“D”;其他的键照常处理。
思路:
8086:
stacks segment
stack db 256h dup(0)
stacks ends
code segment
assume cs:code, ss:stacks
main:
;D 通码 20h 断码 0a0h 断码 = 通码 + 80H
mov ax, stacks
mov ss, ax
mov sp, 256 ;栈顶指针
; push cs ;?????->mov ds, ax, cs
; pop ds
mov ax, 0003h
int 10h
call install
mov ax, 4c00h
int 21h
install:
push ax
push cx
push si
push di
push ds
push es
push cs
pop ds
mov ax, 0
mov es, ax
mov si, offset int9 ;si->di: rep cx
mov di, 204h
mov cx, offset int9end - offset int9;cx for rep movsb:the length of rep
cld ;clear DF 指针递增
rep movsb ;rep move string byte si->di
push es:[9*4]
pop es:[200h]
push es:[9*4 +