assume cs:code
code segment
old:
dw 0, 0 ;用于保存原中断地址
color:
push es
push ax
push bx
push cx
in al, 60h
cmp al, 1eh + 80h
jne def
mov ax, 0b800h
mov es, ax
xor bx, bx
mov cx, 4000
s:
mov byte ptr es:[bx], 'A'
inc bx
mov byte ptr es:[bx], 1100b
inc bx
loop s
def:
pushf
call dword ptr cs:[200h]
pop cx
pop bx
pop ax
pop es
iret
main:
xor ax, ax ;保存原中断
mov es, ax
mov ax, es:[9 * 4]
mov cs:[0], ax
mov ax, es:[9 * 4 + 2]
mov cs:[2], ax
mov ax, cs ;安装新中断代码
mov ds, ax
mov di, 200h
mov si, offset old
mov cx, offset main - offset old
cld
rep movsb
cli ;更改中断
mov word ptr es:[9 * 4], 204h
mov word ptr es:[9 * 4 + 2], 0
sti
mov ax, 4c00h ;退出
int 21h
code ends
end main |