RESMAN 6/08/87 DESCRIPTION RESMAN is a pop-up memory resident program which manages memory allocation for MS (PC)-DOS 3.1 and 3.2 with memory size up to 640k bytes. It allows other Terminate and Stay Resident (TSR) programs to be disabled and reactivated at any time from within an application or from a batch job. RESMAN will permit removal of memory resident programs one at a time or in a group, even from within a batch file. The last TSR program loaded is removed first. RESMAN will remove TSR programs even without a 'marker' in memory for the program, regardless of what may be said in the user manual or documentation file for the program in question. When RESMAN removes a TSR from within an application, such as LOTUS 1-2-3, the removed program is marked as unused, creating a 'hole' in memory. This naturally happens because the application program is not moved from its current memory area -- it would be impossible to do so. However, when the application finishes and returns to DOS, memory will be cleaned up and all holes that were created by removing TSR programs will no longer exist. If TSRs are removed from memory by RESMAN executed within a batch file, RESMAN uses sophisticated memory management techniques to clean up memory so that an additional hole is not created by the DOS batch file operation, a major flaw in the memory allocation of batch files in all versions of DOS. RESMAN allocates memory for batch files so the holes are not created. This feature allows the user complete flexibility in allocating memory to TSRs. MEMORY-RESIDENT PROGRAMS Memory-resident programs are loaded like any others; after they terminate, they remain resident because DOS allows them to keep the memory originally allocated to them. These programs are referred to as TSR for Terminate and Stay Resident. If you load a series of such programs, they fill RAM from the bottom up. There are several commercially available programs that replace some of the Basic Input Output System (BIOS) code and/or alter the operation of the keyboard. Most TSR programs are less than 16K bytes in size, small enough to keep resident all the time. Other TSR programs, such as editors, print spoolers and disk enhancements, are so large that it's necessary to remove them from memory when they are not in use. Some TSR programs are bug-prone and will interfere with other applications and other TSRs. It would often be useful to somehow suspend the operation of a particular TSR so that it would not interfere with other programs. RESIDENT MEMORY MANAGEMENT RESMAN itself operates by capturing interrupt vectors and using its time of control to record information concerning the interrupts used by other memory resident programs. RESMAN records all changes that follow the loading of every resident program, allowing it to suspend and reactivate memory- resident programs by bypassing and restoring the captured interrupts of these programs. RESMAN can even remove programs from memory from within a batch file without creating holes in memory. RESMAN will delay suspension and removal of a program that is currently active. If RESMAN were to remove or suspend it at this time, DOS would not know what to do and just crash. This is why some TSR's will pop up one more time after RESMAN has suspended the program. This will happen only when the HOt KEY for that program is the very next key struck after RESMAN releases control. USING RESMAN To use RESMAN effectively load it before any other memory resident programs (especially those that tell you they should be loaded first). RESMAN will only "see" programs loaded after it is loaded; it should always appear as #1 on the list of memory-resident programs. The best way to load RESMAN is to place it as the first line of the AUTOEXEC.BAT file. RESMAN OPERATION RESMAN may be invoked in two ways: o It will operate as a pop-up utility by typing Alt o It can be activated in a batch file On invocation as a pop-up utility, a display lists the memory-resident programs that were loaded after RESMAN, load addresses, the decimal size (number of bytes), and the command line, if any, passed to the program. It should be noted that some programs will alter their command line. RESMAN will display the current contents. At the bottom of the screen will be a users prompt and command line. The RESMAN command line permits the following operations: Enter to exit RESMAN and return to whatever was active before was entered. No carriage return (CR) is necessary. All other commands are terminated with a carriage return. nterrupt Entering "I" toggles a display showing interrupts captured by each resident program and their addresses (segment: offset). This should be of use to programmers. eep Entering "B" toggles the beeper. When the beeper is on, one beep is sounded for a correct operation and two beeps are sounded if the user mis-keys. If RESMAN recognizes an error in memory, three beeps are sounded and some diagnostic data is displayed. See section on ERROR MESSAGES below. uspend# Entering "S #" will suspend program number "#." This op- eration may be performed without danger at any time, since it does not remove the program from memory. A suspended program will not use processor time or perform any other function. Any program suspended can be reactivated with the (A) command. Entering "S" followed by the program name will suspend that program as described above and may be performed without danger at any time. ctivate# Enter "A #" to reactivate the program "#" suspended with the (S) command. This operation, too, can be performed safely at any time. Many times it is possible to suspend a TSR program that is somehow causing conflict and then reactivate it with the conflict resolved. This feature will save the system from crashing. Entering "A" followed by the program name will reactivate a suspended program. emove # Entering "R #" will remove from memory the program numbered "n" and all resident programs that are loaded after it, freeing the memory for other applications. Entering "R" followed by the program name will remove that program and all programs loaded after it. Please refer to the description above for a detailed discussion. If the Commands , or are used alone, RESMAN will attempt the operation on the last TSR program loaded in memory. It is better to disable TSR programs from within applications than to remove them. If you remove a TSR while inside an application, a hole will be created in memory. This hole will be properly dealt with at the end of the application. It is quite OK to remove TSRs from within a application without fear of a system crash. Some programs, such as DOS version 3.2 PRINT and NETWORK programs, leave memory in a mess. Whenever RESMAN finds that the memory allocation chain has been modified by these offenders, the memory allocation chain is fixed before the offender is removed. This method will guarantee that memory is correct. UNCRASH FEATURE RESMAN includes an "uncrash" feature that allows exiting a "hung" program, under most circumstances, without having to reboot the computer. Since RESMAN keeps interrupt tables, it can handle this function more gracefully than other such programs. If a program is in an endless loop but the keyboard is still alive, an exit to DOS or the "parent" process (e.g., DEBUG) may be effected by simultaneously pressing the INSERT and SCROLL LOCK keys. (This operation is independent of the current status of these keys.) There is no absolute guarantee that everything will be all right on exit, but files that would otherwise be lost may be saved. BATCH FILES After RESMAN has been loaded, further executions of RESMAN will pass the command line to the resident copy of RESMAN to be executed. This feature is most valuable in suspending a TSR that will interfere with an application program. For example, the program 'FASTBIOS.COM' replaces code for interrupt 16 (hex 10) and is designed to speed up screen output. Whenever WORDPERFECT is loaded, how- ever, the system crashes. The following batch file will solve the problem. RESMAN S FASTBIOS \WP\WP /R RESMAN A FASTBIOS The above batch file will suspend FASTBIOS then load and execute WORD PERFECT. After that RESMAN activates FASTBIOS. Under normal batch operations, using RESMAN to remove TSR programs to reclaim memory is a waste of time. DOS cannot reuse the 'holes' in memory created by the batch file processes within DOS until they are reconnected to the main block of unused memory. DOS itself uses a small block of memory for the batch job. This block is normally allocated after the last TSR block was allocated before the current batch job. RESMAN has been designed to solve this problem and can release a TSR at any point within a batch file without creating the hole. It is OK to release several TSR programs at any time within a batch job. Currently the action is only implemented in version 3.1 and 3.2 of PC-DOS. The following example batch job loads three TSR programs and then executes Lotus 1-2-3. At the end of the 1-2-3 execution, the three TSR's are no longer needed and are removed by RESMAN. KEY POPNOTES SK 123 RESMAN R SK RESMAN R POPNOTES RESMAN R KEY Note that the following batch file has the same effect because RESMAN removes TSRs above the current one. KEY POPNOTES SK 123 RESMAN R KEY The example batch job below removes SIDEKICK (C) BORLAND so that the memory can be used by LOTUS 1-2-3. RESMAN R SK 123 By the end of the batch job memory is reset to the state it was before the batch job started. The following batch file will leave memory just as it was before the start of the batch operation. RESMAN R SK 123 SK RESMANB RESMANB is a very small version of RESMAN that works in Batch mode. After RESMAN is loaded in the normal fashion, RESMANB can be used in all batch applications to issue RESMAN commands. RESMANB is provided for users of RAM disks who wish to keep things as small as possible. FOR THE TECHNICALLY MINDED You can change the "" character (scan code 1) by entering some other scan code at location 201H. (Technical Reference manuals and the like contain tables of these codes.) DO NOT enter the ASCII value of the new character! A few technically-oriented applications that capture the keyboard interrupts for themselves may not let you call up RESMAN while they are running. This will not be the case for normal user programs like word processors, spread sheets, database programs, or BASIC. COLOR FEATURE Function Keys F3 and F4 control the background and foreground color of the border box. Function Keys F5 and F6 control the background and foreground color of the text. A WORD OF CAUTION Some TSR programs offer a method of removing themselves from memory. This operation is dangerous because there is no provision for these programs to calculate the effect on other memory resident programs. While using RESMAN, it is important not to use the TSR's own removal procedure. RESMAN may not be able to keep track of this de-installation procedure. This is most important when it comes to replacing stolen interrupts. Memory marking and marker removal programs are exceptions to this rule. While, as examples, Mark and Release should continue to function correctly in conjunction with RESMAN, the user should now be able to effect complete control of memory resident programs with the use of RESMAN. MESSAGES RESMAN has three types of error mes- sages. The first type is user messages that indicate a correct operation. These are accompanied by the sound of one beep. The second type is user error messages that indicate the user has mis-keyed a RESMAN command or a batch operation has failed. These messages are accompanied by the sound of two beeps. The third type is DOS memory (possibly fatal) error messages that indicate bad news. These are accompanied by the sound of three beeps. The user is encouraged to copy down the error hex diagnostic data that accompany the DOS memory error messages. Please contact us about memory error messages or any other problems you encounter with RESMAN. USER MESSAGES Beeper Toggle Interrupt Toggle PROGRAM.COM(04) is now suspended PROGRAM.COM(04) is now removed PROGRAM.COM(04) is now activated USER ERROR MESSAGES PROGRAM.COM(04) not suspended PROGRAM.COM(04) already suspended Unknown Command (not I,B,R,S,or A) Program not found RESMAN requires 80-column text mode Cannot remove any modules... Application has Interrupts. MEMORY ERROR MESSAGE XXXX ABCD XXXX ABCD MEMORY ERROR CONDITION: reset computer Where XXXX ABCD XXXX ABCD is diagnostic data. It is necessary to find ways to help RESMAN control the offending TSR. SUPPORT This product is fully supported. It is the intention of the author to have this program completely "bulletproof." The features that are supported will be supported for all PC-DOS software. If you come across an application that RESMAN cannot master, please do not hesitate to call us at (301)495-5985. Unfortunately the author cannot be held responsible for any data loss or other inconvenience due to a system crash or any other mishap. COPYRIGHT NOTICE RESMAN Copyright 1987. All rights reserved. This program remains the sole property of Richard Estes and may not be altered in any way. The charge for usage of this program is $39.95 per computer it is used on. Site license is available. PUS and POP PUS and POP are twin routines that will help keep track of the the current directory. PUS is a memory resident program that will install itself into memory only in the case that PUS is not already installed. The resident portion of PUS is little more than a stack of up to sixteen directory paths. PUS will put the current directory into the top of the stack. The command line is then used as a possible new path. If the command line is not a good path, PUS will try the command line with a preceeding '\' to test that it could be a proper path from the root directory. POP will test if PUS is resident, if so it will take the last directory off the stack for use as the current directory. PUS and POP are used in batch file operations where the application needs to be loaded from its own directory in order to locate other files that it may need. SIDEKICK is an example of a program that could utilize PUS and POP. SIDEKICK uses a help file that must be in the current directory at the time it is loaded. pus sk SK pop ---------------- DOS Enhancements P.O. Box 1703 Silver Spring, MD 20902