1srec_intel(5)                 File Formats Manual                srec_intel(5)
2
3
4

NAME

6       srec_intel - Intel Hexadecimal object file format specification
7

DESCRIPTION

9       This format is also known as the Intel MCS-86 Object format.
10
11       This  document  describes  the  hexadecimal  object file format for the
12       Intel 8-bit, 16-bit, and 32-bit microprocessors.  The hexadecimal  for‐
13       mat is suitable as input to PROM programmers or hardware emulators.
14
15       Hexadecimal  object  file  format  is a way of representing an absolute
16       binary object file in ASCII.  Because the file is in ASCII  instead  of
17       binary,  it  is possible to store the file is non-binary medium such as
18       paper-tape, punch cards, etc.; and the file can also  be  displayed  on
19       CRT  terminals, line printers, etc..  The 8-bit hexadecimal object file
20       format allows for the placement of code and data within the 16-bit lin‐
21       ear  address space of the Intel 8-bit processors.  The 16-bit hexadeci‐
22       mal format allows for the 20-bit segmented address space of  the  Intel
23       16-bit  processors.  And the 32-bit format allows for the 32-bit linear
24       address space of the Intel 32-bit processors.
25
26       The hexadecimal representation of binary is coded in ASCII alphanumeric
27       characters.   For  example,  the  8-bit binary value 0011-1111 is 3F in
28       hexadecimal.  To code this in ASCII,  one  8-bit  byte  containing  the
29       ASCII code for the character '3' (0011-0011 or 0x33) and one 8-bit byte
30       containing the) ASCII code for the character 'F'  (0100-0110  or  0x46)
31       are required.  For each byte value, the high-order hexadecimal digit is
32       always the first digit of the pair of hexadecimal digits.  This  repre‐
33       sentation  (ASCII  hexadecimal)  requires  twice  as  many bytes as the
34       binary representation.
35
36       A hexadecimal object file is blocked into records, each of  which  con‐
37       tains  the  record  type,  length,  memory load address and checksum in
38       addition to the data.  There are currently six (6) different  types  of
39       records  that  are  defined,  not all combinations of these records are
40       meaningful, however.  The record are:
41
42       · Data Record (8-, 16-, or 32-bit formats)
43
44       · End of File Record (8-, 16-, or 32-bit formats)
45
46       · Extended Segment Address Record (16- or 32-bit formats)
47
48       · Start Segment Address Record (16- or 32-bit formats)
49
50       · Extended Linear Address Record (32-bit format only)
51
52       · Start Linear Address Record (32-bit format only)
53
54   General Record Format
55       ┌───────┬────────┬────────┬────────┬──────┬──────────┐
56       │Record │ Record │ Load   │ Record │ Data │ Checksum │
57       │Mark   │ Length │ Offset │ Type   │      │          │
58       └───────┴────────┴────────┴────────┴──────┴──────────┘
59       Record Mark.
60               Each record begins with a Record Mark  field  containing  0x3A,
61               the ASCII code for the colon (``:'') character.
62
63       Record Length
64               Each  record has a Record Length field which specifies the num‐
65               ber of bytes of information or data which  follows  the  Record
66               Type  field of the record.  This field is one byte, represented
67               as two hexadecimal characters.  The maximum value of the Record
68               Length field is hexadecimal 'FF' or 255.
69
70       Load Offset
71               Each  record has a Load Offset field which specifies the 16-bit
72               starting load offset of the data bytes, therefore this field is
73               only  used for Data Records.  In other records where this field
74               is not used, it should be coded as four ASCII  zero  characters
75               (``0000''  or 0x30303030).  This field is two byte, represented
76               as four hexadecimal characters.
77
78       Record Type
79               Each record has a Record Type field which specifies the  record
80               type  of  this record.  The Record Type field is used to inter‐
81               pret the remaining information within the record.   This  field
82               is  one  byte,  represented as two hexadecimal characters.  The
83               encoding for all the current record types are:
84
85               0  Data Record
86
87               1  End of File Record
88
89               2  Extended Segment Address Record
90
91               3  Start Segment Address Record
92
93               4  Extended Linear Address Record
94
95               5  Start Linear Address Record
96
97       Data    Each record has a variable length Data field,  it  consists  of
98               zero or more bytes encoded as pairs of hexadecimal digits.  The
99               interpretation of this field depends on the Record Type field.
100
101       Checksum
102               Each record ends with a Checksum field that contains the  ASCII
103               hexadecimal  representation  of  the  two's  complement of  the
104               8-bit bytes that result from  converting  each  pair  of  ASCII
105               hexadecimal  digits  to  one byte of binary, from and including
106               the Record Length field to and including the last byte  of  the
107               Data  field.   Therefore,  the  sum of all the ASCII pairs in a
108               record after converting to binary, from the Record Length field
109               to and including the Checksum field, is zero.
110
111   Extended Linear Address Record
112       (32-bit format only)
113
114       ┌────────┬────────┬────────┬────────┬───────────┬──────────┐
115       │Record  │ Record │ Load   │ Record │ ULBA      │ Checksum │
116       │Mark    │ Length │ Offset │ Type   │ (2 bytes) │          │
117       │(``:'') │ (2)    │ (0)    │ (4)    │           │          │
118       └T─h─e──3─2─-─b─i┴t──E─x─t─e─n─d─e┴d──L─i─n─e─a─r─┴A─d─d─r─e─s─s──R┴e─c─o─r─d──i─s──u─s─e┴d──t─o──s─p─e─c─i─f┘y bits 16-31
119       of  the Linear Base Address (LBA), where bits 0-15 of the LBA are zero.
120       Bits 16-31 of the LBA are referred to as the Upper Linear Base  Address
121       (ULBA).   The absolute memory address of a content byte in a subsequent
122       Data Record is) obtained by adding the LBA to an offset  calculated  by
123       adding the Load Offset field of the containing Data Record to the index
124       of the byte in the Data Record (0, 1, 2, ... n).  This offset  addition
125       is done) modulo 4G (i.e. 32-bits from 0xFFFFFFFF to 0x00000000) results
126       in wrapping around from the end to  the  beginning  of  the  4G  linear
127       address  defined  by the LBA.  The linear address at which a particular
128       byte is loaded is calculated as:
129              (LBA + DRLO + DRI) MOD 4G
130       where:
131
132              DRLO is the Load Offset field of a Data Record.
133
134              DRI  is the data byte index within the Data Record.
135       When an Extended Linear Address Record defines the value of LBA, it may
136       appear  anywhere  within  a  32-bit hexadecimal object file. This value
137       remains in effect until  another  Extended  Linear  Address  Record  is
138       encountered.  The LBA defaults to zero until an Extended Linear Address
139       Record is encountered.  The contents of the  individual  fields  within
140       the record are:
141
142       Record Mark
143               This field contains 0x3A, the hexadecimal encoding of the ASCII
144               colon (``:'') character.
145
146       Record Length
147               The field contains 0x3032,  the  hexadecimal  encoding  of  the
148               ASCII  characters ``02'', which is the length, in bytes, of the
149               ULBA data information within this record.
150
151       Load Offset
152               This field contains 0x30303030, the hexadecimal encoding of the
153               ASCII  characters  ``0000'',  since  this field is not used for
154               this record.
155
156       Record Type
157               This field contains 0x3034, the  hexadecimal  encoding  of  the
158               ASCII  character  ``04'', which specifies the record type to be
159               an Extended Linear Address Record.
160
161       ULBA    This field contains four ASCII hexadecimal digits that  specify
162               the  16-bit  Upper  Linear  Base  Address  value.  The value is
163               encoded big-endian (most significant digit first).
164
165       Checksum
166               This field contains the check sum on the  Record  Length,  Load
167               Offset, Record Type, and ULBA fields.
168
169   Extended Segment Address Record
170       (16- or 32-bit formats)
171
172       ┌────────┬────────┬────────┬────────┬───────────┬──────────┐
173       │Record  │ Record │ Load   │ Record │ USBA      │ Checksum │
174       │Mark    │ Length │ Offset │ Type   │ (2 bytes) │          │
175       │(``:'') │ (2)    │ (0)    │ (2)    │           │          │
176       └T─h─e──1─6─-─b─i┴t──E─x─t─e─n─d─e┴d──S─e─g─m─e─n─t┴─A─d─d─r─e─s─s─┴R─e─c─o─r─d──i─s──u─s┴e─d──t─o──s─p─e─c─i┘fy bits 4-19
177       of  the Segment Base Address (SBA), where bits 0-3 of the SBA are zero.
178       Bits 4-19 of the SBA are referred to as the Upper Segment Base  Address
179       (USBA).   The absolute memory address of a content byte in a subsequent
180       Data Record is) obtained by adding the SBA to an offset  calculated  by
181       adding the Load Offset field of the containing Data Record to the index
182       of the byte in the Data Record (0, 1, 2, ... n).  This offset  addition
183       is done modulo 64K (i.e. 16-bits from 0xFFFF to 0x0000 results in wrap‐
184       ping around from the end to the beginning of the 64K segment defined by
185       the  SBA.   The  address at which a particular byte is loaded is calcu‐
186       lated as:
187              SBA + ((DRLO + DRI) MOD 64K)
188       where:
189
190              DRLO is the LOAD OFFSET field of a Data Record.
191
192              DRI  is the data byte index within the Data Record.
193
194       When an Extended Segment Address Record defines the value  of  SBA,  it
195       may  appear  anywhere  within  a  16-bit hexadecimal object file.  This
196       value remains in effect until another Extended Segment  Address  Record
197       is  encountered.   The  SBA  defaults to zero until an Extended Segment
198       Address Record is encountered.
199
200       The contents of the individual fields within the record are:
201
202       Record Mark
203               This field contains 0x3A, the hexadecimal encoding of the ASCII
204               colon (``:'') character.
205
206       Record Length
207               The  field  contains  0x3032,  the  hexadecimal encoding of the
208               ASCII characters '02', which is the length, in  bytes,  of  the
209               USBA data information within this record.
210
211       Load Offset
212               This field contains 0x30303030, the hexadecimal encoding of the
213               ASCII characters '0000', since this field is not used for  this
214               record.
215
216       Record Type
217               This  field  contains  0x3032,  the hexadecimal encoding of the
218               ASCII character ``02'', which specifies the record type  to  be
219               an Extended Segment Address Record.
220
221       USBA    This  field contains four ASCII hexadecimal digits that specify
222               the 16-bit Upper Segment Base  Address  value.   The  field  is
223               encoded big-endian (most significant digit first).
224
225       Checksum
226               This  field  contains  the check sum on the Record length, Load
227               Offset, Record Type, and USBA fields.
228
229   Data Record
230       (8-, 16- or 32-bit formats)
231
232       ┌────────┬────────┬────────┬────────┬──────┬──────────┐
233       │Record  │ Record │ Load   │ Record │ Data │ Checksum │
234       │Mark    │ Length │ Offset │ Type   │      │          │
235       │(``:'') │        │        │        │      │          │
236       └T─h─e──D─a─t─a─┴R─e─c─o─r─d──p─r┴o─v─i─d─e─s──a─┴s─e─t──o─f──h─e┴x─a─d─e─c─i─m┴a─l──d─i─g─i─t─s──t┘hat represent the
237       ASCII code for data bytes that make up a portion  of  a  memory  image.
238       The  method  for  calculating the absolute address (linear in the 8-bit
239       and 32-bit case and segmented in the 16-bit case) for each byte of data
240       is  described  in the discussions of the Extended Linear Address Record
241       and the Extended Segment Address Record.
242
243       The contents of the individual fields within the record are:
244
245       Record Mark
246               This field contains 0x3A, the hexadecimal encoding of the ASCII
247               colon (``:'') character.
248
249       Record Length
250               The  field  contains  two ASCII hexadecimal digits that specify
251               the number of data bytes in the record.  The maximum  value  is
252               255 decimal.
253
254       Load Offset
255               This  field contains four ASCII hexadecimal digits representing
256               the offset from the LBA (see Extended Linear Address Record see
257               Extended Segment Address Record) defining the address which the
258               first byte of the data is to be placed.
259
260       Record Type
261               This field contains 0x3030, the  hexadecimal  encoding  of  the
262               ASCII character ``00'', which specifies the record type to be a
263               Data Record.
264
265       Data    This field contains pairs of ASCII hexadecimal digits, one pair
266               for each data byte.
267
268       Checksum
269               This  field  contains  the check sum on the Record Length, Load
270               Offset, Record Type, and Data fields.
271
272   Start Linear Address Record
273       (32-bit format only)
274
275       ┌────────┬────────┬────────┬────────┬───────────┬──────────┐
276       │Record  │ Record │ Load   │ Record │ EIP       │ Checksum │
277       │Mark    │ Length │ Offset │ Type   │ (4 bytes) │          │
278       │(``:'') │ (4)    │ (0)    │ (5)    │           │          │
279       └T─h─e──S─t─a─r─t┴─L─i─n─e─a─r──A┴d─d─r─e─s─s──R─e┴c─o─r─d──i─s──u┴s─e─d──t─o──s─p─e─c─i┴f─y──t─h─e──e─x─e─c┘ution  start
280       address  for  the  object  file.   The value given is the 32-bit linear
281       address for the EIP register.  Note that this record only specifies the
282       code  address  within the 32-bit linear address space of the 80386.  If
283       the code is to start execution in the real mode of the 80386, then  the
284       Start  Segment Address Record should be used instead, since that record
285       specifies both the CS and IP register contents necessary for real mode.
286
287       The Start Linear Address Record can appear anywhere in a  32-bit  hexa‐
288       decimal  object file.  If such a record is not present in a hexadecimal
289       object file, a loader is free to assign a default start address.
290
291       The contents of the individual fields within the record are:
292
293       Record mark
294               This field contains 0x3A, the hexadecimal encoding of the ASCII
295               colon (``:'') character.
296
297       Record length
298               The  field  contains  0x3034,  the  hexadecimal encoding of the
299               ASCII characters ``04'', which is the length, in bytes, of  the
300               EIP register content within this record.
301
302       Load Offset
303               This field contains 0x30303030, the hexadecimal encoding of the
304               ASCII characters ``0000'', since this field  is  not  used  for
305               this record.
306
307       Record Type
308               This  field  contains  0x3035,  the hexadecimal encoding of the
309               ASCII character ``05'', which specifies the record type to be a
310               Start Linear Address Record.
311
312       EIP     This field contains eight ASCII hexadecimal digits that specify
313               the 32-bit EIP register contents.  The field  is  encoded  big-
314               endian (most significant digit first).
315
316       Checksum
317               This  field  contains  the check sum on the Record length, Load
318               Offset, Record Type, and EIP fields.
319
320   Start Segment Address Record
321       (16- or 32-bit formats)
322
323       ┌────────┬────────┬────────┬────────┬────────────┬────────────┬──────────┐
324       │Record  │ Record │ Load   │ Record │ CS      (2 │ IP      (2 │ Checksum │
325       │Mark    │ Length │ Offset │ Type   │ bytes)     │ bytes)     │          │
326       │(``:'') │ (4)    │ (0)    │ (3)    │            │            │          │
327       └T─h─e──S─t─a─r─t┴─S─e─g─m─e─n─t─┴A─d─d─r─e─s─s──R┴e─c─o─r─d──i─s─┴u─s─e─d──t─o──s─p─e─c─i┴f─y──t─h─e──e─x─e─c─u─t┴i─o─n──s─t─a─r─t──┘
328       address for the object file.  The value given  is  the  20-bit  segment
329       address for the CS and IP registers.  Note that this record only speci‐
330       fies the code address within the 20-bit segmented address space of  the
331       8086/80186.   The Start Segment Address Record can appear anywhere in a
332       16-bit hexadecimal object file.   If such a record is not present in  a
333       hexadecimal  object  file,  a  loader is free to assign a default start
334       address.
335
336       The contents of the individual fields within the record are:
337
338       Record Mark
339               This field contains 0x3A, the hexadecimal encoding of the ASCII
340               colon (``:'') character.
341
342       Record Length
343               The  field  contains  0x3034,  the  hexadecimal encoding of the
344               ASCII characters ``04'', which is the length, in bytes, of  the
345               CS and IP register contents within this record.
346
347       Load Offset
348               This field contains 0x30303030, the hexadecimal encoding of the
349               ASCII characters ``0000'', since this field  is  not  used  for
350               this record.
351
352       Record Type
353               This  field  contains  0x3033,  the hexadecimal encoding of the
354               ASCII character '03', which specifies the record type to  be  a
355               Start Segment Address Record.
356
357       CS      This  field contains four ASCII hexadecimal digits that specify
358               the 16-bit CS register contents.  The  field  is  encoded  big-
359               endian (most significant digit first).
360
361       IP      This  field contains four ASCII hexadecimal digits that specify
362               the 16-bit IP register contents.  The  field  is  encoded  big-
363               endian (most significant digit first).
364
365       Checksum
366               This  field  contains  the check sum on the Record length, Load
367               Offset, Record Type, CS, and IP fields.
368
369   End of File Record
370       (8-, 16-, or 32-bit formats)
371
372       ┌────────┬────────┬────────┬────────┬──────────┐
373       │Record  │ Record │ Load   │ Record │ Checksum │
374       │Mark    │ Length │ Offset │ Type   │ (0xFF)   │
375       │(``:'') │ (0)    │ (0)    │ (1)    │          │
376       └T─h─e──E─n─d──o┴f──F─i─l─e──R─e┴c─o─r─d──s─p─e─c┴i─f─i─e─s──t─h─e┴──e─n─d───o─f──┘the  hexadecimal  object
377       file.
378
379       The contents of the individual fields within the record are:
380
381       Record mark
382               This field contains 0x3A, the hexadecimal encoding of the ASCII
383               colon (``:'') character.
384
385       Record Length
386               The field contains 0x3030,  the  hexadecimal  encoding  of  the
387               ASCII  characters  ``00''.   Since this record does not contain
388               any Data bytes, the length is zero.
389
390       Load Offset
391               This field contains 0x30303030, the hexadecimal encoding of the
392               ASCII  characters  ``0000'',  since  this field is not used for
393               this record.
394
395       Record Type
396               This field contains 0x3031, the  hexadecimal  encoding  of  the
397               ASCII  character  ``01'', which specifies the record type to be
398               an End of File Record.
399
400       Checksum
401               This field contains the check sum an the  Record  Length,  Load
402               Offset,  and  Record  Type  fields.   Since  all the fields are
403               static, the check sum can also be  calculated  statically,  and
404               the  value  is  0x4646,  the  hexadecimal encoding of the ASCII
405               characters ``FF''.
406
407   Size Multiplier
408       In general, binary data will expand in sized by approximately 2.3 times
409       when represented with this format.
410

EXAMPLE

412       Here  is  an  example  Intel  hex  file.  It contains the data ``Hello,
413       World'' to be loaded at address 0.
414              :0D00000048656C6C6F2C20576F726C640AA1
415              :00000001FF
416

REFERENCE

418       This information comes (very indirectly) from Microprocessors and  Pro‐
419       grammed  Logic,  Second Edition, Kenneth L. Short, 1987, Prentice-Hall,
420       ISBN 0-13-580606-2.
421
423       srec_cat version 1.35
424       Copyright (C) 1998, 1999, 2000, 2001, 2002,  2003,  2004,  2005,  2006,
425       2007 Peter Miller
426
427       The srec_cat program comes with ABSOLUTELY NO WARRANTY; for details use
428       the 'srec_cat -VERSion License' command.  This is free software and you
429       are  welcome  to  redistribute it under certain conditions; for details
430       use the 'srec_cat -VERSion License' command.
431

AUTHOR

433       Peter Miller   E-Mail:   millerp@canb.auug.org.au
434       /\/\*             WWW:   http://www.canb.auug.org.au/~millerp/
435
436   Derivation
437       This manual page is derived from a file marked as follows:
438
439       Intel Hexadecimal Object File Format Specification; Revision A, 1/6/88
440
441       Disclaimer: Intel makes no representation or warranties with respect to
442       the  contents  hereof and specifically disclaims any implied warranties
443       of merchantability or fitness for  any  particular  purpose.   Further,
444       Intel  reserves  the right to revise this publication from time to time
445       in the content hereof without obligation of Intel to notify any  person
446       of  such  revision  or  changes.  The publication of this specification
447       should not be construed as a commitment on Intel's  part  to  implement
448       any product.
449
450
451
452Reference Manual                    SRecord                      srec_intel(5)
Impressum