CMOS.COM   v1.00   05-05-1999   Charles Dye
                GPL Freeware   Copyright 1994-1999, C. Dye.
                        email:  raster@highfiber.com
 
        This program is copyrighted, but may be freely distributed
        under the terms of the Free Software Foundation's GNU General
        Public License v2 (or later.)  See the file COPYING for the
        legalities.  If you did not receive a copy of COPYING, you
        may request one from the Free Software Foundation, Inc.,
        59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
        ABSOLUTELY NO WARRANTY -- use it at your own risk!


                             ---  Overview  ---

This program will save the contents of your computer's CMOS memory to a disk
file, or restore it from the file.  The CMOS is a battery-powered chip which
contains the computer's clock and calendar.  It also provides a small amount
of memory used for basic configuration information such as the number and
sizes of drives installed, memory size and speed, keyboard settings, machine
password, and so on.

A utility to save and restore the CMOS data is useful for two purposes.
First, the CMOS memory can be lost; this often happens when the battery runs
down.  Many older machines won't boot correctly if the CMOS data is lost (it
contains necessary info about the hard drive geometry.)  Having a backup copy
of the CMOS contents handy on a bootable floppy disk can save time, because
you don't have to look up the correct settings for your hard drive.  (On
newer computers, the BIOS interrogates the hard drive directly to get the
settings.  Losing the CMOS is less of a problem on these newer machines.)

Second, sometimes it's useful to be able to change CMOS options without
having to run the computer's setup utility.  Especially if the setup program
is on a disk in a file cabinet somewhere; or for blind users whose screen
readers won't work in the BIOS setup utility.  Simply save your current CMOS
data to a file, make your desired changes, and save again to a different
file.  In the future, you can load the desired settings directly, without
having to go through the setup program.

This program will save and restore the commonest types of CMOS memory found
in most computers:  the Motorola 146818, the Dallas Semiconductor DS1687, and
other hardware that emulates them.  It will save either 50 or 114 bytes of
data, depending on the hardware.  (Many similar programs only save 50 bytes.)
No provision is made for the extended CMOS used in EISA or MCA systems.  (I
haven't had a computer of either architecture for years, so I can't even
begin to test code for them.)  Also, no effort is made to save or restore the
clock and calendar; if you lose your CMOS, use the DATE and TIME commands to
reset the clock.

The file CMOS.S in this archive is source code for Eric Isaacson's shareware
assembler A86.  Unless you plan to modify this program, you can delete CMOS.S
to save disk space.  The file COPYING contains information on the GNU General
Public License; if you are familiar with the GPL, this file can also safely
be deleted.


                              ---  Syntax  ---

CMOS /SAVE [filename]

Saves the contents of CMOS to a file.  The filename is optional; if you don't
specify it, CMOS.SAV will be used.  (Don't type the brackets; they're only
there to indicate that "filename" is optional.)  You may abbreviate /SAVE to
/S.  Also allowed:  /B (for Backup) or /W (for Write.)  The switch character
is not important; you may use -S instead, or even just S.

CMOS /LOAD [filename]

Loads CMOS memory from a file.  If you don't specify the filename, CMOS.SAV
is used.  Legal synonyms are /L (Load) or /R (Restore.)  After loading CMOS
from the file, the computer will be rebooted automatically so that the new
settings will be recognized.

CMOS /I [filename]

Loads CMOS memory from a file, like /LOAD.  However, the machine is not
automatically rebooted.  This option is not generally useful.

CMOS /VER [filename]

Verifies the contents of CMOS against a file.  /C (for Compare) is a synonym.
In a batch file, Errorlevel 7 indicates a mismatch between the file and the
current contents of CMOS.

CMOS /DUMP

Dumps the current contents of CMOS to the screen (or stdout) as hexadecimal.
Useful only to hexperts.


                           ---  Return Codes  ---

Use the ERRORLEVEL command to check the return code in a batch file.

0 :  success
1 :  dos file error
2 :  syntax error, invalid switch or filename too long
3 :  not enough memory
4 :  no cmos?  hardware problem?
5 :  invalid or corrupt file
6 :  cmos write-verify mismatch.  hardware problem?
7 :  cmos - file mismatch
8 :  bad dos


                         ---  Data File Format  ---

My CMOS file format is different from everyone else's; you can't share data
files between my CMOS.COM and SAVECMOS.EXE or ROM2.EXE.  Mine requires a
special file header to prevent you from trying to load, say, AUTOEXEC.BAT
into CMOS, and to guarantee file integrity.

4 bytes 'CMOS'  file type identifier
1 byte 10h      file version identifier (1.0)
1 byte          flags:  bit 7 = valid, bit 6 = extended cmos present
2 bytes         bios model and submodel bytes
1 word (n)      length of data (in bytes)  always 50 or 114
1 word          checksum of data  (sum of all bytes)
1 word          hashtotal of data (xor of all words)
n bytes         cmos data


                            ---  What's New  ---

v1.00   05-05-1999
        Cleanup for release with FreeDOS.  Fix for 8086/8088 CPUs.  Added
strings for VERSION.EXE.  Treat nul on command line as an end-of-line.
Documented /I and exit codes.  Changed license to GPL.