	Program usage documentation for EXC

	(c) Copyright 1998 by K. Heidenstrom.

	Modified:

	KH.19980823.001  First version, for EXC 1.0.0

1.  LEGAL

	The EXC source and executable files and this documentation are (c)
	Copyright 1998 K. Heidenstrom.	The author can be reached at
	kheidens@clear.net.nz or by snail mail:
	K. Heidenstrom c/- P.O. Box 27-103, Wellington, New Zealand.

	This program is free software.	You may redistribute the source and
	executable(s) and/or modify the program under the terms of the GNU
	General Public License as published by the Free Software Foundation;
	either version 2 of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful, but
	is provided "as-is", without any warranty of any kind, including
	the implied warranty of merchantability or fitness for a particular
	purpose.  In no event will the author be liable for any damages of
	any kind related to the use of this program.  See the GNU General
	Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

2.  FUNCTION

	EXC converts an MS-DOS EXE file to a COM file.	It is mainly for use
	with my ARK program, which allows you to create executable archives of
	COM files (see the accompanying file ARK.TXT).	ARK cannot archive EXE
	files directly, so EXE files must be converted to COM files for use
	with ARK.

	You can also use EXC to convert EXE files to COM files for use with
	Colin J. Stearman's XEQ archiver program (on which ARK was based).

3.  LIMITATIONS AND RESTRICTIONS

	EXC cannot convert Windows 3.x, Windows 95/98, Windows NT or OS/2
	executables to COM format.  Those types of executables cannot exist
	in COM format at all.

	There are several other restrictions on which files can be converted
	from EXE format to COM format by EXC.  Programs with overlays cannot
	be converted, and there is a size limit of slightly less than 64K on
	the resulting COM file, which includes the load image, the unpacker
	stub, and the packed relocation data, so if the EXE file is larger
	than about 50K it probably cannot be converted (the program will give
	an appropriate message in this case).

	Programs which check and/or modify their image on disk will not work
	properly if converted to COM files, because the program's image on disk
	is not what the program expects to see.  This applies to programs which
	validate their disk images as a crude protection against viruses (these
	programs will report that they have been tampered with, which of course
	is true), programs which contain overlays (mentioned in the previous
	paragraph) and programs which are able to update default settings by
	writing new settings to the executable (these will fail or possibly
	even corrupt themselves if they try to do this).

4.  OPERATION

	EXC's usage syntax is very simple:

		EXC Pathname[.EXE]

	EXC reads the specified executable and, if possible, converts it to a
	COM file with exactly the same path and file name but with an extension
	of '.COM'.

	EXC will overwrite any existing file with the same name as the output
	file (i.e. pathname.COM) WITHOUT ANY WARNING.

	The .EXE extension on the input file can be given but is not required.

	EXC does not delete, or modify, the input file.  Once you are happy
	that the converted program works, you can delete the EXE file manually
	(but I recommend that you should archive the EXE file somewhere first,
	in case of unforseen future problems, since I haven't provided a way
	to convert a COM file back to its original state!).

5.  ERROR MESSAGES

	EXC: Insufficient memory

		There is not enough free system memory for EXC to run.	EXC
		needs at least 64K free system RAM.

	EXC: Unable to open input file

		EXC could not open the specified input file.

	EXC: Read error on input file

		EXC detected an error while reading the input file.
		This could be due to corrupt EXE header data in the input file.

	EXC: Input file is not a valid EXE file

		EXC checks for the EXE signature at the start of the EXE header
		of the input file, and aborts if it is not found.  Use a file
		viewer to view the EXE file, and check the first two bytes.
		For a valid EXE file they should be 'M' and 'Z'.  Some EXE
		files may (maybe?) have them interchanged; in that case, use a
		binary editor to put them into the proper order!

	EXC: Input file is too large to be converted

		This message is issued if EXC cannot convert the file for any
		of several reasons.  It should not appear if the EXE file size
		is less than about 60 kilobytes.  Some EXE files larger than
		this can be converted.	EXC tries its best to convert the file
		and will only abort with this message if it really cannot
		convert the file.

		If the file is not much larger than 64K, you may be able to get
		around this limit by compressing the EXE file with an executable
		compressor such as PKLITE or LZEXE, then converting it to a COM
		file using EXC.

	EXC: Warning: EXE file may contain overlays

		This means that there is extra data in the EXE file past the
		end of the binary image.  (The binary image length is specified
		in the EXE header.)  This may mean that the file contains
		overlays or some other type of data that is loaded from the
		disk image of the file, in which case the program will not work
		if converted to a COM file.  It may also mean that the program
		was transferred with an ancient file transfer protocol such as
		XMODEM which can add up to 127 extra bytes on to the end of the
		file; in this case, the extra data may not be due to overlays.

		In any case, EXC converts the file; if you receive this message
		you should exercise the converted COM file as thoroughly as
		possible, to confirm that it doesn't have overlays.

	EXC: Unable to open output file

		EXC could not create the output file name.  This probably means
		there is already an existing file with the same name, and it is
		marked as read-only, or perhaps you are using a read-only medium
		(CD-ROM, etc).

	EXC: Write error on output file

		Probably means that the disk is full.

	EXC: Program has been converted [not an error message]

		EXC has converted the EXE file to a COM file.  You should check
		that the COM file works properly before deleting the EXE file
		(I recommend that you archive the EXE file somewhere first, in
		case of unforseen future problems, since I haven't provided a
		way to convert a COM file back to its original state!).

	Not enough memory

		This message can be issued by the fixup stub in the converted
		COM file.  It means that there was enough memory to load the
		COM file, but the program (in its original EXE format) needs
		more memory than is available.

	Packed file corrupt

		This message can be issued by the fixup stub in the converted
		COM file.  It means that there was an error in the packed
		relocation data at the end of the file, possibly because the
		file is corrupted or shortened, or maybe due to a bug (gasp!)
		in EXC.  If this occurs on a newly converted file, please
		contact the author and send a copy of the EXE file that causes
		the problem to show up.

