home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / teseract / source / tsint9.asm < prev    next >
Encoding:
Assembly Source File  |  1988-10-02  |  5.3 KB  |  191 lines

  1. IFNDEF TP4
  2.         PAGE 60,132
  3. ;----------------------------------------------------------------------------
  4. SUBTTL  TesSeRact Revision Level 1
  5. ;-----------------------------------------------------------------------------
  6. ;   TesSeRact(tm) -- A Library of Routines for Creating Ram-Resident (TSR)
  7. ;                    programs for the IBM PC and compatible Personal
  8. ;                    Computers.
  9. ;
  10. ;The software, documentation and source code are: 
  11. ;       Copyright (C) 1986, 1987, 1988 Tesseract Development Team
  12. ;       All Rights Reserved 
  13. ;       c/o Chip Rabinowitz
  14. ;       Innovative Data Concepts
  15. ;       2084 Woodlawn Avenue
  16. ;       Glenside, PA 19038
  17. ;       1-215-884-3373
  18. ;
  19. ;-----------------------------------------------------------------------------
  20. ;   This product supports the TesSeRact Standard for Ram-Resident Program 
  21. ;   Communication.  For information about TesSeRact, contact the TesSeRact 
  22. ;   Development Team at:
  23. ;       Compuserve:    70731,20
  24. ;       MCIMAIL:       315-5415
  25. ;   This MCIMAIL Account has been provided to the TesSeRact Development
  26. ;   Team by Borland International, Inc.  The TesSeRact Development Team
  27. ;   is in no way associated with Borland International, Inc.
  28. ;-----------------------------------------------------------------------------
  29.  
  30. INCLUDE TESS.INC
  31. IFDEF   ALLPUBLIC
  32. INCLUDE tsint9.pub      ;public definitions (uses Periscope PUBLIC.COM /E)
  33. ENDIF
  34.  
  35. .MODEL small
  36. .CODE
  37.  
  38. EXTRN TESS_USERPARMS:byte
  39. EXTRN TESS_GLOBALS:byte
  40. EXTRN _TESSCLEARKEYS:near
  41.  
  42. PUBLIC newint9, _TESS_INTERRUPTRETURN
  43.  
  44. ENDIF
  45.  
  46. newint9 proc far
  47.  
  48.         ASSUMENODS
  49.  
  50.         push    ax
  51.  
  52.         in      al,KB_DATA              ;get scan code
  53.  
  54.         mov     ah,al                   ;get scan code to AH
  55.  
  56.         push    ds
  57.         push    si
  58.  
  59.         push    ax
  60.         mov     ax,BIOS_DATA
  61.         mov     ds,ax                   ;set data segment
  62.         mov     si,KB_FLG1              ;set source to keyboard flags
  63.  
  64.         cld
  65.         pop     ax
  66.         lodsb                           ;get the low bytes of kbflags to AL
  67.         pop     si
  68.         pop     ds
  69.  
  70.         and     al,0fh                  ;only want four low bits
  71.  
  72.         push    ds
  73.  
  74.         push    cs
  75.         pop     ds
  76.  
  77.         ASSUMEDS
  78.  
  79.  
  80. check_break:
  81.         test    WPTR [STATUS],TSRENABLED
  82.         jz      no_9_1
  83.  
  84.         cmp     ah,46h                  ;is it scroll lock (or break)?
  85.         je      check_ctl
  86.         cmp     ah,2eh                  ;is it a 'c'??
  87.         jne     check_keys
  88.  
  89. check_ctl:
  90.         cmp     al,04h                  ;is control key down? 
  91.         jne     check_keys              ;no, process further
  92.  
  93. check_stat:                             ;^C, so .....
  94.         call    _TESSCLEARKEYS          ;clear the kbd buffer
  95.  
  96.         test    WPTR [STATUS],TSRACTIVE+INT28ACTIVE     ;are we already running?
  97.         jnz     end_9_2
  98.  
  99.  
  100. check_keys:
  101.         test    WPTR [STATUS],TSRACTIVE+INT28ACTIVE     ;are we already running?
  102.         jnz     no_9_1
  103.  
  104.         cmp     al,BPTR [SHIFTST]       ;check shift state
  105.         jne     check_extra             ;don't match!
  106.  
  107.         cmp     BPTR [HOTKEY],0
  108.         je      hotkeyon                ;Hotkey = 0, shift-state check only
  109.  
  110.         cmp     ah,BPTR [HOTKEY]        ;do they match
  111.         jne     check_extra             ;nope!  
  112.  
  113. hotkeyon:
  114.         xor     al,al                   ;so let's do it!
  115. setflags:
  116.         or      WPTR [STATUS],HOTKEYON
  117.         mov     BPTR [HOTFLAG],al
  118.         jmp     short end_9_2
  119.  
  120. check_extra:
  121.         test    WPTR [STATUS],EXTRAHOTSET
  122.         jz      no_9_1                  ;extra hot keys?
  123.  
  124.         push    cx                      ;save registers
  125.         push    es
  126.         push    bx
  127.  
  128.         xor     ch,ch
  129.         mov     cl,BPTR [HOTCOUNT]      ;load count of extra keys
  130.         les     bx,DPTR [EXTRAHOTK]     ;load structure
  131. extra_loop:
  132.         cmp     BPTR es:[bx+1],al       ;does the shift state match?
  133.         jne     next_check
  134.  
  135.         cmp     BPTR es:[bx],0
  136.         je      nokey                   ;Hotkey = 0, shift-state check only
  137.  
  138.         cmp     BPTR es:[bx],ah         ;does the scan code match?
  139.         jne     next_check
  140.  
  141. nokey:
  142.         mov     al, BPTR es:[bx+2]
  143.         pop     bx
  144.         pop     es
  145.         pop     cx
  146.         jmp     setflags
  147.         
  148. next_check:
  149.         add     bx,3
  150.         loop    extra_loop
  151.  
  152.         pop     bx
  153.         pop     es
  154.         pop     cx
  155.  
  156. no_9_1:
  157.         pop     ds
  158.         pop     ax
  159.  
  160.         ASSUMENODS
  161.  
  162.         jmp     DPTR [OLDINT9]
  163.  
  164. end_9_2:
  165.         in      al,KB_CTL               ;get keyboard status
  166.         mov     ah,al                   ;save it
  167.         or      al,80h                  ;acknowledge it
  168.         out     KB_CTL,al               ;Thanks ...
  169.         xchg    ah,al                   ;get status back
  170.         out     KB_CTL,al               ;reset the keyboard
  171.  
  172.         mov     al,20h
  173.         out     20h,al                  ;EOI
  174.  
  175.         pop     ds
  176.         pop     ax
  177. ;
  178. ; ***************************************************************************
  179. ;       This is the interrupt return address used for dummy routines
  180. ;               for INT1b and INT23 during popup
  181. ;
  182. ;
  183. _TESS_INTERRUPTRETURN:
  184.         iret
  185.  
  186. newint9 endp
  187.  
  188. ENDIT
  189.