Neue Version V963
git-svn-id: svn://svn.compuextreme.de/Viitor/V963/Viitor_cc65@5933 504e572c-2e33-0410-9681-be2bf7408885
This commit is contained in:
commit
223cc6685e
18
etc/sysconfig/profile.d/cc65
Executable file
18
etc/sysconfig/profile.d/cc65
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
#Systeminitialisierung für cc65
|
||||
#
|
||||
#Letzte Änderung von: $Author$
|
||||
#Datum der letzten Änderung: $Date$
|
||||
#Version der Datei: $Revision$
|
||||
#
|
||||
#$Log$
|
||||
#Revision 1.2 2006/03/21 12:20:12 segler
|
||||
#Bug in den Zuweisungen fixed (keine Spaces vor und nach =)
|
||||
#
|
||||
#Revision 1.1.1.1 2006/03/21 10:11:51 segler
|
||||
#Sytemumgebung cc65
|
||||
#
|
||||
|
||||
CC65INC=/usr/lib/cc65/include
|
||||
CC65LIB=/usr/lib/cc65/lib
|
||||
export CC65INC CC65LIB
|
16
usr/share/doc/cc65/webdoc/BUGS
Normal file
16
usr/share/doc/cc65/webdoc/BUGS
Normal file
|
@ -0,0 +1,16 @@
|
|||
List of known bugs that will not get fixed before any new major release:
|
||||
|
||||
* The compiler does not detect if part of an expression evaluated
|
||||
with && or || is constant. For preprocessor evaluation, special
|
||||
routines are used, so this is not true for the preprocessor.
|
||||
|
||||
|
||||
Introduced with version 2.5:
|
||||
|
||||
* Use of "goto" to jump into or out of blocks that declare local variables
|
||||
will create programs that crash, since the stack is not corrected. The old
|
||||
stack correction code was removed because of the restructuring of the
|
||||
symbol table stuff and was not reintroduced because it was ugly anyway,
|
||||
did not work with the new symbol table code, and should be unnecessary as
|
||||
soon as local variables are allocated in one chunk on function entry.
|
||||
|
157
usr/share/doc/cc65/webdoc/CREDITS
Normal file
157
usr/share/doc/cc65/webdoc/CREDITS
Normal file
|
@ -0,0 +1,157 @@
|
|||
|
||||
Many special thanks go to the guy who started it all:
|
||||
|
||||
John R. Dunning
|
||||
|
||||
Without his great work, there would not be a single freeware C crosscompiler
|
||||
for the 6502 out there. He built the grounds for this cc65 and some other cc65
|
||||
implementations and a lot of his code is still in the current compiler.
|
||||
|
||||
|
||||
|
||||
More special thanks to:
|
||||
|
||||
* Keith W. Gerdes <kwg@netzero.net>
|
||||
|
||||
Without his outstanding help, the assembler/compiler wouldn't be, what it
|
||||
is now. He helped with suggestions, bug reports and even kicked me here
|
||||
and then, when I started to get too lazy:-)
|
||||
|
||||
* Kevin Ruland <kevin@rodin.wustl.edu>
|
||||
|
||||
Kevin did the Apple 2 port and found at least one serious error in the
|
||||
C library while doing so.
|
||||
|
||||
* Christian Groessler <cpg@aladdin.de>
|
||||
Mark Keates <Mark.Keates@dendrite.com>
|
||||
Freddy Offenga <taf_offenga@yahoo.com>
|
||||
David Lloyd <dmlloyd@atari-central.com>
|
||||
|
||||
The team that added support for the Atari 8 bit machines.
|
||||
Christian Groessler also sent me several fixes for 64 bit machines.
|
||||
|
||||
* Sidney Cadot <sidney@ch.twi.tudelft.nl>
|
||||
|
||||
Sidney rewrote the random number generator.
|
||||
|
||||
* Maciej Witkowiak <ytm@friko.onet.pl>
|
||||
|
||||
Maciej wrote the GEOS support libraries for cc65.
|
||||
|
||||
* Eric Au <eric_au@hotmail.com>
|
||||
|
||||
Eric is one of the most active testers, and supplied me with dozens of
|
||||
bug reports.
|
||||
|
||||
* MicroSystems Development Technologies Inc. located in San Jose,
|
||||
California payed me for the addition of several assembler features,
|
||||
which went also into the freeware version. These guys are selling
|
||||
nice hardware devices like EPROM emulators. If you are developing
|
||||
hardware or embedded microcontroller applications, you should have
|
||||
a look at their web site at www.msd.com.
|
||||
|
||||
* Mirco Miranda <mircomir@libero.it>
|
||||
|
||||
Miroc contributed Makefile additions, docs and patches to compile cc65
|
||||
cleanly under OS/2 using the EMX toolkit.
|
||||
|
||||
* Marc 'BlackJack' Rintsch <blackjack@civitas64.de>
|
||||
|
||||
Marc wrote and contributed BASIC compatible file I/O routines for the
|
||||
Commodore machines.
|
||||
|
||||
* Groepaz <groepaz@gmx.net>
|
||||
|
||||
Thanks for several nice samples programs, the NES port, and a lot of other
|
||||
code.
|
||||
|
||||
* Craig Bruce
|
||||
|
||||
...for his public domain Swiftlink/Turbo232 drivers which are part
|
||||
of the cc65 library in modified form.
|
||||
|
||||
* Steve Schmidtke <steve_schmidtke@hotmail.com>
|
||||
|
||||
Steve contributed the VIC20 port.
|
||||
|
||||
* Michael Klein <michael.klein@puffin.lb.shuttle.de>
|
||||
|
||||
for the Debian support files.
|
||||
|
||||
* Greg King <gngking@erols.com>
|
||||
|
||||
reported quite some bugs and helped with lots of code and suggestions.
|
||||
|
||||
* MagerValp <magervalp@cling.gu.se>
|
||||
|
||||
for sample code regarding the Plus/4 banking, the base for the new C128
|
||||
conio library supporting 80 column mode and much more.
|
||||
|
||||
* Piotr Fusik <P.Fusik@elka.pw.edu.pl>
|
||||
|
||||
for the zlib routines, lots of bug reports, code snippets and
|
||||
suggestions.
|
||||
|
||||
* Josef Soucek <josef.soucek@ct.cz>
|
||||
|
||||
Josef contributed the CBM directory routines.
|
||||
|
||||
* Stephen L. Judd
|
||||
|
||||
for his GRLIB code which is the base of the C64 320x200 TGI driver.
|
||||
|
||||
* Stefan A. Haubenthal <polluks@web.de>
|
||||
|
||||
Stefan contributed several code snippets for the C64 and Apple ][.
|
||||
|
||||
* Peter Trauner <peter.trauner@utanet.at>
|
||||
|
||||
Peter added minimal Supervision support.
|
||||
|
||||
* The Lynx guys: Bastian Schick, who contributed the code from his own,
|
||||
lynx-only version of cc65, and Karri Kaksonen <karri@sipo.fi> and Shawn
|
||||
Jefferson <jefferson_shawn_a8bit@yahoo.com> who built on this foundation.
|
||||
|
||||
* Oliver Schmidt <ol.sc@web.de> ...
|
||||
|
||||
... for quite some Apple ][ contributions.
|
||||
|
||||
|
||||
|
||||
Thanks to
|
||||
|
||||
da Blondie <db@tvnet.hu>
|
||||
Adam Dunkels <adam@sics.se>
|
||||
Bill Craig <craigw@gusun.georgetown.edu>
|
||||
C. N. Wong <superufo@netvigator.com>
|
||||
Carsten Strotmann <cas@strotmann.de>
|
||||
Chris Ward <chris.ward@freenet.co.uk>
|
||||
Dagan Galarneau <dagan@dnai.com>
|
||||
Darrell Krulce <dkrulce@atcomm.com>
|
||||
Dennis Lin <dennis@mosart.com.tw>
|
||||
Eric Bacher <ebacher@teaser.fr>
|
||||
Gábor Lénárt <lgb@lgb.hu>
|
||||
Ingo Korb <unseen@gmx.net>
|
||||
Jacek Jozwiak <jacek.jozwiak@interia.pl>
|
||||
Jaleco <jaleco@gameone.com.tw>
|
||||
Jari Tuominen <jer64@kolumbus.fi>
|
||||
Jesse Beach <agmorion@erols.com>
|
||||
Joerg Schwedes <joerg.schwedes@siemens.com>
|
||||
John Weidman <jweidman@slip.net>
|
||||
Jonathan Wright <jonathan.wright@adtran.com>
|
||||
Mark Nasgowitz <MNasgowitz@NAZdesign.com>
|
||||
Peter Karlsson <peter@softwolves.pp.se>
|
||||
Robert R. Wal <rrw@reptile.eu.org>
|
||||
Shawn Jefferson <sjefferson@sd62.bc.ca>
|
||||
Stefan Andree <sandree@physik.tu-berlin.de>
|
||||
Stephan Lesch <slesch@studcs.uni-sb.de>
|
||||
Tim Vanderhoek <hoek@FreeBSD.org>
|
||||
Todd Elliott <eyeth@videocam.net.au>
|
||||
|
||||
for bug reports and suggestions.
|
||||
|
||||
|
||||
This list is probably incomplete. So, if you think you should be mentioned
|
||||
here, but cannot find yourself, please drop me a mail.
|
||||
|
||||
|
34
usr/share/doc/cc65/webdoc/apple2-1.html
Normal file
34
usr/share/doc/cc65/webdoc/apple2-1.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Apple ][ specific information for cc65: Overview</TITLE>
|
||||
<LINK HREF="apple2-2.html" REL=next>
|
||||
|
||||
<LINK HREF="apple2.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="apple2-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="apple2.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1.</A> <A HREF="apple2.html#toc1">Overview</A></H2>
|
||||
|
||||
|
||||
<P>This file contains an overview of the Apple ][ runtime system
|
||||
as it comes with the cc65 C compiler. It describes the memory layout,
|
||||
Apple ][ specific header files, available drivers, and any
|
||||
pitfalls specific to that platform.</P>
|
||||
<P>Please note that Apple ][ specific functions are just mentioned
|
||||
here, they are described in detail in the separate
|
||||
<A HREF="funcref.html">function reference</A>. Even functions marked as "platform dependent" may
|
||||
be available on more than one platform. Please see the function reference for
|
||||
more information.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="apple2-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="apple2.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
47
usr/share/doc/cc65/webdoc/apple2-2.html
Normal file
47
usr/share/doc/cc65/webdoc/apple2-2.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Apple ][ specific information for cc65: Binary format</TITLE>
|
||||
<LINK HREF="apple2-3.html" REL=next>
|
||||
<LINK HREF="apple2-1.html" REL=previous>
|
||||
<LINK HREF="apple2.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="apple2-3.html">Next</A>
|
||||
<A HREF="apple2-1.html">Previous</A>
|
||||
<A HREF="apple2.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2.</A> <A HREF="apple2.html#toc2">Binary format</A></H2>
|
||||
|
||||
|
||||
<P>The standard binary output format generated by the linker for the
|
||||
Apple ][ target is a machine language program with a 4 byte DOS
|
||||
3.3 header. The standard load address is $800.</P>
|
||||
<P>The DOS header is in its own segment named <CODE>EXEHDR</CODE>. If you don't want the
|
||||
header for some reason, you can change</P>
|
||||
<P>
|
||||
<PRE>
|
||||
HEADER: start = $0000, size = $4, file = %O;
|
||||
</PRE>
|
||||
</P>
|
||||
<P>to</P>
|
||||
<P>
|
||||
<PRE>
|
||||
HEADER: start = $0000, size = $4, file = "";
|
||||
</PRE>
|
||||
</P>
|
||||
<P>in the linker configuration to have the linker remove it.</P>
|
||||
<P>Please note that there is a "Apple ][ ProDOS 8 system program
|
||||
for loading binary programs" available in the cc65 User Contributions section.
|
||||
It adds all benefits of a ProDOS 8 system program to the standard binary
|
||||
program generated by the linker for the Apple ][ target.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="apple2-3.html">Next</A>
|
||||
<A HREF="apple2-1.html">Previous</A>
|
||||
<A HREF="apple2.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
40
usr/share/doc/cc65/webdoc/apple2-3.html
Normal file
40
usr/share/doc/cc65/webdoc/apple2-3.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Apple ][ specific information for cc65: Memory layout</TITLE>
|
||||
<LINK HREF="apple2-4.html" REL=next>
|
||||
<LINK HREF="apple2-2.html" REL=previous>
|
||||
<LINK HREF="apple2.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="apple2-4.html">Next</A>
|
||||
<A HREF="apple2-2.html">Previous</A>
|
||||
<A HREF="apple2.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3.</A> <A HREF="apple2.html#toc3">Memory layout</A></H2>
|
||||
|
||||
|
||||
<P>In the standard setup, cc65 generated programs use the memory from
|
||||
$800 to $95FF, so 35.5K of memory are available. ROM calls are
|
||||
possible without further precautions.</P>
|
||||
<P>Special locations:</P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Stack</B><DD><P>The C runtime stack is located at HIMEM and grows downwards, regardless of
|
||||
how your linker config file is setup.</P>
|
||||
|
||||
<DT><B>Heap</B><DD><P>The C heap is located at the end of the program and grows towards the C
|
||||
runtime stack.</P>
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="apple2-4.html">Next</A>
|
||||
<A HREF="apple2-2.html">Previous</A>
|
||||
<A HREF="apple2.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
53
usr/share/doc/cc65/webdoc/apple2-4.html
Normal file
53
usr/share/doc/cc65/webdoc/apple2-4.html
Normal file
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Apple ][ specific information for cc65: Platform specific header files</TITLE>
|
||||
<LINK HREF="apple2-5.html" REL=next>
|
||||
<LINK HREF="apple2-3.html" REL=previous>
|
||||
<LINK HREF="apple2.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="apple2-5.html">Next</A>
|
||||
<A HREF="apple2-3.html">Previous</A>
|
||||
<A HREF="apple2.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4.</A> <A HREF="apple2.html#toc4">Platform specific header files</A></H2>
|
||||
|
||||
|
||||
<P>Programs containing Apple ][ specific code may use the
|
||||
<CODE>apple2.h</CODE> header file.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.1">4.1</A> <A HREF="apple2.html#toc4.1">Apple ][ specific functions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The functions listed below are special for the Apple ][. See
|
||||
the
|
||||
<A HREF="funcref.html">function reference</A> for declaration and
|
||||
usage.</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>_dos_type</LI>
|
||||
<LI>get_ostype</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss4.2">4.2</A> <A HREF="apple2.html#toc4.2">Hardware access</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>There's currently no support for direct hardware access. This does not mean
|
||||
you cannot do it, it just means that there's no help.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="apple2-5.html">Next</A>
|
||||
<A HREF="apple2-3.html">Previous</A>
|
||||
<A HREF="apple2.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
116
usr/share/doc/cc65/webdoc/apple2-5.html
Normal file
116
usr/share/doc/cc65/webdoc/apple2-5.html
Normal file
|
@ -0,0 +1,116 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Apple ][ specific information for cc65: Loadable drivers</TITLE>
|
||||
<LINK HREF="apple2-6.html" REL=next>
|
||||
<LINK HREF="apple2-4.html" REL=previous>
|
||||
<LINK HREF="apple2.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="apple2-6.html">Next</A>
|
||||
<A HREF="apple2-4.html">Previous</A>
|
||||
<A HREF="apple2.html#toc5">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s5">5.</A> <A HREF="apple2.html#toc5">Loadable drivers</A></H2>
|
||||
|
||||
|
||||
<P><EM>Note:</EM> Since the Apple ][ doesn't have working disk I/O
|
||||
(see
|
||||
<A HREF="apple2-6.html#limitations">section "Limitations"</A>), the
|
||||
available drivers cannot be loaded at runtime (so the term "loadable drivers"
|
||||
is somewhat misleading). Instead, the drivers have to be converted using the
|
||||
<A HREF="co65.html">co65 utility</A> and statically linked. While
|
||||
this may seem overhead, it has two advantages:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>The interface is identical to the one used for other platforms
|
||||
and to the one for the Apple ][ once it has disk I/O.</LI>
|
||||
<LI>Once disk I/O is available, existing code can be changed to load drivers
|
||||
at runtime with almost no effort.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.1">5.1</A> <A HREF="apple2.html#toc5.1">Graphics drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P><EM>Note:</EM> Since memory for the high resolution graphics has to be allocated,
|
||||
programs using graphics drivers will have to be linked using a special linker
|
||||
configuration. See the <CODE>apple2-tgi.cfg</CODE> file in the documentation
|
||||
directory, and the
|
||||
<A HREF="ld65.html">linker documentation</A> on
|
||||
how to use it.</P>
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>a2.lo.tgi</CODE></B><DD><P>This driver was written by Stefan Haubenthal. It features a resolution of
|
||||
40×40 with 16 colors. At the bottom of the screen, 4 additional text lines
|
||||
are available.</P>
|
||||
|
||||
<DT><B><CODE>a2.hi.tgi</CODE></B><DD><P>This driver was written by Stefan Haubenthal. It features a resolution of
|
||||
280×192 with 6 colors.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.2">5.2</A> <A HREF="apple2.html#toc5.2">Extended memory drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>a2.lc.emd</CODE></B><DD><P>Gives access to 12KB RAM (48 pages of 256 bytes each) on the
|
||||
Apple ][ language card. The driver was contributed by
|
||||
Stefan Haubenthal. Note: This driver is incompatible with any DOS using
|
||||
the language card memory!</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.3">5.3</A> <A HREF="apple2.html#toc5.3">Joystick drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>a2.stdjoy.joy</CODE></B><DD><P>Supports up to two standard analog joysticks connected to the game port of
|
||||
the Apple ][.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.4">5.4</A> <A HREF="apple2.html#toc5.4">Mouse drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Currently no drivers available (in fact, the API for loadable mouse drivers
|
||||
does not exist).</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.5">5.5</A> <A HREF="apple2.html#toc5.5">RS232 device drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>No serial drivers are currently available for the Apple ][.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="apple2-6.html">Next</A>
|
||||
<A HREF="apple2-4.html">Previous</A>
|
||||
<A HREF="apple2.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
49
usr/share/doc/cc65/webdoc/apple2-6.html
Normal file
49
usr/share/doc/cc65/webdoc/apple2-6.html
Normal file
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Apple ][ specific information for cc65: Limitations</TITLE>
|
||||
<LINK HREF="apple2-7.html" REL=next>
|
||||
<LINK HREF="apple2-5.html" REL=previous>
|
||||
<LINK HREF="apple2.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="apple2-7.html">Next</A>
|
||||
<A HREF="apple2-5.html">Previous</A>
|
||||
<A HREF="apple2.html#toc6">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="limitations"></A> <A NAME="s6">6.</A> <A HREF="apple2.html#toc6">Limitations</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss6.1">6.1</A> <A HREF="apple2.html#toc6.1">Disk I/O</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The existing library for the Apple ][ doesn't implement C file
|
||||
I/O. There are two hacks for the <CODE>read()</CODE> and <CODE>write()</CODE> routines in
|
||||
place, which will make functions work that read from or write to <CODE>stdout</CODE>
|
||||
(like <CODE>printf()</CODE>). However, these functions have some shortcomings which
|
||||
won't be fixed, because they're going to be replaced anyway.</P>
|
||||
<P>To be more concrete, this limitation means that you cannot use any of the
|
||||
following functions (and a few others):</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>fclose</LI>
|
||||
<LI>fopen</LI>
|
||||
<LI>fread</LI>
|
||||
<LI>fprintf</LI>
|
||||
<LI>fputc</LI>
|
||||
<LI>fscanf</LI>
|
||||
<LI>fwrite</LI>
|
||||
<LI>...</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="apple2-7.html">Next</A>
|
||||
<A HREF="apple2-5.html">Previous</A>
|
||||
<A HREF="apple2.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
58
usr/share/doc/cc65/webdoc/apple2-7.html
Normal file
58
usr/share/doc/cc65/webdoc/apple2-7.html
Normal file
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Apple ][ specific information for cc65: Other hints</TITLE>
|
||||
<LINK HREF="apple2-8.html" REL=next>
|
||||
<LINK HREF="apple2-6.html" REL=previous>
|
||||
<LINK HREF="apple2.html#toc7" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="apple2-8.html">Next</A>
|
||||
<A HREF="apple2-6.html">Previous</A>
|
||||
<A HREF="apple2.html#toc7">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s7">7.</A> <A HREF="apple2.html#toc7">Other hints</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss7.1">7.1</A> <A HREF="apple2.html#toc7.1">Passing arguments to the program</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Command line arguments can be passed to <CODE>main()</CODE> after BLOAD. Since this is not
|
||||
supported by BASIC, the following syntax was chosen:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
]CALL2048:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>Arguments are separated by spaces.</LI>
|
||||
<LI>Arguments may be quoted.</LI>
|
||||
<LI>Leading and trailing spaces around an argument are ignored. Spaces within
|
||||
a quoted argument are allowed.</LI>
|
||||
<LI>The first argument passed to <CODE>main</CODE> is the program name.</LI>
|
||||
<LI>A maximum number of 10 arguments (including the program name) are
|
||||
supported.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss7.2">7.2</A> <A HREF="apple2.html#toc7.2">Function keys</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>These are defined to be OpenApple + number key.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="apple2-8.html">Next</A>
|
||||
<A HREF="apple2-6.html">Previous</A>
|
||||
<A HREF="apple2.html#toc7">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/apple2-8.html
Normal file
30
usr/share/doc/cc65/webdoc/apple2-8.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Apple ][ specific information for cc65: Bugs/Feedback</TITLE>
|
||||
<LINK HREF="apple2-9.html" REL=next>
|
||||
<LINK HREF="apple2-7.html" REL=previous>
|
||||
<LINK HREF="apple2.html#toc8" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="apple2-9.html">Next</A>
|
||||
<A HREF="apple2-7.html">Previous</A>
|
||||
<A HREF="apple2.html#toc8">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s8">8.</A> <A HREF="apple2.html#toc8">Bugs/Feedback</A></H2>
|
||||
|
||||
|
||||
<P>If you have problems using the library, if you find any bugs, or if you're
|
||||
doing something interesting with it, I would be glad to hear from you. Feel
|
||||
free to contact me by email (
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A>).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="apple2-9.html">Next</A>
|
||||
<A HREF="apple2-7.html">Previous</A>
|
||||
<A HREF="apple2.html#toc8">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
41
usr/share/doc/cc65/webdoc/apple2-9.html
Normal file
41
usr/share/doc/cc65/webdoc/apple2-9.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Apple ][ specific information for cc65: License</TITLE>
|
||||
<LINK HREF="apple2-8.html" REL=previous>
|
||||
<LINK HREF="apple2.html#toc9" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="apple2-8.html">Previous</A>
|
||||
<A HREF="apple2.html#toc9">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s9">9.</A> <A HREF="apple2.html#toc9">License</A></H2>
|
||||
|
||||
|
||||
<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.</P>
|
||||
<P>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:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI> 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.</LI>
|
||||
<LI> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.</LI>
|
||||
<LI> This notice may not be removed or altered from any source
|
||||
distribution.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="apple2-8.html">Previous</A>
|
||||
<A HREF="apple2.html#toc9">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
73
usr/share/doc/cc65/webdoc/apple2.html
Normal file
73
usr/share/doc/cc65/webdoc/apple2.html
Normal file
|
@ -0,0 +1,73 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Apple ][ specific information for cc65</TITLE>
|
||||
<LINK HREF="apple2-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="apple2-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>Apple ][ specific information for cc65</H1>
|
||||
|
||||
<H2>Ullrich von Bassewitz,
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A></H2>2003-12-16
|
||||
<HR>
|
||||
<EM>An overview over the Apple ][ runtime system as it is
|
||||
implemented for the cc65 C compiler.</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="apple2-1.html">Overview</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="apple2-2.html">Binary format</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="apple2-3.html">Memory layout</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="apple2-4.html">Platform specific header files</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc4.1">4.1</A> <A HREF="apple2-4.html#ss4.1">Apple ][ specific functions</A>
|
||||
<LI><A NAME="toc4.2">4.2</A> <A HREF="apple2-4.html#ss4.2">Hardware access</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="apple2-5.html">Loadable drivers</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc5.1">5.1</A> <A HREF="apple2-5.html#ss5.1">Graphics drivers</A>
|
||||
<LI><A NAME="toc5.2">5.2</A> <A HREF="apple2-5.html#ss5.2">Extended memory drivers</A>
|
||||
<LI><A NAME="toc5.3">5.3</A> <A HREF="apple2-5.html#ss5.3">Joystick drivers</A>
|
||||
<LI><A NAME="toc5.4">5.4</A> <A HREF="apple2-5.html#ss5.4">Mouse drivers</A>
|
||||
<LI><A NAME="toc5.5">5.5</A> <A HREF="apple2-5.html#ss5.5">RS232 device drivers</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="apple2-6.html">Limitations</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc6.1">6.1</A> <A HREF="apple2-6.html#ss6.1">Disk I/O</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc7">7.</A> <A HREF="apple2-7.html">Other hints</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc7.1">7.1</A> <A HREF="apple2-7.html#ss7.1">Passing arguments to the program</A>
|
||||
<LI><A NAME="toc7.2">7.2</A> <A HREF="apple2-7.html#ss7.2">Function keys</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc8">8.</A> <A HREF="apple2-8.html">Bugs/Feedback</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc9">9.</A> <A HREF="apple2-9.html">License</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="apple2-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/ar65-1.html
Normal file
30
usr/share/doc/cc65/webdoc/ar65-1.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ar65 Users Guide: Overview</TITLE>
|
||||
<LINK HREF="ar65-2.html" REL=next>
|
||||
|
||||
<LINK HREF="ar65.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ar65-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="ar65.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1.</A> <A HREF="ar65.html#toc1">Overview</A></H2>
|
||||
|
||||
|
||||
|
||||
<P>ar65 is a replacement for the libr65 archiver that was part of the cc65 C
|
||||
compiler suite developed by John R. Dunning. libr65 had some problems and
|
||||
the copyright does not permit some things which I wanted to be possible,
|
||||
so I decided to write a completely new assembler/linker/archiver suite
|
||||
for the cc65 compiler. ar65 is part of this suite.</P>
|
||||
|
||||
<HR>
|
||||
<A HREF="ar65-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="ar65.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
114
usr/share/doc/cc65/webdoc/ar65-2.html
Normal file
114
usr/share/doc/cc65/webdoc/ar65-2.html
Normal file
|
@ -0,0 +1,114 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ar65 Users Guide: Usage</TITLE>
|
||||
<LINK HREF="ar65-3.html" REL=next>
|
||||
<LINK HREF="ar65-1.html" REL=previous>
|
||||
<LINK HREF="ar65.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ar65-3.html">Next</A>
|
||||
<A HREF="ar65-1.html">Previous</A>
|
||||
<A HREF="ar65.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2.</A> <A HREF="ar65.html#toc2">Usage</A></H2>
|
||||
|
||||
|
||||
|
||||
<P>The archiver is called as follows:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
Usage: ar65 <operation> lib file|module ...
|
||||
Operation is one of:
|
||||
a Add modules
|
||||
d Delete modules
|
||||
l List library contents
|
||||
x Extract modules
|
||||
V Print the archiver version
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>You may add modules to a library using the `a' command. If the library
|
||||
does not exist, it is created (and a warning message is printed which you
|
||||
may ignore if creation of the library was your intention). You may
|
||||
specify any number of modules on the command line following the library.</P>
|
||||
<P>If a module with the same name exists in the library, it is replaced by
|
||||
the new one. The archiver prints a warning, if the module in the library
|
||||
has a newer timestamp than the one to add.</P>
|
||||
<P>Here's an example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
ar65 a mysubs.lib sub1.o sub2.o
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>This will add two modules to the library `mysubs.lib' creating the
|
||||
library if necessary. If the library contains modules named sub1.o or
|
||||
sub2.o, they are replaced by the new ones.</P>
|
||||
<P>Modules names in the library are stored without the path, so, using</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
ar65 a mysubs.lib ofiles/sub1.o ofiles/sub2.o
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>will add two modules named `sub1.o' and `sub2.o' to the library.</P>
|
||||
<P>Deleting modules from a library is done with the `d' command. You may not
|
||||
give a path when naming the modules.</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
ar65 d mysubs.lib sub1.o
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>This will delete the module named `sub1.o' from the library, printing an
|
||||
error if the library does not contain that module.</P>
|
||||
|
||||
<P>The `l' command prints a list of all modules in the library. Any module
|
||||
names on the command line are ignored.</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
ar65 l mysubs.lib
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
<P>Using the `x' command, you may extract modules from the library. The
|
||||
modules named on the command line are extracted from the library and put
|
||||
into the current directory.</P>
|
||||
<P>Note: Because of the indexing done by the archiver, the modules may have
|
||||
a changed binary layout, that is, a binary compare with the old module
|
||||
(before importing it into the library) may yield differences. The
|
||||
extracted modules are accepted by the linker and archiver, however, so
|
||||
this is not a problem.</P>
|
||||
<P>Example for extracting a module from the library:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
ar65 x mysubs.lib sub1.o
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
<P>The `V' command prints the version number of the assembler. If you send
|
||||
any suggestions or bugfixes, please include your version number.</P>
|
||||
<P>In addition to these operations, the archiver will check for, and warn
|
||||
about duplicate external symbols in the library, every time when an
|
||||
operation does update the library. This is only a warning, the linker
|
||||
will ignore one of the duplicate symbols (which one is unspecified).</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ar65-3.html">Next</A>
|
||||
<A HREF="ar65-1.html">Previous</A>
|
||||
<A HREF="ar65.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/ar65-3.html
Normal file
30
usr/share/doc/cc65/webdoc/ar65-3.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ar65 Users Guide: Bugs/Feedback</TITLE>
|
||||
<LINK HREF="ar65-4.html" REL=next>
|
||||
<LINK HREF="ar65-2.html" REL=previous>
|
||||
<LINK HREF="ar65.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ar65-4.html">Next</A>
|
||||
<A HREF="ar65-2.html">Previous</A>
|
||||
<A HREF="ar65.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3.</A> <A HREF="ar65.html#toc3">Bugs/Feedback</A></H2>
|
||||
|
||||
|
||||
<P>If you have problems using the archiver, if you find any bugs, or if you're
|
||||
doing something interesting with it, I would be glad to hear from you. Feel
|
||||
free to contact me by email (
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A>).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ar65-4.html">Next</A>
|
||||
<A HREF="ar65-2.html">Previous</A>
|
||||
<A HREF="ar65.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
44
usr/share/doc/cc65/webdoc/ar65-4.html
Normal file
44
usr/share/doc/cc65/webdoc/ar65-4.html
Normal file
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ar65 Users Guide: Copyright</TITLE>
|
||||
<LINK HREF="ar65-3.html" REL=previous>
|
||||
<LINK HREF="ar65.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="ar65-3.html">Previous</A>
|
||||
<A HREF="ar65.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4.</A> <A HREF="ar65.html#toc4">Copyright</A></H2>
|
||||
|
||||
|
||||
<P>ar65 (and all cc65 binutils) are (C) Copyright 1998-2000 Ullrich von
|
||||
Bassewitz. For usage of the binaries and/or sources the following conditions
|
||||
do apply:</P>
|
||||
<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.</P>
|
||||
<P>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:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI> 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.</LI>
|
||||
<LI> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.</LI>
|
||||
<LI> This notice may not be removed or altered from any source
|
||||
distribution.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="ar65-3.html">Previous</A>
|
||||
<A HREF="ar65.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
41
usr/share/doc/cc65/webdoc/ar65.html
Normal file
41
usr/share/doc/cc65/webdoc/ar65.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ar65 Users Guide</TITLE>
|
||||
<LINK HREF="ar65-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ar65-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>ar65 Users Guide</H1>
|
||||
|
||||
<H2>Ullrich von Bassewitz,
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A></H2>19.07.2000
|
||||
<HR>
|
||||
<EM>ar65 is an archiver for object files generated by ca65. It allows to create
|
||||
archives, add or remove modules from archives, and to extract modules from
|
||||
existing archives.</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="ar65-1.html">Overview</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="ar65-2.html">Usage</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="ar65-3.html">Bugs/Feedback</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="ar65-4.html">Copyright</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="ar65-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
34
usr/share/doc/cc65/webdoc/atari-1.html
Normal file
34
usr/share/doc/cc65/webdoc/atari-1.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65: Overview</TITLE>
|
||||
<LINK HREF="atari-2.html" REL=next>
|
||||
|
||||
<LINK HREF="atari.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atari-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="atari.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1.</A> <A HREF="atari.html#toc1">Overview</A></H2>
|
||||
|
||||
|
||||
<P>This file contains an overview of the Atari runtime system as it comes
|
||||
with the cc65 C compiler. It describes the memory layout, Atari specific
|
||||
header files, available drivers, and any pitfalls specific to that
|
||||
platform.</P>
|
||||
<P>Please note that Atari specific functions are just mentioned here, they are
|
||||
described in detail in the separate
|
||||
<A HREF="funcref.html">function reference</A>. Even functions marked as "platform dependent" may be available on
|
||||
more than one platform. Please see the function reference for more
|
||||
information.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atari-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="atari.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
41
usr/share/doc/cc65/webdoc/atari-10.html
Normal file
41
usr/share/doc/cc65/webdoc/atari-10.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65: License</TITLE>
|
||||
<LINK HREF="atari-9.html" REL=previous>
|
||||
<LINK HREF="atari.html#toc10" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="atari-9.html">Previous</A>
|
||||
<A HREF="atari.html#toc10">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s10">10.</A> <A HREF="atari.html#toc10">License</A></H2>
|
||||
|
||||
|
||||
<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.</P>
|
||||
<P>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:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI> 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.</LI>
|
||||
<LI> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.</LI>
|
||||
<LI> This notice may not be removed or altered from any source
|
||||
distribution.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="atari-9.html">Previous</A>
|
||||
<A HREF="atari.html#toc10">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
37
usr/share/doc/cc65/webdoc/atari-2.html
Normal file
37
usr/share/doc/cc65/webdoc/atari-2.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65: Binary format</TITLE>
|
||||
<LINK HREF="atari-3.html" REL=next>
|
||||
<LINK HREF="atari-1.html" REL=previous>
|
||||
<LINK HREF="atari.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atari-3.html">Next</A>
|
||||
<A HREF="atari-1.html">Previous</A>
|
||||
<A HREF="atari.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2.</A> <A HREF="atari.html#toc2">Binary format</A></H2>
|
||||
|
||||
|
||||
<P>The standard binary output format generated by the linker for the
|
||||
Atari target is a machine language program with a standard executable
|
||||
header (FF FF <2 byte start address> <2 bytes end address>
|
||||
[program bytes]). These values are calculated in the crt0.s
|
||||
file from the __CODE_LOAD__ and __BSS_LOAD__ values, so keep this in
|
||||
mind if you create a custom linker config file and start moving
|
||||
segments around (see section
|
||||
<A HREF="atari-8.html#memhole">Reserving a memory area inside the program</A>). You can
|
||||
override this behaviour by creating your own crt0.s file and linking
|
||||
it into your program. A run vector is added to the end of the file
|
||||
($02E0 <run vector>) and is calculated using
|
||||
__CODE_LOAD__ in crt0.s.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atari-3.html">Next</A>
|
||||
<A HREF="atari-1.html">Previous</A>
|
||||
<A HREF="atari.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
57
usr/share/doc/cc65/webdoc/atari-3.html
Normal file
57
usr/share/doc/cc65/webdoc/atari-3.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65: Memory layout</TITLE>
|
||||
<LINK HREF="atari-4.html" REL=next>
|
||||
<LINK HREF="atari-2.html" REL=previous>
|
||||
<LINK HREF="atari.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atari-4.html">Next</A>
|
||||
<A HREF="atari-2.html">Previous</A>
|
||||
<A HREF="atari.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3.</A> <A HREF="atari.html#toc3">Memory layout</A></H2>
|
||||
|
||||
|
||||
<P>The default linker script assumes that the BASIC ROM is disabled (or
|
||||
the BASIC cartridge unplugged). This gives a usable memory range from
|
||||
$2E00 - $BC1F. The library startup code examines the
|
||||
current memory configuration, which depends on the size of the
|
||||
installed memory and cartridges present, by inspecting the value in
|
||||
the MEMTOP ($2E5) variable. Then the initial stack pointer,
|
||||
which indicates the upper bound of memory used, is adjusted. The load
|
||||
address of $2E00 was chosen to accommodate having a DOS loaded
|
||||
and a driver that resides in low memory such as the 850 R: handler.
|
||||
You can override this behaviour by creating a custom linker config
|
||||
file.</P>
|
||||
<P>Special locations:</P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Text screen</B><DD><P>The text screen depends on the installed memory size and cartridges
|
||||
and can be obtained from the SAVMSC variable ($58).</P>
|
||||
|
||||
<DT><B>Stack</B><DD><P>The C runtime stack is located at MEMTOP and grows downwards,
|
||||
regardless of how your linker config file is setup. This
|
||||
accomodates the different memory configurations of the Atari
|
||||
machines, as well as having a cartridge installed. You can override
|
||||
this behaviour by writing your own crt0.s file and linking it to
|
||||
your program (see also
|
||||
<A HREF="atari-8.html#memhole_final_note">Final note</A>).</P>
|
||||
|
||||
<DT><B>Heap</B><DD><P>The C heap is located at the end of the program and grows towards the C
|
||||
runtime stack.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atari-4.html">Next</A>
|
||||
<A HREF="atari-2.html">Previous</A>
|
||||
<A HREF="atari.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
85
usr/share/doc/cc65/webdoc/atari-4.html
Normal file
85
usr/share/doc/cc65/webdoc/atari-4.html
Normal file
|
@ -0,0 +1,85 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65: Platform specific header files</TITLE>
|
||||
<LINK HREF="atari-5.html" REL=next>
|
||||
<LINK HREF="atari-3.html" REL=previous>
|
||||
<LINK HREF="atari.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atari-5.html">Next</A>
|
||||
<A HREF="atari-3.html">Previous</A>
|
||||
<A HREF="atari.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4.</A> <A HREF="atari.html#toc4">Platform specific header files</A></H2>
|
||||
|
||||
|
||||
<P>Programs containing Atari specific code may use the <CODE>atari.h</CODE>
|
||||
header file.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.1">4.1</A> <A HREF="atari.html#toc4.1">Atari specific functions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The functions listed below are special for the Atari. See the
|
||||
<A HREF="funcref.html">function reference</A> for declaration and usage.</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>get_ostype</LI>
|
||||
<LI>get_tv</LI>
|
||||
<LI>_gtia_mkcolor</LI>
|
||||
<LI>_getcolor</LI>
|
||||
<LI>_getdefdev</LI>
|
||||
<LI>_graphics</LI>
|
||||
<LI>_rest_vecs</LI>
|
||||
<LI>_save_vecs</LI>
|
||||
<LI>_scroll</LI>
|
||||
<LI>_setcolor</LI>
|
||||
<LI>_setcolor_low</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.2">4.2</A> <A HREF="atari.html#toc4.2">Hardware access</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The following pseudo variables declared in the <CODE>atari.h</CODE> header
|
||||
file do allow access to hardware located in the address space. Some
|
||||
variables are structures, accessing the struct fields will access the
|
||||
chip registers.</P>
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>GTIA_READ</CODE> and <CODE>GTIA_WRITE</CODE></B><DD><P>The <CODE>GTIA_READ</CODE> structure allows read access to the GTIA. The
|
||||
<CODE>GTIA_WRITE</CODE> structure allows write access to the GTIA.
|
||||
See the <CODE>_gtia.h</CODE> header file located in the include directory
|
||||
for the declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>POKEY_READ</CODE> and <CODE>POKEY_WRITE</CODE></B><DD><P>The <CODE>POKEY_READ</CODE> structure allows read access to the POKEY. The
|
||||
<CODE>POKEY_WRITE</CODE> structure allows write access to the POKEY.
|
||||
See the <CODE>_pokey.h</CODE> header file located in the include directory
|
||||
for the declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>ANTIC</CODE></B><DD><P>The <CODE>ANTIC</CODE> structure allows read access to the ANTIC.
|
||||
See the <CODE>_antic.h</CODE> header file located in the include directory
|
||||
for the declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>PIA</CODE></B><DD><P>The <CODE>PIA</CODE> structure allows read access to the PIA 6520.
|
||||
See the <CODE>_pia.h</CODE> header file located in the include directory
|
||||
for the declaration of the structure.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atari-5.html">Next</A>
|
||||
<A HREF="atari-3.html">Previous</A>
|
||||
<A HREF="atari.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
130
usr/share/doc/cc65/webdoc/atari-5.html
Normal file
130
usr/share/doc/cc65/webdoc/atari-5.html
Normal file
|
@ -0,0 +1,130 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65: Loadable drivers</TITLE>
|
||||
<LINK HREF="atari-6.html" REL=next>
|
||||
<LINK HREF="atari-4.html" REL=previous>
|
||||
<LINK HREF="atari.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atari-6.html">Next</A>
|
||||
<A HREF="atari-4.html">Previous</A>
|
||||
<A HREF="atari.html#toc5">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s5">5.</A> <A HREF="atari.html#toc5">Loadable drivers</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.1">5.1</A> <A HREF="atari.html#toc5.1">Graphics drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Currently there are no graphics drivers available for the Atari platform.
|
||||
However, the runtime library provides a function named _graphics, with
|
||||
a mode parameter just like the BASIC GRAPHICS command. This function will
|
||||
switch to the requested graphics mode.
|
||||
There are currently no functions available to access the graphics
|
||||
memory. The access must be implemented manually.</P>
|
||||
<P>Many graphics modes require more memory than the text screen which is
|
||||
in effect when the program starts up. Therefore the programmer has to
|
||||
tell the program beforehand the memory requirements of the graphics
|
||||
modes the program intends to use.
|
||||
This can be done by using the __RESERVED_MEMORY__ linker config
|
||||
variable. The number specified there describes the number of bytes to
|
||||
subtract from the top of available memory as seen from the runtime
|
||||
library. This memory is then used by the screen buffer.</P>
|
||||
<P>The numbers for the different graphics modes presented below should
|
||||
only be seen as a rule of thumb. Since the screen buffer memory needs
|
||||
to start at specific boundaries, the numbers depend on the current top
|
||||
of available memory.
|
||||
The following numbers were determined by a BASIC program.</P>
|
||||
<P>
|
||||
<BR><CENTER>
|
||||
<TABLE BORDER><TR><TD>
|
||||
graphics mode</TD><TD>reserved memory</TD></TR><TR><TD>
|
||||
0</TD><TD>1</TD></TR><TR><TD>
|
||||
1</TD><TD>1</TD></TR><TR><TD>
|
||||
2</TD><TD>1</TD></TR><TR><TD>
|
||||
3</TD><TD>1</TD></TR><TR><TD>
|
||||
4</TD><TD>1</TD></TR><TR><TD>
|
||||
5</TD><TD>182</TD></TR><TR><TD>
|
||||
6</TD><TD>1182</TD></TR><TR><TD>
|
||||
7</TD><TD>3198</TD></TR><TR><TD>
|
||||
8</TD><TD>7120</TD></TR><TR><TD>
|
||||
9</TD><TD>7146</TD></TR><TR><TD>
|
||||
10</TD><TD>7146</TD></TR><TR><TD>
|
||||
11</TD><TD>7146</TD></TR><TR><TD>
|
||||
12</TD><TD>162</TD></TR><TR><TD>
|
||||
13</TD><TD>1</TD></TR><TR><TD>
|
||||
14</TD><TD>3278</TD></TR><TR><TD>
|
||||
15</TD><TD>7120</TD></TR><TR><TD>
|
||||
16</TD><TD>1</TD></TR><TR><TD>
|
||||
17</TD><TD>1</TD></TR><TR><TD>
|
||||
18</TD><TD>1</TD></TR><TR><TD>
|
||||
19</TD><TD>1</TD></TR><TR><TD>
|
||||
20</TD><TD>1</TD></TR><TR><TD>
|
||||
21</TD><TD>184</TD></TR><TR><TD>
|
||||
22</TD><TD>1192</TD></TR><TR><TD>
|
||||
23</TD><TD>3208</TD></TR><TR><TD>
|
||||
24</TD><TD>7146</TD></TR><TR><TD>
|
||||
25</TD><TD>7146</TD></TR><TR><TD>
|
||||
26</TD><TD>7146</TD></TR><TR><TD>
|
||||
27</TD><TD>7146</TD></TR><TR><TD>
|
||||
28</TD><TD>160</TD></TR><TR><TD>
|
||||
29</TD><TD>1</TD></TR><TR><TD>
|
||||
30</TD><TD>3304</TD></TR><TR><TD>
|
||||
31</TD><TD>7146
|
||||
</TD></TR></TABLE>
|
||||
<CAPTION>reserved memory required for different graphics modes</CAPTION>
|
||||
</CENTER><BR>
|
||||
</P>
|
||||
<P>The values of "1" are needed because the graphics command crashes if
|
||||
it doesn't have at least one byte available. This seems to be a bug of
|
||||
the Atari ROM code.</P>
|
||||
|
||||
<H2><A NAME="ss5.2">5.2</A> <A HREF="atari.html#toc5.2">Extended memory drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Currently there are no extended memory drivers available for the Atari
|
||||
platform.</P>
|
||||
|
||||
<H2><A NAME="ss5.3">5.3</A> <A HREF="atari.html#toc5.3">Joystick drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>atari-stdjoy.joy</CODE></B><DD><P>Supports up to four standard joysticks connected to the joystick ports of
|
||||
the Atari.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.4">5.4</A> <A HREF="atari.html#toc5.4">Mouse drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Currently no drivers available (in fact, the API for loadable mouse drivers
|
||||
does not exist). There is a static driver you can use.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.5">5.5</A> <A HREF="atari.html#toc5.5">RS232 device drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Currently there are no RS232 loadable drivers available for the Atari
|
||||
platform. There is a static driver you can use.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atari-6.html">Next</A>
|
||||
<A HREF="atari-4.html">Previous</A>
|
||||
<A HREF="atari.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
25
usr/share/doc/cc65/webdoc/atari-6.html
Normal file
25
usr/share/doc/cc65/webdoc/atari-6.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65: Limitations</TITLE>
|
||||
<LINK HREF="atari-7.html" REL=next>
|
||||
<LINK HREF="atari-5.html" REL=previous>
|
||||
<LINK HREF="atari.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atari-7.html">Next</A>
|
||||
<A HREF="atari-5.html">Previous</A>
|
||||
<A HREF="atari.html#toc6">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s6">6.</A> <A HREF="atari.html#toc6">Limitations</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atari-7.html">Next</A>
|
||||
<A HREF="atari-5.html">Previous</A>
|
||||
<A HREF="atari.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/atari-7.html
Normal file
30
usr/share/doc/cc65/webdoc/atari-7.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65: DIO implementation</TITLE>
|
||||
<LINK HREF="atari-8.html" REL=next>
|
||||
<LINK HREF="atari-6.html" REL=previous>
|
||||
<LINK HREF="atari.html#toc7" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atari-8.html">Next</A>
|
||||
<A HREF="atari-6.html">Previous</A>
|
||||
<A HREF="atari.html#toc7">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="dio"></A> <A NAME="s7">7.</A> <A HREF="atari.html#toc7">DIO implementation</A></H2>
|
||||
|
||||
|
||||
<P>The Atari supports disk drives with either 128 or 256 byte sectors.
|
||||
The first three sectors of any disk are always 128 bytes long though. This is
|
||||
because the system can only boot from 128 bytes sectors.</P>
|
||||
<P>Therefore the DIO read and write functions transfer only 128 bytes
|
||||
for sectors 1 to 3, regardless of the type of diskette.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atari-8.html">Next</A>
|
||||
<A HREF="atari-6.html">Previous</A>
|
||||
<A HREF="atari.html#toc7">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
249
usr/share/doc/cc65/webdoc/atari-8.html
Normal file
249
usr/share/doc/cc65/webdoc/atari-8.html
Normal file
|
@ -0,0 +1,249 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65: Other hints</TITLE>
|
||||
<LINK HREF="atari-9.html" REL=next>
|
||||
<LINK HREF="atari-7.html" REL=previous>
|
||||
<LINK HREF="atari.html#toc8" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atari-9.html">Next</A>
|
||||
<A HREF="atari-7.html">Previous</A>
|
||||
<A HREF="atari.html#toc8">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s8">8.</A> <A HREF="atari.html#toc8">Other hints</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss8.1">8.1</A> <A HREF="atari.html#toc8.1">Function keys</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>These are defined to be Atari + number key.</P>
|
||||
|
||||
<H2><A NAME="memhole"></A> <A NAME="ss8.2">8.2</A> <A HREF="atari.html#toc8.2">Reserving a memory area inside a program</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The Atari 130XE maps its additional memory into CPU memory in 16K
|
||||
chunks at address $4000 to $7FFF. One might want to
|
||||
prevent this memory area from being used by cc65. Other reasons to
|
||||
prevent the use of some memory area could be the buffers for display
|
||||
lists and screen memory.</P>
|
||||
<P>The Atari executable format allows holes inside a program, e.g. one
|
||||
part loads into $2E00 to $3FFF, going below the reserved
|
||||
memory area (assuming a reserved area from $4000 to
|
||||
$7FFF), and another part loads into $8000 to
|
||||
$BC1F.</P>
|
||||
<P>Each load chunk of the executable starts with a 4 byte header which
|
||||
defines its load address and size.</P>
|
||||
|
||||
<H3>Low code and high data example</H3>
|
||||
|
||||
<P>Goal: Create an executable with 2 load chunks which doesn't use the
|
||||
memory area from $4000 to $7FFF. The CODE segment of
|
||||
the program should go below $4000 and the DATA and RODATA
|
||||
segments should go above $7FFF.</P>
|
||||
<P>The main problem is that the EXE header generated by the cc65 runtine
|
||||
lib is wrong. It defines a single load chunk with the sizes/addresses
|
||||
of the LOWCODE, INIT, CODE, RODATA, and DATA segments (the whole user
|
||||
program).</P>
|
||||
<P>The contents of the EXE header come from the EXEHDR segment, which is
|
||||
defined in crt0.s. This cannot be changed w/o modifiying and
|
||||
recompiling the cc65 atari runtime lib. Therefore the original EXE
|
||||
header must be discarded. It will be replaced by a user created
|
||||
one.</P>
|
||||
<P>The user needs to create a customized linker config file which adds
|
||||
new memory areas and segments to hold the new EXE header and the
|
||||
header data for the second load chunk. Also an assembly source file
|
||||
needs to be created which defines the contents of the new EXE header
|
||||
and the second load chunk header.</P>
|
||||
|
||||
<P>This is a modified cc65 Atari linker configuration file (split.cfg):
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
MEMORY {
|
||||
ZP: start = $82, size = $7E, type = rw, define = yes;
|
||||
|
||||
HEADER: start = $0000, size = $6, file = %O; # first load chunk
|
||||
RAMLO: start = $2E00, size = $1200, file = %O;
|
||||
|
||||
BANK: start = $4000, size = $4000, file = "";
|
||||
|
||||
SECHDR: start = $0000, size = $4, file = %O; # second load chunk
|
||||
RAM: start = $8000, size = $3C20, file = %O; # $3C20: matches upper bound $BC1F
|
||||
TRAILER: start = $0000, size = $0006, file = %O;
|
||||
}
|
||||
SEGMENTS {
|
||||
EXEHDR: load = BANK, type = ro;
|
||||
|
||||
NEXEHDR: load = HEADER, type = ro; # first load chunk
|
||||
LOWCODE: load = RAMLO, type = ro, define = yes, optional = yes;
|
||||
INIT: load = RAMLO, type = ro, optional = yes;
|
||||
CODE: load = RAMLO, type = ro, define = yes;
|
||||
|
||||
CHKHDR: load = SECHDR, type = ro; # second load chunk
|
||||
RODATA: load = RAM, type = ro, define = yes;
|
||||
DATA: load = RAM, type = rw, define = yes;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
AUTOSTRT: load = TRAILER, type = ro; # defines program entry point
|
||||
}
|
||||
FEATURES {
|
||||
CONDES: segment = RODATA,
|
||||
type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__;
|
||||
CONDES: segment = RODATA,
|
||||
type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__;
|
||||
}
|
||||
SYMBOLS {
|
||||
__STACKSIZE__ = $800; # 2K stack
|
||||
__RESERVED_MEMORY__: value = $0, weak = yes;
|
||||
}
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
<P>A new memory area BANK was added which describes the reserved area.
|
||||
It gets loaded with the contents of the old EXEHDR segment. But the
|
||||
memory area isn't written to the output file. This way the contents of
|
||||
the EXEHDR segment get discarded.</P>
|
||||
<P>The added NEXEHDR segment defines the correct EXE header. It puts only
|
||||
the CODE segment into load chunk #1 (RAMLO memory area).</P>
|
||||
<P>The header for the second load chunk comes from the new CHKHDR
|
||||
segment. It puts the RODATA and DATA segments into load chunk #2 (RAM
|
||||
memory area).</P>
|
||||
|
||||
<P>The contents of the new NEXEHDR and CHKHDR segments come from this
|
||||
file (split.s):
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.import __LOWCODE_LOAD__, __BSS_LOAD__, __CODE_SIZE__
|
||||
.import __CODE_LOAD__, __DATA_LOAD__, __RODATA_LOAD__
|
||||
|
||||
.segment "NEXEHDR"
|
||||
.word $FFFF ; EXE file magic number
|
||||
; 1st load chunk
|
||||
.word __LOWCODE_LOAD__
|
||||
.word __CODE_LOAD__ + __CODE_SIZE__ - 1
|
||||
|
||||
.segment "CHKHDR"
|
||||
; 2nd load chunk (contains with AUTOSTRT in fact a 3rd load chunk)
|
||||
.word __RODATA_LOAD__
|
||||
.word __BSS_LOAD__ - 1
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Compile with
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
cl65 -t atari -C split.cfg -o prog.com prog.c split.s
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
<H3>Low data and high code example</H3>
|
||||
|
||||
|
||||
|
||||
<P>Goal: Put RODATA and DATA into low memory and LOWCODE, INIT, CODE, BSS
|
||||
into high memory (split2.cfg):</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
MEMORY {
|
||||
ZP: start = $82, size = $7E, type = rw, define = yes;
|
||||
|
||||
HEADER: start = $0000, size = $6, file = %O; # first load chunk
|
||||
RAMLO: start = $2E00, size = $1200, file = %O;
|
||||
|
||||
BANK: start = $4000, size = $4000, file = "";
|
||||
|
||||
SECHDR: start = $0000, size = $4, file = %O; # second load chunk
|
||||
RAM: start = $8000, size = $3C20, file = %O; # $3C20: matches upper bound $BC1F
|
||||
TRAILER: start = $0000, size = $0006, file = %O;
|
||||
}
|
||||
SEGMENTS {
|
||||
EXEHDR: load = BANK, type = ro; # discarded old EXE header
|
||||
|
||||
NEXEHDR: load = HEADER, type = ro; # first load chunk
|
||||
RODATA: load = RAMLO, type = ro, define = yes;
|
||||
DATA: load = RAMLO, type = rw, define = yes;
|
||||
|
||||
CHKHDR: load = SECHDR, type = ro; # second load chunk
|
||||
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
|
||||
INIT: load = RAM, type = ro, optional = yes;
|
||||
CODE: load = RAM, type = ro, define = yes;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
AUTOSTRT: load = TRAILER, type = ro; # defines program entry point
|
||||
}
|
||||
FEATURES {
|
||||
CONDES: segment = RODATA,
|
||||
type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__;
|
||||
CONDES: segment = RODATA,
|
||||
type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__;
|
||||
}
|
||||
SYMBOLS {
|
||||
__STACKSIZE__ = $800; # 2K stack
|
||||
__RESERVED_MEMORY__: value = $0, weak = yes;
|
||||
}
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>New contents for NEXEHDR and CHKHDR are needed (split2.s):
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.import __LOWCODE_LOAD__, __BSS_LOAD__, __DATA_SIZE__
|
||||
.import __DATA_LOAD__, __RODATA_LOAD__
|
||||
|
||||
.segment "NEXEHDR"
|
||||
.word $FFFF
|
||||
.word __RODATA_LOAD__
|
||||
.word __DATA_LOAD__ + __DATA_SIZE__ - 1
|
||||
|
||||
.segment "CHKHDR"
|
||||
.word __LOWCODE_LOAD__
|
||||
.word __BSS_LOAD__ - 1
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Compile with
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
cl65 -t atari -C split2.cfg -o prog.com prog.c split2.s
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
<H3><A NAME="memhole_final_note"></A> Final note</H3>
|
||||
|
||||
|
||||
<P>There are two other memory areas which don't appear directly in the
|
||||
linker script. They are the stack and the heap.</P>
|
||||
<P>The cc65 runtime lib places the stack location at the end of available
|
||||
memory. This is dynamically set from the MEMTOP system variable at
|
||||
startup. The heap is located in the area between the end of the BSS
|
||||
segment and the top of the stack as defined by __STACKSIZE__.</P>
|
||||
<P>If BSS and/or the stack shouldn't stay at the end of the program,
|
||||
some parts of the cc65 runtime lib need to be replaced/modified.</P>
|
||||
<P>common/_heap.s defines the location of the heap and atari/crt0.s
|
||||
defines the location of the stack by initializing sp.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atari-9.html">Next</A>
|
||||
<A HREF="atari-7.html">Previous</A>
|
||||
<A HREF="atari.html#toc8">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
31
usr/share/doc/cc65/webdoc/atari-9.html
Normal file
31
usr/share/doc/cc65/webdoc/atari-9.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65: Bugs/Feedback</TITLE>
|
||||
<LINK HREF="atari-10.html" REL=next>
|
||||
<LINK HREF="atari-8.html" REL=previous>
|
||||
<LINK HREF="atari.html#toc9" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atari-10.html">Next</A>
|
||||
<A HREF="atari-8.html">Previous</A>
|
||||
<A HREF="atari.html#toc9">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s9">9.</A> <A HREF="atari.html#toc9">Bugs/Feedback</A></H2>
|
||||
|
||||
|
||||
<P>If you have problems using the library, if you find any bugs, or if you're
|
||||
doing something interesting with it, I would be glad to hear from you. Feel
|
||||
free to contact me by email (
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A> or
|
||||
<A HREF="mailto:cpg@aladdin.de">cpg@aladdin.de</A>).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atari-10.html">Next</A>
|
||||
<A HREF="atari-8.html">Previous</A>
|
||||
<A HREF="atari.html#toc9">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
74
usr/share/doc/cc65/webdoc/atari.html
Normal file
74
usr/share/doc/cc65/webdoc/atari.html
Normal file
|
@ -0,0 +1,74 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Atari specific information for cc65</TITLE>
|
||||
<LINK HREF="atari-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atari-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>Atari specific information for cc65</H1>
|
||||
|
||||
<H2>Shawn Jefferson,
|
||||
<A HREF="mailto:shawnjefferson@24fightingchickens.com">shawnjefferson@24fightingchickens.com</A> and Christian Groessler,
|
||||
<A HREF="mailto:cpg@aladdin.de">cpg@aladdin.de</A></H2>04-Sep-2005
|
||||
<HR>
|
||||
<EM>An overview over the Atari runtime system as it is implemented for the cc65 C
|
||||
compiler.</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="atari-1.html">Overview</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="atari-2.html">Binary format</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="atari-3.html">Memory layout</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="atari-4.html">Platform specific header files</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc4.1">4.1</A> <A HREF="atari-4.html#ss4.1">Atari specific functions</A>
|
||||
<LI><A NAME="toc4.2">4.2</A> <A HREF="atari-4.html#ss4.2">Hardware access</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="atari-5.html">Loadable drivers</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc5.1">5.1</A> <A HREF="atari-5.html#ss5.1">Graphics drivers</A>
|
||||
<LI><A NAME="toc5.2">5.2</A> <A HREF="atari-5.html#ss5.2">Extended memory drivers</A>
|
||||
<LI><A NAME="toc5.3">5.3</A> <A HREF="atari-5.html#ss5.3">Joystick drivers</A>
|
||||
<LI><A NAME="toc5.4">5.4</A> <A HREF="atari-5.html#ss5.4">Mouse drivers</A>
|
||||
<LI><A NAME="toc5.5">5.5</A> <A HREF="atari-5.html#ss5.5">RS232 device drivers</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="atari-6.html">Limitations</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc7">7.</A> <A HREF="atari-7.html">DIO implementation</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc8">8.</A> <A HREF="atari-8.html">Other hints</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc8.1">8.1</A> <A HREF="atari-8.html#ss8.1">Function keys</A>
|
||||
<LI><A NAME="toc8.2">8.2</A> <A HREF="atari-8.html#ss8.2">Reserving a memory area inside a program</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc9">9.</A> <A HREF="atari-9.html">Bugs/Feedback</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc10">10.</A> <A HREF="atari-10.html">License</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="atari-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
33
usr/share/doc/cc65/webdoc/atmos-1.html
Normal file
33
usr/share/doc/cc65/webdoc/atmos-1.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Oric Atmos specific information for cc65: Overview</TITLE>
|
||||
<LINK HREF="atmos-2.html" REL=next>
|
||||
|
||||
<LINK HREF="atmos.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atmos-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="atmos.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1.</A> <A HREF="atmos.html#toc1">Overview</A></H2>
|
||||
|
||||
|
||||
<P>This file contains an overview of the Atmos runtime system as it comes with the
|
||||
cc65 C compiler. It describes the memory layout, Atmos specific header files,
|
||||
available drivers, and any pitfalls specific to that platform.</P>
|
||||
<P>Please note that Atmos specific functions are just mentioned here, they are
|
||||
described in detail in the separate
|
||||
<A HREF="funcref.html">function reference</A>. Even functions marked as "platform dependent" may be available on
|
||||
more than one platform. Please see the function reference for more
|
||||
information.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atmos-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="atmos.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
28
usr/share/doc/cc65/webdoc/atmos-2.html
Normal file
28
usr/share/doc/cc65/webdoc/atmos-2.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Oric Atmos specific information for cc65: Binary format</TITLE>
|
||||
<LINK HREF="atmos-3.html" REL=next>
|
||||
<LINK HREF="atmos-1.html" REL=previous>
|
||||
<LINK HREF="atmos.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atmos-3.html">Next</A>
|
||||
<A HREF="atmos-1.html">Previous</A>
|
||||
<A HREF="atmos.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2.</A> <A HREF="atmos.html#toc2">Binary format</A></H2>
|
||||
|
||||
|
||||
<P>The standard binary output format generated by the linker for the Atmos target
|
||||
is a machine language program with a 14 byte tape header. The standard load
|
||||
and autostart address is $500.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atmos-3.html">Next</A>
|
||||
<A HREF="atmos-1.html">Previous</A>
|
||||
<A HREF="atmos.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
40
usr/share/doc/cc65/webdoc/atmos-3.html
Normal file
40
usr/share/doc/cc65/webdoc/atmos-3.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Oric Atmos specific information for cc65: Memory layout</TITLE>
|
||||
<LINK HREF="atmos-4.html" REL=next>
|
||||
<LINK HREF="atmos-2.html" REL=previous>
|
||||
<LINK HREF="atmos.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atmos-4.html">Next</A>
|
||||
<A HREF="atmos-2.html">Previous</A>
|
||||
<A HREF="atmos.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3.</A> <A HREF="atmos.html#toc3">Memory layout</A></H2>
|
||||
|
||||
|
||||
<P>In the standard setup, cc65 generated programs use the memory from
|
||||
$500 to $9800, so nearly 37K of memory (including the stack) is
|
||||
available. ROM calls are possible without further precautions.</P>
|
||||
<P>Special locations:</P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Stack</B><DD><P>The C runtime stack is located at $97FF and growing downwards.</P>
|
||||
|
||||
<DT><B>Heap</B><DD><P>The C heap is located at the end of the program and grows towards the C
|
||||
runtime stack.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atmos-4.html">Next</A>
|
||||
<A HREF="atmos-2.html">Previous</A>
|
||||
<A HREF="atmos.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
45
usr/share/doc/cc65/webdoc/atmos-4.html
Normal file
45
usr/share/doc/cc65/webdoc/atmos-4.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Oric Atmos specific information for cc65: Platform specific header files</TITLE>
|
||||
<LINK HREF="atmos-5.html" REL=next>
|
||||
<LINK HREF="atmos-3.html" REL=previous>
|
||||
<LINK HREF="atmos.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atmos-5.html">Next</A>
|
||||
<A HREF="atmos-3.html">Previous</A>
|
||||
<A HREF="atmos.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4.</A> <A HREF="atmos.html#toc4">Platform specific header files</A></H2>
|
||||
|
||||
|
||||
<P>Programs containing Atmos specific code may use the <CODE>atmos.h</CODE> header file.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.1">4.1</A> <A HREF="atmos.html#toc4.1">Hardware access</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The following pseudo variables declared in the <CODE>atmos.h</CODE> header file do allow
|
||||
access to hardware located in the address space. Some variables are
|
||||
structures, accessing the struct fields will access the chip registers.</P>
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>VIA</CODE></B><DD><P>Access to the VIA (versatile interface adapter) chip is available via the
|
||||
<CODE>VIA</CODE> variable. The structure behind this variable is explained in <CODE>_6522.h</CODE>.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atmos-5.html">Next</A>
|
||||
<A HREF="atmos-3.html">Previous</A>
|
||||
<A HREF="atmos.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
81
usr/share/doc/cc65/webdoc/atmos-5.html
Normal file
81
usr/share/doc/cc65/webdoc/atmos-5.html
Normal file
|
@ -0,0 +1,81 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Oric Atmos specific information for cc65: Loadable drivers</TITLE>
|
||||
<LINK HREF="atmos-6.html" REL=next>
|
||||
<LINK HREF="atmos-4.html" REL=previous>
|
||||
<LINK HREF="atmos.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atmos-6.html">Next</A>
|
||||
<A HREF="atmos-4.html">Previous</A>
|
||||
<A HREF="atmos.html#toc5">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s5">5.</A> <A HREF="atmos.html#toc5">Loadable drivers</A></H2>
|
||||
|
||||
|
||||
<P><EM>Note:</EM> Since the Atmos doesn't have working disk I/O
|
||||
(see
|
||||
<A HREF="atmos-6.html#limitations">section "Limitations"</A>), the
|
||||
available drivers cannot be loaded at runtime (so the term "loadable drivers"
|
||||
is somewhat misleading). Instead, the drivers have to be converted using the
|
||||
<A HREF="co65.html">co65 utility</A> and statically linked. While
|
||||
this may seem overhead, it has two advantages:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>The interface is identical to the one used for other platforms
|
||||
and to the one for the Atmos once it has disk I/O.</LI>
|
||||
<LI>Once disk I/O is available, existing code can be changed to load drivers
|
||||
at runtime with almost no effort.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.1">5.1</A> <A HREF="atmos.html#toc5.1">Graphics drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>atmos-240-200-2.tgi</CODE></B><DD><P>This driver was written by Stefan Haubenthal. It features a resolution of
|
||||
240×200 with 2 colors.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.2">5.2</A> <A HREF="atmos.html#toc5.2">Extended memory drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>No extended memory drivers are currently available for the Atmos.</P>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.3">5.3</A> <A HREF="atmos.html#toc5.3">Mouse drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>No mouse drivers are currently available for the Atmos.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.4">5.4</A> <A HREF="atmos.html#toc5.4">RS232 device drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>No serial drivers are currently available for the Atmos.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atmos-6.html">Next</A>
|
||||
<A HREF="atmos-4.html">Previous</A>
|
||||
<A HREF="atmos.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
50
usr/share/doc/cc65/webdoc/atmos-6.html
Normal file
50
usr/share/doc/cc65/webdoc/atmos-6.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Oric Atmos specific information for cc65: Limitations</TITLE>
|
||||
<LINK HREF="atmos-7.html" REL=next>
|
||||
<LINK HREF="atmos-5.html" REL=previous>
|
||||
<LINK HREF="atmos.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atmos-7.html">Next</A>
|
||||
<A HREF="atmos-5.html">Previous</A>
|
||||
<A HREF="atmos.html#toc6">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="limitations"></A> <A NAME="s6">6.</A> <A HREF="atmos.html#toc6">Limitations</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss6.1">6.1</A> <A HREF="atmos.html#toc6.1">Disk I/O</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The existing library for the Atmos doesn't implement C file
|
||||
I/O. There is one hack for the <CODE>write()</CODE> routine in
|
||||
place, which will make functions work that write to <CODE>stdout</CODE>
|
||||
(like <CODE>printf()</CODE>). However, this function has some shortcomings which
|
||||
won't be fixed, because it's going to be replaced anyway.</P>
|
||||
<P>To be more concrete, this limitation means that you cannot use any of the
|
||||
following functions (and a few others):</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>fclose</LI>
|
||||
<LI>fopen</LI>
|
||||
<LI>fread</LI>
|
||||
<LI>fprintf</LI>
|
||||
<LI>fputc</LI>
|
||||
<LI>fscanf</LI>
|
||||
<LI>fwrite</LI>
|
||||
<LI>...</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atmos-7.html">Next</A>
|
||||
<A HREF="atmos-5.html">Previous</A>
|
||||
<A HREF="atmos.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
39
usr/share/doc/cc65/webdoc/atmos-7.html
Normal file
39
usr/share/doc/cc65/webdoc/atmos-7.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Oric Atmos specific information for cc65: Other hints</TITLE>
|
||||
<LINK HREF="atmos-8.html" REL=next>
|
||||
<LINK HREF="atmos-6.html" REL=previous>
|
||||
<LINK HREF="atmos.html#toc7" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atmos-8.html">Next</A>
|
||||
<A HREF="atmos-6.html">Previous</A>
|
||||
<A HREF="atmos.html#toc7">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s7">7.</A> <A HREF="atmos.html#toc7">Other hints</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss7.1">7.1</A> <A HREF="atmos.html#toc7.1">Interrupts</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The runtime for the Atmos uses routines marked as <CODE>.CONDES</CODE> type 2 for
|
||||
interrupt handlers. Such routines must be written as simple machine language
|
||||
subroutines and will be called automatically by the interrupt handler code
|
||||
when they are linked into a program. See the discussion of the <CODE>.CONDES</CODE>
|
||||
feature in the
|
||||
<A HREF="ca65.html">assembler manual</A>.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atmos-8.html">Next</A>
|
||||
<A HREF="atmos-6.html">Previous</A>
|
||||
<A HREF="atmos.html#toc7">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/atmos-8.html
Normal file
30
usr/share/doc/cc65/webdoc/atmos-8.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Oric Atmos specific information for cc65: Bugs/Feedback</TITLE>
|
||||
<LINK HREF="atmos-9.html" REL=next>
|
||||
<LINK HREF="atmos-7.html" REL=previous>
|
||||
<LINK HREF="atmos.html#toc8" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atmos-9.html">Next</A>
|
||||
<A HREF="atmos-7.html">Previous</A>
|
||||
<A HREF="atmos.html#toc8">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s8">8.</A> <A HREF="atmos.html#toc8">Bugs/Feedback</A></H2>
|
||||
|
||||
|
||||
<P>If you have problems using the library, if you find any bugs, or if you're
|
||||
doing something interesting with it, I would be glad to hear from you. Feel
|
||||
free to contact me by email (
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A>).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="atmos-9.html">Next</A>
|
||||
<A HREF="atmos-7.html">Previous</A>
|
||||
<A HREF="atmos.html#toc8">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
41
usr/share/doc/cc65/webdoc/atmos-9.html
Normal file
41
usr/share/doc/cc65/webdoc/atmos-9.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Oric Atmos specific information for cc65: License</TITLE>
|
||||
<LINK HREF="atmos-8.html" REL=previous>
|
||||
<LINK HREF="atmos.html#toc9" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="atmos-8.html">Previous</A>
|
||||
<A HREF="atmos.html#toc9">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s9">9.</A> <A HREF="atmos.html#toc9">License</A></H2>
|
||||
|
||||
|
||||
<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.</P>
|
||||
<P>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:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI> 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.</LI>
|
||||
<LI> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.</LI>
|
||||
<LI> This notice may not be removed or altered from any source
|
||||
distribution.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="atmos-8.html">Previous</A>
|
||||
<A HREF="atmos.html#toc9">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
72
usr/share/doc/cc65/webdoc/atmos.html
Normal file
72
usr/share/doc/cc65/webdoc/atmos.html
Normal file
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Oric Atmos specific information for cc65</TITLE>
|
||||
<LINK HREF="atmos-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="atmos-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>Oric Atmos specific information for cc65</H1>
|
||||
|
||||
<H2>Ullrich von Bassewitz,
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A>
|
||||
Stefan A. Haubenthal,
|
||||
<A HREF="mailto:polluks@sdf.lonestar.org">polluks@sdf.lonestar.org</A></H2>2005-07-17
|
||||
<HR>
|
||||
<EM>An overview over the Atmos runtime system as it is implemented for the cc65 C
|
||||
compiler.</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="atmos-1.html">Overview</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="atmos-2.html">Binary format</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="atmos-3.html">Memory layout</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="atmos-4.html">Platform specific header files</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc4.1">4.1</A> <A HREF="atmos-4.html#ss4.1">Hardware access</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="atmos-5.html">Loadable drivers</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc5.1">5.1</A> <A HREF="atmos-5.html#ss5.1">Graphics drivers</A>
|
||||
<LI><A NAME="toc5.2">5.2</A> <A HREF="atmos-5.html#ss5.2">Extended memory drivers</A>
|
||||
<LI><A NAME="toc5.3">5.3</A> <A HREF="atmos-5.html#ss5.3">Mouse drivers</A>
|
||||
<LI><A NAME="toc5.4">5.4</A> <A HREF="atmos-5.html#ss5.4">RS232 device drivers</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="atmos-6.html">Limitations</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc6.1">6.1</A> <A HREF="atmos-6.html#ss6.1">Disk I/O</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc7">7.</A> <A HREF="atmos-7.html">Other hints</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc7.1">7.1</A> <A HREF="atmos-7.html#ss7.1">Interrupts</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc8">8.</A> <A HREF="atmos-8.html">Bugs/Feedback</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc9">9.</A> <A HREF="atmos-9.html">License</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="atmos-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
33
usr/share/doc/cc65/webdoc/c128-1.html
Normal file
33
usr/share/doc/cc65/webdoc/c128-1.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 128 specific information for cc65: Overview</TITLE>
|
||||
<LINK HREF="c128-2.html" REL=next>
|
||||
|
||||
<LINK HREF="c128.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c128-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="c128.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1.</A> <A HREF="c128.html#toc1">Overview</A></H2>
|
||||
|
||||
|
||||
<P>This file contains an overview of the C128 runtime system as it comes with the
|
||||
cc65 C compiler. It describes the memory layout, C128 specific header files,
|
||||
available drivers, and any pitfalls specific to that platform.</P>
|
||||
<P>Please note that C128 specific functions are just mentioned here, they are
|
||||
described in detail in the separate
|
||||
<A HREF="funcref.html">function reference</A>. Even functions marked as "platform dependent" may be available on
|
||||
more than one platform. Please see the function reference for more
|
||||
information.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c128-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="c128.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/c128-2.html
Normal file
30
usr/share/doc/cc65/webdoc/c128-2.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 128 specific information for cc65: Binary format</TITLE>
|
||||
<LINK HREF="c128-3.html" REL=next>
|
||||
<LINK HREF="c128-1.html" REL=previous>
|
||||
<LINK HREF="c128.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c128-3.html">Next</A>
|
||||
<A HREF="c128-1.html">Previous</A>
|
||||
<A HREF="c128.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2.</A> <A HREF="c128.html#toc2">Binary format</A></H2>
|
||||
|
||||
|
||||
<P>The standard binary output format generated by the linker for the C128 target
|
||||
is a machine language program with a one line BASIC stub. This means that a
|
||||
program can be loaded as BASIC program and started with RUN. It is of course
|
||||
possible to change this behaviour by using a modified startup file and linker
|
||||
config.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c128-3.html">Next</A>
|
||||
<A HREF="c128-1.html">Previous</A>
|
||||
<A HREF="c128.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
49
usr/share/doc/cc65/webdoc/c128-3.html
Normal file
49
usr/share/doc/cc65/webdoc/c128-3.html
Normal file
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 128 specific information for cc65: Memory layout</TITLE>
|
||||
<LINK HREF="c128-4.html" REL=next>
|
||||
<LINK HREF="c128-2.html" REL=previous>
|
||||
<LINK HREF="c128.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c128-4.html">Next</A>
|
||||
<A HREF="c128-2.html">Previous</A>
|
||||
<A HREF="c128.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3.</A> <A HREF="c128.html#toc3">Memory layout</A></H2>
|
||||
|
||||
|
||||
<P>cc65 generated programs with the default setup run with the I/O area and the
|
||||
kernal ROM enabled. Note that this is a non standard memory layout, and that
|
||||
there is no "memory configuration index" for this layout. This means that
|
||||
special case has to be taken when changing the configuration, or calling any
|
||||
code that does this. The memory configuration register at $FF00 should
|
||||
be saved and restored instead of relying on the memory configuration index
|
||||
stored in the zero page.</P>
|
||||
<P>The setup gives a usable memory range of $1C00 - $CFFF. Having
|
||||
just the kernal ROM mapped in means, that kernal entry points may be called
|
||||
directly, but using the BASIC ROM is not possible without additional code.</P>
|
||||
<P>Special locations:</P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Text screen</B><DD><P>The text screen is located at $400 (as in the standard setup).</P>
|
||||
|
||||
<DT><B>Stack</B><DD><P>The C runtime stack is located at $CFFF and growing downwards.</P>
|
||||
|
||||
<DT><B>Heap</B><DD><P>The C heap is located at the end of the program and grows towards the C
|
||||
runtime stack.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c128-4.html">Next</A>
|
||||
<A HREF="c128-2.html">Previous</A>
|
||||
<A HREF="c128.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
115
usr/share/doc/cc65/webdoc/c128-4.html
Normal file
115
usr/share/doc/cc65/webdoc/c128-4.html
Normal file
|
@ -0,0 +1,115 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 128 specific information for cc65: Platform specific header files</TITLE>
|
||||
<LINK HREF="c128-5.html" REL=next>
|
||||
<LINK HREF="c128-3.html" REL=previous>
|
||||
<LINK HREF="c128.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c128-5.html">Next</A>
|
||||
<A HREF="c128-3.html">Previous</A>
|
||||
<A HREF="c128.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4.</A> <A HREF="c128.html#toc4">Platform specific header files</A></H2>
|
||||
|
||||
|
||||
<P>Programs containing C128 specific code may use the <CODE>c128.h</CODE> or <CODE>cbm.h</CODE>
|
||||
header files. Using the later may be an option when writing code for more than
|
||||
one CBM platform, since it includes <CODE>c128.h</CODE> and declares several functions
|
||||
common to all CBM platforms.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.1">4.1</A> <A HREF="c128.html#toc4.1">C128 specific functions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The functions listed below are special for the C128. See the
|
||||
<A HREF="funcref.html">function reference</A> for declaration and usage.</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>toggle_videomode</LI>
|
||||
<LI>c64mode</LI>
|
||||
<LI>fast</LI>
|
||||
<LI>slow</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.2">4.2</A> <A HREF="c128.html#toc4.2">CBM specific functions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Some functions are available for all (or at least most) of the Commodore
|
||||
machines. See the
|
||||
<A HREF="funcref.html">function reference</A> for
|
||||
declaration and usage.</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>cbm_close</LI>
|
||||
<LI>cbm_closedir</LI>
|
||||
<LI>cbm_k_setlfs</LI>
|
||||
<LI>cbm_k_setnam</LI>
|
||||
<LI>cbm_k_load</LI>
|
||||
<LI>cbm_k_save</LI>
|
||||
<LI>cbm_k_open</LI>
|
||||
<LI>cbm_k_close</LI>
|
||||
<LI>cbm_k_readst</LI>
|
||||
<LI>cbm_k_chkin</LI>
|
||||
<LI>cbm_k_ckout</LI>
|
||||
<LI>cbm_k_basin</LI>
|
||||
<LI>cbm_k_bsout</LI>
|
||||
<LI>cbm_k_clrch</LI>
|
||||
<LI>cbm_load</LI>
|
||||
<LI>cbm_open</LI>
|
||||
<LI>cbm_opendir</LI>
|
||||
<LI>cbm_read</LI>
|
||||
<LI>cbm_readdir</LI>
|
||||
<LI>cbm_save</LI>
|
||||
<LI>cbm_write</LI>
|
||||
<LI>get_tv</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.3">4.3</A> <A HREF="c128.html#toc4.3">Hardware access</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The following pseudo variables declared in the <CODE>c128.h</CODE> header file do
|
||||
allow access to hardware located in the address space. Some variables are
|
||||
structures, accessing the struct fields will access the chip registers.</P>
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>VIC</CODE></B><DD><P>The <CODE>VIC</CODE> structure allows access to the VIC II (the graphics
|
||||
controller). See the <CODE>_vic2.h</CODE> header file located in the include
|
||||
directory for the declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>SID</CODE></B><DD><P>The <CODE>SID</CODE> structure allows access to the SID (the sound interface
|
||||
device). See the <CODE>_sid.h</CODE> header file located in the include directory
|
||||
for the declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>VDC</CODE></B><DD><P>The <CODE>VDC</CODE> structure allows access to the VDC (the video display
|
||||
controller). See the <CODE>_vdc.h</CODE> header file located in the include
|
||||
directory for the declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>CIA1, CIA2</CODE></B><DD><P>Access to the two CIA (complex interface adapter) chips is available via
|
||||
the <CODE>CIA1</CODE> and <CODE>CIA2</CODE> variables. The structure behind these variables
|
||||
is explained in <CODE>_6526.h</CODE>.</P>
|
||||
|
||||
<DT><B><CODE>COLOR_RAM</CODE></B><DD><P>A character array that mirrors the color RAM of the C64 at $D800.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c128-5.html">Next</A>
|
||||
<A HREF="c128-3.html">Previous</A>
|
||||
<A HREF="c128.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
130
usr/share/doc/cc65/webdoc/c128-5.html
Normal file
130
usr/share/doc/cc65/webdoc/c128-5.html
Normal file
|
@ -0,0 +1,130 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 128 specific information for cc65: Loadable drivers</TITLE>
|
||||
<LINK HREF="c128-6.html" REL=next>
|
||||
<LINK HREF="c128-4.html" REL=previous>
|
||||
<LINK HREF="c128.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c128-6.html">Next</A>
|
||||
<A HREF="c128-4.html">Previous</A>
|
||||
<A HREF="c128.html#toc5">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s5">5.</A> <A HREF="c128.html#toc5">Loadable drivers</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.1">5.1</A> <A HREF="c128.html#toc5.1">Graphics drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Note: The graphics drivers for the VDC are incompatible with the extended
|
||||
memory drivers using the VDC memory!</P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B><CODE>c128-vdc.tgi</CODE></B><DD><P>This driver was written by Maciej Witkowiak. It uses the 80 column display
|
||||
and features a resolution of 640*200 with two colors and an adjustable
|
||||
palette (that means that the two colors can be chosen out of the 16 VDC
|
||||
colors).</P>
|
||||
|
||||
<DT><B><CODE>c128-vdc2.tgi</CODE></B><DD><P>This driver was written by Maciej Witkowiak. This driver uses the 80 column
|
||||
display and features a resolution of 640*480 with two colors and an
|
||||
adjustable palette (that means that the two colors can be chosen out of the
|
||||
16 VDC colors). The driver requires 64KB VDC RAM.</P>
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
<P>Note: The colors are translated from definitions in headers to correct VDC values
|
||||
so please use definitions or VIC color numbers only. Colors <CODE>GRAY3</CODE> and <CODE>BROWN</CODE> are
|
||||
missing on VDC and are translated to the two colors missing from VIC palette.</P>
|
||||
|
||||
<H2><A NAME="ss5.2">5.2</A> <A HREF="c128.html#toc5.2">Extended memory drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>c128-georam.emd</CODE></B><DD><P>A driver for the GeoRam cartridge. The driver will always assume 2048 pages
|
||||
of 256 bytes each. There are no checks, so if your program knows better,
|
||||
just go ahead.</P>
|
||||
|
||||
<DT><B><CODE>c128-ram.emd</CODE></B><DD><P>An extended memory driver for the RAM in page 1. The common memory area is
|
||||
excluded, so this driver supports 251 pages of 256 bytes each.</P>
|
||||
|
||||
<DT><B><CODE>c128-ramcart.emd</CODE></B><DD><P>A driver for the RamCart 64/128 written and contributed by Maciej Witkowiak.
|
||||
Will test the hardware for the available RAM.</P>
|
||||
|
||||
<DT><B><CODE>c128-reu.emd</CODE></B><DD><P>A driver for the CBM REUs. The driver will determine from the connected REU
|
||||
if it supports 128KB of RAM or more. In the latter case, 256KB are assumed,
|
||||
but since there are no range checks, the application can use more memory if
|
||||
it has better knowledge about the hardware than the driver.</P>
|
||||
|
||||
<DT><B><CODE>c128-vdc.emd</CODE></B><DD><P>A driver for the VDC memory of the C128 written and contributed by Maciej
|
||||
Witkowiak. Autodetects the amount of memory available (16 or 64K) and offers
|
||||
64 or 256 pages of 256 bytes each. Note: This driver is incompatible with
|
||||
any of the graphics drivers using the VDC!</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.3">5.3</A> <A HREF="c128.html#toc5.3">Joystick drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>c128-ptvjoy.joy</CODE></B><DD><P>Driver for the Protovision 4-player adapter originally written by Groepaz
|
||||
for the C64 and converted for the C128 by me. See
|
||||
<A HREF="http://www.protovision-online.de/hardw/hardwstart.htm">http://www.protovision-online.de/hardw/hardwstart.htm</A> for prices and
|
||||
building instructions. Up to four joysticks are supported.</P>
|
||||
|
||||
<DT><B><CODE>c128-stdjoy.joy</CODE></B><DD><P>Supports up to two joysticks connected to the standard joysticks port of
|
||||
the C128.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.4">5.4</A> <A HREF="c128.html#toc5.4">Mouse drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Currently no drivers available (in fact, the API for loadable mouse drivers
|
||||
does not exist).</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.5">5.5</A> <A HREF="c128.html#toc5.5">RS232 device drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>c128-swlink.ser</CODE></B><DD><P>Driver for the SwiftLink cartridge. Supports up to 38400 baud, hardware flow
|
||||
control (RTS/CTS) and interrupt driven receives. Note that because of the
|
||||
peculiarities of the 6551 chip together with the use of the NMI, transmits
|
||||
are not interrupt driven, and the transceiver blocks if the receiver asserts
|
||||
flow control because of a full buffer.</P>
|
||||
<P>The driver uses the RS232 variables and buffers of the kernal (buffers at
|
||||
$C00 and $D00).</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c128-6.html">Next</A>
|
||||
<A HREF="c128-4.html">Previous</A>
|
||||
<A HREF="c128.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
26
usr/share/doc/cc65/webdoc/c128-6.html
Normal file
26
usr/share/doc/cc65/webdoc/c128-6.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 128 specific information for cc65: Limitations</TITLE>
|
||||
<LINK HREF="c128-7.html" REL=next>
|
||||
<LINK HREF="c128-5.html" REL=previous>
|
||||
<LINK HREF="c128.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c128-7.html">Next</A>
|
||||
<A HREF="c128-5.html">Previous</A>
|
||||
<A HREF="c128.html#toc6">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s6">6.</A> <A HREF="c128.html#toc6">Limitations</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c128-7.html">Next</A>
|
||||
<A HREF="c128-5.html">Previous</A>
|
||||
<A HREF="c128.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
71
usr/share/doc/cc65/webdoc/c128-7.html
Normal file
71
usr/share/doc/cc65/webdoc/c128-7.html
Normal file
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 128 specific information for cc65: Other hints</TITLE>
|
||||
<LINK HREF="c128-8.html" REL=next>
|
||||
<LINK HREF="c128-6.html" REL=previous>
|
||||
<LINK HREF="c128.html#toc7" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c128-8.html">Next</A>
|
||||
<A HREF="c128-6.html">Previous</A>
|
||||
<A HREF="c128.html#toc7">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s7">7.</A> <A HREF="c128.html#toc7">Other hints</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss7.1">7.1</A> <A HREF="c128.html#toc7.1">Passing arguments to the program</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Command line arguments can be passed to <CODE>main()</CODE>. Since this is not
|
||||
supported by BASIC, the following syntax was chosen:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>Arguments are separated by spaces.</LI>
|
||||
<LI>Arguments may be quoted.</LI>
|
||||
<LI>Leading and trailing spaces around an argument are ignored. Spaces within
|
||||
a quoted argument are allowed.</LI>
|
||||
<LI>The first argument passed to <CODE>main</CODE> is the program name.</LI>
|
||||
<LI>A maximum number of 10 arguments (including the program name) are
|
||||
supported.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss7.2">7.2</A> <A HREF="c128.html#toc7.2">Program return code</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The program return code (low byte) is passed back to BASIC by use of the
|
||||
<CODE>ST</CODE> variable.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss7.3">7.3</A> <A HREF="c128.html#toc7.3">Interrupts</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The runtime for the C128 uses routines marked as <CODE>.CONDES</CODE> type 2 for
|
||||
interrupt handlers. Such routines must be written as simple machine language
|
||||
subroutines and will be called automatically by the interrupt handler code
|
||||
when they are linked into a program. See the discussion of the <CODE>.CONDES</CODE>
|
||||
feature in the
|
||||
<A HREF="ca65.html">assembler manual</A>.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c128-8.html">Next</A>
|
||||
<A HREF="c128-6.html">Previous</A>
|
||||
<A HREF="c128.html#toc7">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/c128-8.html
Normal file
30
usr/share/doc/cc65/webdoc/c128-8.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 128 specific information for cc65: Bugs/Feedback</TITLE>
|
||||
<LINK HREF="c128-9.html" REL=next>
|
||||
<LINK HREF="c128-7.html" REL=previous>
|
||||
<LINK HREF="c128.html#toc8" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c128-9.html">Next</A>
|
||||
<A HREF="c128-7.html">Previous</A>
|
||||
<A HREF="c128.html#toc8">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s8">8.</A> <A HREF="c128.html#toc8">Bugs/Feedback</A></H2>
|
||||
|
||||
|
||||
<P>If you have problems using the library, if you find any bugs, or if you're
|
||||
doing something interesting with it, I would be glad to hear from you. Feel
|
||||
free to contact me by email (
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A>).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c128-9.html">Next</A>
|
||||
<A HREF="c128-7.html">Previous</A>
|
||||
<A HREF="c128.html#toc8">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
41
usr/share/doc/cc65/webdoc/c128-9.html
Normal file
41
usr/share/doc/cc65/webdoc/c128-9.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 128 specific information for cc65: License</TITLE>
|
||||
<LINK HREF="c128-8.html" REL=previous>
|
||||
<LINK HREF="c128.html#toc9" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="c128-8.html">Previous</A>
|
||||
<A HREF="c128.html#toc9">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s9">9.</A> <A HREF="c128.html#toc9">License</A></H2>
|
||||
|
||||
|
||||
<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.</P>
|
||||
<P>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:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI> 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.</LI>
|
||||
<LI> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.</LI>
|
||||
<LI> This notice may not be removed or altered from any source
|
||||
distribution.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="c128-8.html">Previous</A>
|
||||
<A HREF="c128.html#toc9">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
72
usr/share/doc/cc65/webdoc/c128.html
Normal file
72
usr/share/doc/cc65/webdoc/c128.html
Normal file
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 128 specific information for cc65</TITLE>
|
||||
<LINK HREF="c128-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c128-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>Commodore 128 specific information for cc65</H1>
|
||||
|
||||
<H2>Ullrich von Bassewitz,
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A></H2>2003-12-14
|
||||
<HR>
|
||||
<EM>An overview over the C128 runtime system as it is implemented for the cc65 C
|
||||
compiler.</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="c128-1.html">Overview</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="c128-2.html">Binary format</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="c128-3.html">Memory layout</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="c128-4.html">Platform specific header files</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc4.1">4.1</A> <A HREF="c128-4.html#ss4.1">C128 specific functions</A>
|
||||
<LI><A NAME="toc4.2">4.2</A> <A HREF="c128-4.html#ss4.2">CBM specific functions</A>
|
||||
<LI><A NAME="toc4.3">4.3</A> <A HREF="c128-4.html#ss4.3">Hardware access</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="c128-5.html">Loadable drivers</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc5.1">5.1</A> <A HREF="c128-5.html#ss5.1">Graphics drivers</A>
|
||||
<LI><A NAME="toc5.2">5.2</A> <A HREF="c128-5.html#ss5.2">Extended memory drivers</A>
|
||||
<LI><A NAME="toc5.3">5.3</A> <A HREF="c128-5.html#ss5.3">Joystick drivers</A>
|
||||
<LI><A NAME="toc5.4">5.4</A> <A HREF="c128-5.html#ss5.4">Mouse drivers</A>
|
||||
<LI><A NAME="toc5.5">5.5</A> <A HREF="c128-5.html#ss5.5">RS232 device drivers</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="c128-6.html">Limitations</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc7">7.</A> <A HREF="c128-7.html">Other hints</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc7.1">7.1</A> <A HREF="c128-7.html#ss7.1">Passing arguments to the program</A>
|
||||
<LI><A NAME="toc7.2">7.2</A> <A HREF="c128-7.html#ss7.2">Program return code</A>
|
||||
<LI><A NAME="toc7.3">7.3</A> <A HREF="c128-7.html#ss7.3">Interrupts</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc8">8.</A> <A HREF="c128-8.html">Bugs/Feedback</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc9">9.</A> <A HREF="c128-9.html">License</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="c128-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
41
usr/share/doc/cc65/webdoc/c16-1.html
Normal file
41
usr/share/doc/cc65/webdoc/c16-1.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 16/116 specific information for cc65: Overview</TITLE>
|
||||
<LINK HREF="c16-2.html" REL=next>
|
||||
|
||||
<LINK HREF="c16.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c16-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="c16.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1.</A> <A HREF="c16.html#toc1">Overview</A></H2>
|
||||
|
||||
|
||||
<P>This file contains an overview of the C16 runtime system as it comes with the
|
||||
cc65 C compiler. It describes the memory layout, C16/116 specific header
|
||||
files, available drivers, and any pitfalls specific to that platform.</P>
|
||||
<P>Please note that C16 specific functions are just mentioned here, they are
|
||||
described in detail in the separate
|
||||
<A HREF="funcref.html">function reference</A>. Even functions marked as "platform dependent" may be available on
|
||||
more than one platform. Please see the function reference for more
|
||||
information.</P>
|
||||
<P>Since the C16/C116 and the Commodore Plus/4 are almost identical (the former
|
||||
don't have the 6551 ACIA and only 16KB of memory), the
|
||||
<A HREF="plus4.html">Plus/4 documentation</A> is also worth a look. The
|
||||
difference between both cc65 targets is that the Plus/4 runtime uses banking
|
||||
to support full 64K RAM, while the C16 does not use banking and supports up to
|
||||
32K RAM. Because banking is not needed, most C16 programs will be somewhat
|
||||
smaller than the same program compiled for the Plus/4. However, programs C16
|
||||
will always run on the Plus/4, while the reverse is not necessarily true.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c16-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="c16.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/c16-2.html
Normal file
30
usr/share/doc/cc65/webdoc/c16-2.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 16/116 specific information for cc65: Binary format</TITLE>
|
||||
<LINK HREF="c16-3.html" REL=next>
|
||||
<LINK HREF="c16-1.html" REL=previous>
|
||||
<LINK HREF="c16.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c16-3.html">Next</A>
|
||||
<A HREF="c16-1.html">Previous</A>
|
||||
<A HREF="c16.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2.</A> <A HREF="c16.html#toc2">Binary format</A></H2>
|
||||
|
||||
|
||||
<P>The standard binary output format generated by the linker for the C16/C116
|
||||
target is a machine language program with a one line BASIC stub. This means
|
||||
that a program can be loaded as BASIC program and started with RUN. It is of
|
||||
course possible to change this behaviour by using a modified startup file and
|
||||
linker config.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c16-3.html">Next</A>
|
||||
<A HREF="c16-1.html">Previous</A>
|
||||
<A HREF="c16.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
47
usr/share/doc/cc65/webdoc/c16-3.html
Normal file
47
usr/share/doc/cc65/webdoc/c16-3.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 16/116 specific information for cc65: Memory layout</TITLE>
|
||||
<LINK HREF="c16-4.html" REL=next>
|
||||
<LINK HREF="c16-2.html" REL=previous>
|
||||
<LINK HREF="c16.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c16-4.html">Next</A>
|
||||
<A HREF="c16-2.html">Previous</A>
|
||||
<A HREF="c16.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3.</A> <A HREF="c16.html#toc3">Memory layout</A></H2>
|
||||
|
||||
|
||||
<P>cc65 generated programs with the default setup run with the kernal and basic
|
||||
banked out. This gives a usable memory range of $1000 - $4000
|
||||
(or $8000 i the machine is equipped with 32K RAM or more). Having the
|
||||
kernal and basic ROMs banked out means, that no ROM entry points may be called
|
||||
directly from user code.</P>
|
||||
<P>Special locations:</P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Text screen</B><DD><P>The text screen is located at $C00 (as in the standard setup).</P>
|
||||
|
||||
<DT><B>Color RAM</B><DD><P>The color RAM is located at $800 (standard location).</P>
|
||||
|
||||
<DT><B>Stack</B><DD><P>The C runtime stack is located at $3FFF ($7FFF in case of a
|
||||
machine with 32K of memory or more) and growing downwards.</P>
|
||||
|
||||
<DT><B>Heap</B><DD><P>The C heap is located at the end of the program and grows towards the C
|
||||
runtime stack.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c16-4.html">Next</A>
|
||||
<A HREF="c16-2.html">Previous</A>
|
||||
<A HREF="c16.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
98
usr/share/doc/cc65/webdoc/c16-4.html
Normal file
98
usr/share/doc/cc65/webdoc/c16-4.html
Normal file
|
@ -0,0 +1,98 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 16/116 specific information for cc65: Platform specific header files</TITLE>
|
||||
<LINK HREF="c16-5.html" REL=next>
|
||||
<LINK HREF="c16-3.html" REL=previous>
|
||||
<LINK HREF="c16.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c16-5.html">Next</A>
|
||||
<A HREF="c16-3.html">Previous</A>
|
||||
<A HREF="c16.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4.</A> <A HREF="c16.html#toc4">Platform specific header files</A></H2>
|
||||
|
||||
|
||||
<P>Programs containing C16 specific code may use the <CODE>c16.h</CODE> or <CODE>cbm.h</CODE>
|
||||
header files. Using the later may be an option when writing code for more than
|
||||
one CBM platform, since it includes <CODE>c16.h</CODE> and declares several functions
|
||||
common to all CBM platforms.</P>
|
||||
<P>Please note that most of the header file declarations from the <CODE>c16.h</CODE>
|
||||
header file are shared between the C16 and Plus/4 configurations. For this
|
||||
reason, most of it is located in a common header file named <CODE>cbm264.h</CODE>.</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss4.1">4.1</A> <A HREF="c16.html#toc4.1">C16/C116 specific functions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>There are currently no special C16/C116 functions.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.2">4.2</A> <A HREF="c16.html#toc4.2">CBM specific functions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Some functions are available for all (or at least most) of the Commodore
|
||||
machines. See the
|
||||
<A HREF="funcref.html">function reference</A> for
|
||||
declaration and usage.</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>cbm_close</LI>
|
||||
<LI>cbm_closedir</LI>
|
||||
<LI>cbm_k_setlfs</LI>
|
||||
<LI>cbm_k_setnam</LI>
|
||||
<LI>cbm_k_load</LI>
|
||||
<LI>cbm_k_save</LI>
|
||||
<LI>cbm_k_open</LI>
|
||||
<LI>cbm_k_close</LI>
|
||||
<LI>cbm_k_readst</LI>
|
||||
<LI>cbm_k_chkin</LI>
|
||||
<LI>cbm_k_ckout</LI>
|
||||
<LI>cbm_k_basin</LI>
|
||||
<LI>cbm_k_bsout</LI>
|
||||
<LI>cbm_k_clrch</LI>
|
||||
<LI>cbm_load</LI>
|
||||
<LI>cbm_open</LI>
|
||||
<LI>cbm_opendir</LI>
|
||||
<LI>cbm_read</LI>
|
||||
<LI>cbm_readdir</LI>
|
||||
<LI>cbm_save</LI>
|
||||
<LI>cbm_write</LI>
|
||||
<LI>get_tv</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.3">4.3</A> <A HREF="c16.html#toc4.3">Hardware access</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The following pseudo variables declared in the <CODE>c16.h</CODE> header file do
|
||||
allow access to hardware located in the address space. Some variables are
|
||||
structures, accessing the struct fields will access the chip registers.</P>
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>TED</CODE></B><DD><P>The <CODE>TED</CODE> structure allows access to the TED chip. See the
|
||||
<CODE>_ted.h</CODE> header file located in the include directory for the
|
||||
declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>COLOR_RAM</CODE></B><DD><P>A character array that mirrors the color RAM of the C16 at $0800.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c16-5.html">Next</A>
|
||||
<A HREF="c16-3.html">Previous</A>
|
||||
<A HREF="c16.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
82
usr/share/doc/cc65/webdoc/c16-5.html
Normal file
82
usr/share/doc/cc65/webdoc/c16-5.html
Normal file
|
@ -0,0 +1,82 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 16/116 specific information for cc65: Loadable drivers</TITLE>
|
||||
<LINK HREF="c16-6.html" REL=next>
|
||||
<LINK HREF="c16-4.html" REL=previous>
|
||||
<LINK HREF="c16.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c16-6.html">Next</A>
|
||||
<A HREF="c16-4.html">Previous</A>
|
||||
<A HREF="c16.html#toc5">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s5">5.</A> <A HREF="c16.html#toc5">Loadable drivers</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.1">5.1</A> <A HREF="c16.html#toc5.1">Graphics drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>No graphics drivers are currently available for the C16/C116.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.2">5.2</A> <A HREF="c16.html#toc5.2">Extended memory drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>c16-ram.emd</CODE></B><DD><P>A driver for the hidden RAM below the BASIC and KERNAL ROMs. Supports 125
|
||||
pages with 256 bytes each if the machine is equipped with 64K of memory
|
||||
(a Plus/4 or a memory extended C16/116).</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.3">5.3</A> <A HREF="c16.html#toc5.3">Joystick drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>c16-stdjoy.joy</CODE></B><DD><P>Supports up to two joysticks connected to the standard joysticks port of
|
||||
the Commodore 16/116.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.4">5.4</A> <A HREF="c16.html#toc5.4">Mouse drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Currently no drivers available (in fact, the API for loadable mouse drivers
|
||||
does not exist).</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.5">5.5</A> <A HREF="c16.html#toc5.5">RS232 device drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The Commodore 16 does not have a builtin ACIA and no RS232 extensions are
|
||||
known. For this reason, there are no RS232 drivers available. Please note that
|
||||
the standard Plus/4 driver will <EM>not</EM> run together with the C16
|
||||
library, because the latter does not support interrupts needed by the driver.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c16-6.html">Next</A>
|
||||
<A HREF="c16-4.html">Previous</A>
|
||||
<A HREF="c16.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
26
usr/share/doc/cc65/webdoc/c16-6.html
Normal file
26
usr/share/doc/cc65/webdoc/c16-6.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 16/116 specific information for cc65: Limitations</TITLE>
|
||||
<LINK HREF="c16-7.html" REL=next>
|
||||
<LINK HREF="c16-5.html" REL=previous>
|
||||
<LINK HREF="c16.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c16-7.html">Next</A>
|
||||
<A HREF="c16-5.html">Previous</A>
|
||||
<A HREF="c16.html#toc6">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s6">6.</A> <A HREF="c16.html#toc6">Limitations</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c16-7.html">Next</A>
|
||||
<A HREF="c16-5.html">Previous</A>
|
||||
<A HREF="c16.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
59
usr/share/doc/cc65/webdoc/c16-7.html
Normal file
59
usr/share/doc/cc65/webdoc/c16-7.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 16/116 specific information for cc65: Other hints</TITLE>
|
||||
<LINK HREF="c16-8.html" REL=next>
|
||||
<LINK HREF="c16-6.html" REL=previous>
|
||||
<LINK HREF="c16.html#toc7" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c16-8.html">Next</A>
|
||||
<A HREF="c16-6.html">Previous</A>
|
||||
<A HREF="c16.html#toc7">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s7">7.</A> <A HREF="c16.html#toc7">Other hints</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss7.1">7.1</A> <A HREF="c16.html#toc7.1">Passing arguments to the program</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Command line arguments can be passed to <CODE>main()</CODE>. Since this is not
|
||||
supported by BASIC, the following syntax was chosen:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>Arguments are separated by spaces.</LI>
|
||||
<LI>Arguments may be quoted.</LI>
|
||||
<LI>Leading and trailing spaces around an argument are ignored. Spaces within
|
||||
a quoted argument are allowed.</LI>
|
||||
<LI>The first argument passed to <CODE>main</CODE> is the program name.</LI>
|
||||
<LI>A maximum number of 10 arguments (including the program name) are
|
||||
supported.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss7.2">7.2</A> <A HREF="c16.html#toc7.2">Program return code</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The program return code (low byte) is passed back to BASIC by use of the
|
||||
<CODE>ST</CODE> variable.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c16-8.html">Next</A>
|
||||
<A HREF="c16-6.html">Previous</A>
|
||||
<A HREF="c16.html#toc7">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/c16-8.html
Normal file
30
usr/share/doc/cc65/webdoc/c16-8.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 16/116 specific information for cc65: Bugs/Feedback</TITLE>
|
||||
<LINK HREF="c16-9.html" REL=next>
|
||||
<LINK HREF="c16-7.html" REL=previous>
|
||||
<LINK HREF="c16.html#toc8" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c16-9.html">Next</A>
|
||||
<A HREF="c16-7.html">Previous</A>
|
||||
<A HREF="c16.html#toc8">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s8">8.</A> <A HREF="c16.html#toc8">Bugs/Feedback</A></H2>
|
||||
|
||||
|
||||
<P>If you have problems using the library, if you find any bugs, or if you're
|
||||
doing something interesting with it, I would be glad to hear from you. Feel
|
||||
free to contact me by email (
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A>).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c16-9.html">Next</A>
|
||||
<A HREF="c16-7.html">Previous</A>
|
||||
<A HREF="c16.html#toc8">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
41
usr/share/doc/cc65/webdoc/c16-9.html
Normal file
41
usr/share/doc/cc65/webdoc/c16-9.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 16/116 specific information for cc65: License</TITLE>
|
||||
<LINK HREF="c16-8.html" REL=previous>
|
||||
<LINK HREF="c16.html#toc9" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="c16-8.html">Previous</A>
|
||||
<A HREF="c16.html#toc9">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s9">9.</A> <A HREF="c16.html#toc9">License</A></H2>
|
||||
|
||||
|
||||
<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.</P>
|
||||
<P>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:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI> 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.</LI>
|
||||
<LI> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.</LI>
|
||||
<LI> This notice may not be removed or altered from any source
|
||||
distribution.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="c16-8.html">Previous</A>
|
||||
<A HREF="c16.html#toc9">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
71
usr/share/doc/cc65/webdoc/c16.html
Normal file
71
usr/share/doc/cc65/webdoc/c16.html
Normal file
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 16/116 specific information for cc65</TITLE>
|
||||
<LINK HREF="c16-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c16-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>Commodore 16/116 specific information for cc65</H1>
|
||||
|
||||
<H2>Ullrich von Bassewitz,
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A></H2>2003-12-15
|
||||
<HR>
|
||||
<EM>An overview over the C16 runtime system as it is implemented for the cc65 C
|
||||
compiler.</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="c16-1.html">Overview</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="c16-2.html">Binary format</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="c16-3.html">Memory layout</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="c16-4.html">Platform specific header files</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc4.1">4.1</A> <A HREF="c16-4.html#ss4.1">C16/C116 specific functions</A>
|
||||
<LI><A NAME="toc4.2">4.2</A> <A HREF="c16-4.html#ss4.2">CBM specific functions</A>
|
||||
<LI><A NAME="toc4.3">4.3</A> <A HREF="c16-4.html#ss4.3">Hardware access</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="c16-5.html">Loadable drivers</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc5.1">5.1</A> <A HREF="c16-5.html#ss5.1">Graphics drivers</A>
|
||||
<LI><A NAME="toc5.2">5.2</A> <A HREF="c16-5.html#ss5.2">Extended memory drivers</A>
|
||||
<LI><A NAME="toc5.3">5.3</A> <A HREF="c16-5.html#ss5.3">Joystick drivers</A>
|
||||
<LI><A NAME="toc5.4">5.4</A> <A HREF="c16-5.html#ss5.4">Mouse drivers</A>
|
||||
<LI><A NAME="toc5.5">5.5</A> <A HREF="c16-5.html#ss5.5">RS232 device drivers</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="c16-6.html">Limitations</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc7">7.</A> <A HREF="c16-7.html">Other hints</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc7.1">7.1</A> <A HREF="c16-7.html#ss7.1">Passing arguments to the program</A>
|
||||
<LI><A NAME="toc7.2">7.2</A> <A HREF="c16-7.html#ss7.2">Program return code</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc8">8.</A> <A HREF="c16-8.html">Bugs/Feedback</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc9">9.</A> <A HREF="c16-9.html">License</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="c16-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
33
usr/share/doc/cc65/webdoc/c64-1.html
Normal file
33
usr/share/doc/cc65/webdoc/c64-1.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 64 specific information for cc65: Overview</TITLE>
|
||||
<LINK HREF="c64-2.html" REL=next>
|
||||
|
||||
<LINK HREF="c64.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c64-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="c64.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1.</A> <A HREF="c64.html#toc1">Overview</A></H2>
|
||||
|
||||
|
||||
<P>This file contains an overview of the C64 runtime system as it comes with the
|
||||
cc65 C compiler. It describes the memory layout, C64 specific header files,
|
||||
available drivers, and any pitfalls specific to that platform.</P>
|
||||
<P>Please note that C64 specific functions are just mentioned here, they are
|
||||
described in detail in the separate
|
||||
<A HREF="funcref.html">function reference</A>. Even functions marked as "platform dependent" may be available on
|
||||
more than one platform. Please see the function reference for more
|
||||
information.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c64-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="c64.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/c64-2.html
Normal file
30
usr/share/doc/cc65/webdoc/c64-2.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 64 specific information for cc65: Binary format</TITLE>
|
||||
<LINK HREF="c64-3.html" REL=next>
|
||||
<LINK HREF="c64-1.html" REL=previous>
|
||||
<LINK HREF="c64.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c64-3.html">Next</A>
|
||||
<A HREF="c64-1.html">Previous</A>
|
||||
<A HREF="c64.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2.</A> <A HREF="c64.html#toc2">Binary format</A></H2>
|
||||
|
||||
|
||||
<P>The standard binary output format generated by the linker for the C64 target
|
||||
is a machine language program with a one line BASIC stub. This means that a
|
||||
program can be loaded as BASIC program and started with RUN. It is of course
|
||||
possible to change this behaviour by using a modified startup file and linker
|
||||
config.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c64-3.html">Next</A>
|
||||
<A HREF="c64-1.html">Previous</A>
|
||||
<A HREF="c64.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
45
usr/share/doc/cc65/webdoc/c64-3.html
Normal file
45
usr/share/doc/cc65/webdoc/c64-3.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 64 specific information for cc65: Memory layout</TITLE>
|
||||
<LINK HREF="c64-4.html" REL=next>
|
||||
<LINK HREF="c64-2.html" REL=previous>
|
||||
<LINK HREF="c64.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c64-4.html">Next</A>
|
||||
<A HREF="c64-2.html">Previous</A>
|
||||
<A HREF="c64.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3.</A> <A HREF="c64.html#toc3">Memory layout</A></H2>
|
||||
|
||||
|
||||
<P>cc65 generated programs with the default setup run with the I/O area and the
|
||||
kernal ROM enabled (memory under the kernal may be used for graphics or as
|
||||
extended memory - see the sections about graphics and extended memory
|
||||
drivers). The BASIC ROM is disabled, which gives a usable memory range of
|
||||
$0800 - $CFFF. This means that kernal entry points may be called
|
||||
directly, but using the BASIC ROM is not possible without additional code.</P>
|
||||
<P>Special locations:</P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Text screen</B><DD><P>The text screen is located at $400 (as in the standard setup).</P>
|
||||
|
||||
<DT><B>Stack</B><DD><P>The C runtime stack is located at $CFFF and growing downwards.</P>
|
||||
|
||||
<DT><B>Heap</B><DD><P>The C heap is located at the end of the program and grows towards the C
|
||||
runtime stack.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c64-4.html">Next</A>
|
||||
<A HREF="c64-2.html">Previous</A>
|
||||
<A HREF="c64.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
108
usr/share/doc/cc65/webdoc/c64-4.html
Normal file
108
usr/share/doc/cc65/webdoc/c64-4.html
Normal file
|
@ -0,0 +1,108 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 64 specific information for cc65: Platform specific header files</TITLE>
|
||||
<LINK HREF="c64-5.html" REL=next>
|
||||
<LINK HREF="c64-3.html" REL=previous>
|
||||
<LINK HREF="c64.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c64-5.html">Next</A>
|
||||
<A HREF="c64-3.html">Previous</A>
|
||||
<A HREF="c64.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4.</A> <A HREF="c64.html#toc4">Platform specific header files</A></H2>
|
||||
|
||||
|
||||
<P>Programs containing C64 specific code may use the <CODE>c64.h</CODE> or <CODE>cbm.h</CODE>
|
||||
header files. Using the later may be an option when writing code for more than
|
||||
one CBM platform, since it includes <CODE>c64.h</CODE> and declares several functions
|
||||
common to all CBM platforms.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.1">4.1</A> <A HREF="c64.html#toc4.1">C64 specific functions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The functions listed below are special for the C64. See the
|
||||
<A HREF="funcref.html">function reference</A> for declaration and usage.</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>get_ostype</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.2">4.2</A> <A HREF="c64.html#toc4.2">CBM specific functions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Some functions are available for all (or at least most) of the Commodore
|
||||
machines. See the
|
||||
<A HREF="funcref.html">function reference</A> for
|
||||
declaration and usage.</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>cbm_close</LI>
|
||||
<LI>cbm_closedir</LI>
|
||||
<LI>cbm_k_setlfs</LI>
|
||||
<LI>cbm_k_setnam</LI>
|
||||
<LI>cbm_k_load</LI>
|
||||
<LI>cbm_k_save</LI>
|
||||
<LI>cbm_k_open</LI>
|
||||
<LI>cbm_k_close</LI>
|
||||
<LI>cbm_k_readst</LI>
|
||||
<LI>cbm_k_chkin</LI>
|
||||
<LI>cbm_k_ckout</LI>
|
||||
<LI>cbm_k_basin</LI>
|
||||
<LI>cbm_k_bsout</LI>
|
||||
<LI>cbm_k_clrch</LI>
|
||||
<LI>cbm_load</LI>
|
||||
<LI>cbm_open</LI>
|
||||
<LI>cbm_opendir</LI>
|
||||
<LI>cbm_read</LI>
|
||||
<LI>cbm_readdir</LI>
|
||||
<LI>cbm_save</LI>
|
||||
<LI>cbm_write</LI>
|
||||
<LI>get_tv</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.3">4.3</A> <A HREF="c64.html#toc4.3">Hardware access</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The following pseudo variables declared in the <CODE>c64.h</CODE> header file do allow
|
||||
access to hardware located in the address space. Some variables are
|
||||
structures, accessing the struct fields will access the chip registers.</P>
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>VIC</CODE></B><DD><P>The <CODE>VIC</CODE> structure allows access to the VIC II (the graphics
|
||||
controller). See the <CODE>_vic2.h</CODE> header file located in the include
|
||||
directory for the declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>SID</CODE></B><DD><P>The <CODE>SID</CODE> structure allows access to the SID (the sound interface
|
||||
device). See the <CODE>_sid.h</CODE> header file located in the include directory
|
||||
for the declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>CIA1, CIA2</CODE></B><DD><P>Access to the two CIA (complex interface adapter) chips is available via
|
||||
the <CODE>CIA1</CODE> and <CODE>CIA2</CODE> variables. The structure behind these variables
|
||||
is explained in <CODE>_6526.h</CODE>.</P>
|
||||
|
||||
<DT><B><CODE>COLOR_RAM</CODE></B><DD><P>A character array that mirrors the color RAM of the C64 at $D800.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c64-5.html">Next</A>
|
||||
<A HREF="c64-3.html">Previous</A>
|
||||
<A HREF="c64.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
126
usr/share/doc/cc65/webdoc/c64-5.html
Normal file
126
usr/share/doc/cc65/webdoc/c64-5.html
Normal file
|
@ -0,0 +1,126 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 64 specific information for cc65: Loadable drivers</TITLE>
|
||||
<LINK HREF="c64-6.html" REL=next>
|
||||
<LINK HREF="c64-4.html" REL=previous>
|
||||
<LINK HREF="c64.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c64-6.html">Next</A>
|
||||
<A HREF="c64-4.html">Previous</A>
|
||||
<A HREF="c64.html#toc5">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s5">5.</A> <A HREF="c64.html#toc5">Loadable drivers</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.1">5.1</A> <A HREF="c64.html#toc5.1">Graphics drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P><EM>Note:</EM> All available graphics drivers for the TGI interface will use
|
||||
the space below the I/O area and kernal ROM, so you can have hires graphics in
|
||||
the standard setup without any memory loss or need for a changed
|
||||
configuration.</P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B><CODE>c64-hi.tgi</CODE></B><DD><P>This driver features a resolution of 320*200 with two colors and an
|
||||
adjustable palette (that means that the two colors can be chosen out of a
|
||||
palette of the 16 C64 colors).</P>
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.2">5.2</A> <A HREF="c64.html#toc5.2">Extended memory drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>c64-georam.emd</CODE></B><DD><P>A driver for the GeoRam cartridge. The driver will always assume 2048 pages
|
||||
of 256 bytes each. There are no checks, so if your program knows better,
|
||||
just go ahead.</P>
|
||||
|
||||
<DT><B><CODE>c64-ram.emd</CODE></B><DD><P>A driver for the hidden RAM below the I/O area and kernal ROM. Supports 48
|
||||
256 byte pages. Please note that this driver is incompatible with any of the
|
||||
graphics drivers!</P>
|
||||
|
||||
<DT><B><CODE>c64-ramcart.emd</CODE></B><DD><P>A driver for the RamCart 64/128 written and contributed by Maciej Witkowiak.
|
||||
Will test the hardware for the available RAM.</P>
|
||||
|
||||
<DT><B><CODE>c64-reu.emd</CODE></B><DD><P>A driver for the CBM REUs. The driver will determine from the connected REU
|
||||
if it supports 128KB of RAM or more. In the latter case, 256KB are assumed,
|
||||
but since there are no range checks, the application can use more memory if
|
||||
it has better knowledge about the hardware than the driver.</P>
|
||||
|
||||
<DT><B><CODE>c64-vdc.emd</CODE></B><DD><P>A driver for the VDC memory of the C128. Written and contributed by Maciej
|
||||
WitkowiakCan be used if the program is running in C64 mode of the C128.
|
||||
Autodetects the amount of memory available (16 or 64K) and offers 64 or 256
|
||||
pages of 256 bytes each.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.3">5.3</A> <A HREF="c64.html#toc5.3">Joystick drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>c64-hitjoy.joy</CODE></B><DD><P>Driver for the Digital Excess & Hitmen adapter contributed by Groepaz. See
|
||||
<A HREF="http://www.digitalexcess.de/downloads/productions.php">http://www.digitalexcess.de/downloads/productions.php</A> on
|
||||
instructions how to build one. Up to four joysticks are supported.</P>
|
||||
|
||||
<DT><B><CODE>c64-ptvjoy.joy</CODE></B><DD><P>Driver for the Protovision 4-player adapter contributed by Groepaz. See
|
||||
<A HREF="http://www.protovision-online.de/hardw/hardwstart.htm">http://www.protovision-online.de/hardw/hardwstart.htm</A> for prices and
|
||||
building instructions. Up to four joysticks are supported.</P>
|
||||
|
||||
<DT><B><CODE>c64-stdjoy.joy</CODE></B><DD><P>Supports up to two standard joysticks connected to the joysticks port of
|
||||
the C64.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.4">5.4</A> <A HREF="c64.html#toc5.4">Mouse drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Currently no drivers available (in fact, the API for loadable mouse drivers
|
||||
does not exist).</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.5">5.5</A> <A HREF="c64.html#toc5.5">RS232 device drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>c64-swlink.ser</CODE></B><DD><P>Driver for the SwiftLink cartridge. Supports up to 38400 baud, hardware flow
|
||||
control (RTS/CTS) and interrupt driven receives. Note that because of the
|
||||
peculiarities of the 6551 chip together with the use of the NMI, transmits
|
||||
are not interrupt driven, and the transceiver blocks if the receiver asserts
|
||||
flow control because of a full buffer.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c64-6.html">Next</A>
|
||||
<A HREF="c64-4.html">Previous</A>
|
||||
<A HREF="c64.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
26
usr/share/doc/cc65/webdoc/c64-6.html
Normal file
26
usr/share/doc/cc65/webdoc/c64-6.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 64 specific information for cc65: Limitations</TITLE>
|
||||
<LINK HREF="c64-7.html" REL=next>
|
||||
<LINK HREF="c64-5.html" REL=previous>
|
||||
<LINK HREF="c64.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c64-7.html">Next</A>
|
||||
<A HREF="c64-5.html">Previous</A>
|
||||
<A HREF="c64.html#toc6">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s6">6.</A> <A HREF="c64.html#toc6">Limitations</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c64-7.html">Next</A>
|
||||
<A HREF="c64-5.html">Previous</A>
|
||||
<A HREF="c64.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
71
usr/share/doc/cc65/webdoc/c64-7.html
Normal file
71
usr/share/doc/cc65/webdoc/c64-7.html
Normal file
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 64 specific information for cc65: Other hints</TITLE>
|
||||
<LINK HREF="c64-8.html" REL=next>
|
||||
<LINK HREF="c64-6.html" REL=previous>
|
||||
<LINK HREF="c64.html#toc7" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c64-8.html">Next</A>
|
||||
<A HREF="c64-6.html">Previous</A>
|
||||
<A HREF="c64.html#toc7">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s7">7.</A> <A HREF="c64.html#toc7">Other hints</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss7.1">7.1</A> <A HREF="c64.html#toc7.1">Passing arguments to the program</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Command line arguments can be passed to <CODE>main()</CODE>. Since this is not
|
||||
supported by BASIC, the following syntax was chosen:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>Arguments are separated by spaces.</LI>
|
||||
<LI>Arguments may be quoted.</LI>
|
||||
<LI>Leading and trailing spaces around an argument are ignored. Spaces within
|
||||
a quoted argument are allowed.</LI>
|
||||
<LI>The first argument passed to <CODE>main</CODE> is the program name.</LI>
|
||||
<LI>A maximum number of 10 arguments (including the program name) are
|
||||
supported.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss7.2">7.2</A> <A HREF="c64.html#toc7.2">Program return code</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The program return code (low byte) is passed back to BASIC by use of the
|
||||
<CODE>ST</CODE> variable.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss7.3">7.3</A> <A HREF="c64.html#toc7.3">Interrupts</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The runtime for the C64 uses routines marked as <CODE>.CONDES</CODE> type 2 for
|
||||
interrupt handlers. Such routines must be written as simple machine language
|
||||
subroutines and will be called automatically by the interrupt handler code
|
||||
when they are linked into a program. See the discussion of the <CODE>.CONDES</CODE>
|
||||
feature in the
|
||||
<A HREF="ca65.html">assembler manual</A>.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c64-8.html">Next</A>
|
||||
<A HREF="c64-6.html">Previous</A>
|
||||
<A HREF="c64.html#toc7">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/c64-8.html
Normal file
30
usr/share/doc/cc65/webdoc/c64-8.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 64 specific information for cc65: Bugs/Feedback</TITLE>
|
||||
<LINK HREF="c64-9.html" REL=next>
|
||||
<LINK HREF="c64-7.html" REL=previous>
|
||||
<LINK HREF="c64.html#toc8" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c64-9.html">Next</A>
|
||||
<A HREF="c64-7.html">Previous</A>
|
||||
<A HREF="c64.html#toc8">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s8">8.</A> <A HREF="c64.html#toc8">Bugs/Feedback</A></H2>
|
||||
|
||||
|
||||
<P>If you have problems using the library, if you find any bugs, or if you're
|
||||
doing something interesting with it, I would be glad to hear from you. Feel
|
||||
free to contact me by email (
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A>).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="c64-9.html">Next</A>
|
||||
<A HREF="c64-7.html">Previous</A>
|
||||
<A HREF="c64.html#toc8">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
41
usr/share/doc/cc65/webdoc/c64-9.html
Normal file
41
usr/share/doc/cc65/webdoc/c64-9.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 64 specific information for cc65: License</TITLE>
|
||||
<LINK HREF="c64-8.html" REL=previous>
|
||||
<LINK HREF="c64.html#toc9" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="c64-8.html">Previous</A>
|
||||
<A HREF="c64.html#toc9">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s9">9.</A> <A HREF="c64.html#toc9">License</A></H2>
|
||||
|
||||
|
||||
<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.</P>
|
||||
<P>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:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI> 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.</LI>
|
||||
<LI> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.</LI>
|
||||
<LI> This notice may not be removed or altered from any source
|
||||
distribution.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="c64-8.html">Previous</A>
|
||||
<A HREF="c64.html#toc9">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
72
usr/share/doc/cc65/webdoc/c64.html
Normal file
72
usr/share/doc/cc65/webdoc/c64.html
Normal file
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 64 specific information for cc65</TITLE>
|
||||
<LINK HREF="c64-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="c64-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>Commodore 64 specific information for cc65</H1>
|
||||
|
||||
<H2>Ullrich von Bassewitz,
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A></H2>2003-09-23
|
||||
<HR>
|
||||
<EM>An overview over the C64 runtime system as it is implemented for the cc65 C
|
||||
compiler.</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="c64-1.html">Overview</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="c64-2.html">Binary format</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="c64-3.html">Memory layout</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="c64-4.html">Platform specific header files</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc4.1">4.1</A> <A HREF="c64-4.html#ss4.1">C64 specific functions</A>
|
||||
<LI><A NAME="toc4.2">4.2</A> <A HREF="c64-4.html#ss4.2">CBM specific functions</A>
|
||||
<LI><A NAME="toc4.3">4.3</A> <A HREF="c64-4.html#ss4.3">Hardware access</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="c64-5.html">Loadable drivers</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc5.1">5.1</A> <A HREF="c64-5.html#ss5.1">Graphics drivers</A>
|
||||
<LI><A NAME="toc5.2">5.2</A> <A HREF="c64-5.html#ss5.2">Extended memory drivers</A>
|
||||
<LI><A NAME="toc5.3">5.3</A> <A HREF="c64-5.html#ss5.3">Joystick drivers</A>
|
||||
<LI><A NAME="toc5.4">5.4</A> <A HREF="c64-5.html#ss5.4">Mouse drivers</A>
|
||||
<LI><A NAME="toc5.5">5.5</A> <A HREF="c64-5.html#ss5.5">RS232 device drivers</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="c64-6.html">Limitations</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc7">7.</A> <A HREF="c64-7.html">Other hints</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc7.1">7.1</A> <A HREF="c64-7.html#ss7.1">Passing arguments to the program</A>
|
||||
<LI><A NAME="toc7.2">7.2</A> <A HREF="c64-7.html#ss7.2">Program return code</A>
|
||||
<LI><A NAME="toc7.3">7.3</A> <A HREF="c64-7.html#ss7.3">Interrupts</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc8">8.</A> <A HREF="c64-8.html">Bugs/Feedback</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc9">9.</A> <A HREF="c64-9.html">License</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="c64-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
85
usr/share/doc/cc65/webdoc/ca65-1.html
Normal file
85
usr/share/doc/cc65/webdoc/ca65-1.html
Normal file
|
@ -0,0 +1,85 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Overview</TITLE>
|
||||
<LINK HREF="ca65-2.html" REL=next>
|
||||
|
||||
<LINK HREF="ca65.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="ca65.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1.</A> <A HREF="ca65.html#toc1">Overview</A></H2>
|
||||
|
||||
|
||||
<P>ca65 is a replacement for the ra65 assembler that was part of the cc65 C
|
||||
compiler, originally developed by John R. Dunning. I had some problems with
|
||||
ra65 and the copyright does not permit some things which I wanted to be
|
||||
possible, so I decided to write a completely new assembler/linker/archiver
|
||||
suite for the cc65 compiler. ca65 is part of this suite.</P>
|
||||
<P>Some parts of the assembler (code generation and some routines for symbol
|
||||
table handling) are taken from an older crossassembler named a816 written
|
||||
by me a long time ago.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss1.1">1.1</A> <A HREF="ca65.html#toc1.1">Design criteria</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Here's a list of the design criteria, that I considered important for the
|
||||
development:</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI> The assembler must support macros. Macros are not essential, but they
|
||||
make some things easier, especially when you use the assembler in the
|
||||
backend of a compiler.</LI>
|
||||
<LI> The assembler must support the newer 65C02 and 65816 CPUs. I have been
|
||||
thinking about a 65816 backend for the C compiler, and even my old
|
||||
a816 assembler had support for these CPUs, so this wasn't really a
|
||||
problem.</LI>
|
||||
<LI> The assembler must produce relocatable code. This is necessary for the
|
||||
compiler support, and it is more convenient.</LI>
|
||||
<LI> Conditional assembly must be supported. This is a must for bigger
|
||||
projects written in assembler (like Elite128).</LI>
|
||||
<LI> The assembler must support segments, and it must support more than
|
||||
three segments (this is the count, most other assemblers support).
|
||||
Having more than one code segments helps developing code for systems
|
||||
with a divided ROM area (like the C64).</LI>
|
||||
<LI> The linker must be able to resolve arbitrary expressions. It should
|
||||
be able to get things like
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.import S1, S2
|
||||
.export Special
|
||||
Special = 2*S1 + S2/7
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
|
||||
right.</LI>
|
||||
<LI> True lexical nesting for symbols. This is very convenient for larger
|
||||
assembly projects.</LI>
|
||||
<LI> "Cheap" local symbols without lexical nesting for those quick, late
|
||||
night hacks.</LI>
|
||||
<LI> I liked the idea of "options" as Anre Fachats .o65 format has it, so I
|
||||
introduced the concept into the object file format use by the new cc65
|
||||
binutils.</LI>
|
||||
<LI> The assembler will be a one pass assembler. There was no real need for
|
||||
this decision, but I've written several multipass assemblers, and it
|
||||
started to get boring. A one pass assembler needs much more elaborated
|
||||
data structures, and because of that it's much more fun:-)</LI>
|
||||
<LI> Non-GPLed code that may be used in any project without restrictions or
|
||||
fear of "GPL infecting" other code.</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="ca65.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
1996
usr/share/doc/cc65/webdoc/ca65-10.html
Normal file
1996
usr/share/doc/cc65/webdoc/ca65-10.html
Normal file
File diff suppressed because it is too large
Load Diff
489
usr/share/doc/cc65/webdoc/ca65-11.html
Normal file
489
usr/share/doc/cc65/webdoc/ca65-11.html
Normal file
|
@ -0,0 +1,489 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Macros</TITLE>
|
||||
<LINK HREF="ca65-12.html" REL=next>
|
||||
<LINK HREF="ca65-10.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc11" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-12.html">Next</A>
|
||||
<A HREF="ca65-10.html">Previous</A>
|
||||
<A HREF="ca65.html#toc11">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="macros"></A> <A NAME="s11">11.</A> <A HREF="ca65.html#toc11">Macros</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss11.1">11.1</A> <A HREF="ca65.html#toc11.1">Introduction</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Macros may be thought of as "parametrized super instructions". Macros are
|
||||
sequences of tokens that have a name. If that name is used in the source
|
||||
file, the macro is "expanded", that is, it is replaced by the tokens that
|
||||
were specified when the macro was defined.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss11.2">11.2</A> <A HREF="ca65.html#toc11.2">Macros without parameters</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>In it's simplest form, a macro does not have parameters. Here's an
|
||||
example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro asr ; Arithmetic shift right
|
||||
cmp #$80 ; Put bit 7 into carry
|
||||
ror ; Rotate right with carry
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>The macro above consists of two real instructions, that are inserted into
|
||||
the code, whenever the macro is expanded. Macro expansion is simply done
|
||||
by using the name, like this:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
lda $2010
|
||||
asr
|
||||
sta $2010
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss11.3">11.3</A> <A HREF="ca65.html#toc11.3">Parametrized macros</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>When using macro parameters, macros can be even more useful:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro inc16 addr
|
||||
clc
|
||||
lda addr
|
||||
adc #$01
|
||||
sta addr
|
||||
lda addr+1
|
||||
adc #$00
|
||||
sta addr+1
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>When calling the macro, you may give a parameter, and each occurrence of
|
||||
the name "addr" in the macro definition will be replaced by the given
|
||||
parameter. So</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
inc16 $1000
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>will be expanded to</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
clc
|
||||
lda $1000
|
||||
adc #$01
|
||||
sta $1000
|
||||
lda $1000+1
|
||||
adc #$00
|
||||
sta $1000+1
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>A macro may have more than one parameter, in this case, the parameters
|
||||
are separated by commas. You are free to give less parameters than the
|
||||
macro actually takes in the definition. You may also leave intermediate
|
||||
parameters empty. Empty parameters are replaced by empty space (that is,
|
||||
they are removed when the macro is expanded). If you have a look at our
|
||||
macro definition above, you will see, that replacing the "addr" parameter
|
||||
by nothing will lead to wrong code in most lines. To help you, writing
|
||||
macros with a variable parameter list, there are some control commands:</P>
|
||||
<P><CODE>
|
||||
<A HREF="ca65-10.html#.IFBLANK">.IFBLANK</A></CODE> tests the rest of the line and
|
||||
returns true, if there are any tokens on the remainder of the line. Since
|
||||
empty parameters are replaced by nothing, this may be used to test if a given
|
||||
parameter is empty. <CODE>
|
||||
<A HREF="ca65-10.html#.IFNBLANK">.IFNBLANK</A></CODE> tests the
|
||||
opposite.</P>
|
||||
<P>Look at this example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro ldaxy a, x, y
|
||||
.ifnblank a
|
||||
lda #a
|
||||
.endif
|
||||
.ifnblank x
|
||||
ldx #x
|
||||
.endif
|
||||
.ifnblank y
|
||||
ldy #y
|
||||
.endif
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>This macro may be called as follows:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
ldaxy 1, 2, 3 ; Load all three registers
|
||||
|
||||
ldaxy 1, , 3 ; Load only a and y
|
||||
|
||||
ldaxy , , 3 ; Load y only
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>There's another helper command for determining, which macro parameters are
|
||||
valid: <CODE>
|
||||
<A HREF="ca65-8.html#.PARAMCOUNT">.PARAMCOUNT</A></CODE> This command is
|
||||
replaced by the parameter count given, <EM>including</EM> intermediate empty macro
|
||||
parameters:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
ldaxy 1 ; .PARAMCOUNT = 1
|
||||
ldaxy 1,,3 ; .PARAMCOUNT = 3
|
||||
ldaxy 1,2 ; .PARAMCOUNT = 2
|
||||
ldaxy 1, ; .PARAMCOUNT = 2
|
||||
ldaxy 1,2,3 ; .PARAMCOUNT = 3
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Macro parameters may optionally be enclosed into curly braces. This allows the
|
||||
inclusion of tokens that would otherwise terminate the parameter (the comma in
|
||||
case of a macro parameter).</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro foo arg1, arg2
|
||||
...
|
||||
.endmacro
|
||||
|
||||
foo ($00,x) ; Two parameters passed
|
||||
foo {($00,x)} ; One parameter passed
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>In the first case, the macro is called with two parameters: '<CODE>($00</CODE>'
|
||||
and 'x)'. The comma is not passed to the macro, since it is part of the
|
||||
calling sequence, not the parameters.</P>
|
||||
<P>In the second case, '($00,x)' is passed to the macro, this time
|
||||
including the comma.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss11.4">11.4</A> <A HREF="ca65.html#toc11.4">Detecting parameter types</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Sometimes it is nice to write a macro that acts differently depending on the
|
||||
type of the argument supplied. An example would be a macro that loads a 16 bit
|
||||
value from either an immediate operand, or from memory. The <CODE>
|
||||
<A HREF="ca65-9.html#.MATCH">.MATCH</A></CODE> and <CODE>
|
||||
<A HREF="ca65-9.html#.XMATCH">.XMATCH</A></CODE>
|
||||
functions will allow you to do exactly this:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro ldax arg
|
||||
.if (.match (.left (1, {arg}), #))
|
||||
; immediate mode
|
||||
lda #<(.right (.tcount ({arg})-1, {arg}))
|
||||
ldx #>(.right (.tcount ({arg})-1, {arg}))
|
||||
.else
|
||||
; assume absolute or zero page
|
||||
lda arg
|
||||
ldx 1+(arg)
|
||||
.endif
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Using the <CODE>
|
||||
<A HREF="ca65-9.html#.MATCH">.MATCH</A></CODE> function, the macro is able to
|
||||
check if its argument begins with a hash mark. If so, two immediate loads are
|
||||
emitted, Otherwise a load from an absolute zero page memory location is
|
||||
assumed. Please note how the curly braces are used to enclose parameters to
|
||||
pseudo functions handling token lists. This is necessary, because the token
|
||||
lists may include commas or parens, which would be treated by the assembler
|
||||
as end-of-list.</P>
|
||||
<P>The macro can be used as</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
foo: .word $5678
|
||||
...
|
||||
ldax #$1234 ; X=$12, A=$34
|
||||
...
|
||||
ldax foo ; X=$56, A=$78
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss11.5">11.5</A> <A HREF="ca65.html#toc11.5">Recursive macros</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Macros may be used recursively:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro push r1, r2, r3
|
||||
lda r1
|
||||
pha
|
||||
.if .paramcount > 1
|
||||
push r2, r3
|
||||
.endif
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>There's also a special macro to help writing recursive macros: <CODE>
|
||||
<A HREF="ca65-10.html#.EXITMACRO">.EXITMACRO</A></CODE> This command will stop macro expansion
|
||||
immediately:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro push r1, r2, r3, r4, r5, r6, r7
|
||||
.ifblank r1
|
||||
; First parameter is empty
|
||||
.exitmacro
|
||||
.else
|
||||
lda r1
|
||||
pha
|
||||
.endif
|
||||
push r2, r3, r4, r5, r6, r7
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>When expanding this macro, the expansion will push all given parameters
|
||||
until an empty one is encountered. The macro may be called like this:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
push $20, $21, $32 ; Push 3 ZP locations
|
||||
push $21 ; Push one ZP location
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss11.6">11.6</A> <A HREF="ca65.html#toc11.6">Local symbols inside macros</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Now, with recursive macros, <CODE>
|
||||
<A HREF="ca65-10.html#.IFBLANK">.IFBLANK</A></CODE> and
|
||||
<CODE>
|
||||
<A HREF="ca65-8.html#.PARAMCOUNT">.PARAMCOUNT</A></CODE>, what else do you need?
|
||||
Have a look at the inc16 macro above. Here is it again:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro inc16 addr
|
||||
clc
|
||||
lda addr
|
||||
adc #$01
|
||||
sta addr
|
||||
lda addr+1
|
||||
adc #$00
|
||||
sta addr+1
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>If you have a closer look at the code, you will notice, that it could be
|
||||
written more efficiently, like this:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro inc16 addr
|
||||
inc addr
|
||||
bne Skip
|
||||
inc addr+1
|
||||
Skip:
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>But imagine what happens, if you use this macro twice? Since the label
|
||||
"Skip" has the same name both times, you get a "duplicate symbol" error.
|
||||
Without a way to circumvent this problem, macros are not as useful, as
|
||||
they could be. One solution is, to start a new lexical block inside the
|
||||
macro:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro inc16 addr
|
||||
.proc
|
||||
inc addr
|
||||
bne Skip
|
||||
inc addr+1
|
||||
Skip:
|
||||
.endproc
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Now the label is local to the block and not visible outside. However,
|
||||
sometimes you want a label inside the macro to be visible outside. To make
|
||||
that possible, there's a new command that's only usable inside a macro
|
||||
definition: <CODE>
|
||||
<A HREF="ca65-10.html#.LOCAL">.LOCAL</A></CODE>. <CODE>.LOCAL</CODE> declares one
|
||||
or more symbols as local to the macro expansion. The names of local variables
|
||||
are replaced by a unique name in each separate macro expansion. So we could
|
||||
also solve the problem above by using <CODE>.LOCAL</CODE>:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro inc16 addr
|
||||
.local Skip ; Make Skip a local symbol
|
||||
clc
|
||||
lda addr
|
||||
adc #$01
|
||||
sta addr
|
||||
bcc Skip
|
||||
inc addr+1
|
||||
Skip: ; Not visible outside
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss11.7">11.7</A> <A HREF="ca65.html#toc11.7">C style macros</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Starting with version 2.5 of the assembler, there is a second macro type
|
||||
available: C style macros using the <CODE>.DEFINE</CODE> directive. These macros are
|
||||
similar to the classic macro type described above, but behaviour is sometimes
|
||||
different:</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI> Macros defined with <CODE>
|
||||
<A HREF="ca65-10.html#.DEFINE">.DEFINE</A></CODE> may not
|
||||
span more than a line. You may use line continuation (see <CODE>
|
||||
<A HREF="ca65-10.html#.LINECONT">.LINECONT</A></CODE>) to spread the definition over
|
||||
more than one line for increased readability, but the macro itself
|
||||
may not contain an end-of-line token.
|
||||
</LI>
|
||||
<LI> Macros defined with <CODE>
|
||||
<A HREF="ca65-10.html#.DEFINE">.DEFINE</A></CODE> share
|
||||
the name space with classic macros, but they are detected and replaced
|
||||
at the scanner level. While classic macros may be used in every place,
|
||||
where a mnemonic or other directive is allowed, <CODE>
|
||||
<A HREF="ca65-10.html#.DEFINE">.DEFINE</A></CODE> style macros are allowed anywhere in a line. So
|
||||
they are more versatile in some situations.
|
||||
</LI>
|
||||
<LI> <CODE>
|
||||
<A HREF="ca65-10.html#.DEFINE">.DEFINE</A></CODE> style macros may take
|
||||
parameters. While classic macros may have empty parameters, this is
|
||||
not true for <CODE>
|
||||
<A HREF="ca65-10.html#.DEFINE">.DEFINE</A></CODE> style macros.
|
||||
For this macro type, the number of actual parameters must match
|
||||
exactly the number of formal parameters.
|
||||
|
||||
To make this possible, formal parameters are enclosed in braces when
|
||||
defining the macro. If there are no parameters, the empty braces may
|
||||
be omitted.
|
||||
</LI>
|
||||
<LI> Since <CODE>
|
||||
<A HREF="ca65-10.html#.DEFINE">.DEFINE</A></CODE> style macros may not
|
||||
contain end-of-line tokens, there are things that cannot be done. They
|
||||
may not contain several processor instructions for example. So, while
|
||||
some things may be done with both macro types, each type has special
|
||||
usages. The types complement each other.
|
||||
</LI>
|
||||
</UL>
|
||||
</P>
|
||||
<P>Let's look at a few examples to make the advantages and disadvantages
|
||||
clear.</P>
|
||||
<P>To emulate assemblers that use "<CODE>EQU</CODE>" instead of "<CODE>=</CODE>" you may use the
|
||||
following <CODE>.DEFINE</CODE>:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.define EQU =
|
||||
|
||||
foo EQU $1234 ; This is accepted now
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>You may use the directive to define string constants used elsewhere:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
; Define the version number
|
||||
.define VERSION "12.3a"
|
||||
|
||||
; ... and use it
|
||||
.asciiz VERSION
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Macros with parameters may also be useful:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.define DEBUG(message) .out message
|
||||
|
||||
DEBUG "Assembling include file #3"
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Note that, while formal parameters have to be placed in braces, this is
|
||||
not true for the actual parameters. Beware: Since the assembler cannot
|
||||
detect the end of one parameter, only the first token is used. If you
|
||||
don't like that, use classic macros instead:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro message
|
||||
.out message
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>(This is an example where a problem can be solved with both macro types).</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss11.8">11.8</A> <A HREF="ca65.html#toc11.8">Characters in macros</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>When using the
|
||||
<A HREF="ca65-2.html#option-t">-t</A> option, characters are translated
|
||||
into the target character set of the specific machine. However, this happens
|
||||
as late as possible. This means that strings are translated if they are part
|
||||
of a <CODE>
|
||||
<A HREF="ca65-10.html#.BYTE">.BYTE</A></CODE> or <CODE>
|
||||
<A HREF="ca65-10.html#.ASCIIZ">.ASCIIZ</A></CODE> command. Characters are translated as soon as they are
|
||||
used as part of an expression.</P>
|
||||
<P>This behaviour is very intuitive outside of macros but may be confusing when
|
||||
doing more complex macros. If you compare characters against numeric values,
|
||||
be sure to take the translation into account.</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-12.html">Next</A>
|
||||
<A HREF="ca65-10.html">Previous</A>
|
||||
<A HREF="ca65.html#toc11">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
168
usr/share/doc/cc65/webdoc/ca65-12.html
Normal file
168
usr/share/doc/cc65/webdoc/ca65-12.html
Normal file
|
@ -0,0 +1,168 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Macro packages</TITLE>
|
||||
<LINK HREF="ca65-13.html" REL=next>
|
||||
<LINK HREF="ca65-11.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc12" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-13.html">Next</A>
|
||||
<A HREF="ca65-11.html">Previous</A>
|
||||
<A HREF="ca65.html#toc12">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="macropackages"></A> <A NAME="s12">12.</A> <A HREF="ca65.html#toc12">Macro packages</A></H2>
|
||||
|
||||
|
||||
<P>Using the <CODE>
|
||||
<A HREF="ca65-10.html#.MACPACK">.MACPACK</A></CODE> directive, predefined
|
||||
macro packages may be included with just one command. Available macro packages
|
||||
are:</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss12.1">12.1</A> <A HREF="ca65.html#toc12.1"><CODE>.MACPACK generic</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>This macro package defines macros that are useful in almost any program.
|
||||
Currently, two macros are defined:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro add Arg
|
||||
clc
|
||||
adc Arg
|
||||
.endmacro
|
||||
|
||||
.macro sub Arg
|
||||
sec
|
||||
sbc Arg
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss12.2">12.2</A> <A HREF="ca65.html#toc12.2"><CODE>.MACPACK longbranch</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>This macro package defines long conditional jumps. They are named like the
|
||||
short counterpart but with the 'b' replaced by a 'j'. Here is a sample
|
||||
definition for the "<CODE>jeq</CODE>" macro, the other macros are built using the same
|
||||
scheme:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro jeq Target
|
||||
.if .def(Target) .and ((*+2)-(Target) <= 127)
|
||||
beq Target
|
||||
.else
|
||||
bne *+5
|
||||
jmp Target
|
||||
.endif
|
||||
.endmacro
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>All macros expand to a short branch, if the label is already defined (back
|
||||
jump) and is reachable with a short jump. Otherwise the macro expands to a
|
||||
conditional branch with the branch condition inverted, followed by an absolute
|
||||
jump to the actual branch target.</P>
|
||||
<P>The package defines the following macros:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
jeq, jne, jmi, jpl, jcs, jcc, jvs, jvc
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss12.3">12.3</A> <A HREF="ca65.html#toc12.3"><CODE>.MACPACK cbm</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The cbm macro package will define a macro named <CODE>scrcode</CODE>. It takes a
|
||||
string as argument and places this string into memory translated into screen
|
||||
codes.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss12.4">12.4</A> <A HREF="ca65.html#toc12.4"><CODE>.MACPACK cpu</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>This macro package does not define any macros but constants used to examine
|
||||
the value read from the <CODE>
|
||||
<A HREF="ca65-8.html#.CPU">.CPU</A></CODE> pseudo variable. For
|
||||
each supported CPU a constant similar to</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
CPU_6502
|
||||
CPU_65SC02
|
||||
CPU_65C02
|
||||
CPU_65816
|
||||
CPU_SUNPLUS
|
||||
CPU_SWEET16
|
||||
CPU_HUC6280
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>is defined. These constants may be used to determine the exact type of the
|
||||
currently enabled CPU. In addition to that, for each CPU instruction set,
|
||||
another constant is defined:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
CPU_ISET_6502
|
||||
CPU_ISET_65SC02
|
||||
CPU_ISET_65C02
|
||||
CPU_ISET_65816
|
||||
CPU_ISET_SUNPLUS
|
||||
CPU_ISET_SWEET16
|
||||
CPU_ISET_HUC6280
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>The value read from the <CODE>
|
||||
<A HREF="ca65-8.html#.CPU">.CPU</A></CODE> pseudo variable may
|
||||
be checked with <CODE>
|
||||
<A HREF="ca65-4.html#operators">.BITAND</A></CODE> to determine if the
|
||||
currently enabled CPU supports a specific instruction set. For example the
|
||||
65C02 supports all instructions of the 65SC02 CPU, so it has the
|
||||
<CODE>CPU_ISET_65SC02</CODE> bit set in addition to its native <CODE>CPU_ISET_65C02</CODE>
|
||||
bit. Using</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
lda (sp)
|
||||
.else
|
||||
ldy #$00
|
||||
lda (sp),y
|
||||
.endif
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>it is possible to determine if the</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
lda (sp)
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>instruction is supported, which is the case for the 65SC02, 65C02 and 65816
|
||||
CPUs (the latter two are upwards compatible to the 65SC02).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-13.html">Next</A>
|
||||
<A HREF="ca65-11.html">Previous</A>
|
||||
<A HREF="ca65.html#toc12">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
50
usr/share/doc/cc65/webdoc/ca65-13.html
Normal file
50
usr/share/doc/cc65/webdoc/ca65-13.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Predefined constants</TITLE>
|
||||
<LINK HREF="ca65-14.html" REL=next>
|
||||
<LINK HREF="ca65-12.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc13" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-14.html">Next</A>
|
||||
<A HREF="ca65-12.html">Previous</A>
|
||||
<A HREF="ca65.html#toc13">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="predefined-constants"></A> <A NAME="s13">13.</A> <A HREF="ca65.html#toc13">Predefined constants</A></H2>
|
||||
|
||||
|
||||
<P>For better orthogonality, the assembler defines similar symbols as the
|
||||
compiler, depending on the target system selected:</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI><CODE>__ACE__</CODE> - Target system is <CODE>ace</CODE></LI>
|
||||
<LI><CODE>__APPLE2__",</CODE> - Target system is <CODE>apple2</CODE></LI>
|
||||
<LI><CODE>__APPLE2ENH__",</CODE> - Target system is <CODE>apple2enh</CODE></LI>
|
||||
<LI><CODE>__ATARI__</CODE> - Target system is <CODE>atari</CODE></LI>
|
||||
<LI><CODE>__ATMOS__",</CODE> - Target system is <CODE>atmos</CODE></LI>
|
||||
<LI><CODE>__BBC__",</CODE> - Target system is <CODE>bbc</CODE></LI>
|
||||
<LI><CODE>__C128__</CODE> - Target system is <CODE>c128</CODE></LI>
|
||||
<LI><CODE>__C16__</CODE> - Target system is <CODE>c16</CODE></LI>
|
||||
<LI><CODE>__C64__</CODE> - Target system is <CODE>c64</CODE></LI>
|
||||
<LI><CODE>__CBM__</CODE> - Target is a Commodore system</LI>
|
||||
<LI><CODE>__CBM510__</CODE> - Target system is <CODE>cbm510</CODE></LI>
|
||||
<LI><CODE>__CBM610__</CODE> - Target system is <CODE>cbm610</CODE></LI>
|
||||
<LI><CODE>__GEOS__",</CODE> - Target system is <CODE>geos</CODE></LI>
|
||||
<LI><CODE>__LUNIX__",</CODE> - Target system is <CODE>lunix</CODE></LI>
|
||||
<LI><CODE>__NES__",</CODE> - Target system is <CODE>nes</CODE></LI>
|
||||
<LI><CODE>__PET__</CODE> - Target system is <CODE>pet</CODE></LI>
|
||||
<LI><CODE>__PLUS4__</CODE> - Target system is <CODE>plus4</CODE></LI>
|
||||
<LI><CODE>__SUPERVISION__",</CODE> - Target system is <CODE>supervision</CODE></LI>
|
||||
<LI><CODE>__VIC20__</CODE> - Target system is <CODE>vic20</CODE></LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-14.html">Next</A>
|
||||
<A HREF="ca65-12.html">Previous</A>
|
||||
<A HREF="ca65.html#toc13">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
133
usr/share/doc/cc65/webdoc/ca65-14.html
Normal file
133
usr/share/doc/cc65/webdoc/ca65-14.html
Normal file
|
@ -0,0 +1,133 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Structs and unions</TITLE>
|
||||
<LINK HREF="ca65-15.html" REL=next>
|
||||
<LINK HREF="ca65-13.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc14" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-15.html">Next</A>
|
||||
<A HREF="ca65-13.html">Previous</A>
|
||||
<A HREF="ca65.html#toc14">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="structs"></A> <A NAME="s14">14.</A> <A HREF="ca65.html#toc14">Structs and unions</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss14.1">14.1</A> <A HREF="ca65.html#toc14.1">Overview</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Structs and unions are special forms of
|
||||
<A HREF="ca65-6.html#scopes">scopes</A>. They
|
||||
are to some degree comparable to their C counterparts. Both have a list of
|
||||
members. Each member allocates storage and may optionally have a name, which,
|
||||
in case of a struct, is the offset from the beginning and, in case of a union,
|
||||
is always zero.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss14.2">14.2</A> <A HREF="ca65.html#toc14.2">Declaration</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Here is an example for a very simple struct with two members and a total size
|
||||
of 4 bytes:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.struct Point
|
||||
xcoord .word
|
||||
ycoord .word
|
||||
.endstruct
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>A union shares the total space between all its members, its size is the same
|
||||
as that of the largest member.</P>
|
||||
<P>A struct or union must not necessarily have a name. If it is anonymous, no
|
||||
local scope is opened, the identifiers used to name the members are placed
|
||||
into the current scope instead.</P>
|
||||
<P>A struct may contain unnamed members and definitions of local structs. The
|
||||
storage allocators may contain a multiplier, as in the example below:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.struct Circle
|
||||
.struct Point
|
||||
.word 2 ; Allocate two words
|
||||
.endstruct
|
||||
Radius .word
|
||||
.endstruct
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss14.3">14.3</A> <A HREF="ca65.html#toc14.3">The <CODE>.TAG</CODE> keyword</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Using the
|
||||
<A HREF="ca65-10.html#.TAG">.TAG</A> keyword, it is possible to reserve space
|
||||
for an already defined struct or unions within another struct:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.struct Point
|
||||
xcoord .word
|
||||
ycoord .word
|
||||
.endstruct
|
||||
|
||||
.struct Circle
|
||||
Origin .tag Point
|
||||
Radius .byte
|
||||
.endstruct
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Space for a struct or union may be allocated using the
|
||||
<A HREF="ca65-10.html#.TAG">.TAG</A> directive.</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
C: .tag Circle
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Currently, members are just offsets from the start of the struct or union. To
|
||||
access a field of a struct, the member offset has to be added to the address
|
||||
of the struct itself:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
lda C+Circle::Radius ; Load circle radius into A
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>This may change in a future version of the assembler.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss14.4">14.4</A> <A HREF="ca65.html#toc14.4">Limitations</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Structs and unions are currently implemented as nested symbol tables (in fact,
|
||||
they were a by-product of the improved scoping rules). Currently, the
|
||||
assembler has no idea of types. This means that the
|
||||
<A HREF="ca65-10.html#.TAG">.TAG</A> keyword will only allocate space. You won't be able to initialize
|
||||
variables declared with
|
||||
<A HREF="ca65-10.html#.TAG">.TAG</A>, and adding an embedded
|
||||
structure to another structure with
|
||||
<A HREF="ca65-10.html#.TAG">.TAG</A> will not make
|
||||
this structure accessible by using the '::' operator.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-15.html">Next</A>
|
||||
<A HREF="ca65-13.html">Previous</A>
|
||||
<A HREF="ca65.html#toc14">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
129
usr/share/doc/cc65/webdoc/ca65-15.html
Normal file
129
usr/share/doc/cc65/webdoc/ca65-15.html
Normal file
|
@ -0,0 +1,129 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Module constructors/destructors</TITLE>
|
||||
<LINK HREF="ca65-16.html" REL=next>
|
||||
<LINK HREF="ca65-14.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc15" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-16.html">Next</A>
|
||||
<A HREF="ca65-14.html">Previous</A>
|
||||
<A HREF="ca65.html#toc15">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="condes"></A> <A NAME="s15">15.</A> <A HREF="ca65.html#toc15">Module constructors/destructors</A></H2>
|
||||
|
||||
|
||||
<P><EM>Note:</EM> This section applies mostly to C programs, so the explanation
|
||||
below uses examples from the C libraries. However, the feature may also be
|
||||
useful for assembler programs.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss15.1">15.1</A> <A HREF="ca65.html#toc15.1">Overview</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Using the <CODE>
|
||||
<A HREF="ca65-10.html#.CONSTRUCTOR">.CONSTRUCTOR</A></CODE>, <CODE>
|
||||
<A HREF="ca65-10.html#.DESTRUCTOR">.DESTRUCTOR</A></CODE> and <CODE>
|
||||
<A HREF="ca65-10.html#.INTERRUPTOR">.INTERRUPTOR</A></CODE> keywords it it possible to export functions in a
|
||||
special way. The linker is able to generate tables with all functions of a
|
||||
specific type. Such a table will <EM>only</EM> include symbols from object
|
||||
files that are linked into a specific executable. This may be used to add
|
||||
initialization and cleanup code for library modules, or a table of interrupt
|
||||
handler functions.</P>
|
||||
<P>The C heap functions are an example where module initialization code is used.
|
||||
All heap functions (<CODE>malloc</CODE>, <CODE>free</CODE>, ...) work with a few
|
||||
variables that contain the start and the end of the heap, pointers to the free
|
||||
list and so on. Since the end of the heap depends on the size and start of the
|
||||
stack, it must be initialized at runtime. However, initializing these
|
||||
variables for programs that do not use the heap are a waste of time and
|
||||
memory.</P>
|
||||
<P>So the central module defines a function that contains initialization code and
|
||||
exports this function using the <CODE>.CONSTRUCTOR</CODE> statement. If (and only if)
|
||||
this module is added to an executable by the linker, the initialization
|
||||
function will be placed into the table of constructors by the linker. The C
|
||||
startup code will call all constructors before <CODE>main</CODE> and all destructors
|
||||
after <CODE>main</CODE>, so without any further work, the heap initialization code is
|
||||
called once the module is linked in.</P>
|
||||
<P>While it would be possible to add explicit calls to initialization functions
|
||||
in the startup code, the new approach has several advantages:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>If a module is not included, the initialization code is not linked in and not
|
||||
called. So you don't pay for things you don't need.
|
||||
</LI>
|
||||
<LI>Adding another library that needs initialization does not mean that the
|
||||
startup code has to be changed. Before we had module constructors and
|
||||
destructors, the startup code for all systems had to be adjusted to call the
|
||||
new initialization code.
|
||||
</LI>
|
||||
<LI>The feature saves memory: Each additional initialization function needs just
|
||||
two bytes in the table (a pointer to the function).
|
||||
</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss15.2">15.2</A> <A HREF="ca65.html#toc15.2">Calling order</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The symbols are sorted in increasing priority order by the linker when using
|
||||
one of the builtin linker configurations, so the functions with lower
|
||||
priorities come first and are followed by those with higher priorities. The C
|
||||
library runtime subroutine that walks over the function tables calls the
|
||||
functions starting from the top of the table - which means that functions with
|
||||
a high priority are called first.</P>
|
||||
<P>So when using the C runtime, functions are called with high priority functions
|
||||
first, followed by low priority functions.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss15.3">15.3</A> <A HREF="ca65.html#toc15.3">Pitfalls</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>When using these special symbols, please take care of the following:</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>The linker will only generate function tables, it will not generate code to
|
||||
call these functions. If you're using the feature in some other than the
|
||||
existing C environments, you have to write code to call all functions in a
|
||||
linker generated table yourself. See the <CODE>condes</CODE> and <CODE>callirq</CODE> modules
|
||||
in the C runtime for an example on how to do this.
|
||||
</LI>
|
||||
<LI>The linker will only add addresses of functions that are in modules linked to
|
||||
the executable. This means that you have to be careful where to place the
|
||||
condes functions. If initialization or an irq handler is needed for a group of
|
||||
functions, be sure to place the function into a module that is linked in
|
||||
regardless of which function is called by the user.
|
||||
</LI>
|
||||
<LI>The linker will generate the tables only when requested to do so by the
|
||||
<CODE>FEATURE CONDES</CODE> statement in the linker config file. Each table has to
|
||||
be requested separately.
|
||||
</LI>
|
||||
<LI>Constructors and destructors may have priorities. These priorities determine
|
||||
the order of the functions in the table. If your initialization or cleanup code
|
||||
does depend on other initialization or cleanup code, you have to choose the
|
||||
priority for the functions accordingly.
|
||||
</LI>
|
||||
<LI>Besides the <CODE>
|
||||
<A HREF="ca65-10.html#.CONSTRUCTOR">.CONSTRUCTOR</A></CODE>, <CODE>
|
||||
<A HREF="ca65-10.html#.DESTRUCTOR">.DESTRUCTOR</A></CODE> and <CODE>
|
||||
<A HREF="ca65-10.html#.INTERRUPTOR">.INTERRUPTOR</A></CODE> statements, there is also a more generic command:
|
||||
<CODE>
|
||||
<A HREF="ca65-10.html#.CONDES">.CONDES</A></CODE>. This allows to specify an
|
||||
additional type. Predefined types are 0 (constructor), 1 (destructor) and 2
|
||||
(interruptor). The linker generates a separate table for each type on request.
|
||||
</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-16.html">Next</A>
|
||||
<A HREF="ca65-14.html">Previous</A>
|
||||
<A HREF="ca65.html#toc15">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
122
usr/share/doc/cc65/webdoc/ca65-16.html
Normal file
122
usr/share/doc/cc65/webdoc/ca65-16.html
Normal file
|
@ -0,0 +1,122 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Porting sources from other assemblers</TITLE>
|
||||
<LINK HREF="ca65-17.html" REL=next>
|
||||
<LINK HREF="ca65-15.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc16" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-17.html">Next</A>
|
||||
<A HREF="ca65-15.html">Previous</A>
|
||||
<A HREF="ca65.html#toc16">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s16">16.</A> <A HREF="ca65.html#toc16">Porting sources from other assemblers</A></H2>
|
||||
|
||||
|
||||
<P>Sometimes it is necessary to port code written for older assemblers to ca65.
|
||||
In some cases, this can be done without any changes to the source code by
|
||||
using the emulation features of ca65 (see <CODE>
|
||||
<A HREF="ca65-10.html#.FEATURE">.FEATURE</A></CODE>). In other cases, it is necessary to make changes to the
|
||||
source code.</P>
|
||||
<P>Probably the biggest difference is the handling of the <CODE>
|
||||
<A HREF="ca65-10.html#.ORG">.ORG</A></CODE> directive. ca65 generates relocatable code, and placement is
|
||||
done by the linker. Most other assemblers generate absolute code, placement is
|
||||
done within the assembler and there is no external linker.</P>
|
||||
<P>In general it is not a good idea to write new code using the emulation
|
||||
features of the assembler, but there may be situations where even this rule is
|
||||
not valid.</P>
|
||||
|
||||
<H2><A NAME="ss16.1">16.1</A> <A HREF="ca65.html#toc16.1">TASS</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>You need to use some of the ca65 emulation features to simulate the behaviour
|
||||
of such simple assemblers.</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>Prepare your sourcecode like this:
|
||||
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
; if you want TASS style labels without colons
|
||||
.feature labels_without_colons
|
||||
|
||||
; if you want TASS style character constants
|
||||
; ("a" instead of the default 'a')
|
||||
.feature loose_char_term
|
||||
|
||||
.word *+2 ; the cbm load address
|
||||
|
||||
[yourcode here]
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
|
||||
|
||||
notice that the two emulation features are mostly useful for porting
|
||||
sources originally written in/for TASS, they are not needed for the
|
||||
actual "simple assembler operation" and are not recommended if you are
|
||||
writing new code from scratch.
|
||||
</LI>
|
||||
<LI>Replace all program counter assignments (which are not possible in ca65
|
||||
by default, and the respective emulation feature works different from what
|
||||
you'd expect) by another way to skip to memory locations, for example the
|
||||
<CODE>
|
||||
<A HREF="ca65-10.html#.RES">.RES</A></CODE> directive.
|
||||
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
; *=$2000
|
||||
.res $2000-* ; reserve memory up to $2000
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
|
||||
|
||||
Please note that other than the original TASS, ca65 can never move the program
|
||||
counter backwards - think of it as if you are assembling to disk with TASS.
|
||||
</LI>
|
||||
<LI>Conditional assembly (<CODE>.ifeq</CODE>/<CODE>.endif</CODE>/<CODE>.goto</CODE> etc.) must be
|
||||
rewritten to match ca65 syntax. Most importantly notice that due to the lack
|
||||
of <CODE>.goto</CODE>, everything involving loops must be replaced by
|
||||
<CODE>
|
||||
<A HREF="ca65-10.html#.REPEAT">.REPEAT</A></CODE>.
|
||||
</LI>
|
||||
<LI>To assemble code to a different address than it is executed at, use the
|
||||
<CODE>
|
||||
<A HREF="ca65-10.html#.ORG">.ORG</A></CODE> directive instead of
|
||||
<CODE>.offs</CODE>-constructs.
|
||||
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.org $1800
|
||||
|
||||
[floppy code here]
|
||||
|
||||
.reloc ; back to normal
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
|
||||
</LI>
|
||||
<LI>Then assemble like this:
|
||||
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
cl65 --start-addr 0x0ffe -t none myprog.s -o myprog.prg
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
|
||||
|
||||
Note that you need to use the actual start address minus two, since two bytes
|
||||
are used for the cbm load address.
|
||||
</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-17.html">Next</A>
|
||||
<A HREF="ca65-15.html">Previous</A>
|
||||
<A HREF="ca65.html#toc16">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
31
usr/share/doc/cc65/webdoc/ca65-17.html
Normal file
31
usr/share/doc/cc65/webdoc/ca65-17.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Bugs/Feedback</TITLE>
|
||||
<LINK HREF="ca65-18.html" REL=next>
|
||||
<LINK HREF="ca65-16.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc17" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-18.html">Next</A>
|
||||
<A HREF="ca65-16.html">Previous</A>
|
||||
<A HREF="ca65.html#toc17">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s17">17.</A> <A HREF="ca65.html#toc17">Bugs/Feedback</A></H2>
|
||||
|
||||
|
||||
<P>If you have problems using the assembler, if you find any bugs, or if
|
||||
you're doing something interesting with the assembler, I would be glad to
|
||||
hear from you. Feel free to contact me by email
|
||||
(
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A>).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-18.html">Next</A>
|
||||
<A HREF="ca65-16.html">Previous</A>
|
||||
<A HREF="ca65.html#toc17">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
46
usr/share/doc/cc65/webdoc/ca65-18.html
Normal file
46
usr/share/doc/cc65/webdoc/ca65-18.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Copyright</TITLE>
|
||||
<LINK HREF="ca65-17.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc18" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="ca65-17.html">Previous</A>
|
||||
<A HREF="ca65.html#toc18">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s18">18.</A> <A HREF="ca65.html#toc18">Copyright</A></H2>
|
||||
|
||||
|
||||
<P>ca65 (and all cc65 binutils) are (C) Copyright 1998-2003 Ullrich von
|
||||
Bassewitz. For usage of the binaries and/or sources the following
|
||||
conditions do apply:</P>
|
||||
<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.</P>
|
||||
<P>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:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI> 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.</LI>
|
||||
<LI> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.</LI>
|
||||
<LI> This notice may not be removed or altered from any source
|
||||
distribution.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="ca65-17.html">Previous</A>
|
||||
<A HREF="ca65.html#toc18">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
216
usr/share/doc/cc65/webdoc/ca65-2.html
Normal file
216
usr/share/doc/cc65/webdoc/ca65-2.html
Normal file
|
@ -0,0 +1,216 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Usage</TITLE>
|
||||
<LINK HREF="ca65-3.html" REL=next>
|
||||
<LINK HREF="ca65-1.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-3.html">Next</A>
|
||||
<A HREF="ca65-1.html">Previous</A>
|
||||
<A HREF="ca65.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2.</A> <A HREF="ca65.html#toc2">Usage</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss2.1">2.1</A> <A HREF="ca65.html#toc2.1">Command line option overview</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The assembler accepts the following options:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
---------------------------------------------------------------------------
|
||||
Usage: ca65 [options] file
|
||||
Short options:
|
||||
-D name[=value] Define a symbol
|
||||
-I dir Set an include directory search path
|
||||
-U Mark unresolved symbols as import
|
||||
-V Print the assembler version
|
||||
-W n Set warning level n
|
||||
-g Add debug info to object file
|
||||
-h Help (this text)
|
||||
-i Ignore case of symbols
|
||||
-l Create a listing if assembly was ok
|
||||
-mm model Set the memory model
|
||||
-o name Name the output file
|
||||
-s Enable smart mode
|
||||
-t sys Set the target system
|
||||
-v Increase verbosity
|
||||
|
||||
Long options:
|
||||
--auto-import Mark unresolved symbols as import
|
||||
--cpu type Set cpu type
|
||||
--debug-info Add debug info to object file
|
||||
--feature name Set an emulation feature
|
||||
--help Help (this text)
|
||||
--ignore-case Ignore case of symbols
|
||||
--include-dir dir Set an include directory search path
|
||||
--listing Create a listing if assembly was ok
|
||||
--list-bytes n Maximum number of bytes per listing line
|
||||
--macpack-dir dir Set a macro package directory
|
||||
--memory-model model Set the memory model
|
||||
--pagelength n Set the page length for the listing
|
||||
--smart Enable smart mode
|
||||
--target sys Set the target system
|
||||
--verbose Increase verbosity
|
||||
--version Print the assembler version
|
||||
---------------------------------------------------------------------------
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss2.2">2.2</A> <A HREF="ca65.html#toc2.2">Command line options in detail</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Here is a description of all the command line options:</P>
|
||||
<P>
|
||||
<DL>
|
||||
<P>
|
||||
<A NAME="option--cpu"></A> </P>
|
||||
<DT><B><CODE>--cpu type</CODE></B><DD><P>Set the default for the CPU type. The option takes a parameter, which
|
||||
may be one of</P>
|
||||
<P>6502, 65SC02, 65C02, 65816, sunplus, sweet16, HuC6280</P>
|
||||
<P>The sunplus cpu is not available in the freeware version, because the
|
||||
instruction set is "proprietary and confidential".</P>
|
||||
|
||||
<P>
|
||||
<A NAME="option--feature"></A> </P>
|
||||
<DT><B><CODE>--feature name</CODE></B><DD><P>Enable an emulation feature. This is identical as using <CODE>.FEATURE</CODE>
|
||||
in the source with two exceptions: Feature names must be lower case, and
|
||||
each feature must be specified by using an extra <CODE>--feature</CODE> option,
|
||||
comma separated lists are not allowed.</P>
|
||||
<P>See the discussion of the <CODE>
|
||||
<A HREF="ca65-10.html#.FEATURE">.FEATURE</A></CODE>
|
||||
command for a list of emulation features.</P>
|
||||
|
||||
<P>
|
||||
<A NAME="option-g"></A> </P>
|
||||
<DT><B><CODE>-g, --debug-info</CODE></B><DD><P>When this option (or the equivalent control command <CODE>.DEBUGINFO</CODE>) is
|
||||
used, the assembler will add a section to the object file that contains
|
||||
all symbols (including local ones) together with the symbol values and
|
||||
source file positions. The linker will put these additional symbols into
|
||||
the VICE label file, so even local symbols can be seen in the VICE
|
||||
monitor.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-h, --help</CODE></B><DD><P>Print the short option summary shown above.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-i, --ignore-case</CODE></B><DD><P>This option makes the assembler case insensitive on identifiers and labels.
|
||||
This option will override the default, but may itself be overridden by the
|
||||
<CODE>
|
||||
<A HREF="ca65-10.html#.CASE">.CASE</A></CODE> control command.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-l, --listing</CODE></B><DD><P>Generate an assembler listing. The listing file will always have the
|
||||
name of the main input file with the extension replaced by ".lst". This
|
||||
may change in future versions.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--list-bytes n</CODE></B><DD><P>Set the maximum number of bytes printed in the listing for one line of
|
||||
input. See the <CODE>
|
||||
<A HREF="ca65-10.html#.LISTBYTES">.LISTBYTES</A></CODE> directive
|
||||
for more information. The value zero can be used to encode an unlimited
|
||||
number of printed bytes.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--macpack-dir dir</CODE></B><DD><P>This options allows to specify a directory containing macro files that are
|
||||
used instead of the builtin images when a <CODE>
|
||||
<A HREF="ca65-10.html#.MACPACK">.MACPACK</A></CODE> directive is encountered. If <CODE>--macpack-dir</CODE>
|
||||
was specified, a <CODE>.mac</CODE> extension is added to the package name and
|
||||
the resulting file is loaded from the given directory. This is most useful
|
||||
when debugging the builtin macro packages.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-mm model, --memory-model model</CODE></B><DD><P>Define the default memory model. Possible model specifiers are near, far and
|
||||
huge.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-o name</CODE></B><DD><P>The default output name is the name of the input file with the extension
|
||||
replaced by ".o". If you don't like that, you may give another name with
|
||||
the -o option. The output file will be placed in the same directory as
|
||||
the source file, or, if -o is given, the full path in this name is used.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--pagelength n</CODE></B><DD><P>sets the length of a listing page in lines. See the <CODE>
|
||||
<A HREF="ca65-10.html#.PAGELENGTH">.PAGELENGTH</A></CODE> directive for more information.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-s, --smart-mode</CODE></B><DD><P>In smart mode (enabled by -s or the <CODE>
|
||||
<A HREF="ca65-10.html#.SMART">.SMART</A></CODE>
|
||||
pseudo instruction) the assembler will track usage of the <CODE>REP</CODE> and
|
||||
<CODE>SEP</CODE> instructions in 65816 mode and update the operand sizes
|
||||
accordingly. If the operand of such an instruction cannot be evaluated by
|
||||
the assembler (for example, because the operand is an imported symbol), a
|
||||
warning is issued.</P>
|
||||
<P>Beware: Since the assembler cannot trace the execution flow this may
|
||||
lead to false results in some cases. If in doubt, use the .ixx and .axx
|
||||
instructions to tell the assembler about the current settings. Smart
|
||||
mode is off by default.</P>
|
||||
|
||||
<P>
|
||||
<A NAME="option-t"></A> </P>
|
||||
<DT><B><CODE>-t sys, --target sys</CODE></B><DD><P>Set the target system. This will enable translation of character strings
|
||||
and character constants into the character set of the target platform.
|
||||
The default for the target system is "none", which means that no translation
|
||||
will take place. The assembler supports the same target systems as the
|
||||
compiler, see there for a list.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-v, --verbose</CODE></B><DD><P>Increase the assembler verbosity. Usually only needed for debugging
|
||||
purposes. You may use this option more than one time for even more
|
||||
verbose output.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-D</CODE></B><DD><P>This option allows you to define symbols on the command line. Without a
|
||||
value, the symbol is defined with the value zero. When giving a value,
|
||||
you may use the '$' prefix for hexadecimal symbols. Please note
|
||||
that for some operating systems, '$' has a special meaning, so
|
||||
you may have to quote the expression.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-I dir, --include-dir dir</CODE></B><DD><P>Name a directory which is searched for include files. The option may be
|
||||
used more than once to specify more than one directory to search. The
|
||||
current directory is always searched first before considering any
|
||||
additional directories.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-U, --auto-import</CODE></B><DD><P>Mark symbols that are not defined in the sources as imported symbols. This
|
||||
should be used with care since it delays error messages about typos and such
|
||||
until the linker is run. The compiler uses the equivalent of this switch
|
||||
(<CODE>
|
||||
<A HREF="ca65-10.html#.AUTOIMPORT">.AUTOIMPORT</A></CODE>) to enable auto imported
|
||||
symbols for the runtime library. However, the compiler is supposed to
|
||||
generate code that runs through the assembler without problems, something
|
||||
which is not always true for assembler programmers.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>-V, --version</CODE></B><DD><P>Print the version number of the assembler. If you send any suggestions
|
||||
or bugfixes, please include the version number.</P>
|
||||
|
||||
<P>
|
||||
<A NAME="option-W"></A> </P>
|
||||
<DT><B><CODE>-Wn</CODE></B><DD><P>Set the warning level for the assembler. Using -W2 the assembler will
|
||||
even warn about such things like unused imported symbols. The default
|
||||
warning level is 1, and it would probably be silly to set it to
|
||||
something lower.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-3.html">Next</A>
|
||||
<A HREF="ca65-1.html">Previous</A>
|
||||
<A HREF="ca65.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
181
usr/share/doc/cc65/webdoc/ca65-3.html
Normal file
181
usr/share/doc/cc65/webdoc/ca65-3.html
Normal file
|
@ -0,0 +1,181 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Input format</TITLE>
|
||||
<LINK HREF="ca65-4.html" REL=next>
|
||||
<LINK HREF="ca65-2.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-4.html">Next</A>
|
||||
<A HREF="ca65-2.html">Previous</A>
|
||||
<A HREF="ca65.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3.</A> <A HREF="ca65.html#toc3">Input format</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss3.1">3.1</A> <A HREF="ca65.html#toc3.1">Assembler syntax</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The assembler accepts the standard 6502/65816 assembler syntax. One line may
|
||||
contain a label (which is identified by a colon), and, in addition to the
|
||||
label, an assembler mnemonic, a macro, or a control command (see section
|
||||
<A HREF="ca65-10.html#control-commands">Control Commands</A> for supported control
|
||||
commands). Alternatively, the line may contain a symbol definition using
|
||||
the '=' token. Everything after a semicolon is handled as a comment (that is,
|
||||
it is ignored).</P>
|
||||
<P>Here are some examples for valid input lines:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
Label: ; A label and a comment
|
||||
lda #$20 ; A 6502 instruction plus comment
|
||||
L1: ldx #$20 ; Same with label
|
||||
L2: .byte "Hello world" ; Label plus control command
|
||||
mymac $20 ; Macro expansion
|
||||
MySym = 3*L1 ; Symbol definition
|
||||
MaSym = Label ; Another symbol
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>The assembler accepts</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>all valid 6502 mnemonics when in 6502 mode (the default or after the
|
||||
<CODE>
|
||||
<A HREF="ca65-10.html#.P02">.P02</A></CODE> command was given).</LI>
|
||||
<LI>all valid 6502 mnemonics plus a set of illegal instructions when in
|
||||
<A HREF="#6502X-mode">6502X mode</A>.</LI>
|
||||
<LI>all valid 65SC02 mnemonics when in 65SC02 mode (after the
|
||||
<CODE>
|
||||
<A HREF="ca65-10.html#.PSC02">.PSC02</A></CODE> command was given).</LI>
|
||||
<LI>all valid 65C02 mnemonics when in 65C02 mode (after the
|
||||
<CODE>
|
||||
<A HREF="ca65-10.html#.PC02">.PC02</A></CODE> command was given).</LI>
|
||||
<LI>all valid 65618 mnemonics when in 65816 mode (after the
|
||||
<CODE>
|
||||
<A HREF="ca65-10.html#.P816">.P816</A></CODE> command was given).</LI>
|
||||
<LI>all valid SunPlus mnemonics when in SunPlus mode (after the
|
||||
<CODE>
|
||||
<A HREF="ca65-10.html#.SUNPLUS">.SUNPLUS</A></CODE> command was given).</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss3.2">3.2</A> <A HREF="ca65.html#toc3.2">65816 mode</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>In 65816 mode several aliases are accepted in addition to the official
|
||||
mnemonics:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
BGE is an alias for BCS
|
||||
BLT is an alias for BCC
|
||||
CPA is an alias for CMP
|
||||
DEA is an alias for DEC A
|
||||
INA is an alias for INC A
|
||||
SWA is an alias for XBA
|
||||
TAD is an alias for TCD
|
||||
TAS is an alias for TCS
|
||||
TDA is an alias for TDC
|
||||
TSA is an alias for TSC
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="6502X-mode"></A> <A NAME="ss3.3">3.3</A> <A HREF="ca65.html#toc3.3">6502X mode</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>6502X mode is an extension to the normal 6502 mode. In this mode, several
|
||||
mnemonics for illegal instructions of the NMOS 6502 CPUs are accepted. Since
|
||||
these instructions are illegal, there are no official mnemonics for them. The
|
||||
unofficial ones are taken from
|
||||
<A HREF="http://oxyron.net/graham/opcodes02.html">http://oxyron.net/graham/opcodes02.html</A>. Please note that only the
|
||||
ones marked as "stable" are supported. The following table uses information
|
||||
from the mentioned web page, for more information, see there.</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI><CODE>ALR: A:=(A and #{imm})*2;</CODE></LI>
|
||||
<LI><CODE>ANC: A:=A and #{imm};</CODE> Generates opcode $0B.</LI>
|
||||
<LI><CODE>ARR: A:=(A and #{imm})/2;</CODE></LI>
|
||||
<LI><CODE>AXS: X:=A and X-#{imm};</CODE></LI>
|
||||
<LI><CODE>DCP: {adr}:={adr}-1; A-{adr};</CODE></LI>
|
||||
<LI><CODE>ISC: {adr}:={adr}+1; A:=A-{adr};</CODE></LI>
|
||||
<LI><CODE>LAS: A,X,S:={adr} and S;</CODE></LI>
|
||||
<LI><CODE>LAX: A,X:={adr};</CODE></LI>
|
||||
<LI><CODE>RLA: {adr}:={adr}rol; A:=A and {adr};</CODE></LI>
|
||||
<LI><CODE>RRA: {adr}:={adr}ror; A:=A adc {adr};</CODE></LI>
|
||||
<LI><CODE>SAX: {adr}:=A and X;</CODE></LI>
|
||||
<LI><CODE>SLO: {adr}:={adr}*2; A:=A or {adr};</CODE></LI>
|
||||
<LI><CODE>SRE: {adr}:={adr}/2; A:=A xor {adr};</CODE></LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="sweet16-mode"></A> <A NAME="ss3.4">3.4</A> <A HREF="ca65.html#toc3.4">sweet16 mode</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>SWEET 16 is an interpreter for a pseudo 16 bit CPU written by Steve Wozniak
|
||||
for the Apple ][ machines. It is available in the Apple ][ ROM. ca65 can
|
||||
generate code for this pseudo CPU when switched into sweet16 mode. The
|
||||
following is special in sweet16 mode:</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>The '@' character denotes indirect addressing and is no longer available
|
||||
for cheap local labels. If you need cheap local labels, you will have to
|
||||
switch to another lead character using the <CODE>
|
||||
<A HREF="ca65-10.html#.LOCALCHAR">.LOCALCHAR</A></CODE> command.
|
||||
</LI>
|
||||
<LI>Registers are specified using <CODE>R0</CODE> .. <CODE>R15</CODE>. In sweet16 mode,
|
||||
these identifiers are reserved words.
|
||||
</LI>
|
||||
</UL>
|
||||
</P>
|
||||
<P>Please note that the assembler does neither supply the interpreter needed for
|
||||
SWEET 16 code, nor the zero page locations needed for the SWEET 16 registers,
|
||||
nor does it call the interpreter. All this must be done by your program. Apple
|
||||
][ programmers do probably know how to use sweet16 mode.</P>
|
||||
<P>For more information about SWEET 16, see
|
||||
<A HREF="http://www.6502.org/source/interpreters/sweet16.htm">http://www.6502.org/source/interpreters/sweet16.htm</A>.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss3.5">3.5</A> <A HREF="ca65.html#toc3.5">Number format</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>For literal values, the assembler accepts the widely used number formats: A
|
||||
preceding '$' or a trailing 'h' denotes a hex value, a preceding '%'
|
||||
denotes a binary value, and a bare number is interpreted as a decimal. There
|
||||
are currently no octal values and no floats.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss3.6">3.6</A> <A HREF="ca65.html#toc3.6">Conditional assembly</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Please note that when using the conditional directives (<CODE>.IF</CODE> and friends),
|
||||
the input must consist of valid assembler tokens, even in <CODE>.IF</CODE> branches
|
||||
that are not assembled. The reason for this behaviour is that the assembler
|
||||
must still be able to detect the ending tokens (like <CODE>.ENDIF</CODE>), so
|
||||
conversion of the input stream into tokens still takes place. As a consequence
|
||||
conditional assembly directives may <B>not</B> be used to prevent normal text
|
||||
(used as a comment or similar) from being assembled. </P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-4.html">Next</A>
|
||||
<A HREF="ca65-2.html">Previous</A>
|
||||
<A HREF="ca65.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
159
usr/share/doc/cc65/webdoc/ca65-4.html
Normal file
159
usr/share/doc/cc65/webdoc/ca65-4.html
Normal file
|
@ -0,0 +1,159 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Expressions</TITLE>
|
||||
<LINK HREF="ca65-5.html" REL=next>
|
||||
<LINK HREF="ca65-3.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-5.html">Next</A>
|
||||
<A HREF="ca65-3.html">Previous</A>
|
||||
<A HREF="ca65.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4.</A> <A HREF="ca65.html#toc4">Expressions</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss4.1">4.1</A> <A HREF="ca65.html#toc4.1">Expression evaluation</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>All expressions are evaluated with (at least) 32 bit precision. An
|
||||
expression may contain constant values and any combination of internal and
|
||||
external symbols. Expressions that cannot be evaluated at assembly time
|
||||
are stored inside the object file for evaluation by the linker.
|
||||
Expressions referencing imported symbols must always be evaluated by the
|
||||
linker.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.2">4.2</A> <A HREF="ca65.html#toc4.2">Size of an expression result</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Sometimes, the assembler must know about the size of the value that is the
|
||||
result of an expression. This is usually the case, if a decision has to be
|
||||
made, to generate a zero page or an absolute memory references. In this
|
||||
case, the assembler has to make some assumptions about the result of an
|
||||
expression:</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI> If the result of an expression is constant, the actual value is
|
||||
checked to see if it's a byte sized expression or not.</LI>
|
||||
<LI> If the expression is explicitly casted to a byte sized expression by
|
||||
one of the '>', '<' or '^' operators, it is a byte expression.</LI>
|
||||
<LI> If this is not the case, and the expression contains a symbol,
|
||||
explicitly declared as zero page symbol (by one of the .importzp or
|
||||
.exportzp instructions), then the whole expression is assumed to be
|
||||
byte sized.</LI>
|
||||
<LI> If the expression contains symbols that are not defined, and these
|
||||
symbols are local symbols, the enclosing scopes are searched for a
|
||||
symbol with the same name. If one exists and this symbol is defined,
|
||||
it's attributes are used to determine the result size.</LI>
|
||||
<LI> In all other cases the expression is assumed to be word sized.</LI>
|
||||
</UL>
|
||||
</P>
|
||||
<P>Note: If the assembler is not able to evaluate the expression at assembly
|
||||
time, the linker will evaluate it and check for range errors as soon as
|
||||
the result is known.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.3">4.3</A> <A HREF="ca65.html#toc4.3">Boolean expressions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>In the context of a boolean expression, any non zero value is evaluated as
|
||||
true, any other value to false. The result of a boolean expression is 1 if
|
||||
it's true, and zero if it's false. There are boolean operators with extreme
|
||||
low precedence with version 2.x (where x > 0). The <CODE>.AND</CODE> and <CODE>.OR</CODE>
|
||||
operators are shortcut operators. That is, if the result of the expression is
|
||||
already known, after evaluating the left hand side, the right hand side is
|
||||
not evaluated.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.4">4.4</A> <A HREF="ca65.html#toc4.4">Constant expressions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Sometimes an expression must evaluate to a constant without looking at any
|
||||
further input. One such example is the <CODE>
|
||||
<A HREF="ca65-10.html#.IF">.IF</A></CODE> command
|
||||
that decides if parts of the code are assembled or not. An expression used in
|
||||
the <CODE>.IF</CODE> command cannot reference a symbol defined later, because the
|
||||
decision about the <CODE>.IF</CODE> must be made at the point when it is read. If the
|
||||
expression used in such a context contains only constant numerical values,
|
||||
there is no problem. When unresolvable symbols are involved it may get harder
|
||||
for the assembler to determine if the expression is actually constant, and it
|
||||
is even possible to create expressions that aren't recognized as constant.
|
||||
Simplifying the expressions will often help.</P>
|
||||
<P>In cases where the result of the expression is not needed immediately, the
|
||||
assembler will delay evaluation until all input is read, at which point all
|
||||
symbols are known. So using arbitrary complex constant expressions is no
|
||||
problem in most cases.</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="operators"></A> <A NAME="ss4.5">4.5</A> <A HREF="ca65.html#toc4.5">Available operators</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Available operators sorted by precedence:</P>
|
||||
<P>
|
||||
<BR><CENTER>
|
||||
<TABLE BORDER><TR><TD>
|
||||
Op</TD><TD>Description</TD><TD>Precedence</TD></TR><TR><TD>
|
||||
</TD><TD>Builtin string functions</TD><TD>0</TD></TR><TR><TD>
|
||||
</TD><TD>Builtin pseudo variables</TD><TD>1</TD></TR><TR><TD>
|
||||
</TD><TD>Builtin pseudo functions</TD><TD>1</TD></TR><TR><TD>
|
||||
+</TD><TD>Unary plus</TD><TD>1</TD></TR><TR><TD>
|
||||
-</TD><TD>Unary minus</TD><TD>1</TD></TR><TR><TD>
|
||||
~</TD><TD>Unary bitwise not</TD><TD>1</TD></TR><TR><TD>
|
||||
.BITNOT</TD><TD>Unary bitwise not</TD><TD>1</TD></TR><TR><TD>
|
||||
<</TD><TD>Low byte operator</TD><TD>1</TD></TR><TR><TD>
|
||||
></TD><TD>High byte operator</TD><TD>1</TD></TR><TR><TD>
|
||||
^</TD><TD>Bank byte operator</TD><TD>1</TD></TR><TR><TD>
|
||||
*</TD><TD>Multiplication</TD><TD>2</TD></TR><TR><TD>
|
||||
/</TD><TD>Division</TD><TD>2</TD></TR><TR><TD>
|
||||
.MOD</TD><TD>Modulo operation</TD><TD>2</TD></TR><TR><TD>
|
||||
&</TD><TD>Bitwise and</TD><TD>2</TD></TR><TR><TD>
|
||||
.BITAND</TD><TD>Bitwise and</TD><TD>2</TD></TR><TR><TD>
|
||||
^</TD><TD>Bitwise xor</TD><TD>2</TD></TR><TR><TD>
|
||||
.BITXOR</TD><TD>Bitwise xor</TD><TD>2</TD></TR><TR><TD>
|
||||
<<</TD><TD>Shift left operator</TD><TD>2</TD></TR><TR><TD>
|
||||
.SHL</TD><TD>Shift left operator</TD><TD>2</TD></TR><TR><TD>
|
||||
>></TD><TD>Shift right operato</TD><TD>r</TD></TR><TR><TD>
|
||||
.SHR</TD><TD>Shift right operator</TD><TD>2</TD></TR><TR><TD>
|
||||
+</TD><TD>Binary plus</TD><TD>3</TD></TR><TR><TD>
|
||||
-</TD><TD>Binary minus</TD><TD>3</TD></TR><TR><TD>
|
||||
|</TD><TD>Binary or</TD><TD>3</TD></TR><TR><TD>
|
||||
.BITOR</TD><TD>Binary or</TD><TD>3</TD></TR><TR><TD>
|
||||
=</TD><TD>Compare operation (equal)</TD><TD>4</TD></TR><TR><TD>
|
||||
<></TD><TD>Compare operation (not equal)</TD><TD>4</TD></TR><TR><TD>
|
||||
<</TD><TD>Compare operation (less)</TD><TD>4</TD></TR><TR><TD>
|
||||
></TD><TD>Compare operation (greater)</TD><TD>4</TD></TR><TR><TD>
|
||||
<=</TD><TD>Compare operation (less or equal)</TD><TD>4</TD></TR><TR><TD>
|
||||
>=</TD><TD>Compare operation (greater or equal)</TD><TD>4</TD></TR><TR><TD>
|
||||
&&</TD><TD>Boolean and</TD><TD>5</TD></TR><TR><TD>
|
||||
.AND</TD><TD>Boolean and</TD><TD>5</TD></TR><TR><TD>
|
||||
.XOR</TD><TD>Boolean xor</TD><TD>5</TD></TR><TR><TD>
|
||||
||</TD><TD>Boolean or</TD><TD>6</TD></TR><TR><TD>
|
||||
.OR</TD><TD>Boolean or</TD><TD>6</TD></TR><TR><TD>
|
||||
!</TD><TD>Boolean not</TD><TD>7</TD></TR><TR><TD>
|
||||
.NOT</TD><TD>Boolean not</TD><TD>7</TD></TR><TR><TD>
|
||||
</TD></TR></TABLE>
|
||||
<CAPTION>Available operators sorted by precedence</CAPTION>
|
||||
</CENTER><BR>
|
||||
</P>
|
||||
<P>To force a specific order of evaluation, braces may be used as usual.</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-5.html">Next</A>
|
||||
<A HREF="ca65-3.html">Previous</A>
|
||||
<A HREF="ca65.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
201
usr/share/doc/cc65/webdoc/ca65-5.html
Normal file
201
usr/share/doc/cc65/webdoc/ca65-5.html
Normal file
|
@ -0,0 +1,201 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Symbols and labels</TITLE>
|
||||
<LINK HREF="ca65-6.html" REL=next>
|
||||
<LINK HREF="ca65-4.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-6.html">Next</A>
|
||||
<A HREF="ca65-4.html">Previous</A>
|
||||
<A HREF="ca65.html#toc5">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s5">5.</A> <A HREF="ca65.html#toc5">Symbols and labels</A></H2>
|
||||
|
||||
|
||||
<P>The assembler allows you to use symbols instead of naked values to make
|
||||
the source more readable. There are a lot of different ways to define and
|
||||
use symbols and labels, giving a lot of flexibility.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.1">5.1</A> <A HREF="ca65.html#toc5.1">Numeric constants</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Numeric constants are defined using the equal sign or the label assignment
|
||||
operator. After doing</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
two = 2
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>may use the symbol "two" in every place where a number is expected, and it is
|
||||
evaluated to the value 2 in this context. The label assignment operator causes
|
||||
the same, but causes the symbol to be marked as a label, which may cause a
|
||||
different handling in the debugger:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
io := $d000
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>The right side can of course be an expression:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
four = two * two
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.2">5.2</A> <A HREF="ca65.html#toc5.2">Standard labels</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>A label is defined by writing the name of the label at the start of the line
|
||||
(before any instruction mnemonic, macro or pseudo directive), followed by a
|
||||
colon. This will declare a symbol with the given name and the value of the
|
||||
current program counter.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.3">5.3</A> <A HREF="ca65.html#toc5.3">Local labels and symbols</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Using the <CODE>
|
||||
<A HREF="ca65-10.html#.PROC">.PROC</A></CODE> directive, it is possible to
|
||||
create regions of code where the names of labels and symbols are local to this
|
||||
region. They are not known outside of this region and cannot be accessed from
|
||||
there. Such regions may be nested like PROCEDUREs in Pascal.</P>
|
||||
<P>See the description of the <CODE>
|
||||
<A HREF="ca65-10.html#.PROC">.PROC</A></CODE>
|
||||
directive for more information.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.4">5.4</A> <A HREF="ca65.html#toc5.4">Cheap local labels</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Cheap local labels are defined like standard labels, but the name of the
|
||||
label must begin with a special symbol (usually '@', but this can be
|
||||
changed by the <CODE>
|
||||
<A HREF="ca65-10.html#.LOCALCHAR">.LOCALCHAR</A></CODE>
|
||||
directive).</P>
|
||||
<P>Cheap local labels are visible only between two non cheap labels. As soon as a
|
||||
standard symbol is encountered (this may also be a local symbol if inside a
|
||||
region defined with the <CODE>
|
||||
<A HREF="ca65-10.html#.PROC">.PROC</A></CODE> directive), the
|
||||
cheap local symbol goes out of scope.</P>
|
||||
<P>You may use cheap local labels as an easy way to reuse common label
|
||||
names like "Loop". Here is an example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
Clear: lda #$00 ; Global label
|
||||
ldy #$20
|
||||
@Loop: sta Mem,y ; Local label
|
||||
dey
|
||||
bne @Loop ; Ok
|
||||
rts
|
||||
Sub: ... ; New global label
|
||||
bne @Loop ; ERROR: Unknown identifier!
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
<H2><A NAME="ss5.5">5.5</A> <A HREF="ca65.html#toc5.5">Unnamed labels</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>If you really want to write messy code, there are also unnamed labels. These
|
||||
labels do not have a name (you guessed that already, didn't you?). A colon is
|
||||
used to mark the absence of the name.</P>
|
||||
<P>Unnamed labels may be accessed by using the colon plus several minus or plus
|
||||
characters as a label designator. Using the '-' characters will create a back
|
||||
reference (use the n'th label backwards), using '+' will create a forward
|
||||
reference (use the n'th label in forward direction). An example will help to
|
||||
understand this:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
: lda (ptr1),y ; #1
|
||||
cmp (ptr2),y
|
||||
bne :+ ; -> #2
|
||||
tax
|
||||
beq :+++ ; -> #4
|
||||
iny
|
||||
bne :- ; -> #1
|
||||
inc ptr1+1
|
||||
inc ptr2+1
|
||||
bne :- ; -> #1
|
||||
|
||||
: bcs :+ ; #2 -> #3
|
||||
ldx #$FF
|
||||
rts
|
||||
|
||||
: ldx #$01 ; #3
|
||||
: rts ; #4
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>As you can see from the example, unnamed labels will make even short
|
||||
sections of code hard to understand, because you have to count labels
|
||||
to find branch targets (this is the reason why I for my part do
|
||||
prefer the "cheap" local labels). Nevertheless, unnamed labels are
|
||||
convenient in some situations, so it's your decision.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.6">5.6</A> <A HREF="ca65.html#toc5.6">Using macros to define labels and constants</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>While there are drawbacks with this approach, it may be handy in some
|
||||
situations. Using <CODE>
|
||||
<A HREF="ca65-10.html#.DEFINE">.DEFINE</A></CODE>, it is
|
||||
possible to define symbols or constants that may be used elsewhere. Since
|
||||
the macro facility works on a very low level, there is no scoping. On the
|
||||
other side, you may also define string constants this way (this is not
|
||||
possible with the other symbol types).</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.DEFINE two 2
|
||||
.DEFINE version "SOS V2.3"
|
||||
|
||||
four = two * two ; Ok
|
||||
.byte version ; Ok
|
||||
|
||||
.PROC ; Start local scope
|
||||
two = 3 ; Will give "2 = 3" - invalid!
|
||||
.ENDPROC
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.7">5.7</A> <A HREF="ca65.html#toc5.7">Symbols and <CODE>.DEBUGINFO</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>If <CODE>
|
||||
<A HREF="ca65-10.html#.DEBUGINFO">.DEBUGINFO</A></CODE> is enabled (or
|
||||
<A HREF="ca65-2.html#option-g">-g</A> is given on the command line), global, local and
|
||||
cheap local labels are written to the object file and will be available in the
|
||||
symbol file via the linker. Unnamed labels are not written to the object file,
|
||||
because they don't have a name which would allow to access them.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-6.html">Next</A>
|
||||
<A HREF="ca65-4.html">Previous</A>
|
||||
<A HREF="ca65.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
322
usr/share/doc/cc65/webdoc/ca65-6.html
Normal file
322
usr/share/doc/cc65/webdoc/ca65-6.html
Normal file
|
@ -0,0 +1,322 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Scopes</TITLE>
|
||||
<LINK HREF="ca65-7.html" REL=next>
|
||||
<LINK HREF="ca65-5.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-7.html">Next</A>
|
||||
<A HREF="ca65-5.html">Previous</A>
|
||||
<A HREF="ca65.html#toc6">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="scopes"></A> <A NAME="s6">6.</A> <A HREF="ca65.html#toc6">Scopes</A></H2>
|
||||
|
||||
|
||||
<P>ca65 implements several sorts of scopes for symbols.</P>
|
||||
|
||||
<H2><A NAME="ss6.1">6.1</A> <A HREF="ca65.html#toc6.1">Global scope</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>All (non cheap local) symbols that are declared outside of any nested scopes
|
||||
are in global scope.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss6.2">6.2</A> <A HREF="ca65.html#toc6.2">Cheap locals</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>A special scope is the scope for cheap local symbols. It lasts from one non
|
||||
local symbol to the next one, without any provisions made by the programmer.
|
||||
All other scopes differ in usage but use the same concept internally.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss6.3">6.3</A> <A HREF="ca65.html#toc6.3">Generic nested scopes</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>A nested scoped for generic use is started with <CODE>
|
||||
<A HREF="ca65-10.html#.SCOPE">.SCOPE</A></CODE> and closed with <CODE>
|
||||
<A HREF="ca65-10.html#.ENDSCOPE">.ENDSCOPE</A></CODE>.
|
||||
The scope can have a name, in which case it is accessible from the outside by
|
||||
using
|
||||
<A HREF="#scopesyntax">explicit scopes</A>. If the scope does not
|
||||
have a name, all symbols created within the scope are local to the scope, and
|
||||
aren't accessible from the outside.</P>
|
||||
<P>A nested scope can access symbols from the local or from enclosing scopes by
|
||||
name without using explicit scope names. In some cases there may be
|
||||
ambiguities, for example if there is a reference to a local symbol that is not
|
||||
yet defined, but a symbol with the same name exists in outer scopes:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.scope outer
|
||||
foo = 2
|
||||
.scope inner
|
||||
lda #foo
|
||||
foo = 3
|
||||
.endscope
|
||||
.endscope
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>In the example above, the <CODE>lda</CODE> instruction will load the value 3 into the
|
||||
accumulator, because <CODE>foo</CODE> is redefined in the scope. However:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.scope outer
|
||||
foo = $1234
|
||||
.scope inner
|
||||
lda foo,x
|
||||
foo = $12
|
||||
.endscope
|
||||
.endscope
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Here, <CODE>lda</CODE> will still load from <CODE>$12,x</CODE>, but since it is unknown to the
|
||||
assembler that <CODE>foo</CODE> is a zeropage symbol when translating the instruction,
|
||||
absolute mode is used instead. In fact, the assembler will not use absolute
|
||||
mode by default, but it will search through the enclosing scopes for a symbol
|
||||
with the given name. If one is found, the address size of this symbol is used.
|
||||
This may lead to errors:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.scope outer
|
||||
foo = $12
|
||||
.scope inner
|
||||
lda foo,x
|
||||
foo = $1234
|
||||
.endscope
|
||||
.endscope
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>In this case, when the assembler sees the symbol <CODE>foo</CODE> in the <CODE>lda</CODE>
|
||||
instruction, it will search for an already defined symbol <CODE>foo</CODE>. It will
|
||||
find <CODE>foo</CODE> in scope <CODE>outer</CODE>, and a close look reveals that it is a
|
||||
zeropage symbol. So the assembler will use zeropage addressing mode. If
|
||||
<CODE>foo</CODE> is redefined later in scope <CODE>inner</CODE>, the assembler tries to change
|
||||
the address in the <CODE>lda</CODE> instruction already translated, but since the new
|
||||
value needs absolute addressing mode, this fails, and an error message "Range
|
||||
error" is output.</P>
|
||||
<P>Of course the most simple solution for the problem is to move the definition
|
||||
of <CODE>foo</CODE> in scope <CODE>inner</CODE> upwards, so it precedes its use. There may be
|
||||
rare cases when this cannot be done. In these cases, you can use one of the
|
||||
address size override operators:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.scope outer
|
||||
foo = $12
|
||||
.scope inner
|
||||
lda a:foo,x
|
||||
foo = $1234
|
||||
.endscope
|
||||
.endscope
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>This will cause the <CODE>lda</CODE> instruction to be translated using absolute
|
||||
addressing mode, which means changing the symbol reference later does not
|
||||
cause any errors.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss6.4">6.4</A> <A HREF="ca65.html#toc6.4">Nested procedures</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>A nested procedure is created by use of <CODE>
|
||||
<A HREF="ca65-10.html#.PROC">.PROC</A></CODE>. It
|
||||
differs from a <CODE>
|
||||
<A HREF="ca65-10.html#.SCOPE">.SCOPE</A></CODE> in that it must have a
|
||||
name, and a it will introduce a symbol with this name in the enclosing scope.
|
||||
So</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.proc foo
|
||||
...
|
||||
.endscope
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>is actually the same as</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
foo:
|
||||
.scope foo
|
||||
...
|
||||
.endscope
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>This is the reason why a procedure must have a name. If you want a scope
|
||||
without a name, use <CODE>
|
||||
<A HREF="ca65-10.html#.SCOPE">.SCOPE</A></CODE>.</P>
|
||||
<P><B>Note:</B> As you can see from the example above, scopes and symbols live in
|
||||
different namespaces. There can be a symbol named <CODE>foo</CODE> and a scope named
|
||||
<CODE>foo</CODE> without any conflicts (but see the section titled
|
||||
<A HREF="#scopesearch">"Scope search order"</A>).</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss6.5">6.5</A> <A HREF="ca65.html#toc6.5">Structs, unions and enums</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Structs, unions and enums are explained in a
|
||||
<A HREF="ca65-14.html#structs">separate section</A>, I do only cover them here, because if they are declared with a
|
||||
name, they open a nested scope, similar to <CODE>
|
||||
<A HREF="ca65-10.html#.SCOPE">.SCOPE</A></CODE>. However, when no name is specified, the behaviour is
|
||||
different: In this case, no new scope will be opened, symbols declared within
|
||||
a struct, union, or enum declaration will then be added to the enclosing scope
|
||||
instead.</P>
|
||||
|
||||
|
||||
<H2><A NAME="scopesyntax"></A> <A NAME="ss6.6">6.6</A> <A HREF="ca65.html#toc6.6">Explicit scope specification</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Accessing symbols from other scopes is possible by using an explicit scope
|
||||
specification, provided that the scope where the symbol lives in has a name.
|
||||
The namespace token (<CODE>::</CODE>) is used to access other scopes:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.scope foo
|
||||
bar: .word 0
|
||||
.endscope
|
||||
|
||||
...
|
||||
lda foo::bar ; Access foo in scope bar
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>The only way to deny access to a scope from the outside is to declare a scope
|
||||
without a name (using the <CODE>
|
||||
<A HREF="ca65-10.html#.SCOPE">.SCOPE</A></CODE> command).</P>
|
||||
<P>A special syntax is used to specify the global scope: If a symbol or scope is
|
||||
preceded by the namespace token, the global scope is searched:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
bar = 3
|
||||
|
||||
.scope foo
|
||||
bar = 2
|
||||
lda #::bar ; Access the global bar (which is 3)
|
||||
.endscope
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="scopesearch"></A> <A NAME="ss6.7">6.7</A> <A HREF="ca65.html#toc6.7">Scope search order</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The assembler searches for a scope in a similar way as for a symbol. First, it
|
||||
looks in the current scope, and then it walks up the enclosing scopes until
|
||||
the scope is found.</P>
|
||||
<P>However, one important thing to note when using explicit scope syntax is, that
|
||||
a symbol may be accessed before it is defined, but a scope may <B>not</B> be
|
||||
used without a preceding definition. This means that in the following
|
||||
example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.scope foo
|
||||
bar = 3
|
||||
.endscope
|
||||
|
||||
.scope outer
|
||||
lda #foo::bar ; Will load 3, not 2!
|
||||
.scope foo
|
||||
bar = 2
|
||||
.endscope
|
||||
.endscope
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>the reference to the scope <CODE>foo</CODE> will use the global scope, and not the
|
||||
local one, because the local one is not visible at the point where it is
|
||||
referenced.</P>
|
||||
<P>Things get more complex if a complete chain of scopes is specified:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.scope foo
|
||||
.scope outer
|
||||
.scope inner
|
||||
bar = 1
|
||||
.endscope
|
||||
.endscope
|
||||
.scope another
|
||||
.scope nested
|
||||
lda #outer::inner::bar ; 1
|
||||
.endscope
|
||||
.endscope
|
||||
.endscope
|
||||
|
||||
.scope outer
|
||||
.scope inner
|
||||
bar = 2
|
||||
.endscope
|
||||
.endscope
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>When <CODE>outer::inner::bar</CODE> is referenced in the <CODE>lda</CODE> instruction, the
|
||||
assembler will first search in the local scope for a scope named <CODE>outer</CODE>.
|
||||
Since none is found, the enclosing scope (<CODE>another</CODE>) is checked. There is
|
||||
still no scope named <CODE>outer</CODE>, so scope <CODE>foo</CODE> is checked, and finally
|
||||
scope <CODE>outer</CODE> is found. Within this scope, <CODE>inner</CODE> is searched, and in
|
||||
this scope, the assembler looks for a symbol named <CODE>bar</CODE>.</P>
|
||||
<P>Please note that once the anchor scope is found, all following scopes
|
||||
(<CODE>inner</CODE> in this case) are expected to be found exactly in this scope. The
|
||||
assembler will search the scope tree only for the first scope (if it is not
|
||||
anchored in the root scope). Starting from there on, there is no flexibility,
|
||||
so if the scope named <CODE>outer</CODE> found by the assembler does not contain a
|
||||
scope named <CODE>inner</CODE>, this would be an error, even if such a pair does exist
|
||||
(one level up in global scope).</P>
|
||||
<P>Ambiguities that may be introduced by this search algorithm may be removed by
|
||||
anchoring the scope specification in the global scope. In the example above,
|
||||
if you want to access the "other" symbol <CODE>bar</CODE>, you would have to write:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.scope foo
|
||||
.scope outer
|
||||
.scope inner
|
||||
bar = 1
|
||||
.endscope
|
||||
.endscope
|
||||
.scope another
|
||||
.scope nested
|
||||
lda #::outer::inner::bar ; 2
|
||||
.endscope
|
||||
.endscope
|
||||
.endscope
|
||||
|
||||
.scope outer
|
||||
.scope inner
|
||||
bar = 2
|
||||
.endscope
|
||||
.endscope
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-7.html">Next</A>
|
||||
<A HREF="ca65-5.html">Previous</A>
|
||||
<A HREF="ca65.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
86
usr/share/doc/cc65/webdoc/ca65-7.html
Normal file
86
usr/share/doc/cc65/webdoc/ca65-7.html
Normal file
|
@ -0,0 +1,86 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Address sizes and memory models</TITLE>
|
||||
<LINK HREF="ca65-8.html" REL=next>
|
||||
<LINK HREF="ca65-6.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc7" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-8.html">Next</A>
|
||||
<A HREF="ca65-6.html">Previous</A>
|
||||
<A HREF="ca65.html#toc7">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="address-sizes"></A> <A NAME="s7">7.</A> <A HREF="ca65.html#toc7">Address sizes and memory models</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss7.1">7.1</A> <A HREF="ca65.html#toc7.1">Address sizes</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>ca65 assigns each segment and each symbol an address size. This is true, even
|
||||
if the symbol is not used as an address. You may also think of a value range
|
||||
of the symbol instead of an address size.</P>
|
||||
<P>Possible address sizes are:</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>Zeropage or direct (8 bits)</LI>
|
||||
<LI>Absolute (16 bits)</LI>
|
||||
<LI>Far (24 bits)</LI>
|
||||
<LI>Long (32 bits)</LI>
|
||||
</UL>
|
||||
</P>
|
||||
<P>Since the assembler uses default address sizes for the segments and symbols,
|
||||
it is usually not necessary to override the default behaviour. In cases, where
|
||||
it is necessary, the following keywords may be used to specify address sizes:</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>DIRECT, ZEROPAGE or ZP for zeropage addressing (8 bits).</LI>
|
||||
<LI>ABSOLUTE, ABS or NEAR for absolute addressing (16 bits).</LI>
|
||||
<LI>FAR for far addressing (24 bits).</LI>
|
||||
<LI>LONG or DWORD for long addressing (32 bits).</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss7.2">7.2</A> <A HREF="ca65.html#toc7.2">Address sizes of segments</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The assembler assigns an address size to each segment. Since the
|
||||
representation of a label within this segment is "segment start + offset",
|
||||
labels will inherit the address size of the segment they are declared in.</P>
|
||||
<P>The address size of a segment may be changed, by using an optional address
|
||||
size modifier. See the <CODE>
|
||||
<A HREF="ca65-10.html#.SEGMENT">segment directive</A></CODE> for
|
||||
an explanation on how this is done.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss7.3">7.3</A> <A HREF="ca65.html#toc7.3">Address sizes of symbols</A>
|
||||
</H2>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss7.4">7.4</A> <A HREF="ca65.html#toc7.4">Memory models</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The default address size of a segment depends on the memory model used. Since
|
||||
labels inherit the address size from the segment they are declared in,
|
||||
changing the memory model is an easy way to change the address size of many
|
||||
symbols at once.</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-8.html">Next</A>
|
||||
<A HREF="ca65-6.html">Previous</A>
|
||||
<A HREF="ca65.html#toc7">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
129
usr/share/doc/cc65/webdoc/ca65-8.html
Normal file
129
usr/share/doc/cc65/webdoc/ca65-8.html
Normal file
|
@ -0,0 +1,129 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Pseudo variables</TITLE>
|
||||
<LINK HREF="ca65-9.html" REL=next>
|
||||
<LINK HREF="ca65-7.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc8" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-9.html">Next</A>
|
||||
<A HREF="ca65-7.html">Previous</A>
|
||||
<A HREF="ca65.html#toc8">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="pseudo-variables"></A> <A NAME="s8">8.</A> <A HREF="ca65.html#toc8">Pseudo variables</A></H2>
|
||||
|
||||
|
||||
<P>Pseudo variables are readable in all cases, and in some special cases also
|
||||
writable.</P>
|
||||
|
||||
<H2><A NAME="ss8.1">8.1</A> <A HREF="ca65.html#toc8.1"><CODE>*</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Reading this pseudo variable will return the program counter at the start
|
||||
of the current input line.</P>
|
||||
<P>Assignment to this variable is possible when <CODE>
|
||||
<A HREF="ca65-10.html#.FEATURE">.FEATURE pc_assignment</A></CODE> is used. Note: You should not use
|
||||
assignments to <CODE>*</CODE>, use <CODE>
|
||||
<A HREF="ca65-10.html#.ORG">.ORG</A></CODE> instead.</P>
|
||||
|
||||
|
||||
<H2><A NAME=".CPU"></A> <A NAME="ss8.2">8.2</A> <A HREF="ca65.html#toc8.2"><CODE>.CPU</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Reading this pseudo variable will give a constant integer value that
|
||||
tells which CPU is currently enabled. It can also tell which instruction
|
||||
set the CPU is able to translate. The value read from the pseudo variable
|
||||
should be further examined by using one of the constants defined by the
|
||||
"cpu" macro package (see <CODE>
|
||||
<A HREF="ca65-10.html#.MACPACK">.MACPACK</A></CODE>).</P>
|
||||
<P>It may be used to replace the .IFPxx pseudo instructions or to construct
|
||||
even more complex expressions.</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macpack cpu
|
||||
.if (.cpu .bitand CPU_ISET_65816)
|
||||
phx
|
||||
phy
|
||||
.else
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
.endif
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".PARAMCOUNT"></A> <A NAME="ss8.3">8.3</A> <A HREF="ca65.html#toc8.3"><CODE>.PARAMCOUNT</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>This builtin pseudo variable is only available in macros. It is replaced by
|
||||
the actual number of parameters that were given in the macro invocation.</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro foo arg1, arg2, arg3
|
||||
.if .paramcount <> 3
|
||||
.error "Too few parameters for macro foo"
|
||||
.endif
|
||||
...
|
||||
.endmacro
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>See section
|
||||
<A HREF="ca65-11.html#macros">Macros</A>.</P>
|
||||
|
||||
|
||||
<H2><A NAME=".TIME"></A> <A NAME="ss8.4">8.4</A> <A HREF="ca65.html#toc8.4"><CODE>.TIME</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Reading this pseudo variable will give a constant integer value that
|
||||
represents the current time in POSIX standard (as seconds since the
|
||||
Epoch).</P>
|
||||
<P>It may be used to encode the time of translation somewhere in the created
|
||||
code.</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.dword .time ; Place time here
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".VERSION"></A> <A NAME="ss8.5">8.5</A> <A HREF="ca65.html#toc8.5"><CODE>.VERSION</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Reading this pseudo variable will give the assembler version according to
|
||||
the following formula:</P>
|
||||
<P>VER_MAJOR*$100 + VER_MINOR*$10 + VER_PATCH</P>
|
||||
<P>It may be used to encode the assembler version or check the assembler for
|
||||
special features not available with older versions.</P>
|
||||
<P>Example:</P>
|
||||
<P>Version 2.11.1 of the assembler will return $2B1 as numerical constant when
|
||||
reading the pseudo variable <CODE>.VERSION</CODE>.</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-9.html">Next</A>
|
||||
<A HREF="ca65-7.html">Previous</A>
|
||||
<A HREF="ca65.html#toc8">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
605
usr/share/doc/cc65/webdoc/ca65-9.html
Normal file
605
usr/share/doc/cc65/webdoc/ca65-9.html
Normal file
|
@ -0,0 +1,605 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide: Pseudo functions</TITLE>
|
||||
<LINK HREF="ca65-10.html" REL=next>
|
||||
<LINK HREF="ca65-8.html" REL=previous>
|
||||
<LINK HREF="ca65.html#toc9" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-10.html">Next</A>
|
||||
<A HREF="ca65-8.html">Previous</A>
|
||||
<A HREF="ca65.html#toc9">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="pseudo-functions"></A> <A NAME="s9">9.</A> <A HREF="ca65.html#toc9">Pseudo functions</A></H2>
|
||||
|
||||
|
||||
<P>Pseudo functions expect their arguments in parenthesis, and they have a result,
|
||||
either a string or an expression.</P>
|
||||
|
||||
|
||||
<H2><A NAME=".BANKBYTE"></A> <A NAME="ss9.1">9.1</A> <A HREF="ca65.html#toc9.1"><CODE>.BANKBYTE</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The function returns the bank byte (that is, bits 16-23) of its argument.
|
||||
It works identical to the '^' operator.</P>
|
||||
<P>See: <CODE>
|
||||
<A HREF="#.HIBYTE">.HIBYTE</A></CODE>,
|
||||
<CODE>
|
||||
<A HREF="#.LOBYTE">.LOBYTE</A></CODE></P>
|
||||
|
||||
|
||||
<H2><A NAME=".BLANK"></A> <A NAME="ss9.2">9.2</A> <A HREF="ca65.html#toc9.2"><CODE>.BLANK</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. The function evaluates its argument in braces and yields
|
||||
"false" if the argument is non blank (there is an argument), and "true" if
|
||||
there is no argument. The token list that makes up the function argument
|
||||
may optionally be enclosed in curly braces. This allows the inclusion of
|
||||
tokens that would otherwise terminate the list (the closing right
|
||||
parenthesis). The curly braces are not considered part of the list, a list
|
||||
just consisting of curly braces is considered to be empty.</P>
|
||||
<P>As an example, the <CODE>.IFBLANK</CODE> statement may be replaced by</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.if .blank({arg})
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME=".CONCAT"></A> <A NAME="ss9.3">9.3</A> <A HREF="ca65.html#toc9.3"><CODE>.CONCAT</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin string function. The function allows to concatenate a list of string
|
||||
constants separated by commas. The result is a string constant that is the
|
||||
concatenation of all arguments. This function is most useful in macros and
|
||||
when used together with the <CODE>.STRING</CODE> builtin function. The function may
|
||||
be used in any case where a string constant is expected.</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.include .concat ("myheader", ".", "inc")
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>This is the same as the command</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.include "myheader.inc"
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".CONST"></A> <A NAME="ss9.4">9.4</A> <A HREF="ca65.html#toc9.4"><CODE>.CONST</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. The function evaluates its argument in braces and
|
||||
yields "true" if the argument is a constant expression (that is, an
|
||||
expression that yields a constant value at assembly time) and "false"
|
||||
otherwise. As an example, the .IFCONST statement may be replaced by</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.if .const(a + 3)
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".HIBYTE"></A> <A NAME="ss9.5">9.5</A> <A HREF="ca65.html#toc9.5"><CODE>.HIBYTE</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The function returns the high byte (that is, bits 8-15) of its argument.
|
||||
It works identical to the '>' operator.</P>
|
||||
<P>See: <CODE>
|
||||
<A HREF="#.LOBYTE">.LOBYTE</A></CODE>,
|
||||
<CODE>
|
||||
<A HREF="#.BANKBYTE">.BANKBYTE</A></CODE></P>
|
||||
|
||||
|
||||
<H2><A NAME=".HIWORD"></A> <A NAME="ss9.6">9.6</A> <A HREF="ca65.html#toc9.6"><CODE>.HIWORD</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The function returns the high word (that is, bits 16-31) of its argument.</P>
|
||||
<P>See: <CODE>
|
||||
<A HREF="#.LOWORD">.LOWORD</A></CODE></P>
|
||||
|
||||
|
||||
<H2><A NAME=".IDENT"></A> <A NAME="ss9.7">9.7</A> <A HREF="ca65.html#toc9.7"><CODE>.IDENT</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The function expects a string as its argument, and converts this argument
|
||||
into an identifier. If the string starts with the current <CODE>
|
||||
<A HREF="ca65-10.html#.LOCALCHAR">.LOCALCHAR</A></CODE>, it will be converted into a cheap local
|
||||
identifier, otherwise it will be converted into a normal identifier.</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro makelabel arg1, arg2
|
||||
.ident (.concat (arg1, arg2)):
|
||||
.endmacro
|
||||
|
||||
makelabel "foo", "bar"
|
||||
|
||||
.word foobar ; Valid label
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".LEFT"></A> <A NAME="ss9.8">9.8</A> <A HREF="ca65.html#toc9.8"><CODE>.LEFT</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. Extracts the left part of a given token list.</P>
|
||||
<P>Syntax:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.LEFT (<int expr>, <token list>)
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>The first integer expression gives the number of tokens to extract from
|
||||
the token list. The second argument is the token list itself. The token
|
||||
list may optionally be enclosed into curly braces. This allows the
|
||||
inclusion of tokens that would otherwise terminate the list (the closing
|
||||
right paren in the given case).</P>
|
||||
<P>Example:</P>
|
||||
<P>To check in a macro if the given argument has a '#' as first token
|
||||
(immediate addressing mode), use something like this:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro ldax arg
|
||||
...
|
||||
.if (.match (.left (1, {arg}), #))
|
||||
|
||||
; ldax called with immediate operand
|
||||
...
|
||||
|
||||
.endif
|
||||
...
|
||||
.endmacro
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>See also the <CODE>
|
||||
<A HREF="#.MID">.MID</A></CODE> and <CODE>
|
||||
<A HREF="#.RIGHT">.RIGHT</A></CODE> builtin functions.</P>
|
||||
|
||||
|
||||
<H2><A NAME=".LOBYTE"></A> <A NAME="ss9.9">9.9</A> <A HREF="ca65.html#toc9.9"><CODE>.LOBYTE</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The function returns the low byte (that is, bits 0-7) of its argument.
|
||||
It works identical to the '<' operator.</P>
|
||||
<P>See: <CODE>
|
||||
<A HREF="#.HIBYTE">.HIBYTE</A></CODE>,
|
||||
<CODE>
|
||||
<A HREF="#.BANKBYTE">.BANKBYTE</A></CODE></P>
|
||||
|
||||
|
||||
<H2><A NAME=".LOWORD"></A> <A NAME="ss9.10">9.10</A> <A HREF="ca65.html#toc9.10"><CODE>.LOWORD</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The function returns the low word (that is, bits 0-15) of its argument.</P>
|
||||
<P>See: <CODE>
|
||||
<A HREF="#.HIWORD">.HIWORD</A></CODE></P>
|
||||
|
||||
|
||||
<H2><A NAME=".MATCH"></A> <A NAME="ss9.11">9.11</A> <A HREF="ca65.html#toc9.11"><CODE>.MATCH</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. Matches two token lists against each other. This is
|
||||
most useful within macros, since macros are not stored as strings, but
|
||||
as lists of tokens.</P>
|
||||
<P>The syntax is</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.MATCH(<token list #1>, <token list #2>)
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Both token list may contain arbitrary tokens with the exception of the
|
||||
terminator token (comma resp. right parenthesis) and</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>end-of-line</LI>
|
||||
<LI>end-of-file</LI>
|
||||
</UL>
|
||||
</P>
|
||||
<P>The token lists may optionally be enclosed into curly braces. This allows
|
||||
the inclusion of tokens that would otherwise terminate the list (the closing
|
||||
right paren in the given case). Often a macro parameter is used for any of
|
||||
the token lists.</P>
|
||||
<P>Please note that the function does only compare tokens, not token
|
||||
attributes. So any number is equal to any other number, regardless of the
|
||||
actual value. The same is true for strings. If you need to compare tokens
|
||||
<EM>and</EM> token attributes, use the <CODE>
|
||||
<A HREF="#.XMATCH">.XMATCH</A></CODE> function.</P>
|
||||
<P>Example:</P>
|
||||
<P>Assume the macro <CODE>ASR</CODE>, that will shift right the accumulator by one,
|
||||
while honoring the sign bit. The builtin processor instructions will allow
|
||||
an optional "A" for accu addressing for instructions like <CODE>ROL</CODE> and
|
||||
<CODE>ROR</CODE>. We will use the <CODE>
|
||||
<A HREF="#.MATCH">.MATCH</A></CODE> function
|
||||
to check for this and print and error for invalid calls.</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro asr arg
|
||||
|
||||
.if (.not .blank(arg)) .and (.not .match ({arg}, a))
|
||||
.error "Syntax error"
|
||||
.endif
|
||||
|
||||
cmp #$80 ; Bit 7 into carry
|
||||
lsr a ; Shift carry into bit 7
|
||||
|
||||
.endmacro
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>The macro will only accept no arguments, or one argument that must be the
|
||||
reserved keyword "A".</P>
|
||||
<P>See: <CODE>
|
||||
<A HREF="#.XMATCH">.XMATCH</A></CODE></P>
|
||||
|
||||
|
||||
<H2><A NAME=".MID"></A> <A NAME="ss9.12">9.12</A> <A HREF="ca65.html#toc9.12"><CODE>.MID</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. Takes a starting index, a count and a token list as
|
||||
arguments. Will return part of the token list.</P>
|
||||
<P>Syntax:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.MID (<int expr>, <int expr>, <token list>)
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>The first integer expression gives the starting token in the list (the first
|
||||
token has index 0). The second integer expression gives the number of tokens
|
||||
to extract from the token list. The third argument is the token list itself.
|
||||
The token list may optionally be enclosed into curly braces. This allows the
|
||||
inclusion of tokens that would otherwise terminate the list (the closing
|
||||
right paren in the given case).</P>
|
||||
<P>Example:</P>
|
||||
<P>To check in a macro if the given argument has a '<CODE>#</CODE>' as first token
|
||||
(immediate addressing mode), use something like this:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro ldax arg
|
||||
...
|
||||
.if (.match (.mid (0, 1, {arg}), #))
|
||||
|
||||
; ldax called with immediate operand
|
||||
...
|
||||
|
||||
.endif
|
||||
...
|
||||
.endmacro
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>See also the <CODE>
|
||||
<A HREF="#.LEFT">.LEFT</A></CODE> and <CODE>
|
||||
<A HREF="#.RIGHT">.RIGHT</A></CODE> builtin functions.</P>
|
||||
|
||||
|
||||
<H2><A NAME=".REFERENCED"></A> <A NAME="ss9.13">9.13</A> <A HREF="ca65.html#toc9.13"><CODE>.REF, .REFERENCED</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. The function expects an identifier as argument in braces.
|
||||
The argument is evaluated, and the function yields "true" if the identifier
|
||||
is a symbol that has already been referenced somewhere in the source file up
|
||||
to the current position. Otherwise the function yields false. As an example,
|
||||
the <CODE>
|
||||
<A HREF="ca65-10.html#.IFREF">.IFREF</A></CODE> statement may be replaced by</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.if .referenced(a)
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>See: <CODE>
|
||||
<A HREF="ca65-10.html#.DEFINED">.DEFINED</A></CODE></P>
|
||||
|
||||
|
||||
<H2><A NAME=".RIGHT"></A> <A NAME="ss9.14">9.14</A> <A HREF="ca65.html#toc9.14"><CODE>.RIGHT</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. Extracts the right part of a given token list.</P>
|
||||
<P>Syntax:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.RIGHT (<int expr>, <token list>)
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>The first integer expression gives the number of tokens to extract from the
|
||||
token list. The second argument is the token list itself. The token list
|
||||
may optionally be enclosed into curly braces. This allows the inclusion of
|
||||
tokens that would otherwise terminate the list (the closing right paren in
|
||||
the given case).</P>
|
||||
<P>See also the <CODE>
|
||||
<A HREF="#.LEFT">.LEFT</A></CODE> and <CODE>
|
||||
<A HREF="#.MID">.MID</A></CODE> builtin functions.</P>
|
||||
|
||||
|
||||
<H2><A NAME=".SIZEOF"></A> <A NAME="ss9.15">9.15</A> <A HREF="ca65.html#toc9.15"><CODE>.SIZEOF</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P><CODE>.SIZEOF</CODE> is a pseudo function that returns the size of its argument. The
|
||||
argument can be a struct/union, a struct member, a procedure, or a label. In
|
||||
case of a procedure or label, its size is defined by the amount of data
|
||||
placed in the segment where the label is relative to. If a line of code
|
||||
switches segments (for example in a macro) data placed in other segments
|
||||
does not count for the size.</P>
|
||||
<P>Please note that a symbol or scope must exist, before it is used together with
|
||||
<CODE>.SIZEOF</CODE> (this may get relaxed later, but will always be true for scopes).
|
||||
A scope has preference over a symbol with the same name, so if the last part
|
||||
of a name represents both, a scope and a symbol, the scope is chosen over the
|
||||
symbol.</P>
|
||||
<P>After the following code:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.struct Point ; Struct size = 4
|
||||
xcoord .word
|
||||
xcoord .word
|
||||
.endstruct
|
||||
|
||||
P: .tag Point ; Declare a point
|
||||
@P: .tag Point ; Declare another point
|
||||
|
||||
.code
|
||||
.proc Code
|
||||
nop
|
||||
.proc Inner
|
||||
nop
|
||||
.endproc
|
||||
nop
|
||||
.endproc
|
||||
|
||||
.proc Data
|
||||
.data ; Segment switch!!!
|
||||
.res 4
|
||||
.endproc
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B><CODE>.sizeof(Point)</CODE></B><DD><P>will have the value 4, because this is the size of struct <CODE>Point</CODE>.</P>
|
||||
|
||||
<DT><B><CODE>.sizeof(Point::xcoord)</CODE></B><DD><P>will have the value 2, because this is the size of the member <CODE>xcoord</CODE>
|
||||
in struct <CODE>Point</CODE>.</P>
|
||||
|
||||
<DT><B><CODE>.sizeof(P)</CODE></B><DD><P>will have the value 4, this is the size of the data declared on the same
|
||||
source line as the label <CODE>P</CODE>, which is in the same segment that <CODE>P</CODE>
|
||||
is relative to.</P>
|
||||
|
||||
<DT><B><CODE>.sizeof(@P)</CODE></B><DD><P>will have the value 4, see above. The example demonstrates that <CODE>.SIZEOF</CODE>
|
||||
does also work for cheap local symbols.</P>
|
||||
|
||||
<DT><B><CODE>.sizeof(Code)</CODE></B><DD><P>will have the value 3, since this is amount of data emitted into the code
|
||||
segment, the segment that was active when <CODE>Code</CODE> was entered. Note that
|
||||
this value includes the amount of data emitted in child scopes (in this
|
||||
case <CODE>Code::Inner</CODE>).</P>
|
||||
|
||||
<DT><B><CODE>.sizeof(Code::Inner)</CODE></B><DD><P>will have the value 1 as expected.</P>
|
||||
|
||||
<DT><B><CODE>.sizeof(Data)</CODE></B><DD><P>will have the value 0. Data is emitted within the scope <CODE>Data</CODE>, but since
|
||||
the segment is switched after entry, this data is emitted into another
|
||||
segment.</P>
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".STRAT"></A> <A NAME="ss9.16">9.16</A> <A HREF="ca65.html#toc9.16"><CODE>.STRAT</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. The function accepts a string and an index as
|
||||
arguments and returns the value of the character at the given position
|
||||
as an integer value. The index is zero based.</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro M Arg
|
||||
; Check if the argument string starts with '#'
|
||||
.if (.strat (Arg, 0) = '#')
|
||||
...
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".SPRINTF"></A> <A NAME="ss9.17">9.17</A> <A HREF="ca65.html#toc9.17"><CODE>.SPRINTF</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. It expects a format string as first argument. The number
|
||||
and type of the following arguments depend on the format string. The format
|
||||
string is similar to the one of the C <CODE>printf</CODE> function. Missing things
|
||||
are: Length modifiers, variable width.</P>
|
||||
<P>The result of the function is a string.</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
num = 3
|
||||
|
||||
; Generate an identifier:
|
||||
.ident (.sprintf ("%s%03d", "label", num)):
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".STRING"></A> <A NAME="ss9.18">9.18</A> <A HREF="ca65.html#toc9.18"><CODE>.STRING</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. The function accepts an argument in braces and converts
|
||||
this argument into a string constant. The argument may be an identifier, or
|
||||
a constant numeric value.</P>
|
||||
<P>Since you can use a string in the first place, the use of the function may
|
||||
not be obvious. However, it is useful in macros, or more complex setups.</P>
|
||||
<P>Example:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
; Emulate other assemblers:
|
||||
.macro section name
|
||||
.segment .string(name)
|
||||
.endmacro
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".STRLEN"></A> <A NAME="ss9.19">9.19</A> <A HREF="ca65.html#toc9.19"><CODE>.STRLEN</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. The function accepts a string argument in braces and
|
||||
evaluates to the length of the string.</P>
|
||||
<P>Example:</P>
|
||||
<P>The following macro encodes a string as a pascal style string with
|
||||
a leading length byte.</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro PString Arg
|
||||
.byte .strlen(Arg), Arg
|
||||
.endmacro
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".TCOUNT"></A> <A NAME="ss9.20">9.20</A> <A HREF="ca65.html#toc9.20"><CODE>.TCOUNT</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. The function accepts a token list in braces. The function
|
||||
result is the number of tokens given as argument. The token list may
|
||||
optionally be enclosed into curly braces which are not considered part of
|
||||
the list and not counted. Enclosement in curly braces allows the inclusion
|
||||
of tokens that would otherwise terminate the list (the closing right paren
|
||||
in the given case).</P>
|
||||
<P>Example:</P>
|
||||
<P>The <CODE>ldax</CODE> macro accepts the '#' token to denote immediate addressing (as
|
||||
with the normal 6502 instructions). To translate it into two separate 8 bit
|
||||
load instructions, the '#' token has to get stripped from the argument:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.macro ldax arg
|
||||
.if (.match (.mid (0, 1, {arg}), #))
|
||||
; ldax called with immediate operand
|
||||
lda #<(.right (.tcount ({arg})-1, {arg}))
|
||||
ldx #>(.right (.tcount ({arg})-1, {arg}))
|
||||
.else
|
||||
...
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME=".XMATCH"></A> <A NAME="ss9.21">9.21</A> <A HREF="ca65.html#toc9.21"><CODE>.XMATCH</CODE></A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Builtin function. Matches two token lists against each other. This is
|
||||
most useful within macros, since macros are not stored as strings, but
|
||||
as lists of tokens.</P>
|
||||
<P>The syntax is</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
.XMATCH(<token list #1>, <token list #2>)
|
||||
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
<P>Both token list may contain arbitrary tokens with the exception of the
|
||||
terminator token (comma resp. right parenthesis) and</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>end-of-line</LI>
|
||||
<LI>end-of-file</LI>
|
||||
</UL>
|
||||
</P>
|
||||
<P>The token lists may optionally be enclosed into curly braces. This allows
|
||||
the inclusion of tokens that would otherwise terminate the list (the closing
|
||||
right paren in the given case). Often a macro parameter is used for any of
|
||||
the token lists.</P>
|
||||
<P>The function compares tokens <EM>and</EM> token values. If you need a function
|
||||
that just compares the type of tokens, have a look at the <CODE>
|
||||
<A HREF="#.MATCH">.MATCH</A></CODE> function.</P>
|
||||
<P>See: <CODE>
|
||||
<A HREF="#.MATCH">.MATCH</A></CODE></P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-10.html">Next</A>
|
||||
<A HREF="ca65-8.html">Previous</A>
|
||||
<A HREF="ca65.html#toc9">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
283
usr/share/doc/cc65/webdoc/ca65.html
Normal file
283
usr/share/doc/cc65/webdoc/ca65.html
Normal file
|
@ -0,0 +1,283 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65 Users Guide</TITLE>
|
||||
<LINK HREF="ca65-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>ca65 Users Guide</H1>
|
||||
|
||||
<H2>Ullrich von Bassewitz,
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A></H2>19.07.2000, 29.11.2000, 02.10.2001
|
||||
<HR>
|
||||
<EM>ca65 is a powerful macro assembler for the 6502, 65C02 and 65816 CPUs. It is
|
||||
used as a companion assembler for the cc65 crosscompiler, but it may also be
|
||||
used as a standalone product.</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="ca65-1.html">Overview</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc1.1">1.1</A> <A HREF="ca65-1.html#ss1.1">Design criteria</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="ca65-2.html">Usage</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc2.1">2.1</A> <A HREF="ca65-2.html#ss2.1">Command line option overview</A>
|
||||
<LI><A NAME="toc2.2">2.2</A> <A HREF="ca65-2.html#ss2.2">Command line options in detail</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="ca65-3.html">Input format</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc3.1">3.1</A> <A HREF="ca65-3.html#ss3.1">Assembler syntax</A>
|
||||
<LI><A NAME="toc3.2">3.2</A> <A HREF="ca65-3.html#ss3.2">65816 mode</A>
|
||||
<LI><A NAME="toc3.3">3.3</A> <A HREF="ca65-3.html#ss3.3">6502X mode</A>
|
||||
<LI><A NAME="toc3.4">3.4</A> <A HREF="ca65-3.html#ss3.4">sweet16 mode</A>
|
||||
<LI><A NAME="toc3.5">3.5</A> <A HREF="ca65-3.html#ss3.5">Number format</A>
|
||||
<LI><A NAME="toc3.6">3.6</A> <A HREF="ca65-3.html#ss3.6">Conditional assembly</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="ca65-4.html">Expressions</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc4.1">4.1</A> <A HREF="ca65-4.html#ss4.1">Expression evaluation</A>
|
||||
<LI><A NAME="toc4.2">4.2</A> <A HREF="ca65-4.html#ss4.2">Size of an expression result</A>
|
||||
<LI><A NAME="toc4.3">4.3</A> <A HREF="ca65-4.html#ss4.3">Boolean expressions</A>
|
||||
<LI><A NAME="toc4.4">4.4</A> <A HREF="ca65-4.html#ss4.4">Constant expressions</A>
|
||||
<LI><A NAME="toc4.5">4.5</A> <A HREF="ca65-4.html#ss4.5">Available operators</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="ca65-5.html">Symbols and labels</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc5.1">5.1</A> <A HREF="ca65-5.html#ss5.1">Numeric constants</A>
|
||||
<LI><A NAME="toc5.2">5.2</A> <A HREF="ca65-5.html#ss5.2">Standard labels</A>
|
||||
<LI><A NAME="toc5.3">5.3</A> <A HREF="ca65-5.html#ss5.3">Local labels and symbols</A>
|
||||
<LI><A NAME="toc5.4">5.4</A> <A HREF="ca65-5.html#ss5.4">Cheap local labels</A>
|
||||
<LI><A NAME="toc5.5">5.5</A> <A HREF="ca65-5.html#ss5.5">Unnamed labels</A>
|
||||
<LI><A NAME="toc5.6">5.6</A> <A HREF="ca65-5.html#ss5.6">Using macros to define labels and constants</A>
|
||||
<LI><A NAME="toc5.7">5.7</A> <A HREF="ca65-5.html#ss5.7">Symbols and <CODE>.DEBUGINFO</CODE></A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc6">6.</A> <A HREF="ca65-6.html">Scopes</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc6.1">6.1</A> <A HREF="ca65-6.html#ss6.1">Global scope</A>
|
||||
<LI><A NAME="toc6.2">6.2</A> <A HREF="ca65-6.html#ss6.2">Cheap locals</A>
|
||||
<LI><A NAME="toc6.3">6.3</A> <A HREF="ca65-6.html#ss6.3">Generic nested scopes</A>
|
||||
<LI><A NAME="toc6.4">6.4</A> <A HREF="ca65-6.html#ss6.4">Nested procedures</A>
|
||||
<LI><A NAME="toc6.5">6.5</A> <A HREF="ca65-6.html#ss6.5">Structs, unions and enums</A>
|
||||
<LI><A NAME="toc6.6">6.6</A> <A HREF="ca65-6.html#ss6.6">Explicit scope specification</A>
|
||||
<LI><A NAME="toc6.7">6.7</A> <A HREF="ca65-6.html#ss6.7">Scope search order</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc7">7.</A> <A HREF="ca65-7.html">Address sizes and memory models</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc7.1">7.1</A> <A HREF="ca65-7.html#ss7.1">Address sizes</A>
|
||||
<LI><A NAME="toc7.2">7.2</A> <A HREF="ca65-7.html#ss7.2">Address sizes of segments</A>
|
||||
<LI><A NAME="toc7.3">7.3</A> <A HREF="ca65-7.html#ss7.3">Address sizes of symbols</A>
|
||||
<LI><A NAME="toc7.4">7.4</A> <A HREF="ca65-7.html#ss7.4">Memory models</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc8">8.</A> <A HREF="ca65-8.html">Pseudo variables</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc8.1">8.1</A> <A HREF="ca65-8.html#ss8.1"><CODE>*</CODE></A>
|
||||
<LI><A NAME="toc8.2">8.2</A> <A HREF="ca65-8.html#ss8.2"><CODE>.CPU</CODE></A>
|
||||
<LI><A NAME="toc8.3">8.3</A> <A HREF="ca65-8.html#ss8.3"><CODE>.PARAMCOUNT</CODE></A>
|
||||
<LI><A NAME="toc8.4">8.4</A> <A HREF="ca65-8.html#ss8.4"><CODE>.TIME</CODE></A>
|
||||
<LI><A NAME="toc8.5">8.5</A> <A HREF="ca65-8.html#ss8.5"><CODE>.VERSION</CODE></A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc9">9.</A> <A HREF="ca65-9.html">Pseudo functions</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc9.1">9.1</A> <A HREF="ca65-9.html#ss9.1"><CODE>.BANKBYTE</CODE></A>
|
||||
<LI><A NAME="toc9.2">9.2</A> <A HREF="ca65-9.html#ss9.2"><CODE>.BLANK</CODE></A>
|
||||
<LI><A NAME="toc9.3">9.3</A> <A HREF="ca65-9.html#ss9.3"><CODE>.CONCAT</CODE></A>
|
||||
<LI><A NAME="toc9.4">9.4</A> <A HREF="ca65-9.html#ss9.4"><CODE>.CONST</CODE></A>
|
||||
<LI><A NAME="toc9.5">9.5</A> <A HREF="ca65-9.html#ss9.5"><CODE>.HIBYTE</CODE></A>
|
||||
<LI><A NAME="toc9.6">9.6</A> <A HREF="ca65-9.html#ss9.6"><CODE>.HIWORD</CODE></A>
|
||||
<LI><A NAME="toc9.7">9.7</A> <A HREF="ca65-9.html#ss9.7"><CODE>.IDENT</CODE></A>
|
||||
<LI><A NAME="toc9.8">9.8</A> <A HREF="ca65-9.html#ss9.8"><CODE>.LEFT</CODE></A>
|
||||
<LI><A NAME="toc9.9">9.9</A> <A HREF="ca65-9.html#ss9.9"><CODE>.LOBYTE</CODE></A>
|
||||
<LI><A NAME="toc9.10">9.10</A> <A HREF="ca65-9.html#ss9.10"><CODE>.LOWORD</CODE></A>
|
||||
<LI><A NAME="toc9.11">9.11</A> <A HREF="ca65-9.html#ss9.11"><CODE>.MATCH</CODE></A>
|
||||
<LI><A NAME="toc9.12">9.12</A> <A HREF="ca65-9.html#ss9.12"><CODE>.MID</CODE></A>
|
||||
<LI><A NAME="toc9.13">9.13</A> <A HREF="ca65-9.html#ss9.13"><CODE>.REF, .REFERENCED</CODE></A>
|
||||
<LI><A NAME="toc9.14">9.14</A> <A HREF="ca65-9.html#ss9.14"><CODE>.RIGHT</CODE></A>
|
||||
<LI><A NAME="toc9.15">9.15</A> <A HREF="ca65-9.html#ss9.15"><CODE>.SIZEOF</CODE></A>
|
||||
<LI><A NAME="toc9.16">9.16</A> <A HREF="ca65-9.html#ss9.16"><CODE>.STRAT</CODE></A>
|
||||
<LI><A NAME="toc9.17">9.17</A> <A HREF="ca65-9.html#ss9.17"><CODE>.SPRINTF</CODE></A>
|
||||
<LI><A NAME="toc9.18">9.18</A> <A HREF="ca65-9.html#ss9.18"><CODE>.STRING</CODE></A>
|
||||
<LI><A NAME="toc9.19">9.19</A> <A HREF="ca65-9.html#ss9.19"><CODE>.STRLEN</CODE></A>
|
||||
<LI><A NAME="toc9.20">9.20</A> <A HREF="ca65-9.html#ss9.20"><CODE>.TCOUNT</CODE></A>
|
||||
<LI><A NAME="toc9.21">9.21</A> <A HREF="ca65-9.html#ss9.21"><CODE>.XMATCH</CODE></A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc10">10.</A> <A HREF="ca65-10.html">Control commands</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc10.1">10.1</A> <A HREF="ca65-10.html#ss10.1"><CODE>.A16</CODE></A>
|
||||
<LI><A NAME="toc10.2">10.2</A> <A HREF="ca65-10.html#ss10.2"><CODE>.A8</CODE></A>
|
||||
<LI><A NAME="toc10.3">10.3</A> <A HREF="ca65-10.html#ss10.3"><CODE>.ADDR</CODE></A>
|
||||
<LI><A NAME="toc10.4">10.4</A> <A HREF="ca65-10.html#ss10.4"><CODE>.ALIGN</CODE></A>
|
||||
<LI><A NAME="toc10.5">10.5</A> <A HREF="ca65-10.html#ss10.5"><CODE>.ASCIIZ</CODE></A>
|
||||
<LI><A NAME="toc10.6">10.6</A> <A HREF="ca65-10.html#ss10.6"><CODE>.ASSERT</CODE></A>
|
||||
<LI><A NAME="toc10.7">10.7</A> <A HREF="ca65-10.html#ss10.7"><CODE>.AUTOIMPORT</CODE></A>
|
||||
<LI><A NAME="toc10.8">10.8</A> <A HREF="ca65-10.html#ss10.8"><CODE>.BSS</CODE></A>
|
||||
<LI><A NAME="toc10.9">10.9</A> <A HREF="ca65-10.html#ss10.9"><CODE>.BYT, .BYTE</CODE></A>
|
||||
<LI><A NAME="toc10.10">10.10</A> <A HREF="ca65-10.html#ss10.10"><CODE>.CASE</CODE></A>
|
||||
<LI><A NAME="toc10.11">10.11</A> <A HREF="ca65-10.html#ss10.11"><CODE>.CHARMAP</CODE></A>
|
||||
<LI><A NAME="toc10.12">10.12</A> <A HREF="ca65-10.html#ss10.12"><CODE>.CODE</CODE></A>
|
||||
<LI><A NAME="toc10.13">10.13</A> <A HREF="ca65-10.html#ss10.13"><CODE>.CONDES</CODE></A>
|
||||
<LI><A NAME="toc10.14">10.14</A> <A HREF="ca65-10.html#ss10.14"><CODE>.CONSTRUCTOR</CODE></A>
|
||||
<LI><A NAME="toc10.15">10.15</A> <A HREF="ca65-10.html#ss10.15"><CODE>.DATA</CODE></A>
|
||||
<LI><A NAME="toc10.16">10.16</A> <A HREF="ca65-10.html#ss10.16"><CODE>.DBYT</CODE></A>
|
||||
<LI><A NAME="toc10.17">10.17</A> <A HREF="ca65-10.html#ss10.17"><CODE>.DEBUGINFO</CODE></A>
|
||||
<LI><A NAME="toc10.18">10.18</A> <A HREF="ca65-10.html#ss10.18"><CODE>.DEFINE</CODE></A>
|
||||
<LI><A NAME="toc10.19">10.19</A> <A HREF="ca65-10.html#ss10.19"><CODE>.DEF, .DEFINED</CODE></A>
|
||||
<LI><A NAME="toc10.20">10.20</A> <A HREF="ca65-10.html#ss10.20"><CODE>.DESTRUCTOR</CODE></A>
|
||||
<LI><A NAME="toc10.21">10.21</A> <A HREF="ca65-10.html#ss10.21"><CODE>.DWORD</CODE></A>
|
||||
<LI><A NAME="toc10.22">10.22</A> <A HREF="ca65-10.html#ss10.22"><CODE>.ELSE</CODE></A>
|
||||
<LI><A NAME="toc10.23">10.23</A> <A HREF="ca65-10.html#ss10.23"><CODE>.ELSEIF</CODE></A>
|
||||
<LI><A NAME="toc10.24">10.24</A> <A HREF="ca65-10.html#ss10.24"><CODE>.END</CODE></A>
|
||||
<LI><A NAME="toc10.25">10.25</A> <A HREF="ca65-10.html#ss10.25"><CODE>.ENDENUM</CODE></A>
|
||||
<LI><A NAME="toc10.26">10.26</A> <A HREF="ca65-10.html#ss10.26"><CODE>.ENDIF</CODE></A>
|
||||
<LI><A NAME="toc10.27">10.27</A> <A HREF="ca65-10.html#ss10.27"><CODE>.ENDMAC, .ENDMACRO</CODE></A>
|
||||
<LI><A NAME="toc10.28">10.28</A> <A HREF="ca65-10.html#ss10.28"><CODE>.ENDPROC</CODE></A>
|
||||
<LI><A NAME="toc10.29">10.29</A> <A HREF="ca65-10.html#ss10.29"><CODE>.ENDREP, .ENDREPEAT</CODE></A>
|
||||
<LI><A NAME="toc10.30">10.30</A> <A HREF="ca65-10.html#ss10.30"><CODE>.ENDSCOPE</CODE></A>
|
||||
<LI><A NAME="toc10.31">10.31</A> <A HREF="ca65-10.html#ss10.31"><CODE>.ENDSTRUCT</CODE></A>
|
||||
<LI><A NAME="toc10.32">10.32</A> <A HREF="ca65-10.html#ss10.32"><CODE>.ENUM</CODE></A>
|
||||
<LI><A NAME="toc10.33">10.33</A> <A HREF="ca65-10.html#ss10.33"><CODE>.ERROR</CODE></A>
|
||||
<LI><A NAME="toc10.34">10.34</A> <A HREF="ca65-10.html#ss10.34"><CODE>.EXITMAC, .EXITMACRO</CODE></A>
|
||||
<LI><A NAME="toc10.35">10.35</A> <A HREF="ca65-10.html#ss10.35"><CODE>.EXPORT</CODE></A>
|
||||
<LI><A NAME="toc10.36">10.36</A> <A HREF="ca65-10.html#ss10.36"><CODE>.EXPORTZP</CODE></A>
|
||||
<LI><A NAME="toc10.37">10.37</A> <A HREF="ca65-10.html#ss10.37"><CODE>.FARADDR</CODE></A>
|
||||
<LI><A NAME="toc10.38">10.38</A> <A HREF="ca65-10.html#ss10.38"><CODE>.FEATURE</CODE></A>
|
||||
<LI><A NAME="toc10.39">10.39</A> <A HREF="ca65-10.html#ss10.39"><CODE>.FILEOPT, .FOPT</CODE></A>
|
||||
<LI><A NAME="toc10.40">10.40</A> <A HREF="ca65-10.html#ss10.40"><CODE>.FORCEIMPORT</CODE></A>
|
||||
<LI><A NAME="toc10.41">10.41</A> <A HREF="ca65-10.html#ss10.41"><CODE>.GLOBAL</CODE></A>
|
||||
<LI><A NAME="toc10.42">10.42</A> <A HREF="ca65-10.html#ss10.42"><CODE>.GLOBALZP</CODE></A>
|
||||
<LI><A NAME="toc10.43">10.43</A> <A HREF="ca65-10.html#ss10.43"><CODE>.I16</CODE></A>
|
||||
<LI><A NAME="toc10.44">10.44</A> <A HREF="ca65-10.html#ss10.44"><CODE>.I8</CODE></A>
|
||||
<LI><A NAME="toc10.45">10.45</A> <A HREF="ca65-10.html#ss10.45"><CODE>.IF</CODE></A>
|
||||
<LI><A NAME="toc10.46">10.46</A> <A HREF="ca65-10.html#ss10.46"><CODE>.IFBLANK</CODE></A>
|
||||
<LI><A NAME="toc10.47">10.47</A> <A HREF="ca65-10.html#ss10.47"><CODE>.IFCONST</CODE></A>
|
||||
<LI><A NAME="toc10.48">10.48</A> <A HREF="ca65-10.html#ss10.48"><CODE>.IFDEF</CODE></A>
|
||||
<LI><A NAME="toc10.49">10.49</A> <A HREF="ca65-10.html#ss10.49"><CODE>.IFNBLANK</CODE></A>
|
||||
<LI><A NAME="toc10.50">10.50</A> <A HREF="ca65-10.html#ss10.50"><CODE>.IFNDEF</CODE></A>
|
||||
<LI><A NAME="toc10.51">10.51</A> <A HREF="ca65-10.html#ss10.51"><CODE>.IFNREF</CODE></A>
|
||||
<LI><A NAME="toc10.52">10.52</A> <A HREF="ca65-10.html#ss10.52"><CODE>.IFP02</CODE></A>
|
||||
<LI><A NAME="toc10.53">10.53</A> <A HREF="ca65-10.html#ss10.53"><CODE>.IFP816</CODE></A>
|
||||
<LI><A NAME="toc10.54">10.54</A> <A HREF="ca65-10.html#ss10.54"><CODE>.IFPC02</CODE></A>
|
||||
<LI><A NAME="toc10.55">10.55</A> <A HREF="ca65-10.html#ss10.55"><CODE>.IFPSC02</CODE></A>
|
||||
<LI><A NAME="toc10.56">10.56</A> <A HREF="ca65-10.html#ss10.56"><CODE>.IFREF</CODE></A>
|
||||
<LI><A NAME="toc10.57">10.57</A> <A HREF="ca65-10.html#ss10.57"><CODE>.IMPORT</CODE></A>
|
||||
<LI><A NAME="toc10.58">10.58</A> <A HREF="ca65-10.html#ss10.58"><CODE>.IMPORTZP</CODE></A>
|
||||
<LI><A NAME="toc10.59">10.59</A> <A HREF="ca65-10.html#ss10.59"><CODE>.INCBIN</CODE></A>
|
||||
<LI><A NAME="toc10.60">10.60</A> <A HREF="ca65-10.html#ss10.60"><CODE>.INCLUDE</CODE></A>
|
||||
<LI><A NAME="toc10.61">10.61</A> <A HREF="ca65-10.html#ss10.61"><CODE>.INTERRUPTOR</CODE></A>
|
||||
<LI><A NAME="toc10.62">10.62</A> <A HREF="ca65-10.html#ss10.62"><CODE>.LINECONT</CODE></A>
|
||||
<LI><A NAME="toc10.63">10.63</A> <A HREF="ca65-10.html#ss10.63"><CODE>.LIST</CODE></A>
|
||||
<LI><A NAME="toc10.64">10.64</A> <A HREF="ca65-10.html#ss10.64"><CODE>.LISTBYTES</CODE></A>
|
||||
<LI><A NAME="toc10.65">10.65</A> <A HREF="ca65-10.html#ss10.65"><CODE>.LOCAL</CODE></A>
|
||||
<LI><A NAME="toc10.66">10.66</A> <A HREF="ca65-10.html#ss10.66"><CODE>.LOCALCHAR</CODE></A>
|
||||
<LI><A NAME="toc10.67">10.67</A> <A HREF="ca65-10.html#ss10.67"><CODE>.MACPACK</CODE></A>
|
||||
<LI><A NAME="toc10.68">10.68</A> <A HREF="ca65-10.html#ss10.68"><CODE>.MAC, .MACRO</CODE></A>
|
||||
<LI><A NAME="toc10.69">10.69</A> <A HREF="ca65-10.html#ss10.69"><CODE>.ORG</CODE></A>
|
||||
<LI><A NAME="toc10.70">10.70</A> <A HREF="ca65-10.html#ss10.70"><CODE>.OUT</CODE></A>
|
||||
<LI><A NAME="toc10.71">10.71</A> <A HREF="ca65-10.html#ss10.71"><CODE>.P02</CODE></A>
|
||||
<LI><A NAME="toc10.72">10.72</A> <A HREF="ca65-10.html#ss10.72"><CODE>.P816</CODE></A>
|
||||
<LI><A NAME="toc10.73">10.73</A> <A HREF="ca65-10.html#ss10.73"><CODE>.PAGELEN, .PAGELENGTH</CODE></A>
|
||||
<LI><A NAME="toc10.74">10.74</A> <A HREF="ca65-10.html#ss10.74"><CODE>.PC02</CODE></A>
|
||||
<LI><A NAME="toc10.75">10.75</A> <A HREF="ca65-10.html#ss10.75"><CODE>.POPSEG</CODE></A>
|
||||
<LI><A NAME="toc10.76">10.76</A> <A HREF="ca65-10.html#ss10.76"><CODE>.PROC</CODE></A>
|
||||
<LI><A NAME="toc10.77">10.77</A> <A HREF="ca65-10.html#ss10.77"><CODE>.PSC02</CODE></A>
|
||||
<LI><A NAME="toc10.78">10.78</A> <A HREF="ca65-10.html#ss10.78"><CODE>.PUSHSEG</CODE></A>
|
||||
<LI><A NAME="toc10.79">10.79</A> <A HREF="ca65-10.html#ss10.79"><CODE>.RELOC</CODE></A>
|
||||
<LI><A NAME="toc10.80">10.80</A> <A HREF="ca65-10.html#ss10.80"><CODE>.REPEAT</CODE></A>
|
||||
<LI><A NAME="toc10.81">10.81</A> <A HREF="ca65-10.html#ss10.81"><CODE>.RES</CODE></A>
|
||||
<LI><A NAME="toc10.82">10.82</A> <A HREF="ca65-10.html#ss10.82"><CODE>.RODATA</CODE></A>
|
||||
<LI><A NAME="toc10.83">10.83</A> <A HREF="ca65-10.html#ss10.83"><CODE>.SCOPE</CODE></A>
|
||||
<LI><A NAME="toc10.84">10.84</A> <A HREF="ca65-10.html#ss10.84"><CODE>.SEGMENT</CODE></A>
|
||||
<LI><A NAME="toc10.85">10.85</A> <A HREF="ca65-10.html#ss10.85"><CODE>.SETCPU</CODE></A>
|
||||
<LI><A NAME="toc10.86">10.86</A> <A HREF="ca65-10.html#ss10.86"><CODE>.SMART</CODE></A>
|
||||
<LI><A NAME="toc10.87">10.87</A> <A HREF="ca65-10.html#ss10.87"><CODE>.STRUCT</CODE></A>
|
||||
<LI><A NAME="toc10.88">10.88</A> <A HREF="ca65-10.html#ss10.88"><CODE>.SUNPLUS</CODE></A>
|
||||
<LI><A NAME="toc10.89">10.89</A> <A HREF="ca65-10.html#ss10.89"><CODE>.TAG</CODE></A>
|
||||
<LI><A NAME="toc10.90">10.90</A> <A HREF="ca65-10.html#ss10.90"><CODE>.WARNING</CODE></A>
|
||||
<LI><A NAME="toc10.91">10.91</A> <A HREF="ca65-10.html#ss10.91"><CODE>.WORD</CODE></A>
|
||||
<LI><A NAME="toc10.92">10.92</A> <A HREF="ca65-10.html#ss10.92"><CODE>.ZEROPAGE</CODE></A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc11">11.</A> <A HREF="ca65-11.html">Macros</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc11.1">11.1</A> <A HREF="ca65-11.html#ss11.1">Introduction</A>
|
||||
<LI><A NAME="toc11.2">11.2</A> <A HREF="ca65-11.html#ss11.2">Macros without parameters</A>
|
||||
<LI><A NAME="toc11.3">11.3</A> <A HREF="ca65-11.html#ss11.3">Parametrized macros</A>
|
||||
<LI><A NAME="toc11.4">11.4</A> <A HREF="ca65-11.html#ss11.4">Detecting parameter types</A>
|
||||
<LI><A NAME="toc11.5">11.5</A> <A HREF="ca65-11.html#ss11.5">Recursive macros</A>
|
||||
<LI><A NAME="toc11.6">11.6</A> <A HREF="ca65-11.html#ss11.6">Local symbols inside macros</A>
|
||||
<LI><A NAME="toc11.7">11.7</A> <A HREF="ca65-11.html#ss11.7">C style macros</A>
|
||||
<LI><A NAME="toc11.8">11.8</A> <A HREF="ca65-11.html#ss11.8">Characters in macros</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc12">12.</A> <A HREF="ca65-12.html">Macro packages</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc12.1">12.1</A> <A HREF="ca65-12.html#ss12.1"><CODE>.MACPACK generic</CODE></A>
|
||||
<LI><A NAME="toc12.2">12.2</A> <A HREF="ca65-12.html#ss12.2"><CODE>.MACPACK longbranch</CODE></A>
|
||||
<LI><A NAME="toc12.3">12.3</A> <A HREF="ca65-12.html#ss12.3"><CODE>.MACPACK cbm</CODE></A>
|
||||
<LI><A NAME="toc12.4">12.4</A> <A HREF="ca65-12.html#ss12.4"><CODE>.MACPACK cpu</CODE></A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc13">13.</A> <A HREF="ca65-13.html">Predefined constants</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc14">14.</A> <A HREF="ca65-14.html">Structs and unions</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc14.1">14.1</A> <A HREF="ca65-14.html#ss14.1">Overview</A>
|
||||
<LI><A NAME="toc14.2">14.2</A> <A HREF="ca65-14.html#ss14.2">Declaration</A>
|
||||
<LI><A NAME="toc14.3">14.3</A> <A HREF="ca65-14.html#ss14.3">The <CODE>.TAG</CODE> keyword</A>
|
||||
<LI><A NAME="toc14.4">14.4</A> <A HREF="ca65-14.html#ss14.4">Limitations</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc15">15.</A> <A HREF="ca65-15.html">Module constructors/destructors</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc15.1">15.1</A> <A HREF="ca65-15.html#ss15.1">Overview</A>
|
||||
<LI><A NAME="toc15.2">15.2</A> <A HREF="ca65-15.html#ss15.2">Calling order</A>
|
||||
<LI><A NAME="toc15.3">15.3</A> <A HREF="ca65-15.html#ss15.3">Pitfalls</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc16">16.</A> <A HREF="ca65-16.html">Porting sources from other assemblers</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc16.1">16.1</A> <A HREF="ca65-16.html#ss16.1">TASS</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc17">17.</A> <A HREF="ca65-17.html">Bugs/Feedback</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc18">18.</A> <A HREF="ca65-18.html">Copyright</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/ca65html-1.html
Normal file
30
usr/share/doc/cc65/webdoc/ca65html-1.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65html Users Guide: Overview</TITLE>
|
||||
<LINK HREF="ca65html-2.html" REL=next>
|
||||
|
||||
<LINK HREF="ca65html.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65html-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="ca65html.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1.</A> <A HREF="ca65html.html#toc1">Overview</A></H2>
|
||||
|
||||
|
||||
<P>ca65html converts assembler source files written for use with the <CODE>
|
||||
<A HREF="ca65.html">ca65</A></CODE> crossassembler into HTML. It is a standalone
|
||||
tool written in Perl, and as such it does not understand the structure of
|
||||
assembler sources in the same depth as ca65 does, so it may fail in very rare
|
||||
cases. In all other cases it generates very nice output.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65html-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="ca65html.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
176
usr/share/doc/cc65/webdoc/ca65html-2.html
Normal file
176
usr/share/doc/cc65/webdoc/ca65html-2.html
Normal file
|
@ -0,0 +1,176 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65html Users Guide: Usage</TITLE>
|
||||
<LINK HREF="ca65html-3.html" REL=next>
|
||||
<LINK HREF="ca65html-1.html" REL=previous>
|
||||
<LINK HREF="ca65html.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65html-3.html">Next</A>
|
||||
<A HREF="ca65html-1.html">Previous</A>
|
||||
<A HREF="ca65html.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2.</A> <A HREF="ca65html.html#toc2">Usage</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss2.1">2.1</A> <A HREF="ca65html.html#toc2.1">Command line option overview</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The HTML converter accepts the following options:</P>
|
||||
<P>
|
||||
<BLOCKQUOTE><CODE>
|
||||
<PRE>
|
||||
---------------------------------------------------------------------------
|
||||
Usage: ca65html [options] file ...
|
||||
Options:
|
||||
--bgcolor c Use background color c instead of #FFFFFF
|
||||
--colorize Colorize the output (generates non standard HTML)
|
||||
--commentcolor c Use color c for comments instead of #B22222
|
||||
--crefs Generate references to the C source file(s)
|
||||
--ctrlcolor c Use color c for directives instead of #228B22
|
||||
--cvttabs Convert tabs to spaces in the output
|
||||
--help This text
|
||||
--htmldir dir Specify directory for HTML files
|
||||
--indexcols n Use n columns on index page (default 6)
|
||||
--indexname file Use file for the index file instead of index.html
|
||||
--indexpage Create an index page
|
||||
--indextitle title Use title as the index title instead of Index
|
||||
--keywordcolor c Use color c for keywords instead of #A020F0
|
||||
--linelabels Generate a linexxx HTML label for each line
|
||||
--linenumbers Add line numbers to the output
|
||||
--linkstyle style Use the given link style
|
||||
--replaceext Replace source extension instead of appending .html
|
||||
--textcolor c Use text color c instead of #000000
|
||||
--verbose Be more verbose
|
||||
---------------------------------------------------------------------------
|
||||
</PRE>
|
||||
</CODE></BLOCKQUOTE>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss2.2">2.2</A> <A HREF="ca65html.html#toc2.2">Command line options in detail</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Here is a description of all the command line options:</P>
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>--bgcolor c</CODE></B><DD><P>Set the background color. The argument c must be a valid HTML color, usually
|
||||
given as RGB triplet in the form <CODE>#rrggbb</CODE>, where r, g and b are the
|
||||
respective red, green and blue parts as two digit hex values. The default is
|
||||
<CODE>#FFFFFF</CODE> (white). This color is used in the <CODE><body></CODE> tag of the
|
||||
generated HTML output.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--colorize</CODE></B><DD><P>Colorize the output. The converter outputs processor instructions, assembler
|
||||
control commands and comments in different colors.</P>
|
||||
<P>While this make the output look very nice, it generates invalid HTML,
|
||||
because using colors in a <CODE><pre></CODE> environment is not allowed.
|
||||
However, most browsers display it well, and it is used by several other
|
||||
tools, so it's up to you.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--commentcolor c</CODE></B><DD><P>Set the color used for comments. The argument c must be a valid HTML color,
|
||||
usually given as RGB triplet in the form <CODE>#rrggbb</CODE>, where r, g and b are
|
||||
the respective red, green and blue parts as two digit hex values. The
|
||||
default is <CODE>#B22222</CODE> (red).</P>
|
||||
<P>Note that this option has no effect if <CODE>--colorize</CODE> is not also given.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--crefs</CODE></B><DD><P>Generate references to the C file, when a <CODE>.dbg</CODE> command is found with a
|
||||
file name. The converter assumes that the C source was also converted into
|
||||
HTML (for example by use of <CODE>c2html</CODE>), has the name <CODE>file.c.html</CODE>, and
|
||||
lives in the same directory as the assembler file. If the <CODE>.dbg</CODE>
|
||||
directive specifies a line, a link to the correct line in the C file is
|
||||
generated, using a label in the form <CODE>linexxx</CODE>, as it is created by
|
||||
<CODE>c2html</CODE> by use of the <CODE>-n</CODE> option.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--commentcolor c</CODE></B><DD><P>Set the color used for assembler control commands. The argument c must be a
|
||||
valid HTML color, usually given as RGB triplet in the form <CODE>#rrggbb</CODE>,
|
||||
where r, g and b are the respective red, green and blue parts as two digit
|
||||
hex values. The default is <CODE>#228B22</CODE> (green).</P>
|
||||
<P>Note that this option has no effect if <CODE>--colorize</CODE> is not also given.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--cvttabs</CODE></B><DD><P>Convert tabs in the input into spaces in the output, assuming the standard
|
||||
tab width of 8. This is useful if the <CODE>--linenumbers</CODE> option is used to
|
||||
retain the indentation.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--help</CODE></B><DD><P>Print the command line option summary shown above.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--htmldir dir</CODE></B><DD><P>Specify an output directory for the generated HTML files.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--indexcols n</CODE></B><DD><P>Use n columns on the index page. This option has no effect if used without
|
||||
<CODE>--indexpage</CODE>.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--indexname name</CODE></B><DD><P>Use another index file name instead of <CODE>index.html</CODE>. This option has no
|
||||
effect if used without <CODE>--indexpage</CODE>.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--indexpage</CODE></B><DD><P>Causes the converter to generate an index page listing all label names and
|
||||
exports found in the converted files.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--indextitle title</CODE></B><DD><P>Use "title" as the title of the index page. This option has no effect if
|
||||
used without <CODE>--indexpage</CODE>.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--keywordcolor c</CODE></B><DD><P>Set the color used for processor instructions. The argument c must be a
|
||||
valid HTML color, usually given as RGB triplet in the form <CODE>#rrggbb</CODE>,
|
||||
where r, g and b are the respective red, green and blue parts as two digit
|
||||
hex values. The default is <CODE>#A020F0</CODE> (purple).</P>
|
||||
<P>Note that this option has no effect if <CODE>--colorize</CODE> is not also given.</P>
|
||||
|
||||
<DT><B><CODE>--linelabels</CODE></B><DD><P>Generate a label for each line using the name <CODE>linexxx</CODE> where xxx is the
|
||||
number of the line.</P>
|
||||
<P>Note: The converter will not make use of this label. Use this option if you
|
||||
have other HTML pages referencing the converted assembler file.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--linenumbers</CODE></B><DD><P>Generate line numbers on the left side of the output.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--linkstyle n</CODE></B><DD><P>Influences the style used when generating links for imports. If n is zero
|
||||
(the default), the converter creates a link to the actual symbol if it is
|
||||
defined somewhere in the input files. If not, it creates a link to the
|
||||
<CODE>.import</CODE> statement. If n is one, the converter will always generate a
|
||||
HTML link to <CODE>.import</CODE> statement.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--replaceext</CODE></B><DD><P>Replace the file extension of the input file instead of appending <CODE>.html</CODE>
|
||||
when generating the output file name.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--textcolor c</CODE></B><DD><P>Set the color for normal text. The argument c must be a valid HTML color,
|
||||
usually given as RGB triplet in the form <CODE>#rrggbb</CODE>, where r, g and b are
|
||||
the respective red, green and blue parts as two digit hex values. The
|
||||
default is <CODE>#000000</CODE> (black). This color is used in the <CODE><body></CODE>
|
||||
tag of the generated HTML output.</P>
|
||||
|
||||
|
||||
<DT><B><CODE>--verbose</CODE></B><DD><P>Increase the converter verbosity. Without this option, ca65html is quiet
|
||||
when working. If you have a slow machine and lots of files to convert, you
|
||||
may like a little bit more progress information.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65html-3.html">Next</A>
|
||||
<A HREF="ca65html-1.html">Previous</A>
|
||||
<A HREF="ca65html.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
74
usr/share/doc/cc65/webdoc/ca65html-3.html
Normal file
74
usr/share/doc/cc65/webdoc/ca65html-3.html
Normal file
|
@ -0,0 +1,74 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65html Users Guide: Peculiarities</TITLE>
|
||||
<LINK HREF="ca65html-4.html" REL=next>
|
||||
<LINK HREF="ca65html-2.html" REL=previous>
|
||||
<LINK HREF="ca65html.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65html-4.html">Next</A>
|
||||
<A HREF="ca65html-2.html">Previous</A>
|
||||
<A HREF="ca65html.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3.</A> <A HREF="ca65html.html#toc3">Peculiarities</A></H2>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss3.1">3.1</A> <A HREF="ca65html.html#toc3.1">Cross links</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Since ca65html is able to generate links between modules, the best way to use
|
||||
it is to supply all modules to it in one run, instead of running each file
|
||||
separately through it.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss3.2">3.2</A> <A HREF="ca65html.html#toc3.2">Include files</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>For now, ca65html will not read files included with <CODE>.include</CODE>. Specifying
|
||||
the include files as normal input files on the command line works in many
|
||||
cases.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss3.3">3.3</A> <A HREF="ca65html.html#toc3.3">Conversion errors</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Since ca65html does not really parse the input, but does most of its work
|
||||
applying text patterns, it doesn't know anything about scoping and advanced
|
||||
features of the assembler. This means that it may miss a label may choose the
|
||||
wrong color for an item in rare cases. Since it's just a tool for displaying
|
||||
sources in a nice form, I think that's ok. Anyway, if you find a conversion
|
||||
problem, you can send me a short piece of example input code. If possible, I
|
||||
will fix it.</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss3.4">3.4</A> <A HREF="ca65html.html#toc3.4">Colorization</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>While having colors in the output looks really nice, it has two drawbacks:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI>The output is not standard compliant HTML, because <CODE><font></CODE>
|
||||
tags are use in a <CODE><pre></CODE> environment. This works with all browsers
|
||||
I've tested, but it may not work with the one you're using.
|
||||
</LI>
|
||||
<LI>Since lots of <CODE><font></CODE> tags are created in the output, the size
|
||||
of the output file will literally explode. This seems to be the price, you
|
||||
have to pay for color...
|
||||
</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65html-4.html">Next</A>
|
||||
<A HREF="ca65html-2.html">Previous</A>
|
||||
<A HREF="ca65html.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/ca65html-4.html
Normal file
30
usr/share/doc/cc65/webdoc/ca65html-4.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65html Users Guide: Bugs/Feedback</TITLE>
|
||||
<LINK HREF="ca65html-5.html" REL=next>
|
||||
<LINK HREF="ca65html-3.html" REL=previous>
|
||||
<LINK HREF="ca65html.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65html-5.html">Next</A>
|
||||
<A HREF="ca65html-3.html">Previous</A>
|
||||
<A HREF="ca65html.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4.</A> <A HREF="ca65html.html#toc4">Bugs/Feedback</A></H2>
|
||||
|
||||
|
||||
<P>If you have problems using the converter, if you find any bugs, or if you're
|
||||
doing something interesting with the assembler, I would be glad to hear from
|
||||
you. Feel free to contact me by email (
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A>).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65html-5.html">Next</A>
|
||||
<A HREF="ca65html-3.html">Previous</A>
|
||||
<A HREF="ca65html.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
45
usr/share/doc/cc65/webdoc/ca65html-5.html
Normal file
45
usr/share/doc/cc65/webdoc/ca65html-5.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65html Users Guide: Copyright</TITLE>
|
||||
<LINK HREF="ca65html-4.html" REL=previous>
|
||||
<LINK HREF="ca65html.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
Next
|
||||
<A HREF="ca65html-4.html">Previous</A>
|
||||
<A HREF="ca65html.html#toc5">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s5">5.</A> <A HREF="ca65html.html#toc5">Copyright</A></H2>
|
||||
|
||||
|
||||
<P>ca65html is (C) Copyright 2000-2003 Ullrich von Bassewitz. For its use the
|
||||
following conditions apply:</P>
|
||||
<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.</P>
|
||||
<P>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:</P>
|
||||
<P>
|
||||
<OL>
|
||||
<LI> 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.</LI>
|
||||
<LI> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.</LI>
|
||||
<LI> This notice may not be removed or altered from any source
|
||||
distribution.</LI>
|
||||
</OL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
Next
|
||||
<A HREF="ca65html-4.html">Previous</A>
|
||||
<A HREF="ca65html.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
53
usr/share/doc/cc65/webdoc/ca65html.html
Normal file
53
usr/share/doc/cc65/webdoc/ca65html.html
Normal file
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>ca65html Users Guide</TITLE>
|
||||
<LINK HREF="ca65html-1.html" REL=next>
|
||||
|
||||
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="ca65html-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
<HR>
|
||||
<H1>ca65html Users Guide</H1>
|
||||
|
||||
<H2>Ullrich von Bassewitz,
|
||||
<A HREF="mailto:uz@cc65.org">uz@cc65.org</A></H2>2003-10-16
|
||||
<HR>
|
||||
<EM>ca65html is an assembler source to HTML converter. It is very useful if you
|
||||
want to publish your assembler sources in the web.</EM>
|
||||
<HR>
|
||||
<P>
|
||||
<H2><A NAME="toc1">1.</A> <A HREF="ca65html-1.html">Overview</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc2">2.</A> <A HREF="ca65html-2.html">Usage</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc2.1">2.1</A> <A HREF="ca65html-2.html#ss2.1">Command line option overview</A>
|
||||
<LI><A NAME="toc2.2">2.2</A> <A HREF="ca65html-2.html#ss2.2">Command line options in detail</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc3">3.</A> <A HREF="ca65html-3.html">Peculiarities</A></H2>
|
||||
|
||||
<UL>
|
||||
<LI><A NAME="toc3.1">3.1</A> <A HREF="ca65html-3.html#ss3.1">Cross links</A>
|
||||
<LI><A NAME="toc3.2">3.2</A> <A HREF="ca65html-3.html#ss3.2">Include files</A>
|
||||
<LI><A NAME="toc3.3">3.3</A> <A HREF="ca65html-3.html#ss3.3">Conversion errors</A>
|
||||
<LI><A NAME="toc3.4">3.4</A> <A HREF="ca65html-3.html#ss3.4">Colorization</A>
|
||||
</UL>
|
||||
<P>
|
||||
<H2><A NAME="toc4">4.</A> <A HREF="ca65html-4.html">Bugs/Feedback</A></H2>
|
||||
|
||||
<P>
|
||||
<H2><A NAME="toc5">5.</A> <A HREF="ca65html-5.html">Copyright</A></H2>
|
||||
|
||||
<HR>
|
||||
<A HREF="ca65html-1.html">Next</A>
|
||||
Previous
|
||||
Contents
|
||||
</BODY>
|
||||
</HTML>
|
39
usr/share/doc/cc65/webdoc/cbm610-1.html
Normal file
39
usr/share/doc/cc65/webdoc/cbm610-1.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 610 specific information for cc65: Overview</TITLE>
|
||||
<LINK HREF="cbm610-2.html" REL=next>
|
||||
|
||||
<LINK HREF="cbm610.html#toc1" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="cbm610-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="cbm610.html#toc1">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s1">1.</A> <A HREF="cbm610.html#toc1">Overview</A></H2>
|
||||
|
||||
|
||||
<P>This file contains an overview of the CBM 610 runtime system as it comes with
|
||||
the cc65 C compiler. It describes the memory layout, CBM 610 specific header
|
||||
files, available drivers, and any pitfalls specific to that platform.</P>
|
||||
<P>Please note that CBM 610 specific functions are just mentioned here, they are
|
||||
described in detail in the separate
|
||||
<A HREF="funcref.html">function reference</A>. Even functions marked as "platform dependent" may be available on
|
||||
more than one platform. Please see the function reference for more
|
||||
information.</P>
|
||||
<P>In addition to the Commodore 610 (named B40 in the U.S.), several other
|
||||
machines are supported by this cc65 target, since they have identical
|
||||
hardware: The Commodore 620 and 630 (more memory, additional coprocessor
|
||||
card), and the Commodore 710, 720 and 730 (same hardware in another case with
|
||||
a builtin monitor).</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="cbm610-2.html">Next</A>
|
||||
Previous
|
||||
<A HREF="cbm610.html#toc1">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
usr/share/doc/cc65/webdoc/cbm610-2.html
Normal file
30
usr/share/doc/cc65/webdoc/cbm610-2.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 610 specific information for cc65: Binary format</TITLE>
|
||||
<LINK HREF="cbm610-3.html" REL=next>
|
||||
<LINK HREF="cbm610-1.html" REL=previous>
|
||||
<LINK HREF="cbm610.html#toc2" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="cbm610-3.html">Next</A>
|
||||
<A HREF="cbm610-1.html">Previous</A>
|
||||
<A HREF="cbm610.html#toc2">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s2">2.</A> <A HREF="cbm610.html#toc2">Binary format</A></H2>
|
||||
|
||||
|
||||
<P>The standard binary output format generated by the linker for the CBM610
|
||||
target is a machine language program with a short BASIC stub. This means that
|
||||
a program can be loaded as BASIC program and started with RUN. It is of course
|
||||
possible to change this behaviour by using a modified startup file and linker
|
||||
config.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="cbm610-3.html">Next</A>
|
||||
<A HREF="cbm610-1.html">Previous</A>
|
||||
<A HREF="cbm610.html#toc2">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
49
usr/share/doc/cc65/webdoc/cbm610-3.html
Normal file
49
usr/share/doc/cc65/webdoc/cbm610-3.html
Normal file
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 610 specific information for cc65: Memory layout</TITLE>
|
||||
<LINK HREF="cbm610-4.html" REL=next>
|
||||
<LINK HREF="cbm610-2.html" REL=previous>
|
||||
<LINK HREF="cbm610.html#toc3" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="cbm610-4.html">Next</A>
|
||||
<A HREF="cbm610-2.html">Previous</A>
|
||||
<A HREF="cbm610.html#toc3">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s3">3.</A> <A HREF="cbm610.html#toc3">Memory layout</A></H2>
|
||||
|
||||
|
||||
<P>cc65 generated programs for the Commodore 610 run in bank 1, the memory bank
|
||||
reserved for BASIC programs. Since there are no ROMs in this memory bank, the
|
||||
program has almost full 64K for its own. A disadvantage is that kernal
|
||||
subroutines cannot be called (at least not in a fast and effective manner), so
|
||||
the runtime has replace kernal functionality.</P>
|
||||
<P>The default memory configuration for the CBM 610 allocates all memory between
|
||||
$0002 and $FFF0 in bank 1 for the compiled program. Some space
|
||||
in low memory is lost, because a separate hardware stack is set up in page 1,
|
||||
and the kernal replacement functions need some more memory locations. A few
|
||||
more bytes are lost in high memory, because the runtime sets up a CBM
|
||||
compatible jump table at $FF81. The main startup code is located at
|
||||
$0400, so about 63K of the complete bank are actually usable for
|
||||
applications.</P>
|
||||
<P>Special locations:</P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B>Stack</B><DD><P>The C runtime stack is located at $FF81 and growing downwards.</P>
|
||||
|
||||
<DT><B>Heap</B><DD><P>The C heap is located at the end of the program and grows towards the C
|
||||
runtime stack.</P>
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="cbm610-4.html">Next</A>
|
||||
<A HREF="cbm610-2.html">Previous</A>
|
||||
<A HREF="cbm610.html#toc3">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
123
usr/share/doc/cc65/webdoc/cbm610-4.html
Normal file
123
usr/share/doc/cc65/webdoc/cbm610-4.html
Normal file
|
@ -0,0 +1,123 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 610 specific information for cc65: Platform specific header files</TITLE>
|
||||
<LINK HREF="cbm610-5.html" REL=next>
|
||||
<LINK HREF="cbm610-3.html" REL=previous>
|
||||
<LINK HREF="cbm610.html#toc4" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="cbm610-5.html">Next</A>
|
||||
<A HREF="cbm610-3.html">Previous</A>
|
||||
<A HREF="cbm610.html#toc4">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s4">4.</A> <A HREF="cbm610.html#toc4">Platform specific header files</A></H2>
|
||||
|
||||
|
||||
<P>Programs containing CBM 610 specific code may use the <CODE>cbm610.h</CODE> or
|
||||
<CODE>cbm.h</CODE> header files. Using the later may be an option when writing code
|
||||
for more than one CBM platform, since it includes <CODE>cbm610.h</CODE> and declares
|
||||
several functions common to all CBM platforms.</P>
|
||||
|
||||
<H2><A NAME="ss4.1">4.1</A> <A HREF="cbm610.html#toc4.1">CBM 610 specific functions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The functions listed below are special for the CBM 610. See the
|
||||
<A HREF="funcref.html">function reference</A> for declaration and usage.</P>
|
||||
<P>
|
||||
<UL>
|
||||
<LI>peekbsys</LI>
|
||||
<LI>peekwsys</LI>
|
||||
<LI>pokebsys</LI>
|
||||
<LI>pokewsys</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss4.2">4.2</A> <A HREF="cbm610.html#toc4.2">CBM specific functions</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Some functions are available for all (or at least most) of the Commodore
|
||||
machines. See the
|
||||
<A HREF="funcref.html">function reference</A> for
|
||||
declaration and usage.</P>
|
||||
|
||||
<P>
|
||||
<UL>
|
||||
<LI>cbm_close</LI>
|
||||
<LI>cbm_closedir</LI>
|
||||
<LI>cbm_k_setlfs</LI>
|
||||
<LI>cbm_k_setnam</LI>
|
||||
<LI>cbm_k_load</LI>
|
||||
<LI>cbm_k_save</LI>
|
||||
<LI>cbm_k_open</LI>
|
||||
<LI>cbm_k_close</LI>
|
||||
<LI>cbm_k_readst</LI>
|
||||
<LI>cbm_k_chkin</LI>
|
||||
<LI>cbm_k_ckout</LI>
|
||||
<LI>cbm_k_basin</LI>
|
||||
<LI>cbm_k_bsout</LI>
|
||||
<LI>cbm_k_clrch</LI>
|
||||
<LI>cbm_load</LI>
|
||||
<LI>cbm_open</LI>
|
||||
<LI>cbm_opendir</LI>
|
||||
<LI>cbm_read</LI>
|
||||
<LI>cbm_readdir</LI>
|
||||
<LI>cbm_save</LI>
|
||||
<LI>cbm_write</LI>
|
||||
<LI>get_tv</LI>
|
||||
</UL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss4.3">4.3</A> <A HREF="cbm610.html#toc4.3">Hardware access</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The following pseudo variables declared in the <CODE>cbm610.h</CODE> header file do
|
||||
allow access to hardware located in the address space. Some variables are
|
||||
structures, accessing the struct fields will access the chip registers.</P>
|
||||
<P><B>Note:</B> All I/O chips are located in the system bank (bank 15) and can
|
||||
therefore not be accessed like on other platforms. Please use one of the
|
||||
<CODE>peekbsys</CODE>, <CODE>peekwsys</CODE>, <CODE>pokebsys</CODE> and <CODE>pokewsys</CODE> functions to
|
||||
access the I/O chips. Direct reads and writes to the structures named below
|
||||
will <EM>not</EM> work!</P>
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>CRTC</CODE></B><DD><P>The <CODE>CRTC</CODE> structure allows access to the CRTC (the video controller).
|
||||
See the <CODE>_6545.h</CODE> header file located in the include directory for the
|
||||
declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>SID</CODE></B><DD><P>The <CODE>SID</CODE> structure allows access to the SID (the
|
||||
sound interface device). See the <CODE>_sid.h</CODE> header file located in the
|
||||
include directory for the declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>ACIA</CODE></B><DD><P>Access to the ACIA (the RS232 chip) is available via the <CODE>ACIA</CODE> variable.
|
||||
See the <CODE>_6551.h</CODE> header file located in the include directory for the
|
||||
declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>CIA</CODE></B><DD><P>Access to the CIA chip is available via the <CODE>CIA</CODE> variable. See the
|
||||
<CODE>_6526.h</CODE> header file located in the include directory for the
|
||||
declaration of the structure.</P>
|
||||
|
||||
<DT><B><CODE>TPI1, TPI2</CODE></B><DD><P>The two 6525 triport chips may be accessed by using this variable. See the
|
||||
<CODE>_6525.h</CODE> header file located in the include directory for the
|
||||
declaration of the structure.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="cbm610-5.html">Next</A>
|
||||
<A HREF="cbm610-3.html">Previous</A>
|
||||
<A HREF="cbm610.html#toc4">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
82
usr/share/doc/cc65/webdoc/cbm610-5.html
Normal file
82
usr/share/doc/cc65/webdoc/cbm610-5.html
Normal file
|
@ -0,0 +1,82 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 610 specific information for cc65: Loadable drivers</TITLE>
|
||||
<LINK HREF="cbm610-6.html" REL=next>
|
||||
<LINK HREF="cbm610-4.html" REL=previous>
|
||||
<LINK HREF="cbm610.html#toc5" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="cbm610-6.html">Next</A>
|
||||
<A HREF="cbm610-4.html">Previous</A>
|
||||
<A HREF="cbm610.html#toc5">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="s5">5.</A> <A HREF="cbm610.html#toc5">Loadable drivers</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.1">5.1</A> <A HREF="cbm610.html#toc5.1">Graphics drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>No graphics drivers are currently available for the Commodore 610 (and since
|
||||
the machine has no graphics capabilities, chances for a graphics driver aren't
|
||||
really good:-).</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.2">5.2</A> <A HREF="cbm610.html#toc5.2">Extended memory drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
<DT><B><CODE>cbm610-ram.emd</CODE></B><DD><P>A driver for the RAM in bank 2. Supports up to 255 pages with 256 bytes
|
||||
each.</P>
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.3">5.3</A> <A HREF="cbm610.html#toc5.3">Joystick drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>The Commodore 610 is a business machine and doesn't have joystick ports. There
|
||||
are no drivers for the non existing ports available.</P>
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss5.4">5.4</A> <A HREF="cbm610.html#toc5.4">Mouse drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Currently no drivers available (in fact, the API for loadable mouse drivers
|
||||
does not exist).</P>
|
||||
|
||||
|
||||
<H2><A NAME="ss5.5">5.5</A> <A HREF="cbm610.html#toc5.5">RS232 device drivers</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
|
||||
<DT><B><CODE>cbm610-std.ser</CODE></B><DD><P>Driver for the 6551 ACIA chip built into the Commodore 610. Supports up to
|
||||
19200 baud, hardware flow control (RTS/CTS) and interrupt driven receives.
|
||||
Note that because of the peculiarities of the 6551 chip transmits are not
|
||||
interrupt driven, and the transceiver blocks if the receiver asserts flow
|
||||
control because of a full buffer.</P>
|
||||
|
||||
</DL>
|
||||
</P>
|
||||
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="cbm610-6.html">Next</A>
|
||||
<A HREF="cbm610-4.html">Previous</A>
|
||||
<A HREF="cbm610.html#toc5">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
49
usr/share/doc/cc65/webdoc/cbm610-6.html
Normal file
49
usr/share/doc/cc65/webdoc/cbm610-6.html
Normal file
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||||
<TITLE>Commodore 610 specific information for cc65: Limitations</TITLE>
|
||||
<LINK HREF="cbm610-7.html" REL=next>
|
||||
<LINK HREF="cbm610-5.html" REL=previous>
|
||||
<LINK HREF="cbm610.html#toc6" REL=contents>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A HREF="cbm610-7.html">Next</A>
|
||||
<A HREF="cbm610-5.html">Previous</A>
|
||||
<A HREF="cbm610.html#toc6">Contents</A>
|
||||
<HR>
|
||||
<H2><A NAME="limitations"></A> <A NAME="s6">6.</A> <A HREF="cbm610.html#toc6">Limitations</A></H2>
|
||||
|
||||
|
||||
|
||||
|
||||
<H2><A NAME="ss6.1">6.1</A> <A HREF="cbm610.html#toc6.1">Kernal and hardware access</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Since the program runs in bank 1, and the kernal and all I/O chips are located
|
||||
in bank 15, calling ROM routines or accessing hardware needs special code. The
|
||||
cc65 runtime implements wrappers for all functions in the kernal jump table.
|
||||
While this simplifies things, it should be noted that the wrappers do have
|
||||
quite an impact on performance: A cross bank call has an extra 300µs
|
||||
penalty added by the wrapper.</P>
|
||||
|
||||
<H2><A NAME="ss6.2">6.2</A> <A HREF="cbm610.html#toc6.2">Interrupts</A>
|
||||
</H2>
|
||||
|
||||
|
||||
<P>Compiled programs contain an interrupt handler that runs in the program bank.
|
||||
This has several advantages, one of them being performance (see cross bank
|
||||
call overhead mentioned above). However, this introduces one problem:
|
||||
Interrupts are lost while the CPU executes code in the kernal bank. As a
|
||||
result, the clock may go wrong and (worse) serial interrupts may get lost.</P>
|
||||
<P>Since the cc65 runtime does only call the kernal for disk I/O, this means that
|
||||
a program should not do file I/O while it depends on interrupts.</P>
|
||||
|
||||
|
||||
<HR>
|
||||
<A HREF="cbm610-7.html">Next</A>
|
||||
<A HREF="cbm610-5.html">Previous</A>
|
||||
<A HREF="cbm610.html#toc6">Contents</A>
|
||||
</BODY>
|
||||
</HTML>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user