---------------------------------------------------------------------- This file: ftp://cher.media.mit.edu/pub/projects/miniboard/hobbytip/s19files.txt Last updated: Tue Aug 22 16:07:57 1995 ---------------------------------------------------------------------- Date: Sun, 29 Aug 93 11:46:48 EDT From: "Fred G. Martin" To: Multiple recipients of list Subject: structure of .s19 file William Young wrote: > One question: I know the Miniboard HC11s have 2K of EEPROM available > for program space. Does this indicate that the max length of a .s19 > file is 2048 bytes? Or is there some other info carried in the files? Take a look at the first few lines of the hexmon.s19 file: S123F8008E00FFCE10008600A7041D282086B0A72B860CA72D1C39801C23101C22104F5F55 S123F820DD00DD02DD04DD06DD08DD0A975D975CCCFFFFDD0CDD0EDD10DD12DD5EDD60DDC2 S123F84062DD640EBDF84920FB863EBDF8DBBDF8CE816125F936BDF8C33C1838BDF8C3321F Here's how a data line is parsed: S1 23 F800 8E00FFCE10008600A7041D282086B0A72B860CA72D1C39801C23101C22104F5F 55 ^^ ^^ ^^^^ |------------------------data bytes----------------------------| ^^ | | | | | | +---- starting address checksum byte ----+ | | | +---- byte count (including address and checksum bytes) | +----- indicates data line So, you can see that 2K of object code would have a file size of greater than 4K, since each object byte is represented in two ASCII bytes, and there is the additional placement information. The last line of the file is different: S9 03 0000 FC ^^ ^^ ^^^^ ^^ | | | | | | | +-- checksum byte | | +-- execution start address | +-- byte count +-- indicates final line The DLM downloader discards the "start address" info contained in the final line; the actual start address is burned into the 6811's RESET vector at $FFFE-$FFFF. The surest way to tell if your object code got too big is too look at the last few lines of the .s19 file. If the target address wrapped around from $FFxx to $00xx, you're in trouble. (Actually, if the code region spills into the vector area at $FFC0, it's trouble.) -Fred Date: Mon, 21 Aug 1995 19:40:38 -0400 From: "DrWho@Tardis.time.space.void" To: Multiple recipients of list Subject: Re: S Record format > Hi all, > > Well the Subject say it all really, can anyone give me a description > of the S-record format ? > > TIA Andrew An S Record is: TYPE + RECORD LENGTH + ADDRESS + CODE/DATA + CHECKSUM -------+---------+--------------------------------------------------- Field: |Printable| Contents: |Chars: | ===================================================================== Type |2 |S record type -------+---------+-------------------------------------------------- Record |2 |The count of the character pairs in the record, Length | |excluding the type and record length -------+---------+-------------------------------------------------- Address|4,6 or 8 |The 2,3 or 4 byte address at which the data field | |is to be loaded into memory -------+---------+--------------------------------------------------- Code/ |0 to 2n |From 0 to n bytes of executable code, data or Data | |descriptive info. For compatibility with teletypes | |some programs limit the number of bytes to 28 (or | |56 printable characters in the s-record) -------+---------+---------------------------------------------------- Chksum |2 |The 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 code/data fields. -------+---------+---------------------------------------------------- Where S record type can be: s0 - A header for each block of s-recs. The code/data field may contain any descriptive information about the following block of s-recs. s1 - a record containing code/data and the 2byte address at which the code/data is to reside. s2 - a record containing code/data and the 3byte address at which the code/data is to reside. s3 - a record containing code/data and the 4byte address at which the code/data is to reside. s5 - a record containing the number of s1, s2 and s3 records transmitted in a particular block. This count appears in the address field. There is no code/data field s7 - A termination record for a block of s3 records. The address field may optionally contain the 4-byte address of the instruction to which control is to be passed. There is no code/data field s8 - A termination record for a block of s2 records. The address field may optionally contain the 3-byte address of the instruction to which control is to be passed. There is no code/data field s9 - A termination record for a block of s1 records. The address field may optionally contain the 2-byte address of the instruction to which control is to be passed. There is no code/data field Each block of S-recs only contains one termination record. S7 and S8 records are only active when control is to be passed to a 3 or 4 byte address; otherwise an S9 is used for termination. Normall there is only one header record, but multiple headers are possible. eg. decode this: s1130000285f245f2212226a000424290008237c2a ------------------------------------------------------ Aras Vaichas - "Dominae sanctum Diabolae rectum"