home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / teseract / source / tshot.asm < prev    next >
Encoding:
Assembly Source File  |  1988-10-02  |  4.5 KB  |  122 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 tshot.pub       ;public definitions (uses Periscope PUBLIC.COM /E)
  33. ENDIF
  34.  
  35. .MODEL small
  36. .CODE
  37.  
  38. EXTRN TESS_GLOBALS:byte
  39. EXTRN TESS_USERPARMS:byte
  40.  
  41. PUBLIC _TESSKEYSTAT
  42.  
  43. ENDIF
  44.  
  45. ;---------------------------------------------------------------------
  46. ;                        K E Y S T A T                               ;          
  47. ;---------------------------------------------------------------------
  48. ;
  49. ;       Call the background task if no key is available
  50. ;       Lets each task push a key into duty if none at bios
  51. ;
  52. _TESSKEYSTAT PROC NEAR
  53.                                         ;preserves all registers except
  54.                                         ;AX,SI,DI,DS & flags
  55.         ASSUMEDS
  56.  
  57.         push    cx
  58.         push    bx
  59.          
  60. skip_16:
  61. bios_161:                               ;Call bios Keybrd Status routine
  62.         mov     ah,1                    ;see if character is available
  63.         or      ah,BPTR [NEWKBDFLAG]    ;re-insert new_bios flags 
  64.         pushf                           ;simulate interrupt
  65.         call    DPTR [OLDINT16]
  66.         jnz     exit_161                ;exit if BIOS has a ready key
  67. ;
  68. ;   BIOS indicated it didn't have a key in the buffer; issue
  69. ;   Interrupt 28 (DOS idle) if all other interrupt flags clear
  70. ;
  71. chkdos_161:
  72.         test    WPTR [STATUS],TSRENABLED
  73.         jz      skip28
  74.  
  75.         test    BPTR [SOFTINTFLAGS],NOT ININT16 ;check all but INT16
  76.                                         ;Dont popup if Other interrupts active
  77.         jnz     skip28                  ;dont issue idle interrupt call
  78.  
  79. ChkDos_16_2:            
  80.         push    ds                      ;check if dos critical error in effect
  81.         push    si
  82.         lds     si,DPTR [DOSCRITERR]    ;zero says dos is interruptable
  83.         ASSUMENODS
  84.         lodsb                           ;$ff  says dos is in a critical state
  85.         lds     si,DPTR [INDOSFLAG]     ;if indos then int $28 issued by dos
  86.         or      al,[si]                 ;so we dont have to.
  87.                                         ;account for active interrupts
  88.         or      al,BPTR [INTFLAGS]      ;any flags says we dont issue call
  89.                                         ;to the background.
  90.            
  91.         pop     si
  92.         pop     ds
  93.         ASSUMEDS
  94.  
  95.         jz      do_28                   ;issue the INT if we're not popped
  96.  
  97.         cmp     al,01                   ;if INDOS is not equal to 1 ....
  98.         ja      skip28                  ;dos cannot take an interrupt yet ..lf
  99.  
  100.         test    WPTR [STATUS],TSRACTIVE ;are we currently running?
  101.         jz      skip28                  ;nope -- so don't issue INT 28s
  102.  
  103. do_28:
  104.         inc     BPTR [WAITCOUNT]        ;Add a counter
  105.         cmp     BPTR [WAITCOUNT],08     ;Have 8 counters passed since last
  106.                                         ;int 28h was called
  107.         jb      skip28                  ;Not 8 counters yet
  108.  
  109.         int     28h                     ;call dos idle function (background dispatch).
  110. skip28:
  111.         xor     ax,ax                   ;show  no keycode available
  112. exit_161:
  113.         pop     bx
  114.         pop     cx
  115.         ret
  116.  
  117. _TESSKEYSTAT endp
  118.  
  119. ENDIT
  120.