home *** CD-ROM | disk | FTP | other *** search
/ For Beginners & Professional Hackers / cd.iso / softcrc / masm / masm.610 / disk3 / samples / tsr / tsr.in$ / TSR
Encoding:
Text File  |  1992-11-12  |  3.8 KB  |  90 lines

  1. COMMENT +
  2.  
  3. To force TSR to set up its own disk transfer area, define the equate 
  4. constant DTA_SIZ with the desired buffer size in bytes.  (See section 
  5. "Preserving Existing Data" in Chapter 11 of the Programmer's Guide.)
  6. DTA_SIZ                 EQU     40      ; DTA size in bytes
  7.  
  8.         +
  9.  
  10. STACK_SIZ               EQU     400h    ; Stack size in bytes
  11. STR_LEN                 EQU     20      ; Max length of multiplex ID string
  12.  
  13. TRUE                    EQU     -1
  14. FALSE                   EQU     0
  15. NULL                    EQU     0
  16. TAB                     EQU     09      ; ASCII code for TAB key
  17. LF                      EQU     10      ; ASCII code for line feed
  18. CR                      EQU     13      ; ASCII code for ENTER key
  19. ESCAPE                  EQU     27      ; ASCII code for ESCAPE key
  20. SHFT_STAT               EQU     417h    ; Offset of shift-key status mask at
  21.                                         ;   0:417h in the ROM BIOS data area
  22.  
  23. ; Return codes used by procedures in HANDLERS and INSTALL modules
  24. NOT_INSTALLED           EQU     0       ; TSR not installed
  25. IS_INSTALLED            EQU     1       ; TSR is installed
  26. ALREADY_INSTALLED       EQU     2       ; TSR already installed
  27. UNKNOWN_PROBLEM         EQU     3       ; Can't install
  28. FLAGS_NOT_FOUND         EQU     4       ; InDos / CritErr flags not found
  29. CANT_DEINSTALL          EQU     5       ; Can't deinstall
  30. WRONG_DOS               EQU     6       ; Can't handle DOS 1.x
  31. MCB_DESTROYED           EQU     7       ; Memory control block problem
  32. NO_IDNUM                EQU     8       ; No identity numbers available
  33. INVALID_ADDR            EQU     9       ; Free memory block problem
  34. OK_ACCESS               EQU     10      ; TSR accessed successfully
  35. CANT_ACCESS             EQU     11      ; TSR not installed: can't access
  36. BAD_ARGUMENT            EQU     12      ; Unrecognized argument
  37. NO_ARGUMENT             EQU     13      ; No argument in command line
  38. OK_ARGUMENT             EQU     14      ; Okay argument in command line
  39.  
  40. IFNDEF  FPVOID                          ; Already in DEMO.INC
  41. FPVOID  TYPEDEF FAR  PTR                ; Type for far pointer to void
  42. ENDIF
  43.  
  44. INTR            STRUCT                  ; Structure of handler information
  45.   Num           BYTE    ?               ; Interrupt number
  46.   Flag          BYTE    ?               ; Active flag (for device interrupts)
  47.   OldHand       FPVOID  ?               ; Address of original handler routine
  48.   NewHand       FPVOID  ?               ; Address of TSR's handler
  49. INTR            ENDS
  50.  
  51. ERRINFO         STRUCT                  ; Structure of extended error
  52.   AxReg         WORD    ?               ;   information (see "Preserving
  53.   BxReg         WORD    ?               ;   Existing Data" in Chapter 11
  54.   CxReg         WORD    ?               ;   of Programmer's Guide)
  55.   DxReg         WORD    ?
  56.   SiReg         WORD    ?
  57.   DiReg         WORD    ?
  58.   DsReg         WORD    ?
  59.   EsReg         WORD    ?
  60.   ErrResrv      WORD    3 DUP (0)
  61. ERRINFO         ENDS
  62.  
  63. ; Prototypes
  64. Install         PROTO FAR PASCAL,
  65.                 Param1:WORD, Param2:WORD, Param3:WORD, Param4:FAR PTR FAR
  66.  
  67. Deinstall       PROTO FAR
  68.                 ; No arguments
  69.  
  70. InitTsr         PROTO FAR PASCAL,
  71.                 PspParam:WORD, StrParam:FPVOID, ShrParam:FPVOID
  72.  
  73. KeepTsr         PROTO FAR PASCAL ParaNum:WORD
  74.  
  75. FreeTsr         PROTO FAR PASCAL PspSeg:WORD
  76.  
  77. CallMultiplex   PROTO FAR
  78.                 ; AL = Function number for multiplex handler
  79.  
  80. CallMultiplexC  PROTO FAR PASCAL FuncNum:WORD, RecvPtr:FPVOID
  81.  
  82. GetResidentSize PROTO FAR PASCAL PspSeg:WORD
  83.  
  84. FatalError      PROTO FAR PASCAL Err:WORD
  85.  
  86. GetOptions      PROTO NEAR
  87.                 ; ES = Segment of Program Segment Prefix
  88.                 ; AL = Argument character for which to scan
  89.  
  90.