-
Notifications
You must be signed in to change notification settings - Fork 0
/
atari2600.html
166 lines (117 loc) · 5.24 KB
/
atari2600.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<LINK REL="stylesheet" TYPE="text/css" HREF="doc.css">
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.82">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Atari 2600 specific information for cc65</TITLE>
</HEAD>
<BODY>
<H1>Atari 2600 specific information for cc65</H1>
<H2>
<A HREF="mailto:[email protected]">Florent Flament</A><BR></H2>
<HR>
<EM>An overview over the Atari 2600 runtime system as it is implemented
for the cc65 C compiler.</EM>
<HR>
<P>
<H2><A NAME="toc1">1.</A> <A HREF="atari2600.html#s1">Overview</A></H2>
<P>
<H2><A NAME="toc2">2.</A> <A HREF="atari2600.html#s2">Binary format</A></H2>
<P>
<H2><A NAME="toc3">3.</A> <A HREF="atari2600.html#s3">Memory layout</A></H2>
<P>
<H2><A NAME="toc4">4.</A> <A HREF="atari2600.html#s4">Start-up condition</A></H2>
<P>
<H2><A NAME="toc5">5.</A> <A HREF="atari2600.html#s5">Platform specific header files</A></H2>
<P>
<H2><A NAME="toc6">6.</A> <A HREF="atari2600.html#s6">Loadable drivers</A></H2>
<P>
<H2><A NAME="toc7">7.</A> <A HREF="atari2600.html#s7">Limitations</A></H2>
<P>
<H2><A NAME="toc8">8.</A> <A HREF="atari2600.html#s8">Other hints</A></H2>
<P>
<H2><A NAME="toc9">9.</A> <A HREF="atari2600.html#s9">License</A></H2>
<HR>
<H2><A NAME="s1">1.</A> <A HREF="#toc1">Overview</A></H2>
<P>This file contains an overview of the Atari 2600 runtime system as it
comes with the cc65 C compiler. It describes the memory layout, Atari
2600 specific header files and any pitfalls specific to that platform.</P>
<H2><A NAME="s2">2.</A> <A HREF="#toc2">Binary format</A></H2>
<P>The default binary output format generated by the linker for the Atari
2600 target is a 4K cartridge image.</P>
<H2><A NAME="s3">3.</A> <A HREF="#toc3">Memory layout</A></H2>
<P>cc65 generated programs with the default setup can use RAM from
$0080 to $00FF - __STACKSIZE__, where __STACKSIZE__ is
the size of the system stack with a default value of 16 bytes. The
size of the system stack can be customized by defining the
__STACKSIZE__ linker variable.</P>
<P>Special locations:</P>
<P>
<DL>
<DT><B>Stack</B><DD>
<P>The C runtime stack is located at $00FF -
__STACKSIZE__ and growing downwards.</P>
<DT><B>Heap</B><DD>
<P>The C heap is located at $0080 and grows upwards.</P>
</DL>
</P>
<H2><A NAME="s4">4.</A> <A HREF="#toc4">Start-up condition</A></H2>
<P>When powered-up, the Atari 2600 TIA registers contain random
values. During the initialization phase, the start-up code needs to
initialize the TIA registers to sound values (or else the console has
an unpredictable behavior). In this implementation, zeros are written
to all of TIA registers during the start-up phase.</P>
<P>Note that RIOT registers (mostly timers) are left uninitialized, as
they don't have any consequence on the console behavior.</P>
<H2><A NAME="s5">5.</A> <A HREF="#toc5">Platform specific header files</A></H2>
<P>Programs containing Atari 2600 specific code may use the
<CODE>atari2600.h</CODE> header file.</P>
<P>The following pseudo variables declared in the <CODE>atari2600.h</CODE> header
file allow access to the Atari 2600 TIA & RIOT chips registers.</P>
<P>
<DL>
<DT><B><CODE>TIA</CODE></B><DD>
<P>The <CODE>TIA</CODE> structure allows read/write access
to the Atari 2600 TIA chip registers. See the <CODE>_tia.h</CODE> header
file located in the include directory for the declaration of the
structure. Also refer to the Stella Programmer's Guide by Steve
Wright for a detailed description of the chip and its registers.</P>
<DT><B><CODE>RIOT</CODE></B><DD>
<P>The <CODE>RIOT</CODE> structure allows read/write
access to the Atari 2600 RIOT chip registers. See the
<CODE>_riot.h</CODE> header file located in the include directory for the
declaration of the structure. Also refer to the Stella Programmer's
Guide by Steve Wright for a detailed description of the chip and its
registers.</P>
</DL>
</P>
<H2><A NAME="s6">6.</A> <A HREF="#toc6">Loadable drivers</A></H2>
<P>There are no drivers for the Atari 2600.</P>
<H2><A NAME="s7">7.</A> <A HREF="#toc7">Limitations</A></H2>
<P>TBD</P>
<H2><A NAME="s8">8.</A> <A HREF="#toc8">Other hints</A></H2>
<P>One may write a custom linker configuration file to tune the memory
layout of a program. See the <CODE>atari2600.cfg</CODE> file in the cfg
directory as a starting point.</P>
<H2><A NAME="s9">9.</A> <A HREF="#toc9">License</A></H2>
<P>This software is provided 'as-is', without any expressed or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.</P>
<P>Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:</P>
<P>
<OL>
<LI> The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.</LI>
<LI> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.</LI>
<LI> This notice may not be removed or altered from any source
distribution.</LI>
</OL>
</P>
</BODY>
</HTML>