PC AT LIFESAVER

The configuration information for the IBM PC AT is kept in a 64-byte 
CMOS memory chip that's maintained by battery even when the machine 
is turned off.  A failing battery can cause errors at boot-up and 
trigger bad configuration record or failed battery messages.  Typical 
batteries have a useful life of about 3 years, so many of the original 
crop of ATs are due for a battery change.  However, when you remove the
battery, you lose all the configuration information and have to run the 
SETUP program to restore the configuration.

To make this chore easier, I created two short programs, CMOSGET and 
CMOSPUT.  CMOSGET reads the contents of the CMOS memory chip and writes
it to a standard output; redirection this output to a file saves 
the 64 bytes of information.  CMOSPUT performs the complementary function.
It reads from standard input and loads the CMOS chip with the saved data.
It again uses redirection to read the data file created by CMOSGET.

You can create these programs by running CMOS.BAS.

You can't simply restore all the old data, however, since you'd end up 
resetting the time and date that were active when you saved the 64 bytes,
and would have to use SETUP to update them.  CMOSPUT avoids this problem
by getting the current time and date from DOS and then using the BIOS
to update the battery backed-up real-time clock (RTC).

The complete procedure is as follows.  First, create a bootable diskette
by using the FORMAT command with the /S option.  Onto this diskette,
copy the SETUP program used by your machine and the CMOSPUT.COM program
you created.  (Later, if the BIOS detects that the data in the CMOS is
not reliable, it will only boot from the A: drive and refuse to access
the hard disk at all.  So this process will create the proper bootable
diskette.)

Run CMOSGET to save the CMOS memory in a file on the diskette, with 
the command 

	CMOSGET > A:CMOS.DAT

Change the battery.  Boot the computer from the floppy and ignore the
error messages.  Set the date and time with the DOS TIME and DATE 
commands.   Run CMOSPUT to load the CMOS memory with the command

	CMOS < CMOS.DAT

Now, remove the diskette and reboot the computer.  If everything works, 
you should get no errors and the correct time and date.  (If there is 
a problem, you can reboot using the diskette and run the setup program.)

As an added feature, this procedure can be run at any time to update 
the time and date in the RTC without resorting to the SETUP program.

Contributed to the June 9, 1987 PC Magazine by
Robert Lewis Hummel
Redondo Beach, California

