Idea similar to _exit
#7
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
Reply


Messages In This Thread
Idea similar to _exit - by eoredson - 09-26-2022, 04:26 AM
RE: Idea similar to _exit - by mnrvovrfc - 09-26-2022, 04:46 AM
RE: Idea similar to _exit - by SpriggsySpriggs - 09-26-2022, 07:13 PM
RE: Idea similar to _exit - by mnrvovrfc - 09-26-2022, 07:20 PM
RE: Idea similar to _exit - by Pete - 09-26-2022, 04:23 PM
RE: Idea similar to _exit - by SpriggsySpriggs - 09-26-2022, 07:42 PM
RE: Idea similar to _exit - by eoredson - 10-10-2022, 03:42 AM
RE: Idea similar to _exit - by a740g - 10-10-2022, 10:53 AM
RE: Idea similar to _exit - by eoredson - 10-11-2022, 04:29 AM
RE: Idea similar to _exit - by mnrvovrfc - 10-12-2022, 05:53 AM
RE: Idea similar to _exit - by eoredson - 11-16-2022, 04:22 AM
RE: Idea similar to _exit - by SMcNeill - 11-16-2022, 04:32 AM
RE: Idea similar to _exit - by a740g - 11-16-2022, 04:33 AM



Users browsing this thread: 7 Guest(s)