[comp.sys.ibm.pc.misc] Anybody want to convert .EXEs -> EPROM?

chuck@eng.umd.edu (Chuck Harris - WA3UQV) (03/28/91)

Hi Netland,

	I recently upgraded a utility that I wrote a number of years ago.
This utility  converts .EXE files into Intel Hex files suitable for loading
into EPROM.

	I have used this utility for many projects where I have used Embedded
80x86 processors, and it works quite well.

	What it does is read the .EXE header file, and relocate the binary
image to a segment of your choice.  It then outputs the image as an Intel
HEX file.

	You can then burn the HEX file into EPROM and make your Embedded
System go.

	The question is: Would anyone be interested in my releasing this
program (source and .exe) to the net?  And if so, what would be the best
group to send it to?

		Chuck Harris - WA3UQV
		C.F. Harris - Consulting
		chuck@eng.umd.edu

rcollins@altos86.Altos.COM (Robert Collins) (04/02/91)

>	I recently upgraded a utility that I wrote a number of years ago.
>This utility  converts .EXE files into Intel Hex files suitable for loading
>into EPROM.
>
>	What it does is read the .EXE header file, and relocate the binary
>image to a segment of your choice.  It then outputs the image as an Intel
>HEX file.

>      The question is: Would anyone be interested in my releasing this
>program (source and .exe) to the net?  And if so, what would be the best
>group to send it to?

I too have a utility that I use to convert EXE files to other output types.
It too will strip .EXE file headers, and extracts only the BINary image
thus ignoring debug or CODEVIEW information.  However, it is very flexible.
   
* The input type can be .EXE for any other BINary format.
* The output type can be HEX-16 (MCS-86), HEX-32 (Intel HEX-32)
  ICE-486 (In-Circuit-Emulator download format for ICE386/ICE486)
  Data I/O Binary, or straight BINary.
* The EPROM image can be prefilled, or postfilled.  POSTFILL is the
  default and locates the BINary image at the bottom of the EPROM image
  (for expansion ROMs).  PREFILL locates the binary image at the TOP
  of the EPROM image (for system BIOS's).
* The fill character can be any ASCII character, or HEX character
  (default fill character = 0).
* EPROM block size can be selected in 16k granularity up to any
  32-bit size (4G if you desire).  If the .EXE for BINary file isn't
  an exact size of this granularity, then the EPROM image is filled
  in (with the fill character) to the nearest multiple of this 
  BLOCK SIZE variable.
* Calculates, and modifies the checksum.  Supports BYTE checksum,
  WORD checksum, and EVEN/ODD checksum.
* The checksum can be inserted as the checksum inverse (so the calculated
  checksum=0), or with the calculated checksum.
* ICE486, and Intel HEX-32 file formats support a loadable address anywhere
  in a 4G address range.  

The entire program is written in assembly language, and can convert a
64k ROM image to any of the file formats in less than 1.5 seconds.

Below is the "README" file associated with my program...anybody
interested?


;-----------------------------------------------------------------------------
; CVT2BIN:	  ConVerT TO BINary
;-----------------------------------------------------------------------------

Syntax:  CVT2BIN [SWITCHES] [PATH]INFILE [SWITCHES] [[PATH]OUTFILE] [SWITCHES]


Switch settings (in alphabetic order):

-BS:n		Block Size.  Uses a hex number n as the output file block size
		designator.  Any use of -F or -C will fill the output file to
		the nearest n-sized block.
		Related switches:  -C, -F
		Default = 32k (8000h)
		Minimum = 16k (4000h)

-C, -CB 	Fill the output file to the nearest increment of -BS:n, and
		modify the last byte with the [inverse] BYTE checksum.
		Related switches:  -BS, -CW, -CEO, -NI

-CW		Fill the output file to the nearest increment of -BS:n, and
		modify the last word with the [inverse] WORD checksum.
		Related switches:  -BS, -C, -CB, -CEO, -NI

-CEO		Fill the output file to the nearest increment of -BS:n, and
		modify the last word with the [inverse] EVEN and ODD BYTE
		checksum.  This options calculates separate BYTE checksums
		for even and odd eproms.
		Related switches:  -BS, -C, -CB, -CW, -NI

-F		Fill the output file to the nearest increment of -BS:n, using
		ASCIIZ (00h) as the fill character.
		Related switches:  -BS

-F:n		Fill the output file to the nearest increment of -BS:n, using
		the hex digit n as the fill character.
		Related switches:  -BS

-F'c'		Fill the output file to the nearest increment of -BS:n, using
		the character 'c' as the fill character.
		Related switches:  -BS

-F"c"		Fill the output file to the nearest increment of -BS:n, using
		the character "c" as the fill character.
		Related switches:  -BS

-LA:n		Load address.  This option is used in conjunction with
		-OT:Type, whose outputs can specify an absolute Load Address.
		The Load Address is specified as an absolute 32-bit address
		by the hex number n.  Leading zero's aren't necesary.
		Related switches:  -OT
		Default = 00000000h
		Maximum = FFFFFFFFh

-NI		Not Inverse checksum.  Used with -Cx to specify that the
		output file will NOT be modified with the Inverse checksum.
		Instead, the calculated checksum will be used as the modifier.
		Related switches:  -C, -CB, -CW, -CEO

-OT:Type	Output Type specifies which output file format to use:
		DIOT10	- Data I/O binary Type 10
			  Default extension:  .BIN

		HEX32	- Intel HEX32
			  Default extension:  .HEX

		MCS86	- Intel MCS86 Hex
			  Default extension:  .HEX

		ICE486	- Intel ICE-386/486 download
			  Default extension:  .ICE

		BIN	- Straight BINary.  (Like EXE2BIN output.)
			  Default extension:  .BIN

		Default:  -OT:DIOT10

-PF		PreFill the output file.  This switch has the affect of
		moving the ROM image to the highest memory address in
		the output file.


Application notes:
*	.EXE files can be used as input.  The .EXE header is analyzed and
	removed.  Only the BINary image is extracted.  Debug or Codeview
	information is excluded from the output.  Therefore, an implicit
	EXE2BIN is performed on .EXE files by CVT2BIN.

*	Invokation of some switches, implicitely sets others.
	-F is implicitely set by any invokation of -C.
	-BS:8000 is implicitely set by invoking either -C, or -F.  Explicitly
	  using -BS:n will override this implicit setting.

*	Switches on the command line can be placed in any order, before or
	after the input [and output] file(s).

*	Specifying an output file isn't necesary.  The output filename
	defaults to using the input filename body, with the default
	.EXTension for the specified output type.

*	Using the ':' in switches specifying a ':' isn't required.  CVT2BIN
	will ignore the ':' if present.  It is there simply for visual
	purposes.


Example:  CVT2BIN -OTICE486 BIOS.EXE -C BIOS.BIN -F'R' -LA:FFFC0000
	  * Output is ICE386/ICE486 downloadable
	  * Use BIOS.EXE as the input file
	  * Calculate BYTE checksum and fill to nearest 32k (implicit)
	  * Use BIOS.BIN as the output file
	  * Fill to nearest 32k using 'R' as the fill character
	  * Set the ICE load address to FFFC0000h



-- 
"Worship the Lord your God, and serve him only."  Mat. 4:10
Robert Collins                 UUCP:  ...!sun!altos86!rcollins
HOME:  (408) 225-8002
WORK:  (408) 432-6200 x4356