9fc .DOSSEG .MODEL SMALL .386 .DATA PUBLIC _ctrlc PUBLIC _ctrls PUBLIC _ctrlq _ctrlc dw 0 _ctrls dw 0 _ctrlq dw 0 Org_Int09 dd ? scancode db ? .CODE PUBLIC _ctrlc_dis PUBLIC _ctrlc_ena _ctrlc_dis PROC NEAR push bx push dx push es mov ax, 3509h ;H„mta vektorn till INT 09 int 21h mov word ptr [Org_Int09], bx ;Org_Rutinens OFFSET h„mtas mov word ptr [Org_Int09+2], es ;Segment sparas push ds ;Ladda kodsegment i DS mov ax, cs mov ds, ax mov dx, OFFSET New_Int09 ;Peka p† ny INT09-rutin mov ax, 2509h int 21h ;Ladda om vektorn! pop ds pop es pop dx pop bx ret _ctrlc_dis ENDP _ctrlc_ena PROC NEAR push dx mov dx, word ptr[Org_Int09] push ds mov ds, word ptr[Org_Int09+2] mov ax,2509h int 21h ;¸terst„ll INT 09 vektor pop ds pop dx ret _ctrlc_ena ENDP New_Int09 PROC FAR ASSUME CS:_TEXT, DS:@data sti push ds push ax mov ax, @data mov ds, ax in al,60h ; Get scancode from keyboard processor mov scancode,al cmp al,02eh ; Check if C character jz match cmp al,01fh ; Check if S character (for Ctrl-S) jz match cmp al,010h ; Check if Q character (for Ctrl-Q) jnz no_match match: push es ; Yes, look into BIOS data area sub ax, ax ; (segment 0) to check shift state mov es, ax mov ax, es:[417h] ; Get SHIFT-key flags test ax, 0000000100000000b ; Check if Ctrl key pressed pop es jz no_match ; No... cli ; Disable interrupts while resetting in al, 61h ; Get current port 61h state or al, 10000000b ; Turn on bit 7 to signal clear keybrd out 61h, al ; Send to port and al, 01111111b ; Turn off bit 7 to signal break out 61h, al ; Send to port mov al, scancode cmp al, 2eh jnz no_ctrlc mov word ptr[_ctrlc], 1 ; Set Ctrl-C flag true jmp getout no_ctrlc: cmp al,01fh jnz no_ctrls mov word ptr[_ctrls], 1 ; Set Ctrl-S flag true jmp getout no_ctrls: cmp al, 010h jnz getout mov word ptr[_ctrlq], 1 ; Set Qtrl-Q flag true getout: mov al, 20h ; Reset interrupt controller out 20h, al sti ; Reenable interrupts pop ax pop ds iret ; That's it! no_match: cli pushf call Org_Int09 ;Call original Int 09 pop ax pop ds iret New_Int09 ENDP END . 0