A brief explanation of the Motorola S19 file format. Motorola S19 file records are a text representation of Hexadecimal coded binary data. All data uses only ASCII characters, so the format is portable across virtually all computer platforms. The S19 format, described here, is for eight bit data. (The '$' will be used throughout to indicate a hexadecimal value.) Each line in a Motorola S19 file is called a 'record'. Records always begin with a the letter 'S', followed by a '1' if the record contains data, or a '9' if this is the last record in the file. The next byte represents the number of bytes in this record, including the starting address, data bytes, and the checksum. The next pair of numbers represent the 16-bit starting address of the data in the record. This is the absolute location in the EPROM. Following the address are the hex representations of the data to be stored. The last byte is an eight-bit one's-complement checksum of all of the bytes in the record (not including the S1). Note that this value is derived from the binary values of the bytes, not the ASCII representation. A standard CR/LF pair (carriage return/linefeed, $0D $0A) terminates each line. This a sample Motorola S19 record. S1130170707172737475767778797A7B7C7D7E7F03 Broken down, it looks as follows: S - Indicates that this is Motorola 1 - 1 means this is a data record 13 - Number of bytes to follow = $13, or 19 decimal. This number can be thought of as the number of data bytes plus three. Therefore there will be 16 data bytes in the record. 0170 - Starting address in the EPROM for this record. 70 - These are the data bytes (in hex) - 16 of them as noted above 71 The first byte ($70) will be stored at $0170, with the 72 remaining bytes following in sequence. 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F 03 - This is the checksum. If you add all of the successive bytes (note that the address is treated as two individual bytes) the result is $7FC. Truncating this to eight bits yields $FC. The one's complement of $FC is $06. (This may be derived by subtracting $FC from $FF, or by inverting the bits.) (CR/LF) - End of this record -- I think the linefeed may be optional. The use of the starting address in each record makes it possible to store data in non-contiguous areas of the EPROM. Each line of data is therefore entirely self-contained. This is useful when areas of the EPROM are unused, as no space in the Motorola S19 file need be wasted by representation of blank data. It is perfectly possible, albeit not recommended, to scramble all of the record lines in a Motorola S19 file and still end up with a correct EPROM image. The end record (end of file) is almost the same: S9030000FC S - Indicates that this is Motorola 9 - 9 means this is the end record 03 - Number of bytes - should be three, as no data bytes will be in this record. 0000 - Address, usually zero. - Zero data bytes here (obviously) FC - The checksum, calculated as above. You may also see records starting with S0 - I believe these are called comment records. They do not contain any data that will be stored in the EPROM. I hope this helps. Sanjaya Vatuk 11/4/96 sanjaya@concentric.net