Motorola S records

S record files are printable files, consisting any number of the eight different record types. S record files can be created from an ICOFF input file by ihex. Each record has the following structure:
 
Field  Size in characters 
Type 
Record Length 
Address  4, 6, or 8 
Code / Data  0 - N 
Checksum 

The record length, address, code/data, and checksum fields are hexadecimal bytes coded in ASCII: 00 is the value 0, 01 the value 1, etc. The record length is the number of data bytes (two hex digits) including the address, code/data, and checksum fields. The checksum field contains the one's complement of the sum of all the bytes from the record length field through the end of the code/data field.

Each record can be terminated with either a carriage return, line feed, or a null (zero) character.

An example assembly file:

                org     $1000
                dc.b    'some data',0
                org     $10000
                dc.b    'data at a higher address',0
run through ihex produces:
        S10D1000736F6D6520646174610074
        S21D0100006461746120617420612068696768657220616464726573730034
        S9030000FC
The record types are as follows:
S0
Header record for each block of S records which may contain descriptive information identifying the following block of S records. The address field is typically zeros. The code/data field of an S0 record typically contains a "hexified" ASCII string.
S1
Code or data record containing a 2-byte address (4 hex digit address).
S2
Code or data record containing a 3-byte address (6 hex digit address).
S3
Code or data record containing a 4-byte address (8 hex digit address).
S5
Count record containing the number of S1, S2, and S3 records transmitted in a block. The count appears in the address field, and there is no code/data field (I never saw this actually used).
S7
Termination record for a block of S records. A 4-byte address contains the address where execution starts. There is no code/data field.
S8
Termination record for a block of S records. A 3-byte address contains the address where execution starts. There is no code/data field.
S9
Termination record for a block of S records. A 2-byte address contains the address where execution starts. There is no code or data field.