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 tsint21.pub ;public definitions (uses Periscope PUBLIC.COM /E)
- ENDIF
-
- .MODEL small
- .CODE
-
- EXTRN TESS_GLOBALS:byte
- EXTRN TESS_USERPARMS:byte
-
- PUBLIC newint21
-
- ENDIF
-
- ;
- ;
- ; ***************************************************************************
- ; This table marks those INT 21 functions which must be passed
- ; without modification. They either never return, fetch parameters
- ; from the stack, or may not be interrupted by a TSR
- ;
-
- IFNDEF TP4
- EVEN
- ELSE
- IFDEF ASMCOM
- EVEN
- ENDIF
- db 0
- ENDIF
-
- dos21funcs:
- db 0, 0, 0, 0, 0, 0, 0, 0 ;0-7
- db 0, 0, 0, 0, 0, 0ffh, 0ffh, 0ffh ;8-f
- db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh ;10-17
- db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh ;18-1f
- db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0, 0ffh ;20-27
- db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0 ;28-2f
- db 0ffh, 0, 0, 0, 0, 0, 0ffh, 0ffh ;30-37
- db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh ;38-3f
- db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh ;40-47
- db 0, 0, 0, 0, 0, 0, 0ffh, 0ffh ;48-4f **
- db 0, 0, 0, 0, 0ffh, 0, 0ffh, 0ffh ;50-57
- db 0, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0, 0 ;58-5f
- db 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh, 0ffh ;60-67
-
- ;--------------------------------------------------------------; ;v0.51
- ; Interrupt 21 gate: If interrupt function table contains ; ;v0.51
- ; FFh, then do not allow function to be interrupted by TESS ; ;v0.51
- ;--------------------------------------------------------------; ;v0.51
- newint21 proc far
- ASSUMENODS
-
- pushf
- cli ;don't allow interrupts
-
- test BPTR [INTFLAGS],ININT21 ;are we already here?
- jz can_process ;nope
-
- cmp ah,0ah ;is this the command line?
- jne notme ;nope .. continue
-
- and BPTR [INTFLAGS],NOT ININT21 ;we broke out of something with
- and BPTR [SOFTINTFLAGS],NOT ININT08
- ;^C, so clear our flag and continue
- ;processing
- can_process:
- cmp ah,63h ;max number
- ja notme
- push ax ;some INT21 functions must be left
- push bx ;...alone. They either never return,
- mov bx,offset dos21funcs ;...grab parameters from the stack
- mov al,ah ;...or can be interrupted.
- xlat BPTR dos21funcs ;test function against table
- or al,al ;functions marked 0 may be interrupted ;v0.51
- pop bx ;these ,ust be left alone
- pop ax
- ; jz notme ;jump to original INT21
- jnz set_21
- notme:
- test WPTR [STATUS], TSRACTIVE
- jz old_21
-
- cmp [SAVEDINDOSFLG],1
- jne old_21
-
- cmp ah,0ch
- ja old_21
-
- or ah,ah
- jz old_21
-
- push es
- push di
- push ax
-
- les di,DPTR [DOSCRITERR]
-
- mov ax,-1
- stosb
-
- pop ax
- pop di
- pop es
-
- jmp set_21
-
- old_21:
- POPFF
- jmp DPTR [OLDINT21]
-
- set_21:
- or BPTR [INTFLAGS],ININT21 ;say int21 is active
-
- no_console:
- POPFF ;get original flags back
- pushf ;simulate interrupt ...
-
- call DPTR [OLDINT21] ;now do the original interrupt 21
-
- pushf
- end_21:
- and BPTR [INTFLAGS],NOT ININT21 ;say int21 is not active
- POPFF
- sti ;make sure ints are enabled!
- ret 2 ;return with flags set
-
- newint21 endp
-
- ENDIT
-