home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / teseract / source / tschkres.asm < prev    next >
Encoding:
Assembly Source File  |  1988-10-02  |  4.5 KB  |  170 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. INCLUDE mixed.inc
  32.  
  33. IFDEF   ALLPUBLIC
  34. INCLUDE tschkres.pub    ;public definitions (uses Periscope PUBLIC.COM /E)
  35. ENDIF
  36.  
  37. .MODEL small
  38. .CODE
  39.  
  40. EXTRN _TESS_INTERRUPTRETURN:near
  41.  
  42. PUBLIC _TESS_TEMPPARMS
  43.  
  44. ENDIF
  45.  
  46. IFNDEF ASMCOM
  47.  
  48. hProc <TSVERIFY2F FAR>
  49.  
  50. ELSE
  51.  
  52. hProc <TSVERIFY2F NEAR>                 ; This procedure is used internally
  53.                                         ;   by TsCheckResident to ensure
  54. ENDIF                                   ;   that a valid INT 2Fh vector 
  55.         ASSUMENODS                      ;   exists.  DOS 2.x initializes
  56.                                         ;   this vector to 00 00
  57.         xor     ax,ax
  58.         mov     es,ax
  59.         mov     bx,2fh
  60.         shl     bx,1
  61.         shl     bx,1
  62.         mov     ax,es:[bx]
  63.         or      ax,es:[bx+2]
  64.         jnz     ok_2f
  65.  
  66.         mov     ax,offset _TESS_INTERRUPTRETURN
  67.         mov     es:[bx],ax
  68.         mov     es:[bx+2],cs
  69. ok_2f:
  70.  
  71.         hRet
  72. hEndp
  73.  
  74.  
  75. _TESS_TEMPPARMS   db  10 dup(0)         ; temporary data area to hold
  76.                                         ; ID String and ID Number on return
  77.                                         ; from TSCHECKRESIDENT before TsDoInit 
  78.                                         ;   v0.66
  79.  
  80.  
  81. IFNDEF ASMCOM
  82.  
  83. hProc <TSCHECKRESIDENT FAR> <USES SI, DI>, UserName:dword, IDNumber:dword
  84.  
  85. else
  86.  
  87. PUBLIC TSCHECKRESIDENT 
  88. TSCHECKRESIDENT proc near
  89. ;
  90. ;       in the assembler version, ES=DS=CS on entry, and SI should 
  91. ;           the offset of the UserName, DI should contain the address
  92. ;           to store the returned ID number
  93. ;
  94. ENDIF
  95.         push    ds
  96.  
  97. IFDEF ASMCOM
  98.         push    di
  99.         push    si                      ;save parms for later
  100. ENDIF
  101.  
  102.         ASSUMENODS
  103.  
  104.         call    TSVERIFY2F
  105.  
  106. IFNDEF ASMCOM
  107.         lds     si,UserName
  108. ELSE
  109.         pop     si                      ;get UserName back
  110. ENDIF
  111.         push    ds
  112.         push    si
  113.         xor     cx,cx                   ;call Multiplex Function 0
  114.         xor     bx,bx
  115.         mov     ax,5453h
  116.         int     2fh
  117.  
  118.         pop     si
  119.         pop     ds
  120.  
  121.         cmp     ax,-1                   ; if AX==ffff, we're already
  122.         je      already_res             ;     resident
  123.  
  124.         push    cx
  125.         lea     di,_TESS_TEMPPARMS
  126.         push    cs
  127.         pop     es
  128.         mov     cx,8                    ;store the user name in TsrParms
  129.         rep     movsb                   ;structure
  130.         pop     ax
  131.  
  132.         stosw                           ;store the ID Number returned by
  133.                                         ;function 0 in TsrParms
  134. IFNDEF ASMCOM
  135.         les     di,IDNumber
  136. ELSE
  137.         pop     di
  138. ENDIF
  139.  
  140.         stosw                           ;also store ID number in user's
  141.                                         ;pointer
  142.         xor     ax,ax
  143.         jmp     short check_out
  144.  
  145. already_res:
  146. IFNDEF ASMCOM
  147.         les     di,IDNumber             ;store returned id number of 
  148.         mov     es:[di],cx              ;already loaded TSR in user data
  149. ELSE
  150.         pop     di
  151.         mov     [di],cx
  152. ENDIF
  153.  
  154. check_out:
  155.         pop     ds
  156. IFNDEF ASMCOM
  157.         hRet
  158. hEndp
  159.  
  160. ELSE
  161.         ret
  162. TSCHECKRESIDENT endp
  163.  
  164. ENDIF
  165.  
  166. ENDIT
  167.  
  168.