CMOS.TXT 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. 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 CHKSAVE.BAT for a realistic way to handle this. 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. 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. offset purpose 00 seconds time of day 01 seconds alarm 02 minutes time of day 03 minutes alarm 04 hours time of day 05 hours alarm 06 day of week 07 alarm day of month 08 month of year 09 year 1980=0 0A status register A !0B status register B alarm !0C status register C flags !0D status register D battery !0E diagnostics status !0F shutdown status !10* diskette type !11* reserved !12* hard disk type !13* reserved !14* LSB equipment word !15* LSB base RAM in K !16* MSB base RAM in K !17* LSB expansion RAM in K !18* MSB expansion RAM in K !19* fixed disk type C: extension !1A* fixed disk type D: extension !1B*.2D reserved !2E* MSB checksum !2F* LSB checksum !30 LSB extended RAM in K above 1 MB !31 MSB extended RAM in K above 1 MB 32 BCD Century !33 128K info status byte !34..3F reserved !40..79 reserved for use by chipset maker ! = must be restored * = checksummed 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 is the source. Author ****** CMOSSAVE, CMOSREST and CMOSCHK are copyrighted but may be freely used for any purpose except military. MASM source is available. If you pass the files on, PLEASE PASS ON THIS DOCUMENTATION TOO. I hereby CURSE anyone to writhe in maggots if they pull the childish stunt of passing on programs without the concomitant documentation. Please report bugs and problems to: Roedy Green Canadian Mind Products #168 - 1020 Mainland Street Vancouver BC Canada V6B 2T4 (604) 684-6529 Electronic mail users can contact me on: BIX id ROEDY Zoomit id GREEN ROEDY 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 Canadian Mind Products #168 - 1020 Mainland Street Vancouver BC Canada V6B 2T4 (604) 684-6529 voice (604) 684-5541 fax We can take Visa, but not other credit cards by phone. Please mention the program title since we sell thousands of different products. We in return will send you the latest version complete with MASM source for CMOSSAVE, CMOSREST, CMOSCHK, REBOOT, BOOTSAVE, BOOTREST and BOOTCHK. 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-