<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 24 Feb 1989 18:05:54 GMT
From   : pyramid!prls!gordon@hplabs.hp.com (Gordon Vickers)
Subject: Intel hex (*.HEX) format questions

In article <1796@uop.edu> mrapple@uop.edu (Nick Sayer) writes:
>Anyone have some cold, hard facts concerning the Intel .HEX format?

   I was going to email this to Mr. Sayer but it seems like something
 that many would like to know.

  There are two forms of Intel Hex format. One is often referred to as
 Intellect format, the other is Extended Intellec. I beleive that the
 former is also known as Motorala 'S' records.

 Intellect format:

 :100000007320457175697320446f7320457175693c
 
 : 10 0000 00 7320457175697320446f732045717569 5c
 |  |   |   | |--------- data ---------------|  |- check sum
 |  |   |   |-- record type, 00 = data, 01 = End record
 |  |   |-- start address for data
 |  |- number of bytes in record (normally ten, but last line may have less)
 |- start of a record, if you don't have this, line is ignored


 Extended Intellect format
   As above but recognizes a record type 02.  Record type 02 is followd
  by a four digit base address and the checksum. Addresses in subsequent
  type 00 and type 01 records are relitive to this base address.  This
  allows address up to FFFFF to be specified.

In both formats the checksum is determined by:
   remove start code and checksum from line ( :5c )
   add the remaining bytes together ( 10+00+00+00+73+20.......+69 = A4 )
   compilment and add 1 ( A4 xor ff = 5b, 5b + 1 = 5c ) 
   the result is the checksum: 5c
     This is an oversimplification. Remember to add the values in the bit
   stream (the actual binary values) and not the ascii values of the numbers
   that get printed to the record.  Don't forget to change the checksum
   into two ascii digits when tacking it on the the end of the record.

Hope this helps.
Referance: Stag PP39 device programmer's manual.

Gordon Vickers 408/991-5370 (Sunnyvale,Ca); {mips|pyramid|philabs}!prls!gordon
Every extinction, whether animal, mineral, or vegetable, hastens our own
demise.

<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>