home *** CD-ROM | disk | FTP | other *** search
- IFNDEF TP4
- PAGE 60,132
- ;----------------------------------------------------------------------------
- SUBTTL TesSeRact Revision Level 1
- ;-----------------------------------------------------------------------------
- ; TesSeRact(tm) -- A Library of Routines for Creating Ram-Resident (TSR)
- ; programs for the IBM PC and compatible Personal
- ; Computers.
- ;
- ;The software, documentation and source code are:
- ;
- ; Copyright (C) 1986, 1987, 1988 Tesseract Development Team
- ; All Rights Reserved
- ;
- ; c/o Chip Rabinowitz
- ; Innovative Data Concepts
- ; 2084 Woodlawn Avenue
- ; Glenside, PA 19038
- ; 1-215-884-3373
- ;
- ;-----------------------------------------------------------------------------
- ; This product supports the TesSeRact Standard for Ram-Resident Program
- ; Communication. For information about TesSeRact, contact the TesSeRact
- ; Development Team at:
- ; Compuserve: 70731,20
- ; MCIMAIL: 315-5415
- ; This MCIMAIL Account has been provided to the TesSeRact Development
- ; Team by Borland International, Inc. The TesSeRact Development Team
- ; is in no way associated with Borland International, Inc.
- ;-----------------------------------------------------------------------------
-
- INCLUDE TESS.INC
- IFDEF ALLPUBLIC
- INCLUDE tshot.pub ;public definitions (uses Periscope PUBLIC.COM /E)
- ENDIF
-
- .MODEL small
- .CODE
-
- EXTRN TESS_GLOBALS:byte
- EXTRN TESS_USERPARMS:byte
-
- PUBLIC _TESSKEYSTAT
-
- ENDIF
-
- ;---------------------------------------------------------------------
- ; K E Y S T A T ;
- ;---------------------------------------------------------------------
- ;
- ; Call the background task if no key is available
- ; Lets each task push a key into duty if none at bios
- ;
- _TESSKEYSTAT PROC NEAR
- ;preserves all registers except
- ;AX,SI,DI,DS & flags
- ASSUMEDS
-
- push cx
- push bx
-
- skip_16:
- bios_161: ;Call bios Keybrd Status routine
- mov ah,1 ;see if character is available
- or ah,BPTR [NEWKBDFLAG] ;re-insert new_bios flags
- pushf ;simulate interrupt
- call DPTR [OLDINT16]
- jnz exit_161 ;exit if BIOS has a ready key
- ;
- ; BIOS indicated it didn't have a key in the buffer; issue
- ; Interrupt 28 (DOS idle) if all other interrupt flags clear
- ;
- chkdos_161:
- test WPTR [STATUS],TSRENABLED
- jz skip28
-
- test BPTR [SOFTINTFLAGS],NOT ININT16 ;check all but INT16
- ;Dont popup if Other interrupts active
- jnz skip28 ;dont issue idle interrupt call
-
- ChkDos_16_2:
- push ds ;check if dos critical error in effect
- push si
- lds si,DPTR [DOSCRITERR] ;zero says dos is interruptable
- ASSUMENODS
- lodsb ;$ff says dos is in a critical state
- lds si,DPTR [INDOSFLAG] ;if indos then int $28 issued by dos
- or al,[si] ;so we dont have to.
- ;account for active interrupts
- or al,BPTR [INTFLAGS] ;any flags says we dont issue call
- ;to the background.
-
- pop si
- pop ds
- ASSUMEDS
-
- jz do_28 ;issue the INT if we're not popped
-
- cmp al,01 ;if INDOS is not equal to 1 ....
- ja skip28 ;dos cannot take an interrupt yet ..lf
-
- test WPTR [STATUS],TSRACTIVE ;are we currently running?
- jz skip28 ;nope -- so don't issue INT 28s
-
- do_28:
- inc BPTR [WAITCOUNT] ;Add a counter
- cmp BPTR [WAITCOUNT],08 ;Have 8 counters passed since last
- ;int 28h was called
- jb skip28 ;Not 8 counters yet
-
- int 28h ;call dos idle function (background dispatch).
- skip28:
- xor ax,ax ;show no keycode available
- exit_161:
- pop bx
- pop cx
- ret
-
- _TESSKEYSTAT endp
-
- ENDIT
-