]> git.sur5r.net Git - cc65/blob - doc/atari5200.sgml
atari5200: update docs for recent conio changes
[cc65] / doc / atari5200.sgml
1 <!doctype linuxdoc system>
2
3 <article>
4 <title>Atari 5200 specific information for cc65
5 <author>
6 <url url="mailto:chris@groessler.org" name="Christian Groessler"><newline>
7
8 <abstract>
9 An overview over the Atari 5200 runtime system as it is implemented for the
10 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 5200 runtime system as it comes
21 with the cc65 C compiler. It describes the memory layout, Atari 5200 specific header
22 files, available drivers, and any pitfalls specific to that platform.
23
24 Please note that Atari 5200 specific functions are just mentioned here, they are
25 described in detail in the separate <url url="funcref.html" name="function
26 reference">. Even functions marked as "platform dependent" may be available on
27 more than one platform. Please see the function reference for more
28 information.
29
30
31 <sect>Binary format<p>
32
33 The standard binary output format generated by the linker for the Atari 5200 target
34 is a cartridge image. It is of course
35 possible to change this behaviour by using a modified startup file and linker
36 config.
37
38 <sect>Memory layout<p>
39
40 cc65 generated programs with the default setup use the RAM space from &dollar;021C to
41 &dollar;3FFF. If you want to reserve memory for the display list and screen buffer
42 you should define the __RESERVED_MEMORY__ linker variable. The number
43 of bytes specified by __RESERVED_MEMORY__ are lowering the top of
44 memory, therefore the available
45 RAM memory for the program is &dollar;021C to &dollar;3FFF-__RESERVED_MEMORY__.
46 The default linker config file sets __RESERVED_MEMORY__ to &dollar;1E0
47 to reserve space for an optional CONIO text screen.
48
49 Special locations:
50
51 <descrip>
52   <tag/Text screen/
53   The text screen is only enabled if any of the CONIO output functions
54   is used in the program. Its size is 20x24 characters (Antic mode 6,
55   BASIC mode 1) by default. The text screen is located at &dollar;3E00. The
56   address of the screen memory is available at runtime in the variable
57   SAVMSC (&dollar;001B).<p>
58   If the program doesn't use any CONIO output functions it needs to setup its own
59   display list.
60
61   <tag/Stack/
62   The C runtime stack is located at &dollar;3FFF-__RESERVED_MEMORY__ and growing downwards.
63
64   <tag/Heap/
65   The C heap is located at the end of the program and grows towards the C
66   runtime stack.
67
68 </descrip><p>
69
70
71
72 <sect>Platform specific header files<p>
73
74 Programs containing Atari 5200 specific code may use the <tt/atari5200.h/ header file.
75
76
77 <sect1>Atari 5200 specific functions<p>
78
79 <itemize>
80 <item>TBD.
81 </itemize>
82
83
84
85 <sect1>Hardware access<p>
86
87 The following pseudo variables declared in the <tt/atari5200.h/ header
88 file do allow access to hardware located in the address space. Some
89 variables are structures, accessing the struct fields will access the
90 chip registers.
91
92 <descrip>
93
94   <tag><tt/GTIA_READ/ and <tt/GTIA_WRITE/</tag>
95   The <tt/GTIA_READ/ structure allows read access to the GTIA. The
96   <tt/GTIA_WRITE/ structure allows write access to the GTIA.
97   See the <tt/_gtia.h/ header file located in the include directory
98   for the declaration of the structure.
99
100   <tag><tt/POKEY_READ/ and <tt/POKEY_WRITE/</tag>
101   The <tt/POKEY_READ/ structure allows read access to the POKEY. The
102   <tt/POKEY_WRITE/ structure allows write access to the POKEY.
103   See the <tt/_pokey.h/ header file located in the include directory
104   for the declaration of the structure.
105
106   <tag><tt/ANTIC/</tag>
107   The <tt/ANTIC/ structure allows read access to the ANTIC.
108   See the <tt/_antic.h/ header file located in the include directory
109   for the declaration of the structure.
110
111 </descrip><p>
112
113
114 <sect>Loadable drivers<p>
115
116 All drivers must be statically linked because no disk I/O is available.
117 The names in the parentheses denote the symbols to be used for static linking of the drivers.
118
119
120 <sect1>Graphics drivers<p>
121
122 No graphics drivers are currently available for the Atari 5200.
123
124
125 <sect1>Extended memory drivers<p>
126
127 No extended memory drivers are available for the Atari 5200.
128
129
130 <sect1>Joystick drivers<p>
131
132 <descrip>
133
134   <tag><tt/atr5200std.joy (atr5200std_joy)/</tag>
135   A joystick driver for the standard Atari 5200 joystick is
136   available. Depending on the version of the 5200 console, two or four joysticks can be attached.
137
138 </descrip><p>
139
140
141 <sect1>Mouse drivers<p>
142
143 No mouse drivers are available for the Atari 5200.
144
145
146 <sect1>RS232 device drivers<p>
147
148 No serial drivers are available for the Atari 5200.
149
150
151
152 <sect>Limitations<p>
153
154
155 <sect1>Direct console I/O<p>
156
157 The <tt/atari5200/ target uses Antic mode 6 (BASIC mode 1) for the console
158 screen by default. There are four colors available:
159
160 <itemize>
161 <item><tt/COLOR_WHITE/
162 <item><tt/COLOR_RED/
163 <item><tt/COLOR_GREEN/
164 <item><tt/COLOR_BLACK/
165 </itemize>
166
167 Note that the <tt/COLOR_GREEN/ and <tt/COLOR_RED/ colors aren't
168 exactly the same colors as the ones with the same name on the
169 <tt/atari/ target.
170 They are the colors which are available as <tt/COLOR_LIGHTGREEN/
171 and <tt/COLOR_LIGHTRED/ there.
172
173 One can set the color shadow registers directly with other colors.
174 Then the color defines from above will just become placeholders. In
175 this scenario it might be more convenient to use index values (0..3)
176 instead of the color defines. The index values specify which of the
177 system shadow color registers (<tt/COLOR0/ .. <tt/COLOR3/) to use.
178
179 The default console screen has a layout of 20x24 characters. An
180 alternative layout, 20x12, Antic mode 7, BASIC mode 2, is provided in
181 the file <tt/atari5200-conioscreen-20x12.o/.
182
183 Using <tt/atari5200-conioscreen-20x12.o/ is as simple as placing it on
184 the linker command line like this:
185
186 <tscreen><verb>
187 cl65 -t atari5200 myprog.c lib/atari5200-conioscreen-20x12.o
188 </verb></tscreen>
189
190
191 <sect1>Disk I/O<p>
192
193 Disk I/O is not supported by the <tt/atari5200/ target. This means that
194 you cannot use any of the following functions (and a few others):
195
196 <itemize>
197 <item>fclose
198 <item>fopen
199 <item>fread
200 <item>fprintf
201 <item>fputc
202 <item>fscanf
203 <item>fwrite
204 <item>...
205 </itemize>
206
207
208
209 <sect>Other hints<p>
210
211 AtariROMMaker (<url url="https://www.wudsn.com/index.php/productions-atari800/tools/atarirommaker"> ) 
212 can be used to create a <tt/.CAR/ file from the binary ROM image cc65 generates.
213 This might be more convenient when working with emulators.
214
215
216 <sect>License<p>
217
218 This software is provided 'as-is', without any expressed or implied
219 warranty.  In no event will the authors be held liable for any damages
220 arising from the use of this software.
221
222 Permission is granted to anyone to use this software for any purpose,
223 including commercial applications, and to alter it and redistribute it
224 freely, subject to the following restrictions:
225
226 <enum>
227 <item>  The origin of this software must not be misrepresented; you must not
228         claim that you wrote the original software. If you use this software
229         in a product, an acknowledgment in the product documentation would be
230         appreciated but is not required.
231 <item>  Altered source versions must be plainly marked as such, and must not
232         be misrepresented as being the original software.
233 <item>  This notice may not be removed or altered from any source
234         distribution.
235 </enum>
236
237 </article>