[comp.os.os9] S Record Format?

pete@wlbr.imsd.contel.com (Pete Lyall) (03/29/91)

I recently came across a situation where I need to convert Motorola
S Record formatted files to binary, including some loader information.
I can't seem to find the file I had stashed away regarding the S
Record file format breakdown.. durn!

Does anyone have a text file (or explanation) that they can mail me
describing the various S Record format lines and their contents?

Thanks!

Pete Lyall

-- 
Pete Lyall                                                   Contel Corporation
Compuserve: 76703,4230              OS9_Net: (805) 375-1401 (24hr 300/1200/2400)
Internet: pete@wlbr.imsd.contel.com     UUCP: {hacgate,jplgodo,voder}!wlbr!pete 

mcmahan@netcom.COM (Dave Mc Mahan) (03/30/91)

 In a previous article, pete@wlbr.imsd.contel.com (Pete Lyall) writes:
>I recently came across a situation where I need to convert Motorola
>S Record formatted files to binary, including some loader information.
>I can't seem to find the file I had stashed away regarding the S
>Record file format breakdown.. durn!
>
>Does anyone have a text file (or explanation) that they can mail me
>describing the various S Record format lines and their contents?

Yup.  Just typed it in last week.  Here it is.



MOTOROLA EXTENDED S-RECORD FORMAT


The S-record format was devised for the purpose of encoding programs of data 
files in a printable format for transportation between computer systems. A 
file containing S-records is constructed so that each line of the file 
contains one S-record.  The entire file contains nothing but printable 
characters or newline characters. 

Each S-record is broken down into 5 fields.  These fields are: 

1. Record Type - This field is always two characters in length.  The first 
             character is always 'S'.  The second  character defines the type 
             of record used and is a character between '0' and '9'. Valid 
             record types are defined below. 
             

2.  Record Length - The count of the number of character pairs in this record, 
             excluding the type field and record length field.  This field is 
             always two characters in length.  The value it contains uses a 
             hexadecimal base to signify the number of character pairs in this 
             record. 

3.  Address - This field can be either 4, 6, or 8 bytes in length.  The length 
             is determined by the type of this record and is defined below for 
             each type. 

4.  Code/Data - This field can be anywhere from 0 bytes in length to N bytes.
             For compatability with teletypewriters, some programs may limit
             the number of bytes to as few as 28 (56 printable characters).

5.  Checksum - This byte contains the ASCII representation of the hexadecimal 
             number that is 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 field. 




    Valid S-Record Types

Several types of S-records have been defined by the public standard. 
These types are listed below. 

S0 - The header record for each block of S-records. 
     
S1 - This record contains code/data and a 2 byte address.  The address field 
     for this record type will be 4 characters long and is normally zeros.
     
S2 - This record type contains code/data and a 3 byte address.  The address 
     field for this record type will be 6 characters long.
     
S3 - This record type contains code/data and a 4 byte address.  The address 
     field for this record type will be 8 characters long. 
     
S5 - This record type contains a count of the number of S1, S2, or S3 records 
     transmitted in a particular block.  the count appears in the address
     field.  There is no code/data field.
     
S7 - This record type is a termination record for a block of S3 records.
     The adress field may optionally contain a 4-byte address of the
     instruction to which control is passed.  There is no code/data field.

S8 - This record type is a termination record for a block of S2 records.
     The adress field may optionally contain a 3-byte address of the
     instruction to which control is passed.  There is no code/data field.
     
S9 - This record type is a termination record for a block of S1 records.
     The adress field may optionally contain a 2-byte address of the
     instruction to which control is passed.  There is no code/data field.
     


>-- 
>Pete Lyall                                                   Contel Corporation
>Internet: pete@wlbr.imsd.contel.com     UUCP: {hacgate,jplgodo,voder}!wlbr!pete 

    -dave

-- 
Dave McMahan                            mcmahan@netcom.com
					{apple,amdahl,claris}!netcom!mcmahan