Specifications

2.4 S-Record file format
A target program in S-record format
Bound-T for the H8/300 can read target programs in an S-record format, a common textual file
format for memory images. Bound-T can generally detect the format of the target program
automatically; if that does not work, the command-line option -srec can be used to make
Bound-T assume S-record format for the target program file.
An additional code or data file in S-record format
A (main) target program file (in any format) can be augmented by one S-record file, named
with the command-line option -srec=file. This option makes Bound-T read additional target
memory contents (code and/or data) from the named file which is assumed to contain S-
records. Bound-T creates the memory image of the target program (as it would be at load time,
before target execution is started) by combining the memory contents from the main
executable file (named on the command line after the options) and this S-record file. If the
memory areas defined by the two files overlap, Bound-T emits an error message because it
cannot know which file, if either, should be given priority.
The S-record format
An S-record file should be a text file where each line is an S-record. An S-record is here defined
as a character string that contains five fields as follows:
Type field, two characters, "S1" .. "S9".
Record length, two hexadecimal digits, giving the number of two-digit hexadecimal numbers
that follow in this record (excluding the Type and Record length fields). In other words, the
number of characters remaining in this record is twice this number.
Address, four hexadecimal digits, giving the load address of the first data octet.
Data, a number of code or data octets, each encoded as a two-digit hexadecimal number.
The number of data octets is (Record length) – 3, where the subtracted constant 3 represents
two octets of Address and one octet of Checksum.
Checksum, two hexadecimal digits defining the least significant octet of the one's
complement of the sum of all the octets in the Record length, Address and Data fields.
The following is an example of an S-record:
S11301506DF60D566D750D554B140D664A201786B8
In this example, the Type field is "S1", the Record length field is "13" which means 19 (decimal)
more two-digit hexadecimal numbers, the Address field is "0150" which means the address 336
(decimal), the Data field contains the sixteen two-digit hexadecimal numbers "6DF6 ... 1786",
and the Checksum field is the last two characters, "B8".
The meaning of the different record types may depend somewhat on the software that
generates and uses the files. However, generally "S1" lines are data/code records as described
above. In a typical S-record file, all lines are "S1" lines except perhaps for the last line, which
may be an "S9" termination record. In an "S9" record the Address field may contain the
start/entry address for the code given in the "S1" records and there is no Data field.
Bound-T handles all S-records in the same way, by loading the Data field into the target
program's memory image starting at the Address given in the S-record.
Bound-T for H8/300 Using Bound-T for H8/300 9