]> git.sur5r.net Git - cc65/blob - doc/atari2600.sgml
Fixed strpbrk().
[cc65] / doc / atari2600.sgml
1 <!doctype linuxdoc system>
2
3 <article>
4
5 <title>Atari 2600 specific information for cc65
6 <author>
7 <url url="mailto:contact@florentflament.com" name="Florent Flament"><newline>
8 <date>2017-01-11
9
10 <abstract>
11 An overview over the Atari 2600 runtime system as it is implemented
12 for the cc65 C compiler.
13 </abstract>
14
15 <!-- Table of contents -->
16 <toc>
17
18 <!-- Begin the document -->
19
20 <sect>Overview<p>
21
22 This file contains an overview of the Atari 2600 runtime system as it
23 comes with the cc65 C compiler. It describes the memory layout, Atari
24 2600 specific header files and any pitfalls specific to that platform.
25
26 <sect>Binary format<p>
27
28 The default binary output format generated by the linker for the Atari
29 2600 target is a 4K cartridge image.
30
31 <sect>Memory layout<p>
32
33 cc65 generated programs with the default setup can use RAM from
34 &dollar;0080 to &dollar;00FF - __STACKSIZE__, where __STACKSIZE__ is
35 the size of the system stack with a default value of 16 bytes. The
36 size of the system stack can be customized by defining the
37 __STACKSIZE__ linker variable.
38
39 Special locations:
40
41 <descrip>
42   <tag/Stack/ The C runtime stack is located at &dollar;00FF -
43     __STACKSIZE__ and growing downwards.
44
45   <tag/Heap/ The C heap is located at &dollar;0080 and grows upwards.
46
47 </descrip><p>
48
49 <sect>Start-up condition<p>
50
51 When powered-up, the Atari 2600 TIA registers contain random
52 values. During the initialization phase, the start-up code needs to
53 initialize the TIA registers to sound values (or else the console has
54 an unpredictable behavior). In this implementation, zeros are written
55 to all of TIA registers during the start-up phase.
56
57 Note that RIOT registers (mostly timers) are left uninitialized, as
58 they don't have any consequence on the console behavior.
59
60 <sect>Platform specific header files<p>
61
62 Programs containing Atari 2600 specific code may use the
63 <tt/atari2600.h/ header file.
64
65 The following pseudo variables declared in the <tt/atari2600.h/ header
66 file allow access to the Atari 2600 TIA & RIOT chips registers.
67
68 <descrip>
69
70   <tag><tt/TIA/</tag> The <tt/TIA/ structure allows read/write access
71   to the Atari 2600 TIA chip registers. See the <tt/_tia.h/ header
72   file located in the include directory for the declaration of the
73   structure. Also refer to the Stella Programmer's Guide by Steve
74   Wright for a detailed description of the chip and its registers.
75
76   <tag><tt/RIOT/</tag> The <tt/RIOT/ structure allows read/write
77   access to the Atari 2600 RIOT chip registers. See the
78   <tt/_riot.h/ header file located in the include directory for the
79   declaration of the structure. Also refer to the Stella Programmer's
80   Guide by Steve Wright for a detailed description of the chip and its
81   registers.
82
83 </descrip><p>
84
85
86 <sect>Loadable drivers<p>
87
88 There are no drivers for the Atari 2600.
89
90
91 <sect>Limitations<p>
92
93 TBD
94
95
96 <sect>Other hints<p>
97
98 One may write a custom linker configuration file to tune the memory
99 layout of a program. See the <tt/atari2600.cfg/ file in the cfg
100 directory as a starting point.
101
102
103 <sect>License<p>
104
105 This software is provided 'as-is', without any expressed or implied
106 warranty.  In no event will the authors be held liable for any damages
107 arising from the use of this software.
108
109 Permission is granted to anyone to use this software for any purpose,
110 including commercial applications, and to alter it and redistribute it
111 freely, subject to the following restrictions:
112
113 <enum>
114 <item>  The origin of this software must not be misrepresented; you must not
115         claim that you wrote the original software. If you use this software
116         in a product, an acknowledgment in the product documentation would be
117         appreciated but is not required.
118 <item>  Altered source versions must be plainly marked as such, and must not
119         be misrepresented as being the original software.
120 <item>  This notice may not be removed or altered from any source
121         distribution.
122 </enum>
123
124 </article>