home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / util2 / tsrcom.lzh / TSR.DOC < prev   
Text File  |  1986-09-07  |  15KB  |  334 lines

  1. ****************************************************************
  2. *                       Version 2.1                            *
  3. *  The TSR package is a group of programs useful in managing   *
  4. *  DOS memory, and in particular managing memory-resident      *
  5. *  utilities. TSR stands for "Terminate and Stay Resident".    *
  6. *                                                              *
  7. ****************************************************************
  8.  
  9. A. MARK, FMARK and RELEASE
  10. ================================================================
  11.  
  12. MARK.COM and RELEASE.COM are used to remove memory-resident
  13. programs from memory, without requiring a system reboot, and
  14. without the usual problems of creating holes or leaving
  15. interrupts dangling. The two programs are used simply as follows:
  16.  
  17. 1) Run the program MARK.COM before installing any memory-
  18.    resident program that you may wish to deinstall later.
  19.    This marks the current position in memory and stores the
  20.    DOS interrupt vector table (all interrupts from 0 to FFH).
  21.  
  22. 2) Install whatever TSRs that you want to use, in the normal
  23.    way that you install them.
  24.  
  25. 3) When you want to deinstall all TSRs above the last MARK,
  26.    run the program RELEASE.COM. This will release all of the
  27.    memory above (and including) the last MARK, and restore
  28.    all interrupt vectors taken over by the memory resident
  29.    programs.
  30.  
  31. MARK and RELEASE can be "stacked" as many times as desired.
  32. RELEASE releases the memory above the last MARK call. MARK uses
  33. about 1600 bytes of memory each time it is called. This 1600
  34. byte region is also released when a RELEASE is done. MARK memory
  35. usage is dominated by the copies of the DOS interrupt vector
  36. table (interrupts 0..FFH) and the copy of the EMS page map
  37. (blocks 0..31 only) which MARK keeps when it goes resident.
  38.  
  39. ================================================================
  40.  
  41. MARK and RELEASE can optionally be called with a single command
  42. line parameter:
  43.  
  44.   MARK MarkName
  45.   RELEASE MarkName
  46.  
  47. In this way a particular mark is given a name. Calling RELEASE
  48. with the same name will release all memory above and including
  49. the mark of that name, also releasing any intermediate marks in
  50. the process. If no mark of the proper name is found, RELEASE
  51. will halt with a warning. A RELEASE call with no MarkName
  52. specified will release the last MARK, whether or not that MARK
  53. was named.
  54.  
  55. The MarkName can be any text string up to 126 characters in
  56. length. It may not contain embedded blanks or tabs. Case (upper
  57. or lower) is not important when matching MarkNames.
  58.  
  59. MarkName supports an additional feature. If the MarkName begins
  60. with ! (exclamation point), then the mark is called a "protected
  61. mark". That mark can be released *only* by an exact match to its
  62. name (including the exclamation point). A protected mark will
  63. NOT be released with an "unnamed" RELEASE. Any named or unnamed
  64. RELEASE will stop without releasing any blocks if it encounters
  65. a protected mark that it does not match exactly.
  66.  
  67. ================================================================
  68.  
  69. As of version 1.4, MARK and RELEASE also control Expanded memory
  70. (Lotus/Intel/Microsoft EMS). They have been tested with READY!
  71. and with the TurboPower Software expanded memory disk cache, as
  72. well as with the device drivers used by the STB Expanded Memory
  73. Card.
  74.  
  75. WARNING: if a resident application allocates expanded memory at
  76. some time *after* going resident and after the last MARK made,
  77. that expanded memory will be released by a call to RELEASE. The
  78. current expanded memory manager (EMM) does not give us enough
  79. information to avoid this possibility. Fortunately, there are no
  80. known memory resident programs which perform this dynamic
  81. allocation of expanded memory. We hope that the EMM will be
  82. upgraded before such applications are designed.
  83.  
  84. ================================================================
  85.  
  86. As of version 1.6, RELEASE takes special precautions to allow it
  87. to release extra invocations of the DOS command processor. In
  88. the simplest form, an extra command processor is obtained by
  89. typing COMMAND at the DOS level. Many multitasking or switching
  90. utilities also utilize this feature of DOS, and these utilities
  91. can now be managed via MARK and RELEASE.
  92.  
  93. ================================================================
  94.  
  95. Due to the way DOS handles batch files, there are certain
  96. limitations on using RELEASE within batch. It is *not* possible
  97. to perform the following sequence of events successfully:
  98.  
  99. First, from the command line:
  100.  
  101.   MARK
  102.   SK      {or any other resident program or programs}
  103.  
  104. Then, within a batch file:
  105.  
  106.   RELEASE {get rid of SK and MARK}
  107.   LOTUS   {run Lotus using the additional memory}
  108.   MARK    {put SK back in place}
  109.   SK
  110.  
  111. DOS allocates a small memory block prior to running any batch
  112. file. It does not allow that block to be deallocated from within
  113. the batch file without various errors occurring. As a result, in
  114. this case the MARK and SK memory blocks are effectively trapped
  115. until the batch file is completed, after which the memory will
  116. be reusable. Indeed, if you run the batch file presented above,
  117. you will get MARK and SK installed above a big hole in memory
  118. left by the previous images of MARK and SK.
  119.  
  120. As of version 1.9, RELEASE guards against this possibility. If
  121. it senses that you are attempting to release memory trapped by a
  122. "batch control block", it writes a warning message to that
  123. effect. It still releases the memory, but when it exits it
  124. passes back a return code of 1 rather than the usual value of 0.
  125.  
  126. It *is* possible to get the desired effect in either of at least
  127. two ways. First, you could make two batch files and call them
  128. one after the other:
  129.  
  130. Batch file #1:
  131.   RELEASE
  132.  
  133. Batch file #2:
  134.   LOTUS
  135.   MARK
  136.   SK
  137.  
  138. In this case, running RELEASE in batch file #1 has the same
  139. effect as running RELEASE from the command line. However,
  140. directly calling the second batch file from the first doesn't
  141. always seem to work either. The only sure bet appears to be the
  142. use of a keypoker like KEY-FAKE or PCED's KEYIN, modifying Batch
  143. #1 as follows:
  144.  
  145.   RELEASE
  146.   KEY-FAKE "batch2" 13
  147.  
  148. A better way to make these things happen is to use the public
  149. domain program CED, or its commercial upgrade PCED. These
  150. programs allow you to define "synonyms" for groups of commands.
  151. The commands execute one after the other just like a batch file.
  152. However, the synonyms do not create an extra batch control
  153. memory block which causes the problems just described.
  154.  
  155. Thus you could make two CED synonyms as follows. (We assume that
  156. the CED "chain character" is ^).
  157.  
  158. SYN LOADSK mark !sk^sk
  159.   {make a protected sidekick marker and load sidekick}
  160.  
  161. SYN RUNLOT release !sk^lotus^mark !sk^sk
  162.   {release sidekick if it's there, run lotus, then reload sidekick}
  163.  
  164. ================================================================
  165.  
  166. As of version 2.0, a new form of marking, called a "file
  167. mark", is also supported. The new mark has the advantage that it
  168. uses only about 150 bytes of memory rather than the 1600 of MARK.
  169.  
  170. The new mark is placed with the command
  171.  
  172.     FMARK [d:][directory]filename
  173.  
  174. The bulk of the vector table and EMS page map are stored in the
  175. file which you specify on the command line rather than in
  176. memory. Note that a command line parameter is *required* in this
  177. case. Otherwise FMARK will halt with an error. The file created
  178. by FMARK will be between 1000 and 2000 bytes in size, depending
  179. on usage of expanded memory.
  180.  
  181. If you might switch drives or directories after using FMARK, you
  182. should specify a complete pathname when FMARK is initially
  183. called. To avoid confusion, you may want to keep the FMARK files
  184. in the root directory, or in a separate directory defined just
  185. for this purpose.
  186.  
  187. The RELEASE program has been upgraded so that it can release
  188. either an in-memory mark (placed by MARK.COM) or a file mark
  189. (placed by FMARK.COM). Use of RELEASE with in-memory marks is
  190. the same as before. To use RELEASE with file marks, call it with
  191. the name of the mark file on the command line:
  192.  
  193.     RELEASE [d:][directory]filename
  194.  
  195. Note that in this case the filename must be specified on the
  196. command line, and that only a file mark exactly matching the
  197. command line will be released. If the specified mark file is not
  198. found, RELEASE will halt with an error message. When the memory
  199. is released, the mark file is also deleted from disk.
  200.  
  201. There is no direct equivalent of protected marks for FMARK. If
  202. an unnamed RELEASE finds an in-memory mark below a file mark,
  203. the file mark will be released in the process of the unnamed
  204. release. In this case, the mark file will not be deleted from
  205. disk.
  206.  
  207. ================================================================
  208.  
  209. Version 2.1 of RELEASE fixes a stupid bug in 2.0. This bug lead
  210. to reports of RELEASE printing its status message on the
  211. printer, and to some system crashes. The bug was caused by
  212. writing over the first two bytes of the DOS file handle table at
  213. offset 0018H in the PSP.
  214.  
  215. We have become aware that certain resident programs which
  216. support the EGA change certain memory locations in the BIOS data
  217. area (0040:XXXX) when they go resident. RELEASE does not restore
  218. these locations, so unpredictable events may occur upon
  219. releasing them. A future version of TSR will handle this effect.
  220.  
  221.  
  222. B. MAPMEM
  223. ================================================================
  224.  
  225. MAPMEM.COM is used to display the current DOS memory map. It shows
  226. the resident programs, how much memory they use, and what interrupt
  227. vectors each currently owns. MAPMEM also shows information about
  228. expanded memory when such a driver is installed. MAPMEM writes to
  229. the standard output - thus the output can be printed or stored
  230. to a file.
  231.  
  232. Calling MAPMEM with a "V" command line parameter (i.e., MAPMEM /V)
  233. will show additional information about each memory block. MAPMEM
  234. will also accept V or -V as the command line switch for the
  235. "verbose" option. The "Files" column shows the number of file
  236. handles that each resident block has kept open. Each block of
  237. memory reported by DOS is listed individually in verbose mode.
  238. This is useful in debugging problems, either with the TSR package
  239. itself, or perhaps with the resident programs that you are using.
  240.  
  241. MAPMEM shows MARKs and FMARKs so that you can look at them prior
  242. to a RELEASE. A MARK will show the owner name "MARK", and the
  243. mark name (if any) in the command line area. An FMARK will show
  244. "N/A" in the owner column (due to the minimal memory kept by an
  245. FMARK), and the name of the mark file in the command line area.
  246.  
  247. Everything we know about DOS memory allocation is embodied in
  248. the source code for MAPMEM and RELEASE. We found this out by
  249. piecing together tips from friends and through many hours of
  250. snooping. Please don't call for an explanation.
  251.  
  252.  
  253. C. RAMFREE and EATMEM
  254. ================================================================
  255.  
  256. RAMFREE.COM supplies a quick way to determine the amount of free
  257. RAM (without going through CHKDSK). RAMFREE also reports the
  258. segment at which the free memory block begins.
  259.  
  260. EATMEM.COM is useful for program development work when you want
  261. to test software in an environment with a desired amount of
  262. available memory. Note that the memory used by EATMEM can be
  263. freed up by using MARK and RELEASE. EATMEM is called with a
  264. single command line parameter, specifying the (decimal) number
  265. of KILOBYTES to eat up:
  266.  
  267.   EATMEM KiloBytesToEat
  268.  
  269. Note that EATMEM will happily allow you to eat up all system
  270. memory, leading to a crash when COMMAND.COM cannot be reloaded.
  271. Be sure to calculate how much memory to eat before calling
  272. EATMEM.
  273.  
  274. D. The Story Behind the TSR Utilities
  275. ================================================================
  276.  
  277. These programs should work on any system running PCDOS or
  278. MSDOS 2.0 or later. They were developed on a Compaq Deskpro 286
  279. running Compaq DOS 3.0 and have subsequently been tested on a
  280. number of different systems. Complete source code is available
  281. in the file TSRSRC.ARC. MARK, FMARK, RAMFREE and EATMEM are
  282. written in assembly language (CHASM), while MAPMEM and RELEASE
  283. are written in Turbo Pascal. TSRSRC requires that you have Turbo
  284. Pascal version 3. On CompuServe, TSRSRC is found in the Borland
  285. SIG (Go BOR-100) in data library 1 (DL1).
  286.  
  287. The programs have been released to the public domain for personal,
  288. non-commercial use only. You may use them yourself, give them to
  289. your friends or co-workers, or distribute them for a cost-based
  290. fee as part of a user's group or bulletin board service. If you
  291. wish to distribute these programs as part of a commercial package,
  292. please contact us for a license agreement.
  293.  
  294. These programs were originally developed as an exercise in
  295. understanding DOS memory management. They have been put in the
  296. public domain as a public service. We ask for no donation for
  297. this set of programs. If for some reason you want the latest
  298. version or need support, we will ask for $5 to cover the costs
  299. of shipping a new disk to you.
  300.  
  301. TurboPower Software is in the business of Turbo Pascal
  302. programming tools for serious developers. Our first product, the
  303. TurboPower Utilities, contains 9 programs including an
  304. intelligent cross-reference, a pretty printer, an execution
  305. profiler and several DOS file and text management tools. Our
  306. second product, Turbo EXTENDER, lets Turbo Pascal programs grow
  307. beyond 64K bytes in size via modular compilation and linking. It
  308. also provides a toolbox of routines for virtual array management
  309. and disk caching, as well as analytical tools for overlayed
  310. programs. As of this writing, we are preparing to release a
  311. powerful symbolic debugger for Turbo Pascal. Tdebug-PLUS will be
  312. an expanded and fully supported version of the popular public
  313. domain program TDEBUG. It will include both a fully symbolic
  314. facility integrated with the Turbo development environment, and
  315. also the ability to generate DOS standard MAP files for use with
  316. other external symbolic debuggers such as Periscope, Symdeb, and
  317. Atron.
  318.  
  319. The TSR Utilities were written by Kim Kokkonen, with thanks to
  320. Neil Rubenking for the original idea behind MARK and RELEASE.
  321. Also my thanks to Richard Wilson and Barry Simon at Cal Tech for
  322. the idea that lead to FMARK, and much useful correspondence
  323. about the TSR Utilities.
  324.  
  325. We can be reached at:
  326.  
  327.      TurboPower Software
  328.      3109 Scotts Valley Drive #122
  329.      Scotts Valley, CA 95066
  330.      408-438-8608
  331.      Compuserve: 72457,2131
  332.  
  333. Version 2.1 - 7/18/86.
  334.