10-10-2022, 03:42 AM
The assembly code I am using to trap x1b and x05 is this:
Code: (Select All)
;Traps and ignores Print-Screen and Control-Break. v1.1a PD 2020.
;Compiled with 'Tasm /t Keytrap;'
;Compile calling program using /fs with BC. (QBX forces /fs).
.model medium, basic ;Stay compatible with basic.
extrn SETUEVENT: far
.code
public SETINT
SETINT proc uses ds
mov ax, 351BH ;Get old control-break interrupt
int 21h ;vector and save it.
mov word ptr cs:OldVector1,bx
mov word ptr cs:OldVector1+2,es
push cs ;Set the new
pop ds ;interrupt vector
lea dx, EventHandler ;to the address
mov ax, 251BH ;of our service
int 21H ;routine.
mov ax, 3505H ;Get old print-screen interrupt
int 21h ;vector and save it.
mov word ptr cs:OldVector2,bx
mov word ptr cs:OldVector2+2,es
push cs ;Set the new
pop ds ;interrupt vector
lea dx, EventHandler ;to the address
mov ax, 2505H ;of our service
int 21H ;routine.
ret
SETINT endp
public EVENTHANDLER
EVENTHANDLER proc
iret ;eat keystroke. pop stack.
OldVector1 dd 0 ;keep data in code segment.
OldVector2 dd 0
EVENTHANDLER endp
public RESTINT
RESTINT proc uses ds ;Restore the old
lds dx, cs:OldVector1 ;interrupt vectors
mov ax, 251BH ;so things will
int 21h ;keep working when
lds dx, cs:OldVector2 ;this basic program is
mov ax, 2505H ;finished.
int 21h
ret
RESTINT endp
end