]> git.sur5r.net Git - cc65/blob - doc/atari2600.sgml
remote TABs in doc/ and test/
[cc65] / doc / atari2600.sgml
1 <!doctype linuxdoc system>
2
3 <article>
4 <title>Atari 2600 specific information for cc65
5 <author>
6 <url url="mailto:contact@florentflament.com" name="Florent Flament"><newline>
7
8 <abstract>
9 An overview over the Atari 2600 runtime system as it is implemented
10 for the cc65 C compiler.
11 </abstract>
12
13 <!-- Table of contents -->
14 <toc>
15
16 <!-- Begin the document -->
17
18 <sect>Overview<p>
19
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.
23
24 <sect>Binary format<p>
25
26 The default binary output format generated by the linker for the Atari
27 2600 target is a 4K cartridge image.
28
29 <sect>Memory layout<p>
30
31 cc65 generated programs with the default setup can use RAM from
32 &dollar;0080 to &dollar;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.
36
37 Special locations:
38
39 <descrip>
40   <tag/Stack/ The C runtime stack is located at &dollar;00FF -
41     __STACKSIZE__ and growing downwards.
42
43   <tag/Heap/ The C heap is located at &dollar;0080 and grows upwards.
44
45 </descrip><p>
46
47 <sect>Start-up condition<p>
48
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.
54
55 Note that RIOT registers (mostly timers) are left uninitialized, as
56 they don't have any consequence on the console behavior.
57
58 <sect>Platform specific header files<p>
59
60 Programs containing Atari 2600 specific code may use the
61 <tt/atari2600.h/ header file.
62
63 The following pseudo variables declared in the <tt/atari2600.h/ header
64 file allow access to the Atari 2600 TIA & RIOT chips registers.
65
66 <descrip>
67
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.
73
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
79   registers.
80
81 </descrip><p>
82
83
84 <sect>Loadable drivers<p>
85
86 There are no drivers for the Atari 2600.
87
88
89 <sect>Limitations<p>
90
91 TBD
92
93
94 <sect>Other hints<p>
95
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.
99
100
101 <sect>License<p>
102
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.
106
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:
110
111 <enum>
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
119         distribution.
120 </enum>
121
122 </article>