
       ----------------------------------------------------------------
       CHKSUM.COM   v1.04a   04-24-2000   C. Dye   raster@highfiber.com
       GPL Freeware.   Copyright 1997-2000, Charles Dye.   No warranty!
       ----------------------------------------------------------------

CHKSUM is a utility which computes and displays checksums for files.

Two checksums will be displayed for each file that CHKSUM processes.  The
first is a 32-bit Cyclic Redundancy Checksum; this is the same checksum used
by PKZIP, ARJ, RAR, and others.  The second is a 16-bit checksum; this is the
same value displayed by XDIR /C under DR DOS.  In addition, the program will
display other directory information:  the file's size, attributes, and date
and time stamps.


                                --------------
                                GENERAL SYNTAX
                                --------------

CHKSUM [filespec...] [switch...]

   /S     recurse into subdirectories
   /M     pause after each screenful
   /M:x   pause after every x lines
   /F:x   date display format; x is U, E, or J
   /E     suppress automatic .* extension
   /H     do not hook critical-error vector

Switches may be uppercase or lowercase, and may begin with a forward slash or
a minus sign.  The order of arguments on the command line is not significant.
If no filespecs are specified, a default of *.* (all files in the current
directory) is assumed.

Filespecs may name files, subdirectories, or DR DOS-style file lists.  You
may use wildcards; all matching files will be checksummed.  If a filespec
names a subdirectory, all files within it will be processed.

Any filename which does not contain a period (i.e. has no extension) will be
given an automatic extension of .*.  For example, CHKSUM FOO and CHKSUM FOO.*
work the same.  To prevent this automatic .* extension, end the filename with
a period (CHKSUM FOO.) or use the /E switch.

A "file list" is a text file containing filespecs, one per line.  If you have
a list of files to process in a file named LIST.TXT, type CHKSUM @LIST.TXT
Note that the at-sign is not part of the filename, just a flag to indicate
that the following filename is a list file.

You may enclose a filespec in double quotes to "trap" troublesome characters.
For example, CHKSUM "ODD FILE" for a filename with an embedded space, or
CHKSUM "@ANOTHER" for a filename beginning with an at-sign.


                              ------------------
                              ERRORLEVEL RETURNS
                              ------------------

                      0    No errors encountered
                      16   General syntax error
                      17   Not enough memory
                      18   Bad operating system
                      19   Error reading from file list
                      20   Filename buffer overflow
                      21   Error resolving dots
                      22   Tree buffer overflow


                                 -----------
                                 WHAT'S NEW?
                                 -----------

1.04a   04-24-2000    5,696 bytes                              E248E220  9C30

Filespec buffers expanded to 260 bytes to handle the super-long pathnames
permitted by Windows 95/98.

1.04    07-26-1999    5,700 bytes                              95028062  9DF9

This release has been rewritten for NASM.  A86 is good, but it's shareware.
This change allows anybody to modify the code -- not just registered A86
users.  Added "master" checksums for all files successfully processed.  The
16-bit master checksum is compatible with XDIR's; the 32-bit master checksum
is compatible with nothing else on Earth.  Neither one is affected by the
order of files.  Also, leading zeroes are no longer suppressed on the hours
value.

1.03    05-23-1999    5,688 bytes                              746AC619  D292

On suggestions from James Hall, I have changed the name of the program to
CHKSUM (it was CC, which collides with some C compilers) and changed the
license to GPL.

Fixed an incompatibility with 8086/8088-based systems.  Added support for the
16-bit checksums displayed by the XDIR /C command in DR DOS.  Changes for
FreeDOS:  null now terminates the command line, like CR; added strings for
VERSION.EXE.  Display changes:  time is always shown in 24-hour format; file
sizes up to 2GB are justified; new /F:x switch to select the date display
format.  Changes to scrolling:  the Control key slows scrolling; Alt key
interrupts; Esc is now ignored; Control-C while paused now exits the program.
Rewrote the method of checking for subdirectory names.  General code bumming:
moved filespec buffers and other uninitialized data areas to the end; new
error handler with arguments passed inline, etc.


                     ------------------------------------
                     ACKNOWLEDGMENTS AND TECHNICAL TRIVIA
                     ------------------------------------

The author is indebted to Andrew Binstock and John Rex.  The CRC32 algorithm
used here is basically the same as presented in chapter 10 of their
"Practical Algorithms for Programmers," translated to 8086 assembly language
and wrapped in a flexible shell.

I have made one modification to their technique.  The lookup table used to
generate the CRC32 is not stored in the program.  Instead, it's computed when
the program is first started.  This adds a miniscule delay each time the
program is run, but shaves nearly a kilobyte off the program size.

The XDIR checksum (it's not a true CRC) turns out to be very simple.  It uses
a 16-bit accumulator.  Each byte of data is added to the accumulator, and
then the accumulator is rotated left one bit, with the most significant bit
going into bit 0.  I implemented this by adding a whopping two instructions
to the program's inner loop, at a cost of not more than 5 clock cycles per
byte processed.

This program is created with NASM, the Netwide Assembler, a freely available
80x86 assembler.  NASM's home page is  http://www.cryogen.com/Nasm

The code was originally created with Eric Isaacson's shareware assembler A86.


                                 ------------
                                 DISTRIBUTION
                                 ------------

This program is licensed under the terms of the Free Software Foundation's
GNU General Public License.  You may freely distribute it under the terms of
version 2 of that License, or at your option, any later version thereof.

You should have received a copy of the GNU General Public License with this
program, as a file named COPYING.  If you did not receive a copy of the
License, one is available from:

     Free Software Foundation, Inc.
     59 Temple Place - Suite 330
     Boston, MA  02111-1307, USA


