2 Hexadecimal Object File
10 Intel makes no representation or warranties with respect to the contents
11 hereof and specifically disclaims any implied warranties of
12 merchantability or fitness for any particular purpose. Further, Intel
13 reserves the right to revise this publication from time to time in the
14 content hereof without obligation of Intel to notify any person of such
15 revision or changes. The publication of this specification should not
16 be construed as a commitment on Intel's part to implement any product.
20 This document describes the hexadecimal object file format for the Intel
21 8- bit, 16-bit, and 32-bit microprocessors. The hexadecimal format is
22 suitable as input to PROM programmers or hardware emulators.
23 Hexadecimal object file format is a way of representing an absolute
24 binary object file in ASCII. Because the file is in ASCII instead of
25 binary, it is possible to store the file is non-binary medium such as
26 paper-tape, punch cards, etc.; and the file can also be displayed on CRT
27 terminals, line printers, etc.. The 8-bit hexadecimal object file
28 format allows for the placement of code and data within the 16-bit
29 linear address space of the Intel 8-bit processors. The 16-bit
30 hexadecimal format allows for the 20-bit segmented address space of the
31 Intel 16-bit processors. And the 32-bit format allows for the 32-bit
32 linear address space of the Intel 32-bit processors.
33 The hexadecimal representation of binary is coded in ASCII alphanumeric
34 characters. For example, the 8-bit binary value 0011-1111 is 3F in
35 hexadecimal. To code this in ASCII, one 8-bit byte containing the ASCII
36 code for the character '3' (0011-0011 or 033H) and one 8-bit byte
37 containing the ASCII code for the character 'F' (0100-0110 or 046H) are
38 required. For each byte value, the high-order hexadecimal digit is
39 always the first digit of the pair of hexadecimal digits. This
40 representation (ASCII hexadecimal) requires twice as ma ny bytes as the
41 binary representation.
42 A hexadecimal object file is blocked into records, each of which
43 contains the record type, length, memory load address and checksum in
44 addition to the data. There are currently six (6) different types of
45 records that are defined, not all combinations of these records are
46 meaningful, however. The records are:
48 Data Record (8-, 16-, or 32-bit formats)
49 End of File Record (8-, 16-, or 32-bit formats)
50 Extended Segment Address Record (16- or 32-bit formats)
51 Start Segment Address Record (16- or 32-bit formats)
52 Extended Linear Address Record (32-bit format only)
53 Start Linear Address Record (32-bit format only)
56 2. General Record Format
57 | RECORD | LOAD | | | INFO | |
58 | MARK | RECLEN | OFFSET | RECTYP | or | CHKSUM |
59 | ':' | | | | DATA | |
60 1-byte 1-byte 2-bytes 1-byte n-bytes 1-byte
62 Each record begins with a RECORD MARK field containing 03AH, the ASCII
63 code for the colon (':') character.
64 Each record has a RECLEN field which specifies the number of bytes of
65 information or data which follows the RECTYP field of the record. Note
66 that one data byte is represented by two ASCII characters. The maximum
67 value of the RECLEN field is hexadecimal 'FF' or 255.
68 Each record has a LOAD OFFSET field which specifies the 16-bit starting
69 load offset of the data bytes, therefore this field is only used for
70 Data Records. In other records where this field is not used, it should
71 be coded as four ASCII zero characters ('0000' or 030303030H).
72 Each record has a RECTYP field which specifies the record type of this
73 record. The RECTYP field is used to interpret the remaining information
74 within the record. The encoding for all the current record types are:
77 '01' End of File Record
78 '02' Extended Segment Address Record
79 '03' Start Segment Address Record
80 '04' Extended Linear Address Record
81 '05' Start Linear Address Record
83 Each record has a variable length INFO/DATA field, it consists of zero
84 or more bytes encoded as pairs of hexadecimal digits. The
85 interpretation of this field depends on the RECTYP field.
86 Each record ends with a CHKSUM field that contains the ASCII hexadecimal
87 representation of the two's complement of the 8-bit bytes that result
88 from converting each pair of ASCII hexadecimal digits to one byte of
89 binary, from and including the RECLEN field to and including the last
90 byte of the INFO/DATA field. Therefore, the sum of all the ASCII pairs
91 in a record after converting to binary, from the RECLEN field to and
92 including the CHKSUM field, is zero.
95 3. Extended Linear Address Record (32-bit format only)
96 | RECORD | LOAD | | | | |
97 | MARK | RECLEN | OFFSET | RECTYP | ULBA | CHKSUM |
98 | ':' | '02' | '0000' | '04' | | |
99 1-byte 1-byte 2-bytes 1-byte 2-bytes 1-byte
101 The 32-bit Extended Linear Address Record is used to specify bits 16-31
102 of the Linear Base Address (LBA), where bits 0-15 of the LBA are zero.
103 Bits 16-31 of the LBA are referred to as the Upper Linear Base Address
104 (ULBA). The absolute memory address of a content byte in a subsequent
105 Data Record is obtained by adding the LBA to an offset calculated by
106 adding the LOAD OFFSET field of the containing Data Record to the index
107 of the byte in the Data Record (0, 1, 2, ... n). This offset addition
108 is done modulo 4G (i.e., 32-bits), ignoring any carry, so that offset
109 wrap-around loading (from OFFFFFFFFH to OOOOOOOOOH) results in wrapping
110 around from the end to the beginning of the 4G linear address defined by
111 the LBA. The linear address at which a particular byte is loaded is
113 (LBA + DRLO + DRI) MOD 4G
115 DRLO is the LOAD OFFSET field of a Data Record.
116 DRI is the data byte index within the Data Record.
118 When an Extended Linear Address Record defines the value of LBA, it may
119 appear anywhere within a 32-bit hexadecimal object file. This value
120 remains in effect until another Extended Linear Address Record is
121 encountered. The LBA defaults to zero until an Extended Linear Address
122 Record is encountered.
123 The contents of the individual fields within the record are:
126 This field contains 03AH, the hexadecimal encoding of the ASCII colon
130 The field contains 03032H, the hexadecimal encoding of the ASCII
131 characters '02', which is the length, in bytes, of the ULBA data
132 information within this record.
135 This field contains 030303030H, the hexadecimal encoding of the ASCII
136 characters '0000', since this field is not used for this record.
139 This field contains 03034H, the hexadecimal encoding of the ASCII
140 character '04', which specifies the record type to be an Extended Linear
144 This field contains four ASCII hexadecimal digits that specify the
145 16-bit Upper Linear Base Address value. The high-order byte is the
146 10th/llth character pair of the record. The low-order byte is the
147 12th/13th character pair of the record.
150 This field contains the check sum on the RECLEN, LOAD OFFSET, RECTYP,
154 4. Extended Segment Address Record (16- or 32-bit formats)
155 | RECORD | LOAD | | | | |
156 | MARK | RECLEN | OFFSET | RECTYP | USBA | CHKSUM |
157 | ':' | '02' | '0000' | '02' | | |
158 1-byte 1-byte 2-bytes 1-byte 2-bytes 1-byte
160 The 16-bit Extended Segment Address Record is used to specify bits 4-19
161 of the Segment Base Address (SBA), where bits 0-3 of the SBA are zero.
162 Bits 4-19 of the SBA are referred to as the Upper Segment Base Address
163 (USBA). The absolute memory address of a content byte in a subsequent
164 Data Record is obtained by adding the SBA to an offset calculated by
165 adding the LOAD OFFSET field of the containing Data Record to the index
166 of the byte in the Data Record (0, 1, 2, ... n). This offset addition
167 is done modulo 64K (i.e., 16-bits), ignoring any carry, so that offset
168 wraparound loading (from OFFFFH to OOOOOH) results in wrapping around
169 from the end to the beginning of the 64K segment defined by the SBA.
170 The address at which a particular byte is loaded is calculated as:
172 SBA + ([DRLO + DRI] MOD 64K)
175 DRLO is the LOAD OFFSET field of a Data Record.
176 DRI is the data byte index within the Data Record.
178 When an Extended Segment Address Record defines the value of SBA, it
179 may appear anywhere within a 16-bit hexadecimal object file. This
180 value remains in effect until another Extended Segment Address
181 Record is encountered. The SBA defaults to zero until an Extended
182 Segment Address Record is encountered.
184 The contents of the individual fields within the record are:
187 This field contains 03AH, the hexadecimal encoding of the ASCII
188 colon (':') character.
191 The field contains 03032H, the hexadecimal encoding of the ASCII
192 characters '02', which is the length, in bytes, of the USBA data
193 information within this record.
196 This field contains 030303030H, the hexadecimal encoding of the
197 ASCII characters '0000', since this field is not used for this
201 This field contains 03032H, the hexadecimal encoding of the ASCII
202 character '02', which specifies the record type to be an Extended
203 Segment Address Record.
206 This field contains four ASCII hexadecimal digits that specify the
207 16-bit Upper Segment Base Address value. The high-order byte is the
208 10th/1lth character pair of the record. The low-order byte is the
209 12th/13th character pair of the record.
212 This field contains the check sum on the RECLEN, LOAD OFFSET,
213 RECTYP, and USBA fields.
215 5. Data Record (8-, 16-, or 32-bit formats)
217 | RECORD | LOAD | | | | |
218 | MARK | RECLEN | OFFSET | RECTYP | DATA | CHKSUM |
219 | ':' | | | '00' | | |
220 1-byte 1-byte 2-bytes 1-byte n-bytes 1-byte
223 The Data Record provides a set of hexadecimal digits that represent
224 the ASCII code for data bytes that make up a portion of a memory
225 image. The method for calculating the absolute address (linear in
226 the 8-bit and 32-bit case and segmented in the 16-bit case) for each
227 byte of data is described in the discussions of the Extended Linear
228 Address Record and the Extended Segment Address Record.
230 The contents of the individual fields within the record are:
233 This field contains 03AH, the hexadecimal encoding of the ASCII
234 colon (':') character.
237 The field contains two ASCII hexadecimal digits that specify the
238 number of data bytes in the record. The maximum value is 'FF' or
239 04646H (255 decimal).
242 This field contains four ASCII hexadecimal digits representing the
243 offset from the LBA (see Extended Linear Address Record) or SBA (see
244 Extended Segment Address Record) defining the address which the
245 first byte of the data is to be placed.
248 This field contains 03030H, the hexadecimal encoding of the ASCII
249 character '00', which specifies the record type to be a Data Record.
252 This field contains pairs of ASCII hexadecimal digits, one pair for
256 This field contains the check sum on the RECLEN, LOAD OFFSET,
257 RECTYP, and DATA fields.
260 6. Start Linear Address Record (32-bit format only)
262 | RECORD | LOAD | | | | |
263 | MARK | RECLEN | OFFSET | RECTYP | EIP | CHKSUM |
264 | ':' | '04' | '0000' | '05' | | |
265 1-byte 1-byte 2-bytes 1-byte 4-bytes 1-byte
268 The Start Linear Address Record is used to specify the execution
269 start address for the object file. The value given is the 32-bit
270 linear address for the EIP register. Note that this record only
271 specifies the code address within the 32-bit linear address space of
272 the 80386. If the code is to start execution in the real mode of
273 the 80386, then the Start Segment Address Record should be used
274 instead, since that record specifies both the CS and IP register
275 contents necessary for real mode.
277 The Start Linear Address Record can appear anywhere in a 32-bit
278 hexadecimal object file. If such a record is not present in a
279 hexadecimal object file, a loader is free to assign a default start
282 The contents of the individual fields within the record are:
285 This field contains 03AH, the hexadecimal encoding of the ASCII
286 colon (':') character.
289 The field contains 03034H, the hexadecimal encoding of the ASCII
290 characters '04', which is the length, in bytes, of the EIP register
291 content within this record.
294 This field contains 030303030H, the hexadecimal encoding of the
295 ASCII characters '0000', since this field is not used for this
299 This field contains 03035H, the hexadecimal encoding of the ASCII
300 character '05', which specifies the record type to be a Start Linear
304 This field contains eight ASCII hexadecimal digits that specify the
305 32-bit EIP register contents. The high-order byte is the 10th/1lth
309 This field contains the check sum on the RECLEN, LOAD OFFSET,
310 RECTYP, and EIP fields.
313 7. Start Segment Address Record (16- or 32-bit formats)
315 | RECORD | LOAD | | | | |
316 | MARK | RECLEN | OFFSET | RECTYP | CS/IP | CHKSUM |
317 | ':' | '04' | '0000' | '03' | | |
318 1-byte 1-byte 2-bytes 1-byte 4-bytes 1-byte
321 The Start Segment Address Record is used to specify the execution
322 start address for the object file. The value given is the 20-bit
323 segment address for the CS and IP registers. Note that this record
324 only specifies the code address within the 20-bit segmented address
325 space of the 8086/80186.
327 The Start Segment Address Record can appear anywhere in a 16-bit
328 hexadecimal object file. If such a record is not present in a
329 hexadecimal object file, a loader is free to assign a default start
332 The contents of the individual fields within the record are:
335 This field contains 03AH, the hexadecimal encoding of the ASCII
336 colon (':') character.
339 The field contains 03034H, the hexadecimal encoding of the ASCII
340 characters '04', which is the length, in bytes, of the CS/IP
341 register contents within this record.
344 This field contains 030303030H, the hexadecimal encoding of the
345 ASCII characters '0000', since this field is not used for this
349 This field contains 03033H, the hexadecimal encoding of the ASCII
350 character '03', which specifies the record type to be a Start
351 Segment Address Record.
354 This field contains eight ASCII hexadecimal digits that specify the
355 16-bit CS register and 16-bit IP register contents. The high-order
356 byte of the CS register content is the 10th/llth character pair, the
357 low-order byte is the 12th/13th character pair of the record. The
358 high-order byte of the IP register content is the 14th/15th
359 character pair, the low-order byte is the 16th/17th character pair
363 This field contains the check sum on the RECLEN, LOAD OFFSET,
364 RECTYP, and CS/IP fields.
368 8. End of File Record (8-, 16-, or 32-bit formats)
370 | RECORD | LOAD | | | |
371 | MARK | RECLEN | OFFSET | RECTYP | CHKSUM |
372 | ':' | '00' | '0000' | '01' | |
373 1-byte 1-byte 2-bytes 1-byte 1-byte
375 The End of File Record specifies the end of the hexadecimal object
378 The contents of the individual fields within the record are:
381 This field contains 03AH, the hexadecimal encoding of the ASCII
382 colon (':') character.
385 The field contains 03030H, the hexadecimal encoding of the ASCII
386 characters '00'. Since this record does not contain any INFO/DATA
387 bytes, the length is zero.
390 This field contains 030303030H, the hexadecimal encoding of the
391 ASCII characters '0000', since this field is not used for this
395 This field contains 03031H, the hexadecimal encoding of the ASCII
396 character '01', which specifies the record type to be an End of File
400 This field contains the check sum an the RECLEN, LOAD OFFSET, and
401 RECTYP fields. Since all the fields are static, the check sum can
402 also be calculated statically, and the value is 04646H, the
403 hexadecimal encoding of the ASCII characters 'FF'.
405 ========================================================================