home *** CD-ROM | disk | FTP | other *** search
- ;CC-KILL.ASM 7-24-88
-
- ;memory resident INT 9 routine
- ;occupies 512 bytes of RAM memory.
- ;
- ;PURPOSE:
- ;to defeat any CNTRL-C keypresses
- ;and CNTRL-BREAK
- ;
- ;7-24-88 modification:
- ;Allow key combination ALT 7 to
- ;perform the Control C function.
-
- cseg segment para public 'code'
- org 100h
-
- CCDEFEAT proc far
- assume cs:cseg, ds:cseg
- jmp install
- oldint9 dd 0
- int9loc equ 9h*4
- kb_flag equ 417h
- ctrl equ 04
- alt equ 08
- noctrl equ 0ffh-ctrl
- ckey equ 46 ;C key keybd scan code
- seven equ 8 ;key scan code for 7 key
- ;routine can be modified for
- ;any ALT - ? combination if
- ;key scan code is put here
- ;for replacement of key 7
-
- newint9:
- sti
- push es
- push di
- push ax
- push cx
- pushf
- mov ax,0
- mov es,ax
- mov di,kb_flag
- mov ah,es:[di]
- test ah,ctrl ;control key down?
- jz checkalt ;if not then check alt key
- in al,60h ;get second key scan code
- cmp al,ckey ;was it the C key ?
- jne return
- and ah,noctrl ;turn off ctrl flag
- mov es:[di],ah ;& put back KB_flag
- jmp return
- checkalt:
- test ah,alt ;was ALT key pressed?
- jz return ;no, exit
- in al,60h ;get second key scan code
- cmp al,seven ;was it the 7 key ?
- jne return
- ;at this point ALT 7 has been pressed so
- ; 1. set keyb buffer head
- ; to start of buffer
- ; 2. set keyb buffer tail
- ; to start + 2 bytes
- ; 3. put CNTRL-C codes into first
- ; word of buffer 03 2E
- mov di,0480h ;adr of keyb buff begin ptr
- ;just in case the software
- ;running has relocated the
- ;keyboard buffer, as some
- ;of mine does.
- mov ax,es:[di] ;get pointer value into ax
- add ax,0400h ;add 400 hex
- push ax
- pop di ;put ax into di
- mov cx,2E03h ;Cntrl-C codes / backwards
- ;looks like 03 2E in buffer
- mov es:[di],cx ;install them in keyb buffer
- sub ax,0400h
- mov di,041Ah
- mov es:[di],ax ;set buffer head pointer
- ;to first byte of buffer.
- add ax,0002h ;bump buffer pointer
- inc di
- inc di
- mov es:[di],ax ;set tail word past the head
- ;telling DOS something waits
- ;in the buffer.
- return:
- popf
- pop cx
- pop ax
- pop di
- pop es
- jmp cs:[oldint9]
- ;
- install:
- mov ax,0
- mov es,ax
- mov di,int9loc
- mov ax,es:[di]
- mov bx,es:[di+2]
- mov si,offset oldint9
- mov [si],ax
- mov [si+2],bx
- mov ax,0
- mov es,ax
- mov bx,ds
- cli ;disable interrupts
- mov di,int9loc
- mov ax,offset newint9
- mov es:[di],ax
- mov es:[di+2],bx
- ;
- ;now defeat the CNTRL/BREAK keys
- ;by changing INT 1Bh so that it
- ;points to an IRET instruction
- ;in ROM.
- push ds
- xor ax,ax
- mov ds,ax
- mov ax,0F000h ;CS
- mov ds:[006Eh],ax
- mov ax,0FF53h ;IP
- mov ds:[006Ch],ax
- pop ds
- ;
- sti ;enable interrupts
- mov dx,offset install ;put offset
- ;of end of
- ;resident
- ;program in
- ;DX reg.
- int 27h ;terminate stay resident
- CCDEFEAT endp
-
- cseg ends
- end CCDEFEAT
-
-
-