CMOS.TXT Last updated 1994 August 29 by Roedy Green Purpose ******* 1. Naive users sometimes meddle with CMOS settings. We need a fast way to put the scores of subtle CMOS configuration settings back the way they were. 2. Power surges can corrupt CMOS. We need a way for a naive user to quickly restore all the CMOS settings. 3. If the battery fails, the contents will be lost. We need a way to restore a known working CMOS configuration. 4. You may want to alter some obscure CMOS setting and you don't have a program to set it. Syntax ****** There are three utilities in the CMOS suite: CMOSSAVE.COM A:Myfile.Sav IF ERRORLEVEL 1 GO TO Trouble - saves a copy of CMOS in a file on hard disk or floppy. CMOSREST.COM A:MyFile.Sav IF ERRORLEVEL 1 GO TO Trouble - restores CMOS from a file on hard disk or floppy. CMOSCHK.COM A:MyFile.Sav IF ERRORLEVEL 1 GO TO FixIt - checks that CMOS has not been meddled with since the last CMOSSAVE. Compares CMOS with a file on hard disk or floppy. Hints on Use ************ Do a CMOSSAVE both to hard disk and to floppy. The hard disk copy can be used for quick restores built into your AUTOEXEC.BAT file. CMOSCHK.COM C:\MyCMOS.Sav IF ERRORLEVEL 1 CMOSREST.COM C:\MyCMOS.Sav At that point you must reboot before the restored cmos settings take effect. See CHKCMOS.BAT for a realistic way to handle this. You will will have to tune that BAT file a little to suit your machine, either by replacing the %XXX% or inserting SET commands. Sometimes CMOS will be so badly damaged the hard disk parameters will be corrupt and your hard disk will stop working. In that case you will have to revert to using the floppy copy. Whenever you change your CMOS setting deliberately, you need to redo the CMOSSAV.COM. However USE A NEW FILENAME, so that you can easily revert to the old version if your new settings do not pan out. How it works ************ CMOSSAVE.COM simply copies the 128 byte contents of the CMOS bytes to a file. CMOSREST.COM copies them back. CMOSCHK compares them with the file contents. If they are not equal it sets ERRORLEVEL 1. CMOSREST does not touch bytes 0 to 09 and 32h because these are volatile -- they contain the date and time. Similarly CMOSCHK, does not panic if any of these volatile bytes differ. However, CMOSSAVE saves all 128 bytes, so that you can browse the generated file with a hex editor to learn more about how CMOS works. You could even patch the CMOS.SAV file to get special effects. Because CMOSSave also saves the extended CMOS bytes, CMOSRest will restore the esoteric options like shadow RAM, wait states, processor clock speed, HMA enable etc. These is no need to calculate checksums, since the checksum is saved and restored just like any other CMOS byte. I have included a file called CHKCMOS.BAT which can be inserted in your AUTOEXEC.BAT which uses all three utilities. How CMOS is used **************** CMOS is battery backed RAM that stores configuration information when the power is off. It is on my top ten worst ideas list of all time. The problem is, CMOS is far too easily corrupted, by programs, power or meddling. See CMOS.OFS for a detailed list of what each byte in the CMOS is used for. Troubleshooting *************** Sometimes your CMOS will be so wrecked you cannot even get your machine limping enough to run CMOSREST from floppy. In that case you must clear CMOS. Do this on AMI BIOSes by holding down the INS key, powering off, powering on, then releasing the INS key. In the worst case, remove the battery and let the capacitance on the board drain overnight to clear it. You can then get a bare bones CMOS configured -- that just has the floppies right. From there you can run CMOSREST.COM. What is considered volatile and what is not, might vary for different boards. If you have trouble restoring, DO NOT DESPAIR. All is recorded. A variant of the CMOSREST program could get you back. All you need do in make a slight modification to the assembler source VOLATILE routine that decides which bytes to consider volatile. Even a very junior MASM programmer could make that modification for you. If you use SSTOR, I suspect it makes it look as though it had modified CMOS. If you boot without the SSTOR driver, CMOS will appear to have changed because SSTOR is not doing its standard trickery. I repeat: CMOSREST won't do you a lick of good unless you run CMOSSAVE BEFORE you have trouble. Make sure you have copies of CMOS.SAV both on hard disk and on floppy. There is a companion program called BOOTSAVE that works in a similar way to protects your boot track from damage by rogue programs or viruses. Again, you must use it BEFORE you have trouble. Author ****** CMOSSAVE, CMOSREST and CMOSCHK are copyrighted but may be freely used for any purpose except military. If you pass the files on, PLEASE PASS ON THIS DOCUMENTATION TOO. Please report bugs and problems to: Roedy Green Canadian Mind Products #601 - 1330 Burrard Vancouver BC Canada V6Z 2B8 (604) 685-8412 Electronic mail users can contact me via internet: roedy@bix.com Harvey Fishman wrote a pair of programs similar to CMOSSAVE and CMOSREST, but to the best of my knowledge, never released them. Shareware Status **************** CMOSSAVE CMOSREST and CMOSCHK are shareware. If you like them send $20 US or Canadian to: CMOSSAVE Roedy Green Canadian Mind Products #601 - 1330 Burrard Vancouver BC Canada V6Z 2B8 (604) 685-8412 Sorry we can no longer accept credit cards. The company was wiped out by criminals and we are just a thread of our former selves. Please mention the program title since we sell many other products. We in return will send you the latest version complete with MASM source for CMOSSAVE, CMOSREST, CMOSCHK, REBOOT, BOOTSAVE, BOOTREST and BOOTCHK. We will also include a 1.2 MB diskette full of the source code for the complete CMP suite of other utilities. If you don't register, we will not do anything mean to you. We don't even want you to feel guilty. This is fee is purely voluntary. Enjoy. -30-