]> git.sur5r.net Git - cc65/blob - doc/apple2enh.sgml
5b3301da7a1d7286076af662b7526b055299b38b
[cc65] / doc / apple2enh.sgml
1 <!doctype linuxdoc system>
2
3 <article>
4
5 <title>enhanced&nbsp;Apple&nbsp;//e specific information for cc65
6 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
7 <date>2003-12-16
8
9 <abstract>
10 An overview over the enhanced&nbsp;Apple&nbsp;//e runtime system as it is
11 implemented for the cc65 C compiler.
12 </abstract>
13
14 <!-- Table of contents -->
15 <toc>
16
17 <!-- Begin the document -->
18
19 <sect>Overview<p>
20
21 This file contains an overview of the enhanced&nbsp;Apple&nbsp;//e runtime system
22 as it comes with the cc65 C compiler. It describes the memory layout,
23 enhanced&nbsp;Apple&nbsp;//e specific header files, available drivers, and any
24 pitfalls specific to that platform.
25
26 Please note that enhanced&nbsp;Apple&nbsp;//e specific functions are just mentioned
27 here, they are described in detail in the separate <htmlurl url="funcref.html"
28 name="function reference">. Even functions marked as "platform dependent" may
29 be available on more than one platform. Please see the function reference for
30 more information.
31
32
33
34 <sect>Binary format<p>
35
36 The standard binary output format generated by the linker for the
37 enhanced&nbsp;Apple&nbsp;//e target is a machine language program with a 4 byte DOS
38 3.3 header. The standard load address is &dollar;800.
39
40 The DOS header is in its own segment named <tt/EXEHDR/. If you don't want the
41 header for some reason, you can change
42
43 <verb>
44     HEADER: start = $0000, size = $4, file = %O;
45 </verb>
46
47 to
48
49 <verb>
50     HEADER: start = $0000, size = $4, file = "";
51 </verb>
52
53 in the linker configuration to have the linker remove it.
54
55 Please note that there is a "Apple&nbsp;&rsqb;&lsqb; ProDOS 8 system program
56 for loading binary programs" available in the cc65 User Contributions section.
57 It adds all benefits of a ProDOS 8 system program to the standard binary
58 program generated by the linker for the enhanced&nbsp;Apple&nbsp;//e target.
59
60
61
62 <sect>Memory layout<p>
63
64 In the standard setup, cc65 generated programs use the memory from
65 &dollar;800 to &dollar;95FF, so 35.5K of memory are available. ROM calls are
66 possible without further precautions.
67
68 Special locations:
69
70 <descrip>
71   <tag/Stack/
72   The C runtime stack is located at HIMEM and grows downwards, regardless of
73   how your linker config file is setup.
74
75   <tag/Heap/
76   The C heap is located at the end of the program and grows towards the C
77   runtime stack.
78 </descrip><p>
79
80
81
82 <sect>Platform specific header files<p>
83
84 Programs containing enhanced&nbsp;Apple&nbsp;//e specific code may use the
85 <tt/apple2enh.h/ header file.
86
87
88 <sect1>enhanced&nbsp;Apple&nbsp;//e specific functions<p>
89
90 The functions listed below are special for the enhanced&nbsp;Apple&nbsp;//e. See
91 the <htmlurl url="funcref.html" name="function reference"> for declaration and
92 usage.
93
94 <itemize>
95 <item>_dos_type
96 <item>_textframe
97 <item>_textframexy
98 <item>get_ostype
99 </itemize>
100
101
102 <sect1>Hardware access<p>
103
104 There's currently no support for direct hardware access. This does not mean
105 you cannot do it, it just means that there's no help.
106
107
108
109 <sect>Loadable drivers<p>
110
111
112 <sect1>Graphics drivers<p>
113
114 <descrip>
115
116   <tag><tt/a2e.lo.tgi/</tag>
117   This driver was written by Stefan Haubenthal. It features a resolution of
118   40&times;40 with 16 colors. At the bottom of the screen, 4 additional text
119   lines are available.
120
121   <tag><tt/a2e.hi.tgi/</tag>
122   This driver was written by Stefan Haubenthal. It features a resolution of
123   280&times;192 with 6 colors. Note that programs using this driver will have
124   to be linked with <tt/--start-addr $4000/ to reserve the first hires page.
125
126 </descrip><p>
127
128
129 <sect1>Extended memory drivers<p>
130
131 <descrip>
132
133   <tag><tt/a2e.lc.emd/</tag>
134   Gives access to 12KB RAM (48 pages of 256 bytes each) on the
135   Apple2 language card. The driver was contributed by Stefan Haubenthal.
136   Note that this driver is incompatible with any DOS using the language
137   card memory!
138
139 </descrip><p>
140
141
142 <sect1>Joystick drivers<p>
143
144 <descrip>
145
146   <tag><tt/a2e.stdjoy.joy/</tag>
147   Supports up to two standard analog joysticks connected to the game port of
148   the enhanced&nbsp;Apple&nbsp;//e.
149
150 </descrip><p>
151
152
153 <sect1>Mouse drivers<p>
154
155 Currently no drivers available (in fact, the API for loadable mouse drivers
156 does not exist).
157
158
159 <sect1>RS232 device drivers<p>
160
161 <descrip>
162
163   <tag><tt/a2e.ssc.ser/</tag>
164   Driver for the Apple2 Super Serial Card. Supports up to 19200 baud,
165   hardware flow control (RTS/CTS) and interrupt driven receives. Note
166   that because of the peculiarities of the 6551 chip transmits are not
167   interrupt driven, and the transceiver blocks if the receiver asserts
168   flow control because of a full buffer.
169
170 </descrip><p>
171
172
173
174 <sect>Limitations<p>
175
176
177
178 <sect>Other hints<p>
179
180
181 <sect1>Passing arguments to the program<p>
182
183 Command line arguments can be passed to <tt/main()/ after BLOAD. Since this is not
184 supported by BASIC, the following syntax was chosen:
185
186 <tscreen><verb>
187 ]CALL2048:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
188 </verb></tscreen>
189
190 <enum>
191 <item>Arguments are separated by spaces.
192 <item>Arguments may be quoted.
193 <item>Leading and trailing spaces around an argument are ignored. Spaces within
194       a quoted argument are allowed.
195 <item>The first argument passed to <tt/main/ is the program name.
196 <item>A maximum number of 10 arguments (including the program name) are
197       supported.
198 </enum>
199
200
201 <sect1>Function keys<p>
202
203 These are defined to be OpenApple + number key.
204
205
206 <sect1>Interrupts<p>
207
208 The runtime for the enhanced&nbsp;Apple&nbsp;//e uses routines marked as <tt/.CONDES/
209 type 2 for ProDOS interrupt handlers. Such routines must be written as simple
210 machine language subroutines and will be called automatically by the interrupt
211 handler code when they are linked into a program. See the discussion of the
212 <tt/.CONDES/ feature in the <htmlurl url="ca65.html" name="assembler manual">.
213
214
215
216 <sect>Bugs/Feedback<p>
217
218 If you have problems using the library, if you find any bugs, or if you're
219 doing something interesting with it, I would be glad to hear from you. Feel
220 free to contact me by email (<htmlurl url="mailto:uz@cc65.org"
221 name="uz@cc65.org">).
222
223
224
225 <sect>License<p>
226
227 This software is provided 'as-is', without any expressed or implied
228 warranty.  In no event will the authors be held liable for any damages
229 arising from the use of this software.
230
231 Permission is granted to anyone to use this software for any purpose,
232 including commercial applications, and to alter it and redistribute it
233 freely, subject to the following restrictions:
234
235 <enum>
236 <item>  The origin of this software must not be misrepresented; you must not
237         claim that you wrote the original software. If you use this software
238         in a product, an acknowledgment in the product documentation would be
239         appreciated but is not required.
240 <item>  Altered source versions must be plainly marked as such, and must not
241         be misrepresented as being the original software.
242 <item>  This notice may not be removed or altered from any source
243         distribution.
244 </enum>
245
246 </article>