home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / SYSUTL / TSRWRK32.ZIP / LOADTSRS.DOC < prev    next >
Encoding:
Text File  |  1989-06-01  |  8.9 KB  |  197 lines

  1.  
  2.  
  3.  
  4.              LoadTSRs Documentation
  5.  
  6. LoadTSRs is NOT a program.  It is a SYSTEM.  The LoadTSRs system
  7. consists of three BAT files and an EXE assembly language program.
  8. The TSRmenu.BAT (1st BAT file) invokes the MenuTSRs.EXE program
  9. which creates the Load2TSR.BAT (2nd BAT file).  Load2TSR.BAT does
  10. the loading of TSRs selected from a MENU of TSRs displayed by the
  11. MenuTSRs.EXE program.  The last line of Load2TSR.BAT chains to a
  12. KillLoad.BAT (3rd BAT file) which deletes the Load2TSR.BAT file.
  13.  
  14. The LoadTSRs system, as you receive it therefore, contains only
  15. the TSRmenu.BAT and KillLoad.BAT files plus the MenuTSRs.EXE and
  16. its source code.  This LoadTSRs.DOC file may help you learn more
  17. about operating your computer in the process of explaining this
  18. system.
  19.  
  20. Although the LoadTSRs system, like ShowTSRs, UnMark, ReMark etc
  21. are provided for programmers, novices can be "programmers" in my
  22. definition of the target audience.  All that is necessary for you
  23. to benefit from what I place in the public domain is willingness
  24. to learn to program.  The idea that "users" should be isolated
  25. from the operating system or the means by which the CPU (central
  26. processing unit) is instructed is a "dumb" one.  It gives me the
  27. same feeling in my lower regions to think that someone operating
  28. a computer for me has been kept ignorant as it would to hear that
  29. school bus drivers have been trained as passengers.  If you don't
  30. want to know anything about the operating system or are unwilling
  31. to try your hand at programming, then erase these files now!
  32.  
  33. I'll assume that no one is reading simply because they did not
  34. know how to erase a file...  Lets review some BAT file concepts.
  35.  
  36. With Version 3.3 of MS-DOS, a BAT file can "call" another BAT
  37. file.  What does that mean?  BAT files commonly have a line which
  38. invokes a program.  The line in TSRmenu.BAT which reads:
  39. "MenuTSRs"
  40. is an example.  The operating system, when it encounters this
  41. line, loads and executes the program.  When the program ends -
  42. (terminates), the operating system resumes in the BAT file right
  43. after the "MenuTSRs" line with the program termination code in a
  44. BAT variable known as "ERRORLEVEL".  The BAT file then continues
  45. with its next line.
  46.  
  47. It is as if the BAT file said, "Go To this program AND come back
  48. with the result."  Here, for example, is the TSRmenu.BAT file:
  49. Echo Off
  50. MenuTSRs
  51. IF ERRORLEVEL 1 GoTo Exit
  52. %MrkDir%\Load2TSR
  53. :Exit
  54.  
  55. Notice the blank line at the end.  This says, "done" and prevents
  56. a double prompt caused by the BAT file processor going back for a
  57. line which does not exist.  But, let us concentrate on content...
  58. The BAT file test for an ERRORLEVEL will be TRUE for a specified
  59. or any higher level.  Only when MenuTSRs exits with 0 ERRORLEVEL
  60. will the jump over the %MrkDir%\Load2TSR NOT take place.
  61.  
  62.  
  63.             LoadTSRs.DOC            page  1
  64.  
  65.  
  66.  
  67.  
  68. MS-DOS versions before 3.3 do NOT provide for calling another BAT
  69. file.  If the Load2TSR.BAT file line is invoked, the Label:
  70. ":Exit"
  71. will never be reached.  It is as if the TSRmenu.BAT file had said
  72. "Go To Load2TSR.BAT AND DON'T come back!"  The operating system
  73. BAT file processor only handles one BAT file at a time.  When the
  74. next BAT file is "chained", the processor starts all over again.
  75. This is NOT bad.  In fact, it is GOOD!...  Suppose you desired to
  76. swim 20 laps of a pool.  Can you see the merrit in comming up for
  77. air at the end of each lap.  Starting over lets DOS update itself
  78. providing the same refreshment as the swimmers breath of air.
  79.  
  80. APPLICATION:  You are considering the hire of a consultant to
  81. train your computer users.  Ask the applicant to write your
  82. AutoExec.BAT file and give a long list of preparation actions
  83. required before the user receives control at the DOS prompt.
  84. If the applicant produces a multi-page AutoExec.BAT file, then
  85. write "unqualified" on the application.  If the applicant's
  86. AutoExec.BAT file is short and begins a series of "chained" BAT
  87. files, with the secondary BAT files placed at logical points,
  88. then hire the applicant.
  89.  
  90. My AutoExec.BAT contains only my virus protection system.  If an
  91. infection is found, it chains one way and if the system is Ok it
  92. chains to a SetPaths.BAT which, in turn, chains to a StartUp.BAT
  93. which has a number of alternatives.  Let us suppose that the next
  94. chain is LoadTSRs.BAT which contains:
  95. Set TSRdir=C:\TSRs
  96. Set MrkDir=G:
  97. FMark %MrkDir%\Watch
  98. Watch
  99. MenuTSRs
  100. TSRmenu
  101.  
  102. The BAT file processor substitutes the Environment String which
  103. was set to "G:" for the variable %MrkDir%.  The FMark line would
  104. be "FMark G:\Watch".  Note that the backslash "\" is literal.
  105.  
  106. This might be a good time to use the MS-DOS "TYPE" command to see
  107. the MenuTSRs.EXE HELP screen.  Do this:
  108. prompt >TYPE MenuTSRs.EXE
  109. "You can't TYPE an .EXE file!", you say.  Well, do it any how...
  110.  
  111. See how the sample LoadTSRs.BAT file sets the requirements for
  112. the LoadTSRs system.  Use ShowTSRs, after the sample LoadTSRs
  113. BAT file.  You will see that the operating system CONFIG.SYS,
  114. DOS SHELL and DOS ENVIRONMENT are followed by FMark G:\Watch,
  115. Watch and a 128 byte LoadTSR line.  MenuTSRs is a TSR itself!
  116. It "signals" that requirements have been met for loading TSRs
  117. from a menu.  The "LoadTSR" line shows 6 instead of 5 under the
  118. files column because the Load2TSR.BAT file is counted.
  119.  
  120. Naturally, you will need to put your TSR.COM files in the TSRdir
  121. directory and have a MrkDir directory for the FMarks and the
  122. Load2TSR.BAT file.  TSR.EXE files and TSRs NOT in the TSRdir or
  123. on the menu can still be loaded without use of MenuTSRs.EXE; but,
  124. it IS important that each be preceeded by an FMark.  We prepare
  125. for changes to the TSR configuration by using FMarks.  UnMark can
  126. be used to remove and TSRmenu can then re-load TSRs to meet your
  127. desires.
  128.  
  129.  
  130.             LoadTSRs.DOC            page  2
  131.  
  132.  
  133.  
  134. Recall the "comming up for air" analogy.  Using BAT files to
  135. UnMark or ReMark TSRs depends on the BAT file chaining process.
  136. When the BAT file processor switches BAT files, it gives DOS an
  137. opportunity to recover its breath between such operations.  It
  138. really is better, however, to UnMark or ReMark from the command
  139. line...  After all, You are the system driver - NOT a passenger!
  140.  
  141. Now for the bottom line on BAT files.  The LoadTSRs system does
  142. NOT use BAT files just so that I could talk about them in this
  143. document.  If MenuTSRs.EXE loaded the TSRs while it was running
  144. they would be installed above it (leaving a hole in memory when
  145. MenuTSRs terminated.  If installation was done by the resident
  146. MenuTSRs, it would require a large resident for all the code.
  147. The use of BAT files allows DOS to do the installation.  Each
  148. set of TSRs loads in the memory just vacated by MenuTSRs when
  149. the Load2TSR.BAT is chained on termination back to TSRmenu.
  150.  
  151. There are some interesting procedures in MenuTSRs.ASM which are
  152. worth consideration.  The GetDirs Proc NOT only reads the master
  153. DOS environment but corrects it if either the TSRdir or MrkDir
  154. directories contains an ending "\".  If you have NOT preset the
  155. variables, this PROCedure takes your input (insuring at least 2
  156. bytes and NO trailing "\"), and puts it into the DOS ENVIRONMENT.
  157. There is a hazard in this!  Your DOS MASTER ENVIRONMENT may NOT
  158. have sufficient space for the additions.  To insure that it IS
  159. big enough, you will want to have a CONFIG.SYS
  160. SHELL=C:\COMMAND.COM C:\ /E:1024 /P
  161. or similar entry.  My "E:1024" entry provides an environment size
  162. of 1k.  You may need less or may want more...
  163.  
  164. The IfPSPA PROCedure is used to test TSRfileNames from either the
  165. residents found in memory or your input against the list of files
  166. in your TSRdir directory.  Notice the care used to make sure that
  167. the STACK is back UP to the RETurn address whichever way the Proc
  168. reaches its RETurn ending point.
  169.  
  170. The MakeBAT and EndBAT PROCedures demonstrate creating, writing
  171. to and closing a file.  MakeBAT is called before the decision as
  172. to whether to install or update the resident MenuTSRs so that an
  173. error will NOT occur as a result of NO Load2TSR.BAT file being
  174. found on the initial call that installs MenuTSRs as a TSR.
  175.  
  176. Displaying a value as HEX or as DECIMAL ASCII is demonstrated
  177. by the BP2PSPA PROCedure and the NBX2ASC PROCedure.  These are
  178. commonly required assembly language routines.  You may use or
  179. modify them for your own programs.
  180.  
  181. The accumulation of a table of MCBs with a WORD size value for
  182. each MemoryControlBlock address, the Address of the Block which
  183. it controls, the size of the block and flags is used in all the
  184. programs of the TSRwrk series.  This table demonstrates how DOS
  185. keeps track of what is resident in its memory.  The last MCB or
  186. currently running program has a MemoryControlBlock identified
  187. with a "Z" and all others begin with an "M".  These paragraphs
  188. (16 byte blocks of memory) are what DOS uses when you Install
  189. TSRs or Release them.
  190.  
  191.         Tom Gilbert's Heart & Mind
  192.         7127 Lafayette Avenue
  193.         Kansas City, KS 66109
  194.  
  195.  
  196.     End of file  -    LoadTSRs.DOC            page  3
  197.