Article 2345 of comp.os.cpm: Path: intelisc!littlei!ogccse!blake!uw-beaver!mit-eddie!bloom-beacon!apple!voder!pyramid!prls!gordon From: gordon@prls.UUCP (Gordon Vickers) Newsgroups: comp.os.cpm Subject: Re: Intel hex (*.HEX) format questions Message-ID: <19411@prls.UUCP> Date: 24 Feb 89 18:05:54 GMT References: <1796@uop.edu> Reply-To: gordon@prls.UUCP (Gordon Vickers) Organization: Philips Research Labs, Sunnyvale, California Lines: 43 Posted: Fri Feb 24 10:05:54 1989 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. Article 1972 of comp.os.cpm: Relay-Version: version B 2.10.3 Pyramid OSx-3.0 85/11/15; site intelisc.UUCP Path: intelisc!omepd!psu-cs!reed!tektronix!uunet!husc6!think!ames!pasteur!ucbvax!NCS.DND.CA!marwood From: marwood@NCS.DND.CA (Gordon Marwood) Newsgroups: comp.os.cpm Subject: Intel HEX Format Message-ID: <8811191321.AA08491@ncs.dnd.ca> Date: 19 Nov 88 13:21:25 GMT Date-Received: 23 Nov 88 05:10:38 GMT Sender: usenet@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 30 In response to Nick Sayer's query about the Intel HEX format, the following information is given in "The Programmer's CP/M Handbook" by Johnson-Laird:- : 04 0158 00 64 00 01 80 BE ^ ^ ^ ^ (____________) ^ | | | | | | | | | | | |____ Checksum formed by adding up | | | | | all of the numbers after the | | | | | colon and subtracting their | | | | | sum from 00H. | | | | | | | | | |_______________ Data bytes | | | | | | | |________________________ Record type, normally 00 | | | | | |_____________________________ Load address for data bytes | | on current line. | | | |__________________________________ Number of data bytes on line | |_______________________________________ Beginning of line marker I don't know if the record type is ever anything but 00. Gordon Marwood Article 1983 of comp.os.cpm: Relay-Version: version B 2.10.3 Pyramid OSx-3.0 85/11/15; site intelisc.UUCP Path: intelisc!littlei!ogccse!blake!uw-beaver!cornell!rochester!bbn!oberon!caesar.usc.edu!mlinar From: mlinar@caesar.usc.edu (Mitch Mlinar) Newsgroups: comp.os.cpm Subject: Re: Sigh... here we go again Message-ID: <13523@oberon.USC.EDU> Date: 18 Nov 88 20:31:02 GMT Date-Received: 23 Nov 88 15:10:08 GMT References: <1739@uop.edu> Sender: news@oberon.USC.EDU Reply-To: mlinar@caesar.usc.edu (Mitch Mlinar) Organization: University of Southern California, Los Angeles, CA Lines: 37 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 Article 1996 of comp.os.cpm: Relay-Version: version B 2.10.3 Pyramid OSx-3.0 85/11/15; site intelisc.UUCP Path: intelisc!omepd!mipos3!intelca!oliveb!pyramid!amdahl!uunet!mcvax!unido!nixpbe!gla From: gla@nixpbe.UUCP Newsgroups: comp.os.cpm Subject: Re: Intel HEX Format Message-ID: <28200002@nixpbe> Date: 24 Nov 88 07:37:00 GMT Date-Received: 27 Nov 88 10:03:52 GMT References: <7040035@ncs.dnd.ca> Lines: 15 Nf-ID: #R:ncs.dnd.ca:-704003596:nixpbe:28200002:000:421 Nf-From: nixpbe.UUCP!gla Nov 24 08:37:00 1988 The Intel Hex Object format is documented in MCS 86 Absoulte Object Formats Order Number 9800821-01 Issued 1979 and should be obtainable from Intel. There are more record types: 02 Extended Address (provides high order 16 of 24 bit address) 03 Start Address (2 16-Bit values, namely CS and IP) 01 End-Of-File Record (no data) Rainer Glaschick, Nixdorf Computers, Germany (... uunet!linus!nixbur!glaschick.pad )