;Traps and ignores control-break. v1.0a PD 1999-2003.

;Compiled with 'Tasm /t Keytrap;'

            .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:OldVector,bx
            mov     word ptr cs:OldVector+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.
            ret 
SETINT	    endp

public  EVENTHANDLER

EVENTHANDLER    proc
            iret                            ;Return from 1BH

OldVector   dd      0                       ;Keep data in code segment

EVENTHANDLER	endp

public      RESTINT

RESTINT     proc    uses ds                 ;Restore the old
            lds     dx, cs:OldVector        ;interrupt vector
            mov     ax, 251BH               ;so things will
            int     21h                     ;keep working when
            ret                             ;the program quits
RESTINT     endp
            end
