2015-02-06 21:53:36 +00:00
|
|
|
<!doctype linuxdoc system>
|
|
|
|
|
|
|
|
<article>
|
|
|
|
<title>Ohio Scientific-specific information for cc65
|
|
|
|
<author>
|
2015-03-07 21:37:58 +00:00
|
|
|
<url url="mailto:stephan.muehlstrasser@web.de" name="Stephan Mühlstrasser">,<newline>
|
|
|
|
<url url="mailto:greg.king5@verizon.net" name="Greg King">
|
2015-02-06 21:53:36 +00:00
|
|
|
|
|
|
|
<abstract>
|
|
|
|
An overview over the Ohio Scientific runtime system as it is implemented for the cc65 C
|
|
|
|
compiler.
|
|
|
|
</abstract>
|
|
|
|
|
|
|
|
<!-- Table of contents -->
|
|
|
|
<toc>
|
|
|
|
|
|
|
|
<!-- Begin the document -->
|
|
|
|
|
|
|
|
<sect>Overview<p>
|
|
|
|
|
|
|
|
This file contains an overview of the Ohio Scientific runtime system as it comes with the
|
|
|
|
cc65 C compiler. It describes the memory layout, Ohio Scientific-specific header files,
|
|
|
|
and any pitfalls specific to that platform.
|
|
|
|
|
|
|
|
Please note that Ohio Scientific-specific functions are just mentioned here, they are
|
|
|
|
described in detail in the separate <url url="funcref.html" name="function
|
|
|
|
reference">. Even functions marked as "platform dependent" may be available on
|
|
|
|
more than one platform. Please see the function reference for more
|
|
|
|
information.
|
|
|
|
|
|
|
|
<sect>Targets<p>
|
|
|
|
|
|
|
|
Currently the target "osic1p" is implemented. This works for the Ohio Scientific
|
2015-03-22 21:45:53 +00:00
|
|
|
Challenger 1P machine and for the Briel Superboard /// replica.
|
2015-02-06 21:53:36 +00:00
|
|
|
|
2015-03-07 21:37:58 +00:00
|
|
|
<sect>Program file formats<p>
|
2015-02-06 21:53:36 +00:00
|
|
|
|
2015-03-07 21:37:58 +00:00
|
|
|
<descrip>
|
|
|
|
<tag/Binary, then text/
|
|
|
|
The standard binary output format generated by the linker for the osic1p
|
|
|
|
target is a pure machine language program.
|
|
|
|
|
|
|
|
For uploading into a real machine over its serial port or into an emulator,
|
|
|
|
that program must be converted into a text file that can be understood by
|
|
|
|
the 65V PROM monitor. For that purpose, the <bf/srec_cat/ program from <url
|
|
|
|
url="http://srecord.sourceforge.net/" name="the SRecord tool collection">
|
|
|
|
can be used.
|
|
|
|
|
|
|
|
Care must be taken that the <tt/-offset/ and <tt/-execution-start-address/
|
|
|
|
options for the <bf/srec_cat/ program correspond to the start address
|
|
|
|
of the executable.
|
|
|
|
|
|
|
|
Example for converting an executable "hello" file that was built for the
|
|
|
|
default start address $0200 to an uploadable file "hello.c1p":
|
2015-02-06 21:53:36 +00:00
|
|
|
|
2015-03-07 21:37:58 +00:00
|
|
|
<tscreen><verb>
|
|
|
|
srec_cat hello -bin -of 0x200 -o hello.c1p -os -esa=0x200
|
|
|
|
</verb></tscreen>
|
2015-02-06 21:53:36 +00:00
|
|
|
|
2015-03-07 21:37:58 +00:00
|
|
|
<tag/Hybrid/
|
|
|
|
The linker can create an alternate format that contains two parts:
|
|
|
|
<enum>
|
|
|
|
<item>A text header that is understood by the 65V PROM monitor.
|
|
|
|
It is a boot loader that reads the second part.
|
|
|
|
<item>The default binary code that is described above.
|
|
|
|
</enum>
|
2015-02-06 21:53:36 +00:00
|
|
|
|
2015-03-07 21:37:58 +00:00
|
|
|
You can make the alternate format by adding the option <tt/-u __BOOT__/ to
|
|
|
|
<tt/cl65/'s or <tt/ld65/'s command lines.
|
2015-02-06 21:53:36 +00:00
|
|
|
|
2015-03-07 21:37:58 +00:00
|
|
|
This format doesn't need to be converted. It is smaller than the text-only
|
|
|
|
format. But, it cannot be loaded by <url
|
|
|
|
url="http://www.pcjs.org/docs/c1pjs/" name="C1Pjs">; you must use the
|
2015-03-08 14:43:03 +00:00
|
|
|
SRecord-produced text-only format with that emulator. (However, if you know
|
|
|
|
that you never will use C1Pjs, then you can edit the
|
|
|
|
<tt>cfg/osic1p*.cfg</tt> files; uncomment the lines that import <tt/__BOOT__/.
|
|
|
|
Then, you won't need to use <tt/-u __BOOT__/ on your command lines.)
|
2015-03-07 21:37:58 +00:00
|
|
|
|
|
|
|
</descrip>
|
2015-02-06 21:53:36 +00:00
|
|
|
|
|
|
|
<sect>Memory layout<p>
|
|
|
|
|
|
|
|
By default programs compiled for the osic1p target are configured for 32 kB RAM.
|
2015-03-07 21:37:58 +00:00
|
|
|
The RAM size can be configured via the symbol <tt/__HIMEM__/.
|
2015-02-06 21:53:36 +00:00
|
|
|
|
|
|
|
Special locations:
|
|
|
|
|
|
|
|
<descrip>
|
|
|
|
<tag/Program start address/
|
|
|
|
The default start address is $0200. The start address is configurable
|
2015-03-07 21:37:58 +00:00
|
|
|
via the linker option <tt/--start-addr/.
|
2015-02-06 21:53:36 +00:00
|
|
|
|
|
|
|
<tag/Stack/
|
|
|
|
The C runtime stack is located at the top of RAM and growing downwards.
|
2015-03-07 21:37:58 +00:00
|
|
|
The size is configurable via the symbol <tt/__STACKSIZE__/. The default
|
2015-02-06 21:53:36 +00:00
|
|
|
stack size is $0400.
|
|
|
|
|
|
|
|
<tag/Heap/
|
|
|
|
The C heap is located at the end of the program and grows towards the C
|
|
|
|
runtime stack.
|
|
|
|
|
|
|
|
<tag/Video RAM/
|
2015-03-07 21:37:58 +00:00
|
|
|
The 1 kB video RAM is located at $D000. On the monitor, only a subset
|
2015-02-06 21:53:36 +00:00
|
|
|
of the available video RAM is visible. The address of the upper left corner
|
2015-02-08 14:06:55 +00:00
|
|
|
of the visible area is $D085 and corresponds to conio cursor
|
2015-02-06 21:53:36 +00:00
|
|
|
position (0, 0).
|
|
|
|
|
|
|
|
</descrip><p>
|
|
|
|
|
|
|
|
Example for building a program with start address $0300, stack size
|
2015-02-08 14:46:33 +00:00
|
|
|
$0200 and RAM size $2000:
|
2015-02-06 21:53:36 +00:00
|
|
|
|
2015-03-07 21:37:58 +00:00
|
|
|
<tscreen><verb>
|
2015-02-08 14:46:33 +00:00
|
|
|
cl65 --start-addr 0x300 -Wl -D,__HIMEM__=$2000,-D,__STACKSIZE__=$0200 -t osic1p hello.c
|
2015-03-07 21:37:58 +00:00
|
|
|
</verb></tscreen>
|
2015-02-06 21:53:36 +00:00
|
|
|
|
2015-02-08 14:06:55 +00:00
|
|
|
<sect>Linker configurations<p>
|
|
|
|
|
|
|
|
The ld65 linker comes with a default config file "osic1p.cfg" for the Ohio Scientific
|
|
|
|
Challenger 1P, which is implicitly used via <tt/-t osic1p/. The
|
|
|
|
osic1p package comes with additional secondary linker config files, which are
|
|
|
|
used via <tt/-t osic1p -C <configfile>/.
|
|
|
|
|
2015-03-22 21:45:53 +00:00
|
|
|
<sect1>Default config file (<tt/osic1p.cfg/)<p>
|
2015-02-08 14:06:55 +00:00
|
|
|
|
|
|
|
The default configuration is tailored to C programs.
|
|
|
|
|
|
|
|
<sect1><tt/osic1p-asm.cfg/<p>
|
|
|
|
|
|
|
|
This configuration is made for assembler programmers who don't need a special
|
|
|
|
setup.
|
|
|
|
|
|
|
|
To use this config file, assemble with <tt/-t osic1p/ and link with
|
|
|
|
<tt/-C osic1p-asm.cfg/. The former will make sure that correct runtime library
|
|
|
|
is used, while the latter supplies the actual config. When using <tt/cl65/,
|
|
|
|
use both command line options.
|
|
|
|
|
2015-03-07 21:37:58 +00:00
|
|
|
Sample command lines for <tt/cl65/:
|
2015-02-08 14:06:55 +00:00
|
|
|
|
|
|
|
<tscreen><verb>
|
2015-03-07 21:37:58 +00:00
|
|
|
cl65 -t osic1p -C osic1p-asm.cfg -o program source.s
|
|
|
|
cl65 -t osic1p -C osic1p-asm.cfg -u __BOOT__ -o program.lod source.s
|
2015-02-08 14:06:55 +00:00
|
|
|
</verb></tscreen>
|
|
|
|
|
2015-02-06 21:53:36 +00:00
|
|
|
<sect>Platform-specific header files<p>
|
|
|
|
|
2015-03-07 21:37:58 +00:00
|
|
|
Programs containing Ohio Scientific-specific code may use the <tt/osic1p.h/
|
|
|
|
header file.
|
2015-02-06 21:53:36 +00:00
|
|
|
|
2015-02-06 23:20:38 +00:00
|
|
|
<sect1>Ohio Scientific-specific functions<p>
|
2015-02-06 21:53:36 +00:00
|
|
|
|
|
|
|
There are currently no special Ohio Scientific functions.
|
|
|
|
|
|
|
|
<sect1>Hardware access<p>
|
|
|
|
|
|
|
|
There is no specific support for direct hardware access.
|
|
|
|
|
|
|
|
<sect>Loadable drivers<p>
|
|
|
|
|
|
|
|
There are no loadable drivers available.
|
|
|
|
|
2015-03-22 21:45:53 +00:00
|
|
|
<sect>Support for different screen layouts<p>
|
|
|
|
|
|
|
|
By default the conio library uses a 24 columns by 24 lines screen layout
|
|
|
|
for the Challenger 1P, like under BASIC. In addition to that there is support
|
|
|
|
for other screen layouts with extra modules.
|
|
|
|
|
|
|
|
There is a module <tt/screen-c1p-24x24.o/ in the OSI-specific
|
|
|
|
cc65 runtime library that contains all conio functions that depend
|
|
|
|
on the screen layout. No further configuration is needed for using the
|
|
|
|
default screen layout of the Challenger 1P.
|
|
|
|
|
|
|
|
For other screen layouts additional versions of the screen module are
|
|
|
|
available. The linker finds these modules without further configuration
|
|
|
|
if they are specified on the compiler or linker command line. The
|
|
|
|
extra module then overrides the default module.
|
|
|
|
|
|
|
|
Sample <tt/cl65/ command line to override the default screen
|
|
|
|
module with the module <tt/osic1p-screen-s3-32x28.o/:
|
|
|
|
|
|
|
|
<tscreen><verb>
|
|
|
|
cl65 -o hello -t osic1p osic1p-screen-s3-32x28.o hello.c
|
|
|
|
</verb></tscreen>
|
|
|
|
|
|
|
|
Currently the following extra screen configuration modules are implemented:
|
|
|
|
|
|
|
|
<itemize>
|
|
|
|
<item><tt>osic1p-screen-s3-32x28.o</tt>: 32 columns by 28 lines mode
|
|
|
|
for Briel Superboard ///</item>
|
2023-05-05 22:02:42 +00:00
|
|
|
<item><tt>osic1p-screen-c1p-48x12.s</tt>: 48 columns by 12 lines mode
|
|
|
|
for Challenger 1P</item>
|
2015-03-22 21:45:53 +00:00
|
|
|
</itemize>
|
|
|
|
|
2023-05-05 22:02:42 +00:00
|
|
|
On the Briel Superboard /// you enter 32 column mode by holding down
|
|
|
|
the BREAK key on powerup.
|
|
|
|
|
|
|
|
On the Challenger 1P you can enable 48 column mode by writing a 1 to
|
|
|
|
bit 0 of address $D800, and writing a 0 to go back to 24 column mode.
|
|
|
|
You can use code like the following to do this:
|
|
|
|
|
|
|
|
<tscreen><verb>
|
|
|
|
*(char*)0xd800 = 1; /* Switch to 48 column mode */
|
|
|
|
</verb></tscreen>
|
|
|
|
|
2015-02-06 21:53:36 +00:00
|
|
|
<sect>Limitations<p>
|
|
|
|
|
|
|
|
<sect1>stdio implementation<p>
|
|
|
|
|
|
|
|
There is no support for stdio at the moment.
|
|
|
|
|
|
|
|
<sect>Other hints<p>
|
|
|
|
|
|
|
|
<sect1>Passing arguments to the program<p>
|
|
|
|
|
|
|
|
There is currently no support for passing arguments to a program.
|
|
|
|
|
|
|
|
<sect1>Program return code<p>
|
|
|
|
|
|
|
|
The program return code currently has no effect. When the main() function
|
|
|
|
finishes, the boot prompt is shown again.
|
|
|
|
|
|
|
|
<sect>License<p>
|
|
|
|
|
|
|
|
This software is provided 'as-is', without any expressed or implied
|
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
|
|
arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
<enum>
|
2019-02-12 21:50:49 +00:00
|
|
|
<item> The origin of this software must not be misrepresented; you must not
|
|
|
|
claim that you wrote the original software. If you use this software
|
|
|
|
in a product, an acknowledgment in the product documentation would be
|
|
|
|
appreciated but is not required.
|
|
|
|
<item> Altered source versions must be plainly marked as such, and must not
|
|
|
|
be misrepresented as being the original software.
|
|
|
|
<item> This notice may not be removed or altered from any source
|
|
|
|
distribution.
|
2015-02-06 21:53:36 +00:00
|
|
|
</enum>
|
|
|
|
|
|
|
|
</article>
|
2015-03-22 21:45:53 +00:00
|
|
|
|