Date : Fri, 18 Nov 1988 20:31:02 GMT
From : caesar.usc.edu!mlinar@oberon.usc.edu (Mitch Mlinar)
Subject: Sigh... here we go again
In article <1739@uop.edu> mrapple@uop.edu (Nick Sayer) writes:
>It's me again. This time I'm interested in the format of a
>.HEX file. I've noticed this:
>
>:1001000000112233445566778899AABBCCDDEEFFxx
>| | | ||------------------------------| |
>| | | | | checksum?
>| | | | data bytes
>| | | zero byte
>| | address
>| number of bytes in data field
>required ":"
>
>:0000000000 marks EOF
>
>The questions are this: Is there a purpose to the zero byte
>before the begining of the data field? How do you compute the
>checksum on the end of the line?
The zero byte is NOT always zero; it indicates the record type of this
line of hex code. The last line of a HEX file is usually:
:00xxyy01
where xxyy is the starting address for example, although I have seen other
meanings for it. The 01 indicates this is the last record.
Checksum is computed by taking the sum of all bytes on the line (the colon is
ignored) and inverting it. In other words, if you sum all bytes on the
line including the checksum, the result should be an 8-bit zero (ignore any
carry beyond 8-bits).
I have seem some implementations which, for some reason, ignore the count
byte (1st one) in computing the checksum. Don't know how that happened,
but that method is wrong.
-Mitch