home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / TECLADO / KILBREAK.ZIP / KILL-2.LST < prev   
Encoding:
File List  |  1988-07-24  |  9.5 KB  |  197 lines

  1. Microsoft (R) Macro Assembler  Version 4.00                 7/24/88 17:53:59
  2.  
  3.                                                             Page     1-1
  4.                                                             
  5.  
  6.                                 ;CC-KILL.ASM 7-24-88 
  7.                                  
  8.                                 ;memory resident INT 9 routine 
  9.                                 ;occupies 512 bytes of RAM memory. 
  10.                                 ; 
  11.                                 ;PURPOSE: 
  12.                                 ;to defeat any CNTRL-C keypresses 
  13.                                 ;and CNTRL-BREAK 
  14.                                 ; 
  15.                                 ;7-24-88 modification: 
  16.                                 ;Allow key combination ALT 7 to 
  17.                                 ;perform the Control C function. 
  18.                                  
  19.  0000                           cseg segment para public 'code' 
  20.  0100                           org 100h 
  21.                                  
  22.  0100                           CCDEFEAT proc far 
  23.                                 assume cs:cseg, ds:cseg 
  24.  0100  EB 61 90                 jmp  install 
  25.  0103  00 00 00 00              oldint9 dd 0 
  26.  = 0024                         int9loc equ 9h*4 
  27.  = 0417                         kb_flag equ 417h 
  28.  = 0004                         ctrl equ 04 
  29.  = 0008                         alt equ 08 
  30.  = 00FB                         noctrl equ 0ffh-ctrl 
  31.  = 002E                         ckey equ 46 ;C key keybd scan code 
  32.  = 0008                         seven equ 8 ;key scan code for 7 key 
  33.                                             ;routine can be modified for 
  34.                                             ;any ALT - ? combination if 
  35.                                             ;key scan code is put here 
  36.                                             ;for replacement of key 7 
  37.                                  
  38.  0107                           newint9: 
  39.  0107  FB                         sti 
  40.  0108  06                         push es 
  41.  0109  57                         push di 
  42.  010A  50                         push ax 
  43.  010B  51                         push cx 
  44.  010C  9C                         pushf 
  45.  010D  B8 0000                    mov ax,0 
  46.  0110  8E C0                      mov es,ax 
  47.  0112  BF 0417                    mov di,kb_flag 
  48.  0115  26: 8A 25                  mov ah,es:[di] 
  49.  0118  F6 C4 04                   test ah,ctrl ;control key down? 
  50.  011B  74 0F                      jz checkalt  ;if not then check alt key 
  51.  011D  E4 60                      in al,60h    ;get second key scan code 
  52.  011F  3C 2E                      cmp al,ckey  ;was it the C key ? 
  53.  0121  75 36                      jne return 
  54.  0123  80 E4 FB                   and ah,noctrl      ;turn off ctrl flag 
  55.  0126  26: 88 25                  mov es:[di],ah     ;& put back KB_flag 
  56.  0129  EB 2E 90                   jmp return 
  57.  012C                           checkalt: 
  58.  012C  F6 C4 08                   test ah,alt  ;was ALT key pressed? 
  59.  012F  74 28                      jz return    ;no, exit 
  60. Microsoft (R) Macro Assembler  Version 4.00                 7/24/88 17:53:59
  61.  
  62.                                                             Page     1-2
  63.                                                             
  64.  
  65.  0131  E4 60                      in al,60h    ;get second key scan code 
  66.  0133  3C 08                      cmp al,seven ;was it the 7 key ? 
  67.  0135  75 22                      jne return 
  68.                                 ;at this point ALT 7 has been pressed so 
  69.                                 ;           1. set keyb buffer head 
  70.                                 ;              to start of buffer 
  71.                                 ;           2. set keyb buffer tail 
  72.                                 ;              to start + 2 bytes 
  73.                                 ;           3. put CNTRL-C codes into first 
  74.                                 ;              word of buffer  03 2E 
  75.  0137  BF 0480                    mov di,0480h    ;adr of keyb buff begin ptr 
  76.                                                   ;just in case the software 
  77.                                                   ;running has relocated the 
  78.                                                   ;keyboard buffer, as some 
  79.                                                   ;of mine does. 
  80.  013A  26: 8B 05                  mov ax,es:[di]  ;get pointer value into ax 
  81.  013D  05 0400                    add ax,0400h    ;add 400 hex 
  82.  0140  50                         push ax 
  83.  0141  5F                         pop di          ;put ax into di 
  84.  0142  B9 2E03                    mov cx,2E03h    ;Cntrl-C codes / backwards 
  85.                                                   ;looks like 03 2E in buffer 
  86.  0145  26: 89 0D                  mov es:[di],cx  ;install them in keyb buffer 
  87.  0148  2D 0400                    sub ax,0400h 
  88.  014B  BF 041A                    mov di,041Ah 
  89.  014E  26: 89 05                  mov es:[di],ax  ;set buffer head pointer 
  90.                                                   ;to first byte of buffer. 
  91.  0151  05 0002                    add ax,0002h    ;bump buffer pointer 
  92.  0154  47                         inc di 
  93.  0155  47                         inc di 
  94.  0156  26: 89 05                  mov es:[di],ax  ;set tail word past the head 
  95.                                                   ;telling DOS something waits 
  96.                                                   ;in the buffer. 
  97.  0159                           return: 
  98.  0159  9D                         popf 
  99.  015A  59                         pop cx 
  100.  015B  58                         pop ax 
  101.  015C  5F                         pop di 
  102.  015D  07                         pop es 
  103.  015E  2E: FF 2E 0103 R           jmp cs:[oldint9] 
  104.                                 ; 
  105.  0163                           install: 
  106.  0163  B8 0000                    mov ax,0 
  107.  0166  8E C0                      mov es,ax 
  108.  0168  BF 0024                    mov di,int9loc 
  109.  016B  26: 8B 05                  mov ax,es:[di] 
  110.  016E  26: 8B 5D 02               mov bx,es:[di+2] 
  111.  0172  BE 0103 R                  mov si,offset oldint9 
  112.  0175  89 04                      mov [si],ax 
  113.  0177  89 5C 02                   mov [si+2],bx 
  114.  017A  B8 0000                    mov ax,0 
  115.  017D  8E C0                      mov es,ax 
  116.  017F  8C DB                      mov bx,ds 
  117.  0181  FA                         cli         ;disable interrupts 
  118.  0182  BF 0024                    mov di,int9loc 
  119. Microsoft (R) Macro Assembler  Version 4.00                 7/24/88 17:53:59
  120.  
  121.                                                             Page     1-3
  122.                                                             
  123.  
  124.  0185  B8 0107 R                  mov ax,offset newint9 
  125.  0188  26: 89 05                  mov es:[di],ax 
  126.  018B  26: 89 5D 02               mov es:[di+2],bx 
  127.                                 ; 
  128.                                 ;now defeat the CNTRL/BREAK keys 
  129.                                 ;by changing INT 1Bh so that it 
  130.                                 ;points to an IRET instruction 
  131.                                 ;in ROM. 
  132.  018F  1E                         push ds 
  133.  0190  33 C0                      xor ax,ax 
  134.  0192  8E D8                      mov ds,ax 
  135.  0194  B8 F000                    mov ax,0F000h ;CS 
  136.  0197  A3 006E                    mov ds:[006Eh],ax 
  137.  019A  B8 FF53                    mov ax,0FF53h ;IP 
  138.  019D  A3 006C                    mov ds:[006Ch],ax 
  139.  01A0  1F                         pop ds 
  140.                                 ; 
  141.  01A1  FB                         sti          ;enable interrupts 
  142.  01A2  BA 0163 R                  mov dx,offset install   ;put offset 
  143.                                                           ;of end of 
  144.                                                           ;resident 
  145.                                                           ;program in 
  146.                                                           ;DX reg. 
  147.  01A5  CD 27                      int 27h ;terminate stay resident 
  148.                                 CCDEFEAT endp 
  149.                                  
  150.  01A7                           cseg ends 
  151.                                 end CCDEFEAT 
  152. Microsoft (R) Macro Assembler  Version 4.00                 7/24/88 17:53:59
  153.  
  154.                                                             Symbols-1
  155.                                                              
  156.  
  157. Segments and Groups:
  158.  
  159.                 N a m e             Size    Align    Combine Class
  160.  
  161. CSEG . . . . . . . . . . . . . .      01A7    PARA    PUBLIC    'CODE'
  162.  
  163. Symbols:            
  164.  
  165.                 N a m e             Type    Value    Attr         
  166.  
  167. ALT  . . . . . . . . . . . . . .      Number    0008    
  168.  
  169. CCDEFEAT . . . . . . . . . . . .      F PROC    0100    CSEG    Length = 00A7
  170. CHECKALT . . . . . . . . . . . .      L NEAR    012C    CSEG
  171. CKEY . . . . . . . . . . . . . .      Number    002E    
  172. CTRL . . . . . . . . . . . . . .      Number    0004    
  173.  
  174. INSTALL  . . . . . . . . . . . .      L NEAR    0163    CSEG
  175. INT9LOC  . . . . . . . . . . . .      Number    0024    
  176.  
  177. KB_FLAG  . . . . . . . . . . . .      Number    0417    
  178.  
  179. NEWINT9  . . . . . . . . . . . .      L NEAR    0107    CSEG
  180. NOCTRL . . . . . . . . . . . . .      Number    00FB    
  181.  
  182. OLDINT9  . . . . . . . . . . . .      L DWORD    0103    CSEG
  183.  
  184. RETURN . . . . . . . . . . . . .      L NEAR    0159    CSEG
  185.  
  186. SEVEN  . . . . . . . . . . . . .      Number    0008    
  187.  
  188.  
  189.     136 Source  Lines
  190.     136 Total   Lines
  191.      36 Symbols
  192.  
  193.   49286 Bytes symbol space free
  194.  
  195.       0 Warning Errors
  196.       0 Severe  Errors
  197.