home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / t / tsrutls.zip / TSR.DOC < prev    next >
Text File  |  1993-03-04  |  23KB  |  528 lines

  1.                        TSR Utilities Version 2.9
  2.                              Kim Kokkonen
  3.                           TurboPower Software
  4.  
  5. Introduction
  6. ------------
  7. The TSR Utilities are a collection of programs useful for managing DOS 
  8. memory, particularly for managing memory-resident programs, also known as 
  9. TSRs. TSR stands for "Terminate and Stay Resident." The most popular use 
  10. of The TSR Utilities is for removing TSRs from memory without rebooting 
  11. the PC. There are many other uses, however.
  12.  
  13. The TSR Utilities have grown to include 8 programs. Here's a quick 
  14. overview of each one:
  15.  
  16.   MARK     marks a position in memory above which TSRs can be released.
  17.   RELEASE  removes TSRs from memory.
  18.   FMARK    performs the same function as MARK but uses less memory.
  19.   WATCH    a TSR itself, it keeps track of other TSRs.
  20.   DISABLE  disables or reactivates TSRs, leaving them in memory.
  21.   RAMFREE  shows how much RAM memory is available.
  22.   MAPMEM   shows what memory resident programs are loaded.
  23.   EATMEM   uses up memory for controlled program testing.
  24.  
  25. Be sure to read the documentation before using these programs. All of the 
  26. programs are command line driven, and unexpected events may occur if you 
  27. just start typing the program names at the DOS command line.
  28.  
  29. NOTE: Due to limited disk space, this version of The TSR Utilities does 
  30. not include three programs normally included. Two of them, MARKNET and 
  31. RELNET, are designed solely for use on Novell Network systems. The other, 
  32. DEVICE, is a program to display information about installed device 
  33. drivers. See the end of this file for information on obtaining the version 
  34. The TSR Utilities that contains these programs.
  35.  
  36. System Requirements
  37. -------------------
  38. The TSR Utilities will run on any IBM-compatible computer. You need DOS 
  39. 2.0 or a later version. Memory requirements vary according to the TSR 
  40. programs you normally use. Any monitor is acceptable.
  41.  
  42. Installation
  43. ------------
  44. For easiest use on hard disks, copy the program files to a directory named 
  45. in the PATH statement in your AUTOEXEC.BAT file. For more information on 
  46. the PATH command, see your DOS Manual.
  47.  
  48.  
  49. MARK, FMARK, and RELEASE
  50. ------------------------
  51. MARK.COM and RELEASE.EXE are used to remove TSRs from memory, without 
  52. requiring a system reboot. In their simplest form, MARK and RELEASE are 
  53. used as follows:
  54.  
  55. 1. Run MARK before installing your TSR(s). This marks the current position 
  56. in memory and stores information that RELEASE will later need to restore 
  57. the system. A common place to call MARK is in your AUTOEXEC.BAT file.
  58.  
  59. 2. Install whatever TSRs you want, using the normal method for each TSR.
  60.  
  61. 3. To remove those TSRs from memory, run RELEASE. This will release all 
  62. of the memory above (and including) the last MARK, and will restore the 
  63. system to the state at the time the MARK was made.
  64.  
  65. There are a number of variations of this simple method. First, MARKs can 
  66. be stacked in memory, as shown in the following hypothetical batch file. 
  67. Where you see TSR(n), substitute the name of the program you're 
  68. installing.
  69.  
  70.     MARK
  71.     TSR1
  72.     MARK
  73.     TSR2
  74.     MARK
  75.     TSR3
  76.  
  77. Each call to RELEASE releases memory above and including the last MARK. In
  78. this example, the first call to RELEASE would remove TSR3 and the last 
  79. MARK from memory, the second call would remove TSR2 and its MARK, and so 
  80. on.
  81.  
  82. MARK and RELEASE can be called using a command line parameter. The 
  83. parameter specifies a "mark name" and allows releasing TSRs to a specific 
  84. point in memory. Consider the following example:
  85.  
  86.     MARK TSR1
  87.     TSR1
  88.     MARK TSR2
  89.     TSR2
  90.     MARK TSR3
  91.     TSR3
  92.  
  93. This loads the three TSRs just as in the previous example. However, if 
  94. RELEASE were called like this
  95.  
  96.     RELEASE TSR2
  97.  
  98. then both TSR2 and TSR3 would be removed from memory. Note that the use of
  99. such a name does not allow just a single layer of TSRs to be removed 
  100. (just TSR2, for example). RELEASE always removes all TSRs including and 
  101. beyond the one named.
  102.  
  103. A mark name is any string up to 126 characters long. The name may not 
  104. include white space (blanks or tabs). 
  105.  
  106. When named marks are used, calling RELEASE without specifying a mark name 
  107. will still remove the last TSR from memory. Assuming that TSR1, TSR2, and 
  108. TSR3 are still in memory, typing just RELEASE would remove TSR3 and the 
  109. last mark. 
  110.  
  111. You can change this behavior by using "protected marks," which can be 
  112. released only by explicitly specifying their names. A protected mark is 
  113. placed by giving it a name that starts with an exclamation point, '!'. 
  114. Consider the following:
  115.  
  116.     MARK TSR1
  117.     TSR1
  118.     MARK TSR2
  119.     TSR2
  120.     MARK !TSR3
  121.     TSR3
  122.  
  123. Here !TSR3 specifies a protected mark. RELEASE alone would produce an 
  124. error message "No matching marker found, or protected marker encountered." 
  125. The same error would occur after entering the command, RELEASE TSR2. When 
  126. this error occurs, RELEASE does not remove any TSRs from memory.
  127.  
  128. The only way to remove TSR3 in this case is by entering
  129.  
  130.     RELEASE !TSR3
  131.  
  132. Each time a MARK is placed in memory, it consumes about 1600 bytes of RAM 
  133. space, which is used to store a copy of the system interrupt vector table 
  134. and other information with which RELEASE can later restore the system. 
  135. Although 1600 bytes isn't very much, we can reduce this memory usage by 
  136. storing the information in a disk file rather than in memory. FMARK.COM is 
  137. a variation on MARK that does just that. You can call FMARK at any time 
  138. that you would call MARK. FMARK uses only about 150 bytes of memory.
  139.  
  140. All calls to FMARK must include a command line parameter to specify the 
  141. name of the file:
  142.  
  143.     FMARK [d:][directory]filename
  144.  
  145. You should generally specify a complete pathname for the mark file. When 
  146. you later call RELEASE, you must give it the identical pathname, 
  147. regardless of what the current directory happens to be at the time. For 
  148. example, if you specified the following file mark:
  149.  
  150.     FMARK C:\TEST\TEST.MRK
  151.  
  152. then the following calls to RELEASE would generate an error:
  153.  
  154.     RELEASE TEST.MRK
  155.     RELEASE C:TEST.MRK
  156.  
  157. even if the current directory on drive C: was \TEST. The only way to call 
  158. RELEASE is with
  159.  
  160.     RELEASE C:\TEST\TEST.MRK
  161.  
  162. RELEASE can use either type of mark. Note that RELEASE treats marks placed 
  163. with FMARK just like protected marks. That is, they can be released only 
  164. by explicitly naming them. 
  165.  
  166. Consider the following example:
  167.  
  168.     MARK
  169.     TSR1
  170.     FMARK C:\MARKS\TSR2.MRK
  171.     TSR2
  172.  
  173. Typing just RELEASE in this situation generates the warning message "No 
  174. matching marker found, or protected marker encountered," because the file 
  175. mark is treated like a protected mark.
  176.  
  177. TSR2 can be removed from memory by entering
  178.  
  179.     RELEASE C:\MARKS\TSR2.MRK
  180.  
  181. RELEASE deletes the mark file when it has finished.
  182.  
  183. RELEASE has several command line options to modify its behavior. The 
  184. following table lists the options, which must start with a slash, '/', or 
  185. a hyphen, '-'.
  186.  
  187.     /E         do NOT access EMS memory.
  188.     /K         release memory, but keep the mark in place.
  189.     /S chars   insert string (<16 chars) into keyboard buffer on exit.
  190.     /?         display a help screen.
  191.  
  192. None of the options is required for normal use of RELEASE.
  193.  
  194. /E is made available for systems running early, buggy EMS (expanded 
  195. memory) drivers that don't correctly implement all of the EMS 3.2 system 
  196. calls. Don't use it unless you have an EMS-related problem during or after 
  197. running RELEASE.
  198.  
  199. /K is useful when you will be releasing and reloading a TSR repeatedly. 
  200. With it, you avoid the need to replace the mark each time the TSR is 
  201. released. Using /K in combination with a file mark also prevents RELEASE 
  202. from deleting the mark file.
  203.  
  204. /S followed by at least one space and then a short string (15 characters 
  205. or fewer) tells RELEASE to insert this string into the keyboard buffer 
  206. just before exiting. RELEASE automatically adds a carriage return to the 
  207. end of the string. 
  208.  
  209. To explain why the /S option is important, we must digress a moment. Let's
  210. assume that you normally keep SideKick loaded, but that you must unload it 
  211. in order to have enough memory free to run Lotus 1-2-3. It would seem 
  212. reasonable to write a little batch file like this:
  213.  
  214.    RELEASE SK
  215.    LOTUS
  216.    MARK SK
  217.    SK
  218.  
  219. which would remove the previously loaded SideKick from memory, run Lotus, 
  220. and then load SideKick again. Unfortunately, this won't work!
  221.  
  222. The reason is complicated to explain. It must suffice here to say that DOS
  223. batch files trap memory, and the memory freed by a call to RELEASE does 
  224. not truly become available until the current batch file ends.
  225.  
  226. Now perhaps the need for the /S option becomes clear. We can split the 
  227. previous batch file into two:
  228.  
  229.   batch1:
  230.     RELEASE SK /S BATCH2
  231.  
  232.   batch2:
  233.     LOTUS
  234.     MARK SK
  235.     SK
  236.  
  237. The first batch file releases the memory and stuffs the characters 
  238. 'BATCH2<Enter>' into the keyboard buffer. When the batch file ends, the 
  239. released memory becomes available. DOS automatically reads the keystrokes 
  240. waiting in the buffer and starts up the second batch file, which runs 
  241. Lotus and later reloads SideKick.
  242.  
  243. To keep things simple, the /S option pokes the specified keystrokes 
  244. directly into the system keyboard buffer. As a result, the number of 
  245. keystrokes is limited to 15 (not counting the <Enter> key, which RELEASE 
  246. adds automatically). This always allows enough keys to start another batch 
  247. file, however, and the new batch file can take over from there.
  248.  
  249. RELEASE detects when it is releasing memory within a batch file. It writes 
  250. a warning message to that effect, but continues processing anyway under 
  251. the assumption that the batch file is about to end. You can ignore the 
  252. warning if you've already taken account of DOS's memory management 
  253. behavior within batch files.
  254.  
  255. MARK and RELEASE are capable of removing many, but not all, TSRs from 
  256. memory. The TSRs that cannot be released fall into two categories: those 
  257. that cannot be released without specific internal knowledge of the TSR, 
  258. and those that can be released by storing additional general information 
  259. about the system.
  260.  
  261. The most common examples of TSRs that can't be released without internal 
  262. knowledge are those that cooperate with other TSRs in memory. Examples 
  263. include Microsoft's MOUSE.COM driver and its associated MENU program, and 
  264. the program CED with its "user-installed commands" such as KEYIN, HS, RAW, 
  265. and others. These programs can be released, but only if all the 
  266. cooperating partners are released at the same time. CED is well-behaved in 
  267. that it provides a built-in command (KILL) to release its partners. 
  268. MOUSE.COM is not so flexible, though.
  269.  
  270. Other TSRs modify well-defined areas of DOS memory that MARK and FMARK 
  271. simply don't record. Examples of such TSRs include the Novell NetWare 
  272. workstation shell and certain DOS utilities like MODE and SHARE. 
  273.  
  274. WARNING: you should not use RELEASE to try to release most disk caching 
  275. programs. If you do so, part of the information that should be stored on 
  276. disk will never make it, and you may end up with a corrupted disk as a 
  277. result. If you know that the disk cache uses a "write-through" algorithm 
  278. (which guarantees that all writes immediately go to disk), or if the disk 
  279. cache has a "flush the cache" command, then it may be safe to release the 
  280. cache.
  281.  
  282. WARNING: you cannot release the DOS 3.3 FASTOPEN or APPEND TSRs. These 
  283. TSRs patch internal DOS data areas that cannot be reliably located.
  284.  
  285.  
  286. WATCH and DISABLE
  287. -----------------
  288. WATCH.COM is a resident program that keeps track of other memory resident 
  289. programs. As a TSR goes resident, WATCH updates a data area in memory that
  290. contains information about what interrupt vectors were taken over. This 
  291. information can later be used by MAPMEM and DISABLE to show more details 
  292. about interrupts than normally available.
  293.  
  294. Installation of WATCH.COM is optional. All of the TSR Utilities except 
  295. DISABLE can be used whether or not WATCH is installed.
  296.  
  297. If you want to use it, WATCH.COM should be installed as the first TSR in 
  298. your AUTOEXEC.BAT file. WATCH uses about 4000 bytes of memory when it is 
  299. installed. Most of this memory holds various information about the TSRs 
  300. installed in the system -- it includes two copies of the interrupt vector 
  301. table and a data area containing a list of the interrupt vectors taken 
  302. over by each TSR. This information is used by DISABLE to deactivate and 
  303. reactivate TSRs without removing them from memory.
  304.  
  305. With DISABLE.EXE, you can disable and re-enable specified memory resident 
  306. programs without removing them from memory. Its function is analogous to 
  307. that performed by REFEREE from Persoft, although DISABLE has neither a 
  308. fancy user interface nor an option to work from within other programs. 
  309. DISABLE can allow conflicting TSRs to coexist, and it can let you run 
  310. applications whose keystrokes conflict with those of TSRs already loaded. 
  311. DISABLE also provides a small bonus in that it can be used to detect the 
  312. presence of a particular TSR in memory, thus allowing the design of 
  313. semi-intelligent batch files.
  314.  
  315. In order to use DISABLE, you must install WATCH.COM as the first memory 
  316. resident program in your system. WATCH keeps the detailed information 
  317. about each memory resident program that DISABLE uses to later control 
  318. them.
  319.  
  320. Like the other TSR Utilities, DISABLE is operated from the command line. 
  321. You specify a single TSR by its name (if you are running DOS 3.0 or later) 
  322. or by its address as determined from a MAPMEM report (described below). If 
  323. you specify an address, immediately precede the address with a dollar sign 
  324. "$" and specify the address in hexadecimal.
  325.  
  326. The name specified for a TSR is the one reported by MAPMEM in the "owner" 
  327. column. If the owner column reports "N/A," then you must instead specify 
  328. the address from the "PSP" column.
  329.  
  330. DISABLE accepts the following command line syntax:
  331.  
  332.   DISABLE TSRname|$PSPaddress [options]
  333.  
  334. Options can be preceded by either / or -. Valid options are as follows:
  335.  
  336.      /A     reactivate the specified TSR.
  337.      /C     check for the presence of the specified TSR.
  338.      /?     display a help screen.
  339.  
  340. If no option is specified, DISABLE will disable the named TSR.
  341.  
  342. Examples of usage:
  343.  
  344.   DISABLE SK              disables SideKick
  345.   DISABLE SK /A           re-enables SideKick
  346.   DISABLE SK /C           checks for the presence of SideKick
  347.   DISABLE $2F2E           disables the TSR at address 2F2E (hex)
  348.  
  349. DISABLE sets the DOS ERRORLEVEL in order to return status information to a
  350. batch file. It uses the following values of errorlevel:
  351.  
  352.   0       success: TSR is present, was disabled, or was re-enabled.
  353.   1       TSR is present, but no action was required to enable or disable it.
  354.   2       TSR is not present in memory.
  355.   254     invalid command line.
  356.   255     severe error.
  357.  
  358. WARNING: you cannot use DISABLE to deactivate SideKick Plus, whose 
  359. swapping technique is incompatible with DISABLE.
  360.  
  361.  
  362. MAPMEM and RAMFREE
  363. ---------------------------
  364. These two utilities provide status information about DOS memory usage. 
  365. They don't make active changes to the system like RELEASE and DISABLE do.
  366.  
  367. MAPMEM.EXE displays a map of DOS memory. It shows the resident programs, 
  368. how much memory they use, and what interrupt vectors each one controls. 
  369. MAPMEM also shows information about expanded and extended memory when 
  370. available.
  371.  
  372. MAPMEM writes to the standard output -- the output can be printed or 
  373. stored to a file by using DOS redirection.
  374.  
  375. Here is an example of MAPMEM output:
  376.  
  377.  PSP  blks bytes owner    command line        chained vectors
  378. ----- ---- ----- -------- ------------------- ------------------------------
  379. 0008   1   34240 config
  380. 1228   2    3536 command
  381. 1315   2    3888 WATCH    TSR WATCHER         16 21 27
  382. 140A   2   22128 CED      N/A                 1B 21 64
  383. 1973   1     144 N/A      C:\MARK\PS.MRK
  384. 197D   2     736 PSKEY    S3                  09 15
  385. 19AD   2   68400 PS       /B:0 /E:1 /R:0 /... 01 03 06 0D
  386. 2A62   2    1504 MARK     test                00 3F
  387. 2AC2   2   10384 EATMEM   10
  388. 2D4D   2  469808 free
  389.  
  390. block   bytes   (Expanded Memory)
  391. -----   ------
  392.     1  1048576
  393.  free  1048576
  394. total  2097152
  395.                 (Extended Memory)
  396. total   379240
  397.  
  398. "PSP" stands for Program Segment Prefix. This is the physical address, 
  399. specified in hexadecimal, where the program was loaded. If you're running 
  400. DOS 2.x, you'll need to use an address from this column to pass to 
  401. DISABLE.
  402.  
  403. "Blks" is the number of memory blocks DOS is using to manage the program. 
  404. This will typically be two: one for the program itself and another for the
  405. environment that stores the program name, the DOS path, and other 
  406. environment variables.
  407.  
  408. "Bytes" is the number of bytes of memory, specified in decimal, allocated 
  409. to the program.
  410.  
  411. The "owner" column shows the name of the program that allocated the block. 
  412. An "N/A" in this column means either that the program de-allocated its 
  413. environment to reduce memory usage (as shown on the fifth row of the 
  414. report) or that the system is running DOS 2.x, where the owner names are 
  415. simply not available.
  416.  
  417. "Command line" shows the command line entered when the TSR was originally 
  418. loaded. Some TSRs overwrite their command line with other code or data in
  419. order to save memory space. MAPMEM can usually detect this behavior and 
  420. will display "N/A" in the command line column when it does.
  421.  
  422. The last column will be titled with either "chained vectors" or "hooked 
  423. vectors." When WATCH is loaded, "chained" will appear; otherwise, "hooked"
  424. will. The numbers in this column indicate what interrupt vectors the TSR 
  425. has grabbed. Without WATCH, MAPMEM must use a heuristic technique to 
  426. identify the owner of each vector; don't be surprised if you see some 
  427. ridiculous looking vector numbers. With WATCH, MAPMEM should report an 
  428. accurate list for each TSR and should show the complete chain of control 
  429. for each interrupt.
  430.  
  431. MAPMEM indicates disabled TSRs by displaying the word "disabled" in the 
  432. interrupt vector column of the report.
  433.  
  434. The expanded memory report shows each allocated block of expanded memory, 
  435. as well as the free and total EMS space. When extended memory is 
  436. available, MAPMEM shows just the total amount available. The extended 
  437. memory report is not highly reliable because of the lack of a standardized 
  438. method for allocating extended memory space. Some applications that use 
  439. extended memory allocate the space by making it appear that the memory is 
  440. no longer in the system.
  441.  
  442. MAPMEM shows the various types of marks so that you can examine them prior 
  443. to releasing them. As shown in the example, MAPMEM reports a call to 
  444. MARK with the owner name "MARK," and the mark name (if any) in the command 
  445. line area. The result of a call to FMARK or MARKNET will show "N/A" in the 
  446. owner column (due to the minimal memory kept by an FMARK), and the name of 
  447. the mark file in the command line area.
  448.  
  449. MAPMEM offers the following command line options:
  450.  
  451.      /V     verbose report.
  452.      /?     display a help screen.
  453.  
  454. The verbose report shows each individual memory block rather than just one 
  455. for each program. It also adds two new columns of information. "Mcb" 
  456. stands for Memory Control Block. This is a physical address, expressed in 
  457. hexadecimal, of the DOS data structure used for managing each block of 
  458. memory. The MCB address is typically one less than the address of the 
  459. program. "Files" reports the number of files kept open by the TSR. In most 
  460. cases this will be zero. When it is non-zero, the maximum number of files 
  461. opened by the rest of the programs (including the foreground application) 
  462. is reduced accordingly.
  463.  
  464. RAMFREE.COM is a tiny program with a single purpose: to tell you how many
  465. bytes of memory are free for the next application. RAMFREE's advantage
  466. is that you don't need to wait for your hard disk to be analyzed before
  467. you find out how much memory is free. (Please note that, due to 
  468. differences in DOS versions, there may be very small discrepancies 
  469. between the bytes free reported by MAPMEM, RAMFREE, and DOS's CHKDSK.)
  470.  
  471. EATMEM
  472. ------
  473. EATMEM is a small program that is useful to software developers. It is a 
  474. TSR that consumes a specified amount of memory. Developers can use it to 
  475. simulate a system with less memory, or to create a buffer zone between an 
  476. application and programs preceding it.
  477.  
  478. The memory used by EATMEM can be freed only by using MARK and RELEASE. 
  479. Call EATMEM with a single command line parameter, specifying the (decimal) 
  480. number of KILOBYTES to eat up:
  481.  
  482.   EATMEM KiloBytesToEat
  483.  
  484. EATMEM will allow you to eat up all available memory, leading to a system 
  485. crash when COMMAND.COM cannot be reloaded. Be sure to calculate how much 
  486. memory to use before calling EATMEM.
  487.  
  488.  
  489. Copyright and License Information
  490. ---------------------------------
  491. The TSR Utilities are copyright (c) 1986,1987,1989 by Kim Kokkonen. All 
  492. Rights Reserved.
  493.  
  494. These programs are copyrighted, but license is hereby granted to 
  495. distribute them for personal, non-commercial use. You may use them 
  496. yourself, give them to your friends or co-workers, or distribute them for 
  497. a cost-based fee ($10 or less) as part of a user's group or bulletin board 
  498. service. If you wish to distribute these programs as part of a commercial 
  499. package, please contact us for a license agreement.
  500.  
  501. These programs are not shareware: we're not asking for a donation. 
  502. However, if you request that we send you a new version, we'll ask for $20 
  503. to cover our time and costs. The disk will include the latest version of 
  504. the TSR Utilities, including the complete source code.
  505.  
  506. The first (and only) place that we upload new versions of the TSR 
  507. Utilities is on CompuServe, the BPROGA forum, in the latest Turbo Pascal 
  508. library, which at this time is LIB 2. The executable programs are stored 
  509. in a file called TSRCOM.ARC, and the source code is stored in a file 
  510. called TSRSRC.ARC. From CompuServe, the programs fan out to public domain 
  511. bulletin boards around the world. Unfortunately, due to the transient 
  512. nature of bulletin boards, we cannot recommend where besides CompuServe 
  513. you should call to download the latest version.
  514.  
  515. The TSR Utilities were written by Kim Kokkonen, with thanks to Neil 
  516. Rubenking for the original idea behind MARK and RELEASE. Special thanks to 
  517. Richard Wilson and Barry Simon at CalTech for the idea that lead to FMARK, 
  518. and for much useful correspondence about the TSR Utilities.
  519.  
  520. You can reach Kim Kokkonen at:
  521.  
  522.      TurboPower Software
  523.      P.O. Box 66747
  524.      Scotts Valley, CA 95066-0747
  525.  
  526.      408-438-8608 (voice only, Monday-Friday 9AM-5PM)
  527.      CompuServe: 72457,2131
  528.