[comp.sys.m68k.pc] S file format.

gam3@well.UUCP.UUCP (10/27/87)

I am looking for the format of 'S-format' files.
Does anyone know when I could get this information?

Allen Morris - well!gam3

motsea@amc.UUCP.UUCP (10/29/87)

In article <4319@well.UUCP> hplabs!well!gam3@seismo.CSS.GOV (G. Allen Morris III) writes:
>
>I am looking for the format of 'S-format' files.

I believe the appropriate term here is S-record format, if you are referring to
a standard means of up/down loading information between host and target

>Does anyone know when I could get this information?
>
>Allen Morris - well!gam3

You should give the Motorola Sales ofc in Sunnyvale a call. Ask to speak
to anyone in applications, and they should be able to make you a copy of
the S-record format information. It is a standard appendix to many of the
Motorola systems documentation.

Hope this helps.....


				...mark konopacky   fae   motorola   seattle

[I am fortunate enough to use Applied Microsystems' node for news, so
that I don't spend time administering...]

<<  Standard Disclaimer....  >>

jkg@PYR.GATECH.EDU.UUCP (10/30/87)

In article <4319@well.UUCP> (G. Allen Morris III) writes:
>I am looking for the format of 'S-format' files.
>Does anyone know when I could get this information?

There are actually 3 formats, depending on whether you have a 16, 24, or 32
bit address fields. They are similar, though, so a general discussion should
give you the idea. The format is as follows:

	Sxnnaaaadddd....ddddcc

where:

	x	represents the record type. It may be any of 0, 1, 2, 3, 7,
		8, or 9. Record type 0 is an optional header record. Record
		types 1, 2, and 3 are data records. Record types 7, 8, and
		9 are program start records.

	nn	is a count of the number of ASCII hex bytes (half the number
		of characters) that follows.

	aaaa	is the load address for that record. It may contain 2, 3, or
		4 ASCII hex bytes, depending on the size of the processor
		address space.

	dd	are one or more ASCII hex data bytes.

	cc	is a checksum byte that is calculated by taking the one's
		complement of the sum of the nn, aaaa, and dd bytes modulo
		256.

The S0 record contains the name of the load module. The data bytes are 
computed by converting the characters in the program name string to their
ASCII hex equivalents. This string is usually taken from the argument to 
the NAM directive in the Motorola standard assembler. For instance, the
program "FUBAR" would generate the following S0 record (assuming 16 bit
addresses):

	S0080000465542415287

The other records contain object code and constant data, and are grouped 
according to the address size as follows:

	S1 and S9 records are always used together with 16 bit addresses.
	S2 and S8 records are always used together with 24 bit addresses.
	S3 and S7 records are always used together with 32 bit addresses.

The only thing that changes for each record type is the number of ASCII
hex bytes in the aaaa field. The number of ASCII hex data bytes in a data 
record can vary, but there are usually 16 or 24.

The S7, S8, and S9 records are used by the loader to determine the start
address of the program fragment. They contain nn, aaaa, and cc fields -
no data. This number is usually given as an argument to the END statement
in the Motorola standard assembler. There is only one such record per load 
module.

If anybody is interested, I will be more than happy to post some concrete
examples, but once you get the hang of it, they're really pretty easy to
figure out. The reason I had to know this was so I could write a little
Pascal program to convert ASCII hex files to binary files for my EPROM
programmer. Intel hex files are constructed in a similar fashion (BTW, if
anybody knows the format for Tek hex files, I would appreciate their
sending it to me - I want to add that format to my program).

						Jim Greenlee
-- 
The Shadow...!{allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!pyr!jkg

Jryy, abj lbh'ir tbar naq qbar vg! Whfg unq gb xrrc svqqyvat jvgu vg hagvy lbh
oebxr vg, qvqa'g lbh?!