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 tsint28.pub ;public definitions (uses Periscope PUBLIC.COM /E)
- ENDIF
-
- .MODEL small
-
- EXTRN TSRBACKCHECK:FAR
-
- .CODE
-
- EXTRN _TESSDOPOPUP:near
-
- EXTRN _TESSDOBACK:near
- EXTRN TESSBEEP:FAR
-
- EXTRN TESS_GLOBALS:byte
- EXTRN TESS_USERPARMS:byte
-
- PUBLIC newint28, _TESSBACKGROUND
-
- ENDIF
-
- wait28 db 8
-
- ; --------------------------------------------------------------------;
- ; Interrupt 28 DOS idle interrupt ;
- ; --------------------------------------------------------------------;
-
- _TESSBACKGROUND proc near
-
- ASSUMEDS
-
- mov ax,WPTR [STATUS] ;get TSR status flags
- test ax,BACKSET ;do we have a routine?
- jz done_background ;nope -- do next one
-
- test ax,INT28ACTIVE ;are we already running?
- jz chkdos_28_1
- jmp done_background
- chkdos_28_1:
-
- cld
- 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
- or al,BPTR [INTFLAGS] ;any flags says we're busy
- ;NOTE: Indos flag is always set here!
- ; just check to make sure it is *only*
- ; set to '1'
- mov ah,al ;save it away
- lds si,DPTR [INDOSFLAG]
- lodsb
-
- mov BPTR [SAVEDINDOSFLG],al
- and al,0FEh ;mask off first bit
- or al,ah
-
- pop si
- pop ds
- ASSUMEDS
- jnz done_background ;we're busy-EXIT & try again next time
-
- or WPTR [STATUS],INT28ACTIVE ;set active bit
-
- push ds
- push es
-
- mov ax,WPTR [OURDSEG]
- push ax
- push ax
- pop es
- pop ds
-
- ASSUMENODS
-
- IFDEF TP4
- IFNDEF ASMCOM
- call DPTR PBACKCHECK ; call users INT28 routine (TP4 ver)
- ELSE
- call TSRBACKCHECK ; call users INT28 routine
- ENDIF
- ELSE
- call TSRBACKCHECK ; call users INT28 routine
- ENDIF
- pop es
- pop ds
-
- ASSUMEDS
-
- or ax,ax
- jz again_28
-
- call _TESSDOBACK
-
- again_28:
- and WPTR [STATUS],NOT INT28ACTIVE ;set active bit
- mov BPTR [SAVEDINDOSFLG],0
- xor ax,ax
- jmp done_b2
-
- done_background:
- mov ax,-1
- done_b2:
- ret
- _TESSBACKGROUND endp
-
-
- newint28 proc far
-
- push ds
- push cs
- pop ds
-
- ASSUMEDS
-
- pushf
- test WPTR [STATUS],TSRRELEASED
- jnz tfl_28
-
- test WPTR [STATUS],TSRENABLED
- jz do_old28
-
- tfl_28:
- test BPTR [SOFTINTFLAGS],ININT28 ;See if recursion has taken place
- jz start_new_int28 ;If not continue with new int 28
-
- do_old28:
- POPFF
- pop ds
- ASSUMENODS
- jmp DPTR [OLDINT28]
-
- start_new_int28:
-
- ASSUMEDS
- POPFF
-
- pushf ;simulate interrupt ...
- cli
- call DPTR [OLDINT28] ;do the original
- sti
-
- or BPTR [SOFTINTFLAGS],ININT28 ;Say INT 28 is active
-
- push dx
- push cx ;save regs
- push bx
- push ax
-
-
- call _TESSBACKGROUND
-
- test_28:
- mov ax,WPTR [STATUS] ;get TSR status flags
-
- test ax,INT28ACTIVE ;are we already running?
- jnz again_28_2
- test ax,POPUPSET ;ax holds status flags
- jz again_28_2
- test ax,HOTKEYON ;is hot-key flag set?
- jz again_28_2
- test ax,TSRACTIVE ;are we already running?
- jnz again_28_2 ;yep -- next one
-
- chkdos_28:
- cld
- 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
- or al,BPTR [INTFLAGS] ;any flags says we're busy
- ;NOTE: Indos flag is always set here!
- ; just check to make sure it is *only*
- ; set to '1'
- mov ah,al ;save it away
- lds si,DPTR [INDOSFLAG]
- lodsb
-
- mov BPTR [SAVEDINDOSFLG],al
- and al,0FEh ;mask off first bit
- or al,ah
-
- pop si
- pop ds
- ASSUMEDS
- jnz end_28 ;we're busy-EXIT & try again next time
-
- and BPTR [SOFTINTFLAGS],NOT ININT28 ;pretend we're out of INT28
- call _TESSDOPOPUP ;... call the popup stuff
- mov BPTR [SAVEDINDOSFLG],0
- reset_28:
- mov wait28,8
- jmp short again_28_2
- end_28:
- dec wait28
- jnz again_28_2
-
- test WPTR [STATUS],TSRRELEASED
- jnz reset_28
- and WPTR [STATUS],NOT HOTKEYON
- IFDEF TP4
- IFNDEF ASMCOM
- call FAR PTR TESSBEEP
- ELSE
- call TESSBEEP
- ENDIF
- ELSE
- call TESSBEEP
- ENDIF
- jmp short reset_28
-
- again_28_2:
- and BPTR [SOFTINTFLAGS],NOT ININT28 ;tell we're out of INT28
- mov BPTR [WAITCOUNT],0 ;clear waiting count and ...
-
- pop ax ;get back registers
- pop bx
- pop cx
- pop dx
- exit_28:
- pop ds
- iret
-
- newint28 endp
-
- ENDIT
-