home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / teseract / source / tsint21.asm < prev    next >
Encoding:
Assembly Source File  |  1988-10-02  |  5.5 KB  |  163 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 tsint21.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 newint21
  42.  
  43. ENDIF
  44.  
  45. ;
  46. ;
  47. ; ***************************************************************************
  48. ;       This table marks those INT 21 functions which must be passed
  49. ;       without modification. They either never return, fetch parameters
  50. ;       from the stack, or may not be interrupted by a TSR
  51. ;
  52.  
  53. IFNDEF TP4
  54. EVEN
  55. ELSE
  56. IFDEF ASMCOM
  57. EVEN
  58. ENDIF
  59. db 0
  60. ENDIF
  61.  
  62. dos21funcs:
  63.         db      0,      0,      0,      0,      0,      0,      0,      0       ;0-7
  64.         db      0,      0,      0,      0,      0,      0ffh,   0ffh,   0ffh    ;8-f
  65.         db      0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh    ;10-17
  66.         db      0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh    ;18-1f
  67.         db      0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0,      0ffh    ;20-27
  68.         db      0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0       ;28-2f
  69.         db      0ffh,   0,      0,      0,      0,      0,      0ffh,   0ffh    ;30-37
  70.         db      0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh    ;38-3f
  71.         db      0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh    ;40-47
  72.         db      0,      0,      0,      0,      0,      0,      0ffh,   0ffh    ;48-4f **
  73.         db      0,      0,      0,      0,      0ffh,   0,      0ffh,   0ffh    ;50-57
  74.         db      0,      0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0,      0       ;58-5f
  75.         db      0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh,   0ffh    ;60-67
  76.  
  77. ;--------------------------------------------------------------;        ;v0.51
  78. ; Interrupt 21 gate: If interrupt function table contains      ;        ;v0.51
  79. ; FFh, then do not allow function to be interrupted by TESS    ;        ;v0.51
  80. ;--------------------------------------------------------------;        ;v0.51
  81. newint21 proc far
  82.         ASSUMENODS
  83.  
  84.         pushf
  85.         cli                             ;don't allow interrupts
  86.  
  87.         test    BPTR [INTFLAGS],ININT21 ;are we already here?
  88.         jz      can_process             ;nope
  89.  
  90.         cmp     ah,0ah                  ;is this the command line?
  91.         jne     notme                   ;nope .. continue
  92.  
  93.         and     BPTR [INTFLAGS],NOT ININT21     ;we broke out of something with
  94.         and     BPTR [SOFTINTFLAGS],NOT ININT08
  95.                                         ;^C, so clear our flag and continue
  96.                                         ;processing
  97. can_process:
  98.         cmp     ah,63h                  ;max number
  99.         ja      notme
  100.         push    ax                      ;some INT21 functions must be left
  101.         push    bx                      ;...alone.  They either never return,
  102.         mov     bx,offset dos21funcs    ;...grab parameters from the stack
  103.         mov     al,ah                   ;...or can be interrupted.
  104.         xlat    BPTR dos21funcs         ;test function against table
  105.         or      al,al                   ;functions marked 0 may be interrupted ;v0.51
  106.         pop     bx                      ;these ,ust be left alone
  107.         pop     ax
  108. ;       jz      notme                   ;jump to original INT21
  109.         jnz     set_21
  110. notme:
  111.     test    WPTR [STATUS], TSRACTIVE
  112.     jz    old_21
  113.  
  114.     cmp    [SAVEDINDOSFLG],1
  115.     jne    old_21
  116.  
  117.     cmp    ah,0ch
  118.     ja    old_21
  119.  
  120.     or    ah,ah
  121.     jz    old_21
  122.  
  123.     push    es
  124.     push    di
  125.     push    ax
  126.  
  127.         les     di,DPTR [DOSCRITERR]
  128.  
  129.     mov    ax,-1
  130.     stosb
  131.  
  132.     pop    ax
  133.     pop    di
  134.     pop    es
  135.  
  136.     jmp    set_21
  137.  
  138. old_21:
  139.         POPFF
  140.         jmp     DPTR [OLDINT21]
  141.  
  142. set_21:
  143.         or      BPTR [INTFLAGS],ININT21 ;say int21 is active
  144.  
  145. no_console:
  146.         POPFF                           ;get original flags back
  147.         pushf                           ;simulate interrupt ...
  148.  
  149.         call    DPTR [OLDINT21] ;now do the original interrupt 21
  150.  
  151.         pushf
  152. end_21:
  153.         and     BPTR [INTFLAGS],NOT ININT21     ;say int21 is not active
  154.         POPFF
  155.         sti                             ;make sure ints are enabled!
  156.         ret     2                       ;return with flags set
  157.  
  158. newint21 endp
  159.  
  160. ENDIT
  161.