]> git.sur5r.net Git - cc65/blob - doc/osi.sgml
Merge branch 'master' of https://github.com/cc65/cc65 into c1p
[cc65] / doc / osi.sgml
1 <!doctype linuxdoc system>
2
3 <article>
4
5 <title>Ohio Scientific-specific information for cc65
6 <author>
7 <url url="mailto:stephan.muehlstrasser@web.de" name="Stephan M&uuml;hlstrasser"><newline>
8 <date>2015-02-04
9
10 <abstract>
11 An overview over the Ohio Scientific runtime system as it is implemented for the cc65 C
12 compiler.
13 </abstract>
14
15 <!-- Table of contents -->
16 <toc>
17
18 <!-- Begin the document -->
19
20 <sect>Overview<p>
21
22 This file contains an overview of the Ohio Scientific runtime system as it comes with the
23 cc65 C compiler. It describes the memory layout, Ohio Scientific-specific header files,
24 and any pitfalls specific to that platform.
25
26 Please note that Ohio Scientific-specific functions are just mentioned here, they are
27 described in detail in the separate <url url="funcref.html" name="function
28 reference">. Even functions marked as "platform dependent" may be available on
29 more than one platform. Please see the function reference for more
30 information.
31
32 <sect>Targets<p>
33
34 Currently the target "osic1p" is implemented. This works for the Ohio Scientific
35 Challenger 1P machine.
36
37 <sect>Binary format<p>
38
39 The standard binary output format generated by the linker for the osic1p target
40 is a machine language program.<p>
41
42 For uploading into a real machine over the serial port or into an emulator a
43 program must be converted to a text file that is understood by the 65V PROM
44 monitor. For this purpose the srec_cat program from the
45 <url url="http://srecord.sourceforge.net/" name="SRecord">
46 tool collection can be used.
47
48 Care must be taken that the -offset and -execution-start-address options for the srec_cat
49 program correspond to the start address of the executable.
50
51 Example for converting an executable "hello" that was built for the default
52 start address &dollar;0200 to an uploadable file "hello.c1p":
53
54 <tscreen>
55 srec_cat hello -binary -offset 0x200 -o hello.c1p -Ohio_Scientific -execution-start-address=0x200
56 </tscreen>
57
58 <sect>Memory layout<p>
59
60 By default programs compiled for the osic1p target are configured for 32 kB RAM.
61 The RAM size can be configured via the symbol __HIMEM__.
62
63 Special locations:
64
65 <descrip>
66   <tag/Program start address/
67   The default start address is &dollar;0200. The start address is configurable
68   via the compiler option --start-addr.
69
70   <tag/Stack/
71   The C runtime stack is located at the top of RAM and growing downwards.
72   The size is configurable via the symbol __STACKSIZE__. The default
73   stack size is &dollar;0400.
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
79   <tag/Video RAM/
80   The 1 kB video RAM is located at &dollar;D000. On the monitor only a subset
81   of the available video RAM is visible. The address of the upper left corner
82   of the visible area is &dollar;D085 and corresponds to conio cursor
83   position (0, 0).
84
85 </descrip><p>
86
87 Example for building a program with start address &dollar;0300, stack size
88 &dollar;0200 and RAM size &dollar;2000:
89
90 <tscreen>
91 cl65 --start-addr 0x300 -Wl -D,__HIMEM__=$2000,-D,__STACKSIZE__=$0200 -t osic1p hello.c
92 </tscreen>
93
94 <sect>Linker configurations<p>
95
96 The ld65 linker comes with a default config file "osic1p.cfg" for the Ohio Scientific
97 Challenger 1P, which is implicitly used via <tt/-t osic1p/. The
98 osic1p package comes with additional secondary linker config files, which are
99 used via <tt/-t osic1p -C &lt;configfile&gt;/.
100
101 <sect1>default config file (<tt/osic1p.cfg/)<p>
102
103 The default configuration is tailored to C programs.
104
105 <sect1><tt/osic1p-asm.cfg/<p>
106
107 This configuration is made for assembler programmers who don't need a special
108 setup.
109
110 To use this config file, assemble with <tt/-t osic1p/ and link with
111 <tt/-C osic1p-asm.cfg/. The former will make sure that correct runtime library
112 is used, while the latter supplies the actual config. When using <tt/cl65/,
113 use both command line options.
114
115 Sample command line for <tt/cl65/:
116
117 <tscreen><verb>
118 cl65 -o program -t osic1p -C osic1p-asm.cfg source.s
119 </verb></tscreen>
120
121 <sect>Platform-specific header files<p>
122
123 Programs containing Ohio Scientific-specific code may use the <tt/osic1p.h/ 
124 header file. 
125
126 <sect1>Ohio Scientific-specific functions<p>
127
128 There are currently no special Ohio Scientific functions.
129
130 <sect1>Hardware access<p>
131
132 There is no specific support for direct hardware access.
133
134 <sect>Loadable drivers<p>
135
136 There are no loadable drivers available.
137
138 <sect>Limitations<p>
139
140 <sect1>conio implementation<p>
141
142 The conio implementation is complete except for the kbhit() function. A
143 call to cgetc() always blocks until a character is entered.
144
145 <sect1>stdio implementation<p>
146
147 There is no support for stdio at the moment.
148
149 <sect>Other hints<p>
150
151 <sect1>Passing arguments to the program<p>
152
153 There is currently no support for passing arguments to a program.
154
155 <sect1>Program return code<p>
156
157 The program return code currently has no effect. When the main() function
158 finishes, the boot prompt is shown again.
159
160 <sect>License<p>
161
162 This software is provided 'as-is', without any expressed or implied
163 warranty.  In no event will the authors be held liable for any damages
164 arising from the use of this software.
165
166 Permission is granted to anyone to use this software for any purpose,
167 including commercial applications, and to alter it and redistribute it
168 freely, subject to the following restrictions:
169
170 <enum>
171 <item>  The origin of this software must not be misrepresented; you must not
172         claim that you wrote the original software. If you use this software
173         in a product, an acknowledgment in the product documentation would be
174         appreciated but is not required.
175 <item>  Altered source versions must be plainly marked as such, and must not
176         be misrepresented as being the original software.
177 <item>  This notice may not be removed or altered from any source
178         distribution.
179 </enum>
180
181 </article>