home *** CD-ROM | disk | FTP | other *** search
File List | 1988-07-24 | 9.5 KB | 197 lines |
- Microsoft (R) Macro Assembler Version 4.00 7/24/88 17:53:59
-
- Page 1-1
-
-
- ;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.
-
- 0000 cseg segment para public 'code'
- 0100 org 100h
-
- 0100 CCDEFEAT proc far
- assume cs:cseg, ds:cseg
- 0100 EB 61 90 jmp install
- 0103 00 00 00 00 oldint9 dd 0
- = 0024 int9loc equ 9h*4
- = 0417 kb_flag equ 417h
- = 0004 ctrl equ 04
- = 0008 alt equ 08
- = 00FB noctrl equ 0ffh-ctrl
- = 002E ckey equ 46 ;C key keybd scan code
- = 0008 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
-
- 0107 newint9:
- 0107 FB sti
- 0108 06 push es
- 0109 57 push di
- 010A 50 push ax
- 010B 51 push cx
- 010C 9C pushf
- 010D B8 0000 mov ax,0
- 0110 8E C0 mov es,ax
- 0112 BF 0417 mov di,kb_flag
- 0115 26: 8A 25 mov ah,es:[di]
- 0118 F6 C4 04 test ah,ctrl ;control key down?
- 011B 74 0F jz checkalt ;if not then check alt key
- 011D E4 60 in al,60h ;get second key scan code
- 011F 3C 2E cmp al,ckey ;was it the C key ?
- 0121 75 36 jne return
- 0123 80 E4 FB and ah,noctrl ;turn off ctrl flag
- 0126 26: 88 25 mov es:[di],ah ;& put back KB_flag
- 0129 EB 2E 90 jmp return
- 012C checkalt:
- 012C F6 C4 08 test ah,alt ;was ALT key pressed?
- 012F 74 28 jz return ;no, exit
- Microsoft (R) Macro Assembler Version 4.00 7/24/88 17:53:59
-
- Page 1-2
-
-
- 0131 E4 60 in al,60h ;get second key scan code
- 0133 3C 08 cmp al,seven ;was it the 7 key ?
- 0135 75 22 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
- 0137 BF 0480 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.
- 013A 26: 8B 05 mov ax,es:[di] ;get pointer value into ax
- 013D 05 0400 add ax,0400h ;add 400 hex
- 0140 50 push ax
- 0141 5F pop di ;put ax into di
- 0142 B9 2E03 mov cx,2E03h ;Cntrl-C codes / backwards
- ;looks like 03 2E in buffer
- 0145 26: 89 0D mov es:[di],cx ;install them in keyb buffer
- 0148 2D 0400 sub ax,0400h
- 014B BF 041A mov di,041Ah
- 014E 26: 89 05 mov es:[di],ax ;set buffer head pointer
- ;to first byte of buffer.
- 0151 05 0002 add ax,0002h ;bump buffer pointer
- 0154 47 inc di
- 0155 47 inc di
- 0156 26: 89 05 mov es:[di],ax ;set tail word past the head
- ;telling DOS something waits
- ;in the buffer.
- 0159 return:
- 0159 9D popf
- 015A 59 pop cx
- 015B 58 pop ax
- 015C 5F pop di
- 015D 07 pop es
- 015E 2E: FF 2E 0103 R jmp cs:[oldint9]
- ;
- 0163 install:
- 0163 B8 0000 mov ax,0
- 0166 8E C0 mov es,ax
- 0168 BF 0024 mov di,int9loc
- 016B 26: 8B 05 mov ax,es:[di]
- 016E 26: 8B 5D 02 mov bx,es:[di+2]
- 0172 BE 0103 R mov si,offset oldint9
- 0175 89 04 mov [si],ax
- 0177 89 5C 02 mov [si+2],bx
- 017A B8 0000 mov ax,0
- 017D 8E C0 mov es,ax
- 017F 8C DB mov bx,ds
- 0181 FA cli ;disable interrupts
- 0182 BF 0024 mov di,int9loc
- Microsoft (R) Macro Assembler Version 4.00 7/24/88 17:53:59
-
- Page 1-3
-
-
- 0185 B8 0107 R mov ax,offset newint9
- 0188 26: 89 05 mov es:[di],ax
- 018B 26: 89 5D 02 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.
- 018F 1E push ds
- 0190 33 C0 xor ax,ax
- 0192 8E D8 mov ds,ax
- 0194 B8 F000 mov ax,0F000h ;CS
- 0197 A3 006E mov ds:[006Eh],ax
- 019A B8 FF53 mov ax,0FF53h ;IP
- 019D A3 006C mov ds:[006Ch],ax
- 01A0 1F pop ds
- ;
- 01A1 FB sti ;enable interrupts
- 01A2 BA 0163 R mov dx,offset install ;put offset
- ;of end of
- ;resident
- ;program in
- ;DX reg.
- 01A5 CD 27 int 27h ;terminate stay resident
- CCDEFEAT endp
-
- 01A7 cseg ends
- end CCDEFEAT
- Microsoft (R) Macro Assembler Version 4.00 7/24/88 17:53:59
-
- Symbols-1
-
-
- Segments and Groups:
-
- N a m e Size Align Combine Class
-
- CSEG . . . . . . . . . . . . . . 01A7 PARA PUBLIC 'CODE'
-
- Symbols:
-
- N a m e Type Value Attr
-
- ALT . . . . . . . . . . . . . . Number 0008
-
- CCDEFEAT . . . . . . . . . . . . F PROC 0100 CSEG Length = 00A7
- CHECKALT . . . . . . . . . . . . L NEAR 012C CSEG
- CKEY . . . . . . . . . . . . . . Number 002E
- CTRL . . . . . . . . . . . . . . Number 0004
-
- INSTALL . . . . . . . . . . . . L NEAR 0163 CSEG
- INT9LOC . . . . . . . . . . . . Number 0024
-
- KB_FLAG . . . . . . . . . . . . Number 0417
-
- NEWINT9 . . . . . . . . . . . . L NEAR 0107 CSEG
- NOCTRL . . . . . . . . . . . . . Number 00FB
-
- OLDINT9 . . . . . . . . . . . . L DWORD 0103 CSEG
-
- RETURN . . . . . . . . . . . . . L NEAR 0159 CSEG
-
- SEVEN . . . . . . . . . . . . . Number 0008
-
-
- 136 Source Lines
- 136 Total Lines
- 36 Symbols
-
- 49286 Bytes symbol space free
-
- 0 Warning Errors
- 0 Severe Errors
-