|
 |
S-Record format
The Motorola S-Record Format was devised
for the purpose of encoding programs or data files in printable
format for transport between computer platforms.
S-record explanation:
Each S-record is a character string
composed of few fields which identify:
- Record type
- Record length
- Memory address
- Code/Data
- Checksum
Each byte of binary data is encoded
in the S-record as two-character hexadecimal number:
- The first character represents the
high-order four bits of the byte
- The second character represents the
low-order fours bits of the byte
The five fields that comprise an S-record
are shown in the table below:
|
Type
|
Record length
|
Address
|
Code\Data
|
Checksum
|
The S-record fields fields are described
in the table below:
| Field |
Printable Characters |
Details |
| Type |
2 |
S-Record type - S0, S1, etc. |
| Record length |
2 |
Character pair count in the
record, excluding the type and record length. |
| Address |
4,6,8 |
2-,3-,4- byte address at
which the data field is to be loaded into memory. |
| Code\Data |
0-2N |
From 0 to N bytes of executable
code, memory loadable data or describe information.
For compatibility with teletypewriter , some programs
may limit the number of bytes to as few as 28 (56 printable
characters in the S-record |
| Checksum |
2 |
Least significant byte of
the one's complement of the sum of the values represented
by the pairs of characters making up the record length,
address, and the code/data fields. |
Eight types of S-record have been defined
to accommodate the several needs of the encoding, transport
and decoding function. The various Motorola upload, download
and other record transport control programs, as well as
cross assemblers, linkers and other file-creating or debugging
programs, utilize only those S-record which serve the purpose
of the program.
A typical S-record format, as printed
or displayed, is shown in this example:
S1 14 C0 1E 0B 29 BD C0 2A 18 38 6A 3B 6F 3B 39 18 09 26
FC 39 DE
S1 - record type 14 - number of hex characters following
Len= $14 hex ( 20 dec ) $CO1E - memory load address field
Ldhi, Ldlo $0B - - - - $39 - code\data field $DE - checksum
byte A part from the letter S at the start, all characters
in the records are hexadecimal digits presented in ASCII
format. Checksum formula below:

-
-
-
-
-
-
|
 |
|