I am trying to create an active TSR which prints an 'A'
when the ESC key is pressed, it doesn't work.
Can anyone tell me what's wrong?
bits 16
org 100h
jmp init.tsr
int1c:
push ds
push ax
push cs
pop ds
call checkdos2
jc int1c_e
cmp byte [hotkey_found], 1
jnz int1c_e
call tsrapp
int1c_e:
pop ax
pop ds
iret
int28:
push ds
push ax
push cs
pop ds
call checkdos
jc int28_e
cmp byte [hotkey_found], 1
jnz int28_e
call tsrapp
int28_e:
pop ax
pop ds
iret
checkdos2:
push bx
push es
les bx, [InDOS]
mov al, 0
cmp al, byte [es:bx]
jb checkdos2_e
cmp al, byte [es:bx-1]
checkdos2_e:
pop es
pop bx
ret
checkdos:
push bx
push es
les bx, [InDOS]
mov al, 1
cmp al, byte [es:bx]
jb checkdos_e
xor al, al
cmp al, byte [es:bx-1]
checkdos_e:
pop es
pop bx
ret
InDOS dd 0
Orig_isr9 dd 0
in_isr9 db 0
hotkey_found db 0
hotkey_idx dw 0
hotseq db 0x1b
isr9:
push ds
push bx
push ax
push cs
pop ds
in al, 0x60
pushf
cli
call word far [Orig_isr9]
mov ah, [in_isr9]
or ah, [hotkey_found]
jnz isr9_e
inc byte [in_isr9]
cmp al, byte [hotseq]
jz isr9_foundkey
jmp isr9_exit
isr9_foundkey:
mov byte [hotkey_found], 1
isr9_exit:
dec byte [in_isr9]
isr9_e:
pop ax
pop bx
pop ds
iret
tsrapp:
push dx
mov ah, 0x2
mov dl, 0x41
int 0x21
pop dx
ret
pre equ $
init.tsr:
mov ax, 0x3509
int 0x21
mov [Orig_isr9], bx
mov [Orig_isr9+2], es
mov dx, isr9
mov ax, 0x2509
int 0x21
mov dx, int28
mov ax, 0x2528
int 0x21
mov dx, int1c
mov ax, 0x251c
int 0x21
mov ax, 0x3400
int 0x21
mov [InDOS], bx
mov [InDOS+2], es
mov dx, pre
add dx, 0xf
shr dx, 4
mov ax, 0x3100
int 0x21