1 <!doctype linuxdoc system>
4 <title>Atari 2600 specific information for cc65
6 <url url="mailto:contact@florentflament.com" name="Florent Flament"><newline>
9 An overview over the Atari 2600 runtime system as it is implemented
10 for the cc65 C compiler.
13 <!-- Table of contents -->
16 <!-- Begin the document -->
20 This file contains an overview of the Atari 2600 runtime system as it
21 comes with the cc65 C compiler. It describes the memory layout, Atari
22 2600 specific header files and any pitfalls specific to that platform.
24 <sect>Binary format<p>
26 The default binary output format generated by the linker for the Atari
27 2600 target is a 4K cartridge image.
29 <sect>Memory layout<p>
31 cc65 generated programs with the default setup can use RAM from
32 $0080 to $00FF - __STACKSIZE__, where __STACKSIZE__ is
33 the size of the system stack with a default value of 16 bytes. The
34 size of the system stack can be customized by defining the
35 __STACKSIZE__ linker variable.
40 <tag/Stack/ The C runtime stack is located at $00FF -
41 __STACKSIZE__ and growing downwards.
43 <tag/Heap/ The C heap is located at $0080 and grows upwards.
47 <sect>Start-up condition<p>
49 When powered-up, the Atari 2600 TIA registers contain random
50 values. During the initialization phase, the start-up code needs to
51 initialize the TIA registers to sound values (or else the console has
52 an unpredictable behavior). In this implementation, zeros are written
53 to all of TIA registers during the start-up phase.
55 Note that RIOT registers (mostly timers) are left uninitialized, as
56 they don't have any consequence on the console behavior.
58 <sect>Platform specific header files<p>
60 Programs containing Atari 2600 specific code may use the
61 <tt/atari2600.h/ header file.
63 The following pseudo variables declared in the <tt/atari2600.h/ header
64 file allow access to the Atari 2600 TIA & RIOT chips registers.
68 <tag><tt/TIA/</tag> The <tt/TIA/ structure allows read/write access
69 to the Atari 2600 TIA chip registers. See the <tt/_tia.h/ header
70 file located in the include directory for the declaration of the
71 structure. Also refer to the Stella Programmer's Guide by Steve
72 Wright for a detailed description of the chip and its registers.
74 <tag><tt/RIOT/</tag> The <tt/RIOT/ structure allows read/write
75 access to the Atari 2600 RIOT chip registers. See the
76 <tt/_riot.h/ header file located in the include directory for the
77 declaration of the structure. Also refer to the Stella Programmer's
78 Guide by Steve Wright for a detailed description of the chip and its
84 <sect>Loadable drivers<p>
86 There are no drivers for the Atari 2600.
96 One may write a custom linker configuration file to tune the memory
97 layout of a program. See the <tt/atari2600.cfg/ file in the cfg
98 directory as a starting point.
103 This software is provided 'as-is', without any expressed or implied
104 warranty. In no event will the authors be held liable for any damages
105 arising from the use of this software.
107 Permission is granted to anyone to use this software for any purpose,
108 including commercial applications, and to alter it and redistribute it
109 freely, subject to the following restrictions:
112 <item> The origin of this software must not be misrepresented; you must not
113 claim that you wrote the original software. If you use this software
114 in a product, an acknowledgment in the product documentation would be
115 appreciated but is not required.
116 <item> Altered source versions must be plainly marked as such, and must not
117 be misrepresented as being the original software.
118 <item> This notice may not be removed or altered from any source