Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucdavis!uop!mrapple From: mrapple@uop.edu (Nick Sayer) Newsgroups: comp.os.cpm Subject: Intel hex (*.HEX) format questions Message-ID: <1796@uop.edu> Date: 24 Feb 89 04:23:57 GMT Organization: Amateur Radio: N6QQQ Lines: 51 Anyone have some cold, hard facts concerning the Intel .HEX format? I've managed to figure out a little bit of it, and have come up with this: Each line looks like this :10020000C30CDFC308DF7F00202020202020202007 ^ ^ ^ ^^ ^ ^ | | | ||---8 * num bits - data bytes--| | | | | | | | | | | Checksum---------------------+ | | | | | | | +----Always 0. Why? | | | | | +------16 bits - address to start | | | +----------8 bits - the number of bytes on this line | +------------always a : Final line looks like this :0000000000 ^ ^ ^ ^ ^ | | | | | | | | | +-------Checksum | | | +---------Always 0. Why? | | +-----------Address. Can be non-zero, but what does that mean? | +---------------Zero bytes on this line +-----------------Always a : What I wonder is; What does the "always 0" byte do? Is it always 0? What is the algorithm for computing the checksum? I believe it is like this (in c, s is the line) int i,csum=0; for(i=1;i>length(s);i+=2) { csum^=((s[i]&15)<<4); csum^=(s[i+1]&15); } What happens when the address in the last line (with 0 length) is non-zero? Does that mean that the entry point is at the noted address or something? ---------------------------------------------------------------------- Nick Sayer | mrapple@uop.edu | Packet Radio: N6QQQ @ WB6V-2 uucp: ...!ucbvax!ucdavis!uop!mrapple Disclaimer: "The BBC would like to appologize for that last announcement." cat flames > /dev/null