SAFRAM6.DOC Feb 22, 1988 Copyright 1988 by Roy Lipscomb, Logic Associates, Chicago Permission hereby granted only for non-fee copying and distribution. SAFRAM6.ASM: [] Restores SAFRAM's compatibility with $$$.SUB files. [] Allows SAFRAM to be de-installed, via "SAFRAM OFF". [] More reliably detects an already-active SAFRAM module. ******************************************************************************* FUNCTIONS --------- [] Speeds up warmboot and "disk-system reset" functions by not reloading CP/M and by not logging in drive A until needed. (The above feature is standard for CP/M 2.2. Clones of CP/M can take advanatage of this feature by customizing the variable "offsetcdk" in SAFRAM6.ASM.) [] Acts as a buffer between TSR's that do not easily tolerate other TSR's. [] Creates a "safe ram" harbor below the CCP in which data or programs are protected from being overwritten, even after warmboots. [] Makes it possible to install BDOS and/or BIOS extensions below the CCP instead of above the BIOS. This saves space by letting such extensions be installed in RAM only as needed. This also makes it possible to install extensions that are too long to reside in the BIOS on the system tracks of the boot disk. ******************************************************************************* BACKGROUND ---------- Various utility modules or "traps" install themselves just below the CCP before they begin operation. This allows other programs to load and execute normally, without overlaying and disrupting operation of the traps. Essential to this technique is altering RAM memory locations 6 and 7 to point to the start of the trap. This is necessary because 6/7 tells the next program what the upper end of the available work space is. This technique has been hobbled by the fact that warmboot alters the 6/7 contents back to their original coldboot value. This strips away the module's protection. SAFRAM operates by protecting the contents of 6/7 from being changed back to its original coldboot value. This protection lasts until the reset button is pushed, or until SAFRAM is explicitly disabled by the user. ******************************************************************************* INSTALLATION ------------ SAFRAM allows two modes of installation. 1) Executed without parameters, SAFRAM will secure the current address in location 6/7 (or will secure the CCP if 6/7 points higher than the CCP start). Example: A>SAFRAM 2) Executed with a four-character hex address as its parameter, SAFRAM will secure that address. Example: A>SAFRAM A000 Installed, the SAFRAM resident module occupies about 300 bytes of RAM. Each additional execution of SAFRAM will add another 3 bytes of overhead. SAFRAM also makes the CCP (2K in size) stay resident. NOTE: SAFRAM will not install unless the CCP is resident and intact. Since DDT normally overlays the CCP, SAFRAM will normally refuse to execute under DDT. If you wish to load SAFRAM under DDT, first execute some utility that protects the CCP. Besides SAFRAM itself, one such public-domain utility is DDTZ. ******************************************************************************* DE-INSTALLATION --------------- To deinstall SAFRAM, 1) Type-- SAFRAM OFF where "" means "carriage return" or 2) Press the system-reset button. ******************************************************************************* BUFFERING BETWEEN TSRs ---------------------- Most programs are active only between the time you load them and the time you "warmboot" (exit back to the operating-system command line without pressing the reset button). A terminate-and-stay-resident (TSR) utility is one that relocates to the top of the program-memory area, and then attaches itself into the operating system. This allows the utility to remains active even after its main portion terminates and you execute other programs. Some TSRs crash if any other TSR happens to be active. This results when the late-comer TSR uses a relocating-and-attaching technique that is oblivious to the possibility that any other TSR may be present. Recoding of the "ill-behaved" TSR is the best solution. There are relocating-and-attaching techniques that can make any TSR "friendly." But recoding is often unfeasible. In such a case, the following "work around" may allow two otherwise incompatible TSRs to co-exist in memory: Step 1. Execute one of the TSRs. Step 2. Execute SAFRAM6. Step 3. Execute the other TSR. Step 4. Execute SAFRAM6. The above technique can be employed to cover not only two, but also three, four, or any number of TSRs. Though this technique is not foolproof, it has been found to create "compatibility" in enough situations that it is worth trying at least as a last resort. ******************************************************************************* THEORY OF OPERATION ------------------- At initial installation, the SAFRAM trap module relocates itself to just below the CCP (or the currently protected module), and protects both itself and whatever is above it in RAM. In simplest terms, SAFRAM operates by patching two traps into the BIOS jump table. * The "WARMBOOT" trap sets a flag indicating that a warmboot has been requested; then simulates a normal warmboot; and jumps to the already resident CCP. * The "CONSOLE OUT" trap checks the warmboot flag. If the flag is set, this trap resets the flag and (if this option was set at assembly time) notifies the user of the presence of SAFRAM. This trap finishes by jumping to the normal CONOUT routine. Starting with version 5, SAFRAM also traps each "reset system" function call and converts it to "reset all disks". ("System reset" always logs in drive A. "Reset all disks" doesn't, and so saves time.) Version 6 also monitors "open file," "close file," "find file," and "erase file" for activity on file "$$$.SUB". "Erase file" causes SAFRAM to turn off the CCP "$$$.SUB-active" flag. The other functions, when successful, cause SAFRAM to turn the flag on. Note: This flag-setting/resetting takes place only if SAFRAM can assure itself at run time that it has in fact located the "$$$.SUB-active" flag within the CCP. ******************************************************************************* ASSEMBLING ---------- This source uses the LINK pseudo-operation featured in Ward Christensen's LASM.COM (available on RCPM's) and its predecessor LINKASM.COM (available from CPM Users Group as 36.11 and 36.12). This feature is used here to link SAFRAM6.ASM to itself, and thus introduce two (partial) copies to the assembler. The two copies are used by the resultant SAFRAM6.COM to produce a relocatable module. If neither of the above assemblers is available, this source can be assembled in a more roundabout fashion. First, delete these three statements from the end of SAFRAM6.ASM: if not copy1 link safram6 endif Next, execute the following commands: PIP SAFRAMX.ASM=SAFRAM6.ASM,SAFRAM6.ASM ;The next step can use ASM.COM or any standard assembler. ASM SAFRAMX LOAD SAFRAMX ERA SAFRAMX.HEX REA SAFRAMX.PRN The resulting SAFRAMX.COM in equivalent in every respect to SAFRAM6.COM. ******************************************************************************* CUSTOMIZING ----------- Customizing of SAFRAM6.ASM is accomplished via these variables: VARIABLE DEFAULT COMMENT -------- ------- ------- BOOT 0 0 for standard CP/M. NOTIFY yes "yes" to receive verification of the currently secured address during each warmboot. PAGEBND no Lower SAFRAM6 module to page boundary+6? If no, SAFRAM6 fits snug against TPA ceiling. OFSETCD 342H Offset to current-drive storage byte in bdos. [] If your system IS CP/M 2.2, -- * Do NOT change the value of this variable. It allows SAFRAM6 to speed up warmboots. [] If your system IS NOT CP/M 2.2, ------ * If you customize this value for your BDOS, SAFRAM6 will speed up warmboots. * If you do not customize this value, SAFRAM6 will not speed up warmboots. ******************************************************************************* APPLICATION NOTES ----------------- [] Some high-memory modules do not protect themselves by changing locations 6/7. To secure such a module, use the explicit-address option of SAFRAM6. (See INSTALLATION above.) [] Self-relocating utility modules that will be protected by SAFRAM6 should insure that they do not overlay the CCP. [] To inspect the CCP using DDT (which normally overlays the CCP), execute SAFRAM6 before invoking DDT. Thereafter, the CCP will remain intact when DDT is loaded. [] To install and then protect DDT, use this command sequence: SAFRAM6 <--to secure the CCP. DDT SAFRAM6.COM -G <--to secure DDT. DDT will now remain resident until the system is reset. This allows you to instantly return to DDT anytime the system is waiting for console-input, even in the midst of another program. (Instant return to DDT requires the installation of the public- domain BACK2DDT or a similar utility. BACK2DDT is available from many RCP/M's and from Logic Associates.) ******************************************************************************* MESSAGES -------- The following message is displayed at each logon: DDDDDD DDDD DDDDD DDDDD DDDD DD DD DDD DD DD DD DD DD DD DD DDD DDD DDDDD DD DD DDDD DDDDD DD DD DDDDDDDD DDDD DDDDDD DD DD DD DDDDDD DD DD DD DDDDDD DD DD DD DD DD DD DD DD DD SAFRAM 6.0 2/25/88 (C) Copyright 1988, Logic Associates, Chicago * Acts as buffer between ill-behaved TSRs. * Speeds up warmboot and "reset all disks". * Creates safe RAM partition below the CCP. [] "SAFRAM xxxx" --protects hex address xxxx. [] "SAFRAM" --protects CCP and all TSRs. [] "SAFRAM OFF" --removes SAFRAM. [] Multiple re-executions are permitted. ---------------------------------------------- After the above logon message, one of the COMMENTS messages below will be displayed: -------- *** Installed. *** <--SAFRAM newly installed. *** Reassigned. *** <--Previously installed SAFRAM now protects new address. *** De-installed. *** <--SAFRAM newly removed. *** Abort: Valid range is xxxxH to xxxxH. *** <--User-requested installation addr not within free RAM. *** Abort: SAFRAM not present. *** <--Cannot remove SAFRAM; it's not installed. *** Abort: Unable to locate CCP. *** <--Cannot find location to move SAFRAM into. *** Abort: Cannot de-install at present. *** <--SAFRAM's patch points are overlayed by some other utilities patches at the moment. *** Abort: Conflicting versions of SAFRAM.*** <--Can't reassign or remove SAFRAM unless re-executing installed version. ******************************************************************************* OTHER SOFTWARE -------------- In addition to our variety of freeware, Logic Associates offers a selection of commercial packages. These packages have been reviewed in DR. DOBBS JOURNAL, SEXTANT Magazine, COMPUTER SHOPPER, and various user-group newsletters. Among our packages are-- COLUMNS Easily converts single-column text into multi- column pages with margins. And vice versa. Allows page formatting, column deletion, column "zippering", more. DISKGUISE 1) Allows trouble-free use of Wordstar(tm) in any drive and user area, even if Wordstar and its overlays are not present there. 2) Allows assigning an implicit user area to each disk name, so that accessing different user areas is as easy as accessing different disks. TUTORI/O Demystifies the BDOS functions, using "show and tell." For assembly-language programmers. SUPERMIT Endows any batch-processing language with BASIC-like extensions: GOTO line number, IF...THEN...ELSE, dynamic variables, etc. Compatible with SUBMIT, EX15, SUPERSUB, etc. MEGABACK Safely backs up your hard disk to floppies. VERSBASE Automatically updates filenames with version numbers instead of with ".BAK". Interactive or automatic modes. Our packages come with a 30-day money-back guarantee. For copies of reviews and other information, write or call-- Logic Associates 1433 W. Thome Chicago, IL 60660 (312) 274-0531 Thank you, and we hope you enjoy SAFRAM! ****************************************************************************** (end)