CMOS.TXT - Shareware to restore damaged CMOS Last updated 2002-07-21 by Roedy Green The most important fact you will want to know about this package is how to turn it off. If the CHKCMOS.BAT has been installed in AUTOEXEC.BAT, you must delete the files C:\CMP\CMOS.SAV and C:\CMP\BOOT.SAV B_E_F_O_R_E making any changes to CMOS or to the partitions. Otherwise, CHKCMOS will put CMOS back the way it was and BOOTREST will put back the partition table. This is deliberate to protect you from naive users from experimenting with the CMOS settings. You may have installed CHGCMOS.BAT and CHGBOOT.BAT files to do this deleting for you. You can do this by running the CHGCMOS.BAT program before you make any delibarate CMOS changes. The second most important fact is you must use CMOSSAVE BEFORE you have trouble. If you have not done so, CMOSREST won't do you a lick if good once your CMOS is corrupted. The third most important fact is you must REDO you CMOSSAVE any time you change your CMOS, e.g. upgrade your disk. You also need to redo your BOOTSAVE at the same time. GETTING THE LATEST VERSION ************************** You can find the latest CMP utilities via my home page at: http://mindprod.com/downloads#CMOS PURPOSE ******* 1. Naive users sometimes fiddle 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. 5. CMOSRest can also be used to toggle between two CMOS configurations, for example with and without a removable hard drive installed. If you had removable hard disks, you could rapidly switch between the various disks. 6. CMOSChk can detect subtle corruption to CMOS, as might be caused by a rogue program or a virus, something that might slow your machine or make it unreliable. 7. CMOSSave can create a backup of your CMOS on floppy. This way you may safely experiment with CMOS settings. You can always get back to where you started by using CMOSRest to restore the original settings. Any time you fiddle with the computer innards, you might accidentally disconnect the battery, losing CMOS. CMOSSAVE lets you put it back the way it was. 8. Testing your machine for year Y2K 2000 compliance, to make sure the BIOS will kick the date over properly in the year 2000. Not so important anymore. 9. If you build machines for a living, you can rapidly clone the CMOS settings of one template machine in a dozen others. WHAT IS CMOS ************ Your computer has three kinds of memory, RAM, CMOS and hard disk. When the power turns off, your computer forgets everything in RAM. Your much slower hard disk retains its magnetic memory. When the power is off, your tiny CMOS memory is kept alive by battery backup (ideally a lithium battery, sometimes a rechargeable nicad battery, or worst of all a pack of ordinary alkaline batteries.) In the CMOS is recorded basic facts about your configuration -- the size and geometry of your hard disk, how many floppy drives you have and what type, how much RAM you have, how many wait states need to be added to slow down the CPU enough to work with your RAM, etc. etc. The data in CMOS RAM can only be examined or changed with a special program such as CMOSSAVE. It is not a file. If you are curious about how CMOSSAVE does the access, have a look at the notes in the source code in CMOS.ASM. When the battery dies, or does when a recharegeable battery not get sufficient on time to recharge, the CMOS fails, and it forgets all it knows about your configuration. CMOSSAVE is designed to restore this lost information by storing copies of it on floppy and/or hard disk. 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 /Q IF ERRORLEVEL 1 GO TO FixIt - checks that CMOS has not been fiddled with since the last CMOSSAVE. Compares CMOS with a file on hard disk or floppy. - /Q suppresses unnecessary banner messages. HINTS ON USE ************ There are three ways you can use the suite: (1) manually, (2) automatically (3) with a rescue diskette. 1. Manually. Prepare a bootable floppy with the command: Format A: /S /V /U /F:1.44MB Unfortunatly Windows NT W2K and XP can no longer create a bootable DOS floppy. Borrow a DOS bootable disk from someone with FORMAT on it, and duplicate it or boot from it to create another bootable dos floppy, or get a friend to create you a bootable DOS floppy with W98 or WindowsME.) Install CMOSSAVE.com and CMOSREST.com on your hard disk into C:\CMP You can create such a directory with: MD C:\CMP This directory need not be on the path, but if it is not, you will have to type C:\CMP\CMOSSAVE instead of just CMOSSAVE. Backup your CMOS to the bootable floppy with: CMOSSAVE.com A:\CMOS.SAV COPY C:\CMP\CMOS*.com A: If ever your cmos becomes corrupted, correct it by booting from floppy and typing: CMOSREST.com A:\CMOS.SAV Then reboot. In this case you don't bother with CMOSCHK.com at all. 2. With a rescue diskette. Prepare a bootable DOS floppy with an autoexec.bat that invokes the following commands to correct most CMOS and hard disk problems: CMOSREST A:\CMOS.SAV BOOTREST A:\BOOT.SAV CHKDSK C:/F SYS C: COPY A:\COMMAND.COM C:\ COPY A:\COMMAND.COM C:\DOS (BootRest.com shareware is separately available. It is part of the package we send when you register or you can get it from my website.) You need to make a separate rescue disk for each machine unless the machines are absolutely identical including hard disk size. 3. Automatically. This won't work in NT, W2K or XP since those operating systems block CMOSREST.COM from working. Insert the line: CALL C:\CMP\CHKCMOS.BAT in your autoexec.bat. This bat file uses CMOSCHK.com to compare the contents of CMOS with what it should be. If there is a mismatch, it will invoke CMOSREST.com to put it back. then REBOOT.com to try again. Note this method will not be able to recover if the CMOS is badly damaged. You will have to revert to method 1 or 2. Note that CHKCMOS.BAT needs to be configured with a text editor before use. Need.com and Reboot.com are shareware available separately. They are included in the package we send when you register. NOTE THE NAMES: CHKCMOS.BAT but CMOSCHK.com!!! BELT AND SUSPENDERS ******************* Do a CMOSSAVE both to hard disk and to floppy. The hard disk copy can be used for quick restores with the following two lines added to your AUTOEXEC.BAT file. Use a text editor to add these lines. CMOSCHK.COM C:\CMP\CMOS.Sav IF ERRORLEVEL 1 CMOSREST.COM C:\CMP\CMOS.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. If you are just making a minor change, you can simply delete the existing *.SAV files, and CHKCMOS.BAT will recreate them. If you fail to do this, CHKCMOS.BAT will presume the changes were unintentional and will undo them. To someone unfamiliar with CMOSSAVE, having his deliberate CMOS changes undone can be very disconcerting. 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 need some sort of hex viewer to see the contents of the CMOS.SAV file. I use a free one called Hexview I got from www.sprynet.com/sprynet/funduc. There is one built into QDOS. The old DOS version of the Norton utilities DE (DiskEdit) had a hex viewer. The hex list of bytes is not that meaningful if you are not a computer programmer. Daring users could even patch the CMOS.SAV file with a hex editor and restore to get special effects, e.g. to switch between two different CMOS configurations e.g. one with and one without some hard disk. Don't attempt to edit the file with a non-hex viewer such as NotePad, WordPad, Write or Word For Windows. If you do, you will scramble the file beyond recognition. Because CMOSSave also saves the extended CMOS bytes,...
spidi3003