Article View: comp.sys.m68k.pc
Article #142Re: S file format.
From: jkg
Date: Fri, 30 Oct 1987 05:56
Date: Fri, 30 Oct 1987 05:56
71 lines
3611 bytes
3611 bytes
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?!
Technical Details
Message-ID:
<4324@pyr.gatech.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!PYR.GATECH.EDU!jkgReferences:
<4319@well.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!cbosgd!ucbvax!PYR.GATECH.EDU!jkg From: jkg@PYR.GATECH.EDU.UUCP Newsgroups: comp.sys.m68k.pc Subject: Re: S file format. Message-ID: <4324@pyr.gatech.EDU> Date: Fri, 30-Oct-87 00:56:24 EST Article-I.D.: pyr.4324 Posted: Fri Oct 30 00:56:24 1987 Date-Received: Sat, 31-Oct-87 17:48:29 EST References: <4319@well.UUCP> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: jkg@pyr.gatech.edu (Jim Greenlee) Organization: Georgia Institute of Technology Lines: 71 Approved: info-68k@ucbvax.berkeley.edu