byte2bin

This little utility program is intended for use with the AS31 assembler for 8051-style microcontrollers. While this assembler can output standard INTEL HEX files, some EPROM programmers (notably mine, 12 years old) do not understand this format. AS31 can output a byte oriented format, though, which puts one byte on each line, prefixed by its address. This output format is selected using AS31's -Fbyte command line option.

byte2bin now takes one or more of these byte-format input files and fills an internal memory image with the contained data. Finally, the image is written to a file which is readable by most EPROM programmers in "binary" mode.

Download
The code consists of a single C source file. I have put it in a zip file (here) together with a Windows 32 bit executable created from it using the (free) Borland BCC 5.5 compiler.
Synopsis
byte2bin - v1.00 - 10.11.2002 - Matthias Gaertner - mgaert@web.de
Usage:
byte2bin [-s <size>] [-o <offset>] [-u] <output file> {<input file>}+

Example:
byte2bin -s 64K -o 32K paulmon.bin paulmon21.byte extra.byte

byte2bin allocates an internal buffer of the given size (default: 32K)
and transfers all data in the given input file(s) into this buffer.
The input files are processed in sequence. Redundant definitions for the
same address in later files will overwrite earlier specifications.

Options:
 -s (size) Specify the image file size as a decimal number, optionally
    followed by K or M (i.e. 2048, 2K, 4M). The memory area will be
    initialized with 0xFF bytes.
 -o (offset) Add an offset to all addresses of the input file. Default: 0.
 -u (update) The 'output file' is read first, then modified, then written
    back. Use this to mix different input files at different offsets into
    one image. The file must contain at least the number of bytes specified
    by the -s option. Bytes beyond that will be ignored, but retained.

Advanced options:
 -A (Address shuffling) Specify a shuffling of the address bits. The 16
    input bits are denoted F-A9-0. A valid permutation is any 16-character
    sequence of these. Additionally, symbols H and L may be used to force
    address bits to high or low. Use this to allow for non-standard address
    line wirings (where uP's A0 is connected to memory's A8, for example).
    Shuffling is done on the input file addresses before adding the offset.
    Default is FEDCBA9876543210, i.e no shuffling.
 -D (Data shuffling) Same as -A, but for the 8 data bits.
    Default is 76543210, i.e no shuffling.

byte2bin is in the public domain. byte2bin is distributed in the hope that it
will be useful, but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
Links
Copyright

This code has been written by me, Matthias Gärtner. I place it in the public domain.

Back

 

This page was last changed on November 10th, 2002. © Matthias Gärtner 2002