Usage: hex2bin [ | ]+ bin2hex Options: -g -- Use Intel seGmented addressing in hex files for ROMs between 64k and 1M in size. Normally, linear addressing is used for ROMs bigger than 64k. For ROMs larger than 1M, this switch has no effect, since only linear addressing is possible. -o -- default is 'out.bin' or 'out.hex' No suffix is added to the filename, so the full file name must be specified. -p -- default is 0xFF, which is the erased value for most ROM's. Pad bytes are not explicitly written out when 'bin2hex' is used. This reduces the size of sparse ROM images. -R -- may be any value. Normally this will be specified as '128k' or 0x10000. The suffixes 'k' and 'M' are recognized. The default value is 64k for 'hex2bin' and 1M for 'bin2hex'. -v [] -- used primarily for debugging. A verbosity level of 3 will print each line as it is processed. Options are global, and may be specified anywhere on the command line. Only 'flags', below, are position sensitive. Flags must be specified immediately before the file name they are to affect. They do not affect more that a single file. They reset to their default values before the next input file, scanning left to right, is processed. Flags: Flag values apply only to the following file, and are reset to the default values before the next file is processed. The source and destination flags allow code to be relocated within the ROM so that code may be loaded at a different location than where it will ultimately be run. -d -- default is 0. data will only be loaded between the limits of the -d address and the -D address minus 1. -D -- default is 16M. No data will be loaded at or above this address. -s -- default is 0. Hex input is only processed if it falls at addresses in the .hex input file between the -s address and the -S address minus 1. Likewise, Bin input is only processed if it falls between similar limits in the input ROM image. -S -- default is 16M. No input data at or above this address will be processed. Suffix: For HEX to BIN conversions, a suffix may be appended to an input filename to indicate that it is in Motorola S-record format instead of Intel hex format. /M -- there may be no space between the file- name and the /M suffix. The foregoing file is a Motorola S-record (S19) file, not an Intel hex file. Numeric values on the command line may be specified in any C-like syntax: 0x0000 is hexadecimal, 1234 is decimal, and 0177 is octal. In addition the suffixes 'k' for kilo- and 'M' for mega- cause the preceding values to be multiplied by 1024 or 1048576, respectively. Examples: hex2bin -p 0xFF -R32k cpm22.hex -o cpmtest.bin hex2bin -o cpmtest.bin cpm22.hex -R 0x8000 -p255 The preceding two lines have identical effects in all respects. hex2bin -R 1M -s 0xd000 -d 0x0800 -D0x2800 image.hex \ pagezero.hex -oROMIMAGE.bin The above line loads the 'pagezero.hex' file at the exact addresses specified in the file; however, the 'image.hex' file is assembled at 0xD000, must run at 0xD000, but is loaded between 0x800 <= addr < 0x2800. It is presumed that the code will be relocated to the correct address before it is executed. hex2bin -R16K tutor.S68/M -o tutor.bin The above line converts the Mororola SREC file 'tutor.S68' to a flat 16K binary file named 'tutor.bin'. bin2hex -R128k romimage.bin -o image.hex Simple conversion from a BIN file to a HEX file. The ROM data is limited to 128k. bin2hex -s 0x1000 -S 0x2000 -d 0x21000 romimage.bin \ -o Relocated.hex Extract from a ROM image file all of the data between 0x1000 and 0x1FFF, inclusive, and write to an Intel hex file for re-loading two 64k segments higher in a future ROM. (end)