1srec_mos_tech(5) File Formats Manual srec_mos_tech(5)
2
3
4
6 srec_mos_tech - MOS Technology file format
7
9 The MOS Technology format allows binary files to be uploaded and down‐
10 loaded between between a computer system (such as a PC, Macintosh, or
11 workstation) and an emulator or evaluation board for microcontrollers
12 and microprocessors.
13
14 The Lines
15 Each line consists of 5 fields. These are the length field, address
16 field, data field, and the checksum. The lines always start with a
17 semicolon (;) character.
18
19 The Fields
20 ┌──┬────────┬─────────┬──────┬──────────┬──────┐
21 │; │ Length │ Address │ Data │ Checksum │ CRLF │
22 └──┴────────┴─────────┴──────┴──────────┴──────┘
23 Length The record length field is a 2 character (1 byte) field that
24 specifies the number of data bytes in the record. Typically
25 this is 24 or less.
26
27 Address This is a 2‐byte address that specifies where the data in the
28 record is to be loaded into memory, big‐endian.
29
30 Data The data field contains the executable code, memory‐loadable
31 data or descriptive information to be transferred.
32
33 Checksum
34 The checksum is an 2‐byte field that represents the least sig‐
35 nificant two bytes of the the sum of the values represented by
36 the pairs of characters making up the record's length, address,
37 and data fields, big‐endian.
38
39 End of File
40 The final line should have a data length of zero, and the data line
41 count in the address field. The checksum is not the usual checksum, it
42 is instead a repeat of the data line count.
43
44 Size Multiplier
45 In general, binary data will expand in sized by approximately 2.54
46 times when represented with this format.
47
49 Here is an example MOS Technology format file. It contains the data
50 “Hello, World” to be loaded at address 0.
51 ;0C000048656C6C6F2C20576F726C640454
52 ;0000010001
53
55 srec_cat version 1.55
56 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
57 2007, 2008, 2009, 2010 Peter Miller
58
59 The srec_cat program comes with ABSOLUTELY NO WARRANTY; for details use
60 the 'srec_cat -VERSion License' command. This is free software and you
61 are welcome to redistribute it under certain conditions; for details
62 use the 'srec_cat -VERSion License' command.
63
65 Peter Miller E‐Mail: pmiller@opensource.org.au
66 /\/\* WWW: http://miller.emu.id.au/pmiller/
67
69 (The following information is reproduced from
70 http://users.telenet.be/kim1‐6502/6502/usrman.html#F just in case it
71 vanishes from the Web.)
72
73 The paper tape LOAD and DUMP routines store and retrieve data in a spe‐
74 cific format designed to insure error free recovery. Each byte of data
75 to be stored is converted to two half bytes. The half bytes (whose
76 possible values are 0 to F HEX) are translated into their ASCII equiva‐
77 lents and written out onto paper tape in this form.
78
79 Each record outputted begins with a “;” character (ASCII 3B) to mark
80 the start of a valid record. The next byte transmitted (18HEX) or (24
81 decimal) is the number of data bytes contained in the record. The
82 record's starting address High (1 byte, 2 characters), starting address
83 Lo (1 byte, 2 characters), and data (24 bytes, 48 characters) follow.
84 Each record is terminated by the record's check‐sum (2 bytes, 4 charac‐
85 ters), a carriage return (ASCII 0D), line feed (ASCII 0A), and six
86 “NULL” characters (ASCII 00). (NULL characters cause a blank area on
87 the paper tape.)
88
89 The last record transmitted has zero data bytes (indicated by ;00) The
90 starting address field is replaced by a four digit Hex number repre‐
91 senting the total number of data records contained in the transmission,
92 followed by the records usual check‐sum digits. An “XOFF” character
93 ends the transmission.
94 ;180000FFEEDDCCBBAA0099887766554433221122334455667788990AFC
95 ;0000010001
96 During a “LOAD” all incoming data is ignored until a “;” character is
97 received. The receipt of non ASCII data or a mismatch between a
98 records calculated check‐sum and the check‐sum read from tape will
99 cause an error condition to be recognized by KIM. The check‐sum is
100 calculated by adding all data in the record except the “;” character.
101
102 The paper tape format described is compatible with all other MOS Tech‐
103 nology, Inc. software support programs.
104
105
106
107Reference Manual SRecord srec_mos_tech(5)