blob: 88a7e11e0e5ec3c2cff962d451163753985199e2 [file] [log] [blame]
oliverschmidt3cf3d302004-06-08 20:28:33 +00001
2Contiki on the Apple ][ (Oliver Schmidt)
3========================================
4
oliverschmidt3cf3d302004-06-08 20:28:33 +00005
oliverschmidta6f52752006-06-01 22:39:06 +00006Contiki for the Apple ][ comes in two variants:
7
81. 'Contiki40' runs in 40 column text mode and requires at least an Apple ][+
9 with Language Card resulting in 64kB memory.
10
112. 'Contiki80' runs in 80 column text mode and requires at least an enhanced
12 Apple //e with Extended 80 Column Board resulting in 128kB memory.
13
14The remainder of this text describes Contiki80.
15
16
oliverschmidt76872e82004-12-26 14:13:34 +000017Installation
18------------
oliverschmidt3cf3d302004-06-08 20:28:33 +000019
oliverschmidta6f52752006-06-01 22:39:06 +0000201. Get the 'cc65 complete cross development package' from 06/01/2006 or later:
21 http://www.cc65.org
oliverschmidt3cf3d302004-06-08 20:28:33 +000022
oliverschmidt3cf3d302004-06-08 20:28:33 +000023
oliverschmidta6f52752006-06-01 22:39:06 +0000242. Build the two targets apple2enh and programsenh.
oliverschmidt3cf3d302004-06-08 20:28:33 +000025
oliverschmidt5867b672004-07-12 21:35:20 +000026
oliverschmidta6f52752006-06-01 22:39:06 +0000273. Get the 'a2tools' by Terry Kyriacopoulos:
28 ftp://ftp.apple.asimov.net/pub/apple_II/unsorted/a2tools.zip
oliverschmidt3cf3d302004-06-08 20:28:33 +000029
oliverschmidt3cf3d302004-06-08 20:28:33 +000030
oliverschmidta6f52752006-06-01 22:39:06 +0000314. Get the 'Apple][ ProDOS 8 system program for loading binary programs':
32 ftp://ftp.musoftware.de/pub/uz/cc65/contrib/loader-1.2.zip
33
34
355. Use the 'a2tools' to copy these files into a DOS 3.3 disk image:
36
37 a2tools in b dos33.dsk CONTIKI.SYSTEM loader~1.sys
38 a2tools in -r b dos33.dsk CONTIKI contiki
39 a2tools in b.0000 dos33.dsk A2E.STDMOU.MOU a2estd~1.mou
40 a2tools in b.0000 dos33.dsk ABOUT.PRG about.prg
41 a2tools in b.0000 dos33.dsk ABOUT.DSC about.dsc
42 a2tools in b.0000 dos33.dsk CALC.PRG calc.prg
43 a2tools in b.0000 dos33.dsk CALC.DSC calc.dsc
44 a2tools in b.0000 dos33.dsk CONFIG.PRG config.prg
45 a2tools in b.0000 dos33.dsk CONFIGEDIT.PRG config~1.prg
46 a2tools in b.0000 dos33.dsk CONFIGEDIT.DSC config~1.dsc
47 a2tools in b.0000 dos33.dsk DHCP.PRG dhcp.prg
48 a2tools in b.0000 dos33.dsk DHCP.DSC dhcp.dsc
49 a2tools in b.0000 dos33.dsk DIRECTORY.PRG direct~1.prg
50 a2tools in b.0000 dos33.dsk DIRECTORY.DSC direct~1.dsc
51 a2tools in b.0000 dos33.dsk EMAIL.PRG email.prg
52 a2tools in b.0000 dos33.dsk EMAIL.DSC email.dsc
53 a2tools in b.0000 dos33.dsk FTP.PRG ftp.prg
54 a2tools in b.0000 dos33.dsk FTP.DSC ftp.dsc
55 a2tools in b.0000 dos33.dsk IRC.PRG irc.prg
56 a2tools in b.0000 dos33.dsk IRC.DSC irc.dsc
57 a2tools in b.0000 dos33.dsk MEMSTAT.PRG memstat.prg
58 a2tools in b.0000 dos33.dsk MEMSTAT.DSC memstat.dsc
59 a2tools in b.0000 dos33.dsk PROCESSES.PRG proces~1.prg
60 a2tools in b.0000 dos33.dsk PROCESSES.DSC proces~1.dsc
61 a2tools in b.0000 dos33.dsk SHELL.PRG shell.prg
62 a2tools in b.0000 dos33.dsk SHELL.DSC shell.dsc
63 a2tools in b.0000 dos33.dsk TELNET.PRG telnet.prg
64 a2tools in b.0000 dos33.dsk TELNET.DSC telnet.dsc
65 a2tools in b.0000 dos33.dsk WEBSERVER.PRG webser~1.prg
66 a2tools in b.0000 dos33.dsk WEBSERVER.DSC webser~1.dsc
67 a2tools in b.0000 dos33.dsk WELCOME.PRG welcome.prg
68 a2tools in b.0000 dos33.dsk WGET.PRG wget.prg
69 a2tools in b.0000 dos33.dsk WGET.DSC wget.dsc
70 a2tools in b.0000 dos33.dsk WWW.PRG www.prg
71 a2tools in b.0000 dos33.dsk WWW.DSC www.dsc
72 a2tools in b.0000 dos33.dsk LANCEGS.DRV lancegs.drv
73 a2tools in b.0000 dos33.dsk LANCEGS.DSC lancegs.dsc
74 a2tools in b.0000 dos33.dsk UTHER.DRV uther.drv
75 a2tools in b.0000 dos33.dsk UTHER.DSC uther.dsc
76 a2tools in b.0000 dos33.dsk BOUNCE.SAV bounce.sav
77 a2tools in b.0000 dos33.dsk BOUNCE.DSC bounce.dsc
78 a2tools in b.0000 dos33.dsk PLASMA.SAV plasma.sav
79 a2tools in b.0000 dos33.dsk PLASMA.DSC plasma.dsc
80 a2tools in b.0000 dos33.dsk SSFIRE.SAV ssfire.sav
81 a2tools in b.0000 dos33.dsk SSFIRE.DSC ssfire.dsc
82
83
846. Use any ProDOS 8 file utility program capable of reading DOS 3.3 files to
oliverschmidt76872e82004-12-26 14:13:34 +000085 copy the files from the DOS 3.3 disk to a ProDOS 8 disk.
oliverschmidt3cf3d302004-06-08 20:28:33 +000086
oliverschmidt3cf3d302004-06-08 20:28:33 +000087
oliverschmidta6f52752006-06-01 22:39:06 +0000887. Use BASIC.SYSTEM to convert the loader from a BIN to a SYS file:
oliverschmidt76872e82004-12-26 14:13:34 +000089
90 BLOAD CONTIKI.SYSTEM
91 DELETE CONTIKI.SYSTEM
92 CREATE CONTIKI.SYSTEM,TSYS
oliverschmidta6f52752006-06-01 22:39:06 +000093 BSAVE CONTIKI.SYSTEM,TSYS,A$2000,L465
oliverschmidt76872e82004-12-26 14:13:34 +000094
95
oliverschmidt76872e82004-12-26 14:13:34 +000096Usage
97-----
98
99Select CONTIKI.SYSTEM from the ProDOS 8 dispatcher or use BASIC.SYSTEM:
100
101 - CONTIKI.SYSTEM
102
oliverschmidta6f52752006-06-01 22:39:06 +00001031. CONTIKI.SYSTEM supports the ProDOS 8 startup file protocol. The startup file
104 will be initially launched instead of WELCOME.PRG.
oliverschmidt76872e82004-12-26 14:13:34 +0000105
oliverschmidta6f52752006-06-01 22:39:06 +0000106 The startup file support allows to open *.PRG files from the GS/OS finder:
107
108 a) Give your Contiki disk the volume name /CONTIKI
109 b) Copy contiki.icon to /CONTIKI/ICONS/CONTIKI.ICON
110 c) Set the filetype of CONTIKI.ICON to $CA aka ICN
111 d) Set the filetype of the *.PRG files to $FE aka REL
112
1132. Contiki includes mouse support for the AppleMouse II Card, the Apple //c and
114 the Apple IIgs. All slots are searched for mouse firmware but if non is found
115 the mouse support is silently turned off.
116
117 IIgs ROM 3 users: Make sure to have set 'Slot 4' in the 'Control Panel' to
118 'Mouse Port' although this isn't necessary for GS/OS.
oliverschmidt19032c62004-06-14 22:30:32 +0000119
oliverschmidtd78036e2005-03-31 21:55:14 +0000120
oliverschmidta6f52752006-06-01 22:39:06 +0000121Implementation Notes
122--------------------
123
1241. File I/O
125
126 Contiki loads programs, drivers and screensavers from disk using ProDOS 8.
127 The ProDOS 8 file I/O library in the cc65 C-library is to large to be used
128 to load WWW.PRG into a 64k Apple ][. Fortunately WWW.PRG itself does no file
129 I/O but delegates that to WGET.PRG which is a lot smaller than WWW.PRG. so
130 the solution is to have two different file I/O libaries.
131
132 The first one is as small as possible and is only capable of reading one file
133 at a time and only from the directory CONTIKI resides in. It is part of the
134 Contiki kernel and thus called 'KernelFileSystem' (kfs). ProDOS 8 needs a 1kB
135 I/O buffer aligned to a page boundary for every opoen file. The one and only
136 I/O buffer necessary for fks is placed at $0800-$0BFF and serves as buffer
137 for incoming/outgoing IP data as well.
138
139 The other one which is called 'ContikiFileSystem' (cfs) is mapped to the
140 existing cc65 C-library and linked into the programs (like WGET.PRG).
141
1422. Memory Layout
143
144 The Contiki memory layout is based on the standard cc65 layout which means
145 that the binary is loaded to the lowest available address ($0C00 here) and
146 contains the CODE, RODATA and DATA segments. The BSS segment is located
147 directly above those and set to zero programatically. The cc65 stack (not
148 to be confused with the 6502 stack at $0100-$01FF) starts at the highest
149 available address and grows downwards. The heap is located between the BSS
150 and the stack.
151
152 But to satisfy the memory requirements of the larger Contiki programs
153 several modifications were necessary:
154
155 Generally it's very hard to make use of memory mapping for an event driven
156 system like Contiki but the Apple //e allows to map only 8kB of Aux memory
157 to the address space $2000-$3FFF to facilitate double hires graphics. This
158 feature is accompanied by ProDOS 8 which allows to keep /RAM generally active
159 while doing double hires graphics by saving a 8kB file as first file to /RAM
160 and thus preserving $2000-$3FFF of Aux memory. Contiki makes use of all this
161 double hires support while just staying in text mode and using the 8kB as
162 additional memory.
163
164 The additional 8kB are used to store the code of the uIP TCP/IP stack. They
165 are mapped in both on calls from the Contiki event kernel to the TCP/IP stack
166 process (poll and event handler) and calls to the uIP API from programs. Most
167 of the time the 8kB are just kept mapped in when the uIP code calls other
168 code. This is possible because the only memory not reachable from the uIP
169 code are the corresponding 8kB of Main memory - and the Contiki kernel
oliverschmidtda292252006-06-28 20:06:09 +0000170 objects are linked in an order which makes only CTK code (which is never
oliverschmidta6f52752006-06-01 22:39:06 +0000171 called by uIP code) use that 8kB of Main memory. The only call from uIP code
172 that triggers mapping out the 8kB of Aux memory is the uIP upcall into a
173 program for processing incoming IP data as some program may potentially call
174 CTK code while processing that data.
175
176 Beside that Contiki makes use of the Language Card bank 2 to store the code
177 of the C-libary. Most of this 4 kB can be considered free although officially
178 marked as reserved by ProDOS 8. Only $D100-$D3FF are actually used to store
179 the ProDOS 8 dispatcher. As it is only used after terminating Contiki it can
180 be saved to /RAM on startup and restored from there while cleanup.
181
182 The code doing all that code relocation gets overwritten on setting the BSS
183 segment to zero. The code doing this (and the C-library initialization) gets
184 overwritten later by the heap content.
185
oliverschmidt3cf3d302004-06-08 20:28:33 +0000186eof