Motorola created the S-record format in the mid-1970s for its 6800 processor: its development tools wrote S-record files and PROM programmers read them to burn EPROMs. The S2 record was added for the 68000 and S3 for the 68012 and later 68000-series chips. This page follows the descriptions in Wikipedia and the SRecord package’s manual page; Motorola’s original document was not among the sources read.
Record layout
Each record is a line of ASCII text. Records are separated by one or more line ends (LF, or CR LF), so each one sits alone on its line.
| Characters | Field | Meaning |
|---|---|---|
| 1 | Start | An upper-case S (0x53). |
| 1 | Type | One digit, 0 to 9; see record types. |
| 2 | Byte count | Number of bytes that follow: address, data and checksum. At least 3, at most 255 (00, 01 and 02 are illegal). |
| 4, 6 or 8 | Address | 2, 3 or 4 bytes depending on the type, big-endian. |
| 2 × n | Data | n bytes as hexadecimal digit pairs. |
| 2 | Checksum | See checksum. |
Record types
| Type | Name | Address | Data | Meaning |
|---|---|---|---|---|
S0 | Header | 2 bytes, 0000 | any | Descriptive information about the block of records that follows, often a NUL-terminated text; HDR (48 44 52) is common when there is nothing more specific. |
S1 | Data | 2 bytes | count − 3 bytes | Data to be placed at a 16-bit address. |
S2 | Data | 3 bytes | count − 4 bytes | Data to be placed at a 24-bit address. |
S3 | Data | 4 bytes | count − 5 bytes | Data to be placed at a 32-bit address. |
S4 | — | — | — | Not defined by the S-record standard. |
S5 | Count | 2 bytes: the count | none | Optional: the number of S1, S2 and S3 records sent in the block, held in the address field. |
S6 | Count | 3 bytes: the count | none | Optional and not in the original standard: the same count as a 24-bit number, for blocks with more than 65 535 data records. |
S7 | Termination | 4 bytes | none | Ends a block of S3 records. The address may give the 32-bit entry point; 00000000 if none is needed. |
S8 | Termination | 3 bytes | none | Ends a block of S2 records, with an optional 24-bit entry point. |
S9 | Termination | 2 bytes | none | Ends a block of S1 records, with an optional 16-bit entry point. |
The S0 data field has a layout in the old Unix srec(5) manual page (a copy
is cited in the sources). Its subfields, with lengths written as numbers of characters
of record text, so that two characters make one byte, are: module name
(mname, 20 characters), version (ver, 2), revision
(rev, 2) and a text comment (description, 0 to 36). The
version and revision are one byte each, as numbers; the module name and description
are the hexadecimal values of ASCII characters. Counted in bytes that is 10, 1, 1 and
0 to 18; this conversion is the page’s reading of the manual’s wording, and the manual
gives the whole data field as at most 64 characters, which fits (20 + 2 + 2 + 36 =
60). The same manual says nothing from Motorola is known to use these subfields, and
its own example S0 record has no such layout (HDR only), so treat the
layout as a convention that some tools follow.
The SRecord manual notes open questions that the original description leaves:
whether a file may hold more than one count record, whether the count restarts after
each, and what happens when S5 and S6 are mixed. Its own srec_cat writes
at most one, using S6 only when the count does not fit in 16 bits.
Record order and file styles
Some Unix documentation says the order of records is of no significance, but most software writes them in this order, and names the style by its data record type:
| Style | Addresses | Records |
|---|---|---|
| S19 | 16-bit | S0, one or more S1, optional S5, S9 |
| S28 | 24-bit | S0, one or more S2, optional S5, S8 |
| S37 | 32-bit | S0, one or more S3, optional S5, S7 |
Line length
A byte count of 255 allows lines of up to 514 characters, so a record can carry at
most 252 data bytes (S1), 251 (S2) or 250 (S3). An old Unix manual page limited records
to 78 characters and 32 data bytes, and many sources still suggest 32 or 16 data bytes
per record. There is no comment syntax: some programs skip lines that do not start with
S or ignore text after the checksum, but other programs reject such
files.
Checksum
Add the byte count, the address bytes and the data bytes, keep the least significant
byte of the sum, and take its ones’ complement (0xFF − (sum AND 0xFF)).
S1137AF00A0A0D0000000000000000000000000061
13 + 7A + F0 + 0A + 0A + 0D + 00 × 13 = 019E
low byte 9E, ones’ complement 61 checksum 61
0x7AF0 and its checksum.Examples of every type
| Record | Meaning and checksum |
|---|---|
S00600004844521B | S0 header HDR. 06 + 48 + 44 + 52 = 0xE4; complement 1B. |
S111003848656C6C6F20776F726C642E0A0042 | S1: 14 bytes (Hello world., a line feed and a NUL) at 0x0038. 11 + 00 + 38 = 0x49, data 0x474, total 0x4BD; complement of BD is 42. |
S20801000001020304EC | S2: bytes 01 02 03 04 at 0x010000. 08 + 01 + 01 + 02 + 03 + 04 = 0x13; complement EC. |
S3090001000001020304EB | S3: the same bytes at 0x00010000. Sum 0x14; complement EB. |
S5030001FB | S5: one data record in the block. Sum 0x04; complement FB. |
S604000001FA | S6: the same count in 24 bits. Sum 0x05; complement FA. |
S70500000000FA | S7: end of an S3 block, entry point 0. Sum 0x05; complement FA. |
S804000000FB | S8: end of an S2 block, entry point 0. Sum 0x04; complement FB. |
S9030000FC | S9: end of an S1 block, entry point 0. Sum 0x03; complement FC. |
File names
Extensions in use include .s19, .s28, .s37
(after the styles above), .s, .s1, .s2,
.s3, .sx, .srec, .exo,
.mot and .mxt. Nothing inside the file depends on the
name. The explorer opens .srec, .s19, .s28, .s37, .mot and .sre
(the last was asked for; none of the sources read lists it), and it also reads an S-record file that has been named .hex, as six real files are (below).
.mot is also the extension of LightWave motion files, which the explorer does not take for S-records.
Seen in real files
Facts found by reading real files on the machine that built this site (not from a source):
- Six ROM images of the SAGE-II computer in the SIMH source tree (
SAGE/FILES/*.hex, 20 to 40 KB) are S-record files named.hex: an S0 header holding the file name, S2 records of 32 data bytes with 24-bit addresses starting at0xFE0000and an S8 end record, with CR LF line endings. Every S2 and S8 record has the right checksum; the S0 header’s checksum is the ones’ complement of the sum without the byte count in all six, so by the rule above it differs by the byte count (0x0B). That is a quirk of whatever wrote them, not part of the format; the explorer reports the checksum as wrong and still reads the file. - Files written by GNU
objcopy2.47 (-O srec) use S1, S2 or S3 records by the highest address, 16 data bytes to a record (the default of this version;--srec-len=16gave the same), an S0 header holding the output file name, and an end record that carries the start address (S9 for S1 files, S8 for S2, S7 for S3).--srec-forceS3writes S3 and S7 whatever the addresses. There is no S5 count record.objcopy -I srec -O binaryreads the files back to the same bytes the explorer shows as the memory image.
Sources
- SREC (file format) – Wikipedia: history, record fields and types, order, line lengths, checksum example, extensions
- srec_motorola(5) – the SRecord package’s description of each record type, the checksum and the count-record questions
- Motorola S-record description – a 4-page PDF (read in full on 13 November 2026) of a Unix
srec(5)manual page, kept by the Mirrors of the Retro archive at deramp.com and saved from amelek.gda.pl in 2005. It says it was found “on the man pages of a UNIX system”; its source is not Motorola. It gives the generic record layout, the S0 subfields, S1, S2, S3, S5, S7, S8 and S9, the checksum, the 514-character rule and a worked seven-record example. It also says the 78-byte and 64-byte limits “shouldn’t be trusted”, and that the order of records “is of no significance”.
No Motorola or NXP original of the S-record specification is public: searches on 13 November 2026 found only copies of that man page and derived descriptions. This is therefore the earliest public description. Its example (S00600004844521B to S9030000FC) agrees with the checksums computed here. The checksums of this page’s own examples were worked out by hand. The manual does not mention S4 or S6, which this page takes from Wikipedia and the SRecord manual.