6.  INTERNAL DETAILS

	EXC is very similar in function to Microsoft's old EXEPACK utility,
	which was used to compress the relocation table in some large programs.
	The difference is that EXEPACK leaves the file as an EXE file and does
	not have a 64K limit, whereas EXC converts the EXE file to a COM file,
	and therefore does have a 64K limit.

	EXC is _not_ like EXE2BIN (or EXE2COM, Chris Dunford's replacement for
	EXE2BIN).  EXE2BIN and EXE2COM are used to convert a program which is
	temporarily in EXE format, to its proper COM format, as part of the
	program compilation sequence.  EXC converts a functional program which
	is a functional EXE file, and is supposed to be an EXE file, into a
	functional COM file.

	You could also compare EXC to executable file compressors like PKLITE
	and LZEXE, but EXC does not compress the load image, so typically the
	converted file is a similar size to the original EXE file.  The
	converted file may be larger or smaller, depending mainly on the number
	of relocation entries in the EXE header.

	EXC works by creating a COM file which contains the original load image
	of the EXE file, a small fixup stub, and a list of packed relocation
	entries.  Since execution always begins at the start of a COM file,
	the first three bytes of the load image are replaced with a JMP to the
	stub, and the stub restores the original values that were in those
	three bytes.

	The layout of a converted file is:

		0100-0102	Three-byte JMP to fixup stub
		0103-xxxx	Original load image, minus first three bytes
		xxxx-xxxx	Fixup stub code
		xxxx-xxxx	Packed fixup (relocation) data

	I have not tested EXC extensively.  Please report any bugs you find.

6.1  EXEPACKED FILES AND COMPRESSED EXECUTABLES

	Running EXC on a file that has been packed by Microsoft's old EXEPACK
	utility or compressed by an executable compressor such as PKLITE, LZEXE
	or DIET will produce a COM file that is slightly larger than the EXE
	file.  EXC gets best performance on unpacked, uncompressed executables.

	For EXEPACKed files, it is better to unpack the file before converting
	it.  This will usually produce a COM file that is smaller than the
	EXEPACKed EXE file.

	For executable-compressed (PKLITE, LZEXE, DIET etc) files, it is also
	better to unpack the file before converting it.  You can then run the
	executable compressor on the COM file, or if you are going to include
	the file in an ARK or XEQ archive, leave it in its uncompressed state,
	and run the executable compressor on the archive file.	This will give
	better compression of the ARK file because the executable compressor
	will not be trying to compress its own output.	If you use this method,
	and you later want to extract the file, you will extract an uncompressed
	file, which could then be compressed by an executable compressor if
	desired.

	The above guidelines are to help you get the smallest COM file size.
	If an EXE program is too large to be converted to a COM file by EXC,
	you may be able to convert it if you compress the EXE file first, using
	an executable compressor like PKLITE or LZEXE.	This does not minimise
	the COM file size, and it produces an uncompressable COM file (which,
	if included in an ARK archive, can reduce the effectiveness of final
	executable compression on the ARK file, if used) but it may at least
	enable you to convert the file.

7.  HOW DO YOU PRONOUNCE 'EXC'?

	Who cares.

8.  SYSTEM REQUIREMENTS

	CPU:		8086 or later
	Memory:		64K free system memory
	DOS:		2.0 or later, or Windows 3.x/95/98/NT or OS/2

				   ----//----
