assume cs:code, ds:data
stack segment
db 1024 dup(0)
stack ends
data segment
old_int9:
dw 0, 0
flag:
db 0
data ends
code segment
start:
mov ax, stack
mov ss, ax
mov sp, 1024
mov ax, data
mov ds, ax
xor ax, ax
mov es, ax
cli
push word ptr es:[9 * 4]
push word ptr es:[9 * 4 + 2]
pop word ptr [old_int9 + 2]
pop word ptr [old_int9]
mov ax, offset new_int9
push ax
push cs
pop word ptr es:[9 * 4 + 2]
pop word ptr es:[9 * 4]
sti
@@:
cmp byte ptr [flag], 0
je @B
push es
mov ax, 0b800h
mov es, ax
xor di, di
mov cx, 2000
mov ax, 0761h
rep stosw
pop es
cli
push word ptr [old_int9]
push word ptr [old_int9 + 2]
pop word ptr es:[9 * 4 + 2]
pop word ptr es:[9 * 4]
sti
mov ax, 4c00h
int 21h
new_int9:
push ax
in al, 60h
cmp al, 9eh
jne @F
or byte ptr [flag], 1
@@:
pushf
call dword ptr [old_int9]
pop ax
iret
code ends
end start
|