1 <!doctype linuxdoc system>
5 <title>Atari specific information for cc65
6 <author>Shawn Jefferson, <htmlurl url="mailto:shawnjefferson@24fightingchickens.com" name="shawnjefferson@24fightingchickens.com">
7 Christian Groessler, <htmlurl url="mailto:cpg@aladdin.de" name="cpg@aladdin.de">
11 An overview over the Atari runtime system as it is implemented for the cc65 C
15 <!-- Table of contents -->
18 <!-- Begin the document -->
22 This file contains an overview of the Atari runtime system as it comes
23 with the cc65 C compiler. It describes the memory layout, Atari specific
24 header files, available drivers, and any pitfalls specific to that
27 Please note that Atari specific functions are just mentioned here, they are
28 described in detail in the separate <htmlurl url="funcref.html" name="function
29 reference">. Even functions marked as "platform dependent" may be available on
30 more than one platform. Please see the function reference for more
34 <sect>Binary format<p>
36 The standard binary output format generated by the linker for the
37 Atari target is a machine language program with a standard executable
38 header (FF FF <start address> <end address>). These values are
39 calculated in the crt0.s file from the __CODE_LOAD__ and __BSS_LOAD__
40 values, so keep this in mind if you create a custom linker config file
41 and start moving segments around. You can override this behaviour by
42 creating your own crt0.s file and linking it into your program. A run
43 vector is added to the end of the file ($02E0 <run vector>)
44 and is calculated using __CODE_LOAD__ in crt0.s also.
47 <sect>Memory layout<p>
49 The default linker script assumes that the BASIC ROM is disabled (or
50 the BASIC cartridge unplugged). This gives a usable memory range from
51 $2E00 - $BC1F. The library startup code examines the
52 current memory configuration, which depends on the size of the
53 installed memory and cartridges present, by inspecting the value in
54 the MEMTOP ($2E5) variable. Then the initial stack pointer,
55 which indicates the upper bound of memory used, is adjusted. The load
56 address of $2E00 was chosen to accommodate having a DOS loaded
57 and a driver that resides in low memory such as the 850 R: handler.
58 You can override this behaviour by creating a custom linker config
65 The text screen depends on the installed memory size and cartridges
66 and can be obtained from the SAVMSC variable ($58).
69 The C runtime stack is located at MEMTOP and grows downwards,
70 regardless of how your linker config file is setup. This
71 accomodates the different memory configurations of the Atari
72 machines, as well as having a cartridge installed. You can override
73 this behaviour by writing your own crt0.s file and linking it to
77 The C heap is located at the end of the program and grows towards the C
84 <sect>Platform specific header files<p>
86 Programs containing Atari specific code may use the <tt/atari.h/
90 <sect1>Atari specific functions<p>
92 The functions listed below are special for the Atari. See the <htmlurl
93 url="funcref.html" name="function reference"> for declaration and usage.
110 <sect1>Hardware access<p>
112 The following pseudo variables declared in the <tt/atari.h/ header
113 file do allow access to hardware located in the address space. Some
114 variables are structures, accessing the struct fields will access the
119 <tag><tt/GTIA_READ/ and <tt/GTIA_WRITE/</tag>
120 The <tt/GTIA_READ/ structure allows read access to the GTIA. The
121 <tt/GTIA_WRITE/ structure allows write access to the GTIA.
122 See the <tt/_gtia.h/ header file located in the include directory
123 for the declaration of the structure.
125 <tag><tt/POKEY_READ/ and <tt/POKEY_WRITE/</tag>
126 The <tt/POKEY_READ/ structure allows read access to the POKEY. The
127 <tt/POKEY_WRITE/ structure allows write access to the POKEY.
128 See the <tt/_pokey.h/ header file located in the include directory
129 for the declaration of the structure.
131 <tag><tt/ANTIC/</tag>
132 The <tt/ANTIC/ structure allows read access to the ANTIC.
133 See the <tt/_antic.h/ header file located in the include directory
134 for the declaration of the structure.
137 The <tt/PIA/ structure allows read access to the PIA 6520.
138 See the <tt/_pia.h/ header file located in the include directory
139 for the declaration of the structure.
145 <sect>Loadable drivers<p>
147 <sect1>Graphics drivers<p>
149 Currently there are no graphics drivers available for the Atari platform.
151 <sect1>Extended memory drivers<p>
153 Currently there are no extended memory drivers available for the Atari
156 <sect1>Joystick drivers<p>
160 <tag><tt/atari-stdjoy.joy/</tag>
161 Supports up to four standard joysticks connected to the joystick ports of
168 <sect1>Mouse drivers<p>
170 Currently no drivers available (in fact, the API for loadable mouse drivers
171 does not exist). There is a static driver you can use.
174 <sect1>RS232 device drivers<p>
176 Currently there are no RS232 loadable drivers available for the Atari
177 platform. There is a static driver you can use.
186 <sect1>Function keys<p>
188 These are defined to be Atari + number key.
192 <sect>Bugs/Feedback<p>
194 If you have problems using the library, if you find any bugs, or if you're
195 doing something interesting with it, I would be glad to hear from you. Feel
196 free to contact me by email (<htmlurl url="mailto:uz@cc65.org"
197 name="uz@cc65.org">).
203 This software is provided 'as-is', without any expressed or implied
204 warranty. In no event will the authors be held liable for any damages
205 arising from the use of this software.
207 Permission is granted to anyone to use this software for any purpose,
208 including commercial applications, and to alter it and redistribute it
209 freely, subject to the following restrictions:
212 <item> The origin of this software must not be misrepresented; you must not
213 claim that you wrote the original software. If you use this software
214 in a product, an acknowledgment in the product documentation would be
215 appreciated but is not required.
216 <item> Altered source versions must be plainly marked as such, and must not
217 be misrepresented as being the original software.
218 <item> This notice may not be removed or altered from any source