<article>
<title>ca65 Users Guide
-<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
-<date>2000-07-19, 2000-11-29, 2001-10-02, 2005-09-08
+<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
+<date>2014-04-24
<abstract>
ca65 is a powerful macro assembler for the 6502, 65C02 and 65816 CPUs. It is
--debug Debug mode
--debug-info Add debug info to object file
--feature name Set an emulation feature
- --forget-inc-paths Forget include search paths
--help Help (this text)
--ignore-case Ignore case of symbols
--include-dir dir Set an include directory search path
--large-alignment Don't warn about large alignments
--listing name Create a listing file 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
--relax-checks Relax some checks (see docs)
Set the default for the CPU type. The option takes a parameter, which
may be one of
- 6502, 65SC02, 65C02, 65816, sunplus, sweet16, HuC6280
-
- The sunplus cpu is not available in the freeware version, because the
- instruction set is "proprietary and confidential".
+ 6502, 65SC02, 65C02, 65816, sweet16, HuC6280
<label id="option-create-dep">
command for a list of emulation features.
- <label id="option--forget-inc-paths">
- <tag><tt>--forget-inc-paths</tt></tag>
-
- Forget the builtin include paths. This is most useful when building
- customized assembler modules, in which case the standard header files should
- be ignored.
-
-
<label id="option-g">
<tag><tt>-g, --debug-info</tt></tag>
number of printed bytes.
- <label id="option--macpack-dir">
- <tag><tt>--macpack-dir dir</tt></tag>
-
- This options allows to specify a directory containing macro files that are
- used instead of the builtin images when a <tt><ref id=".MACPACK"
- name=".MACPACK"></tt> directive is encountered. If <tt>--macpack-dir</tt>
- was specified, a <tt>.mac</tt> 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.
-
-
<label id="option-mm">
<tag><tt>-mm model, --memory-model model</tt></tag>
Normal include files are searched in the following places:
<enum>
-<item>The current directory.
-<item>A compiled-in directory, which is often <tt>/usr/lib/cc65/asminc</tt>
- on Linux systems.
+<item>The current file's directory.
+<item>Any directory added with the <tt/<ref id="option-I" name="-I">/ option
+on the command line.
<item>The value of the environment variable <tt/CA65_INC/ if it is defined.
<item>A subdirectory named <tt/asminc/ of the directory defined in the
environment variable <tt/CC65_HOME/, if it is defined.
-<item>Any directory added with the <tt/<ref id="option-I" name="-I">/ option
-on the command line.
+<item>An optionally compiled-in directory.
</enum>
Binary include files are searched in the following places:
<enum>
-<item>The current directory.
+<item>The current file's directory.
<item>Any directory added with the <tt/<ref id="option--bin-include-dir"
name="--bin-include-dir">/ option on the command line.
</enum>
<tt><ref id=".PC02" name=".PC02"></tt> command was given).
<item>all valid 65618 mnemonics when in 65816 mode (after the
<tt><ref id=".P816" name=".P816"></tt> command was given).
-<item>all valid SunPlus mnemonics when in SunPlus mode (after the
- <tt><ref id=".SUNPLUS" name=".SUNPLUS"></tt> command was given).
</itemize>
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 <htmlurl
-url="http://www.oxyron.de/html/opcodes02.html"
-name="http://www.oxyron.de/html/opcodes02.html">. Please note that only the
+unofficial ones are taken from <url
+url="http://www.oxyron.de/html/opcodes02.html">. 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.
][ programmers do probably know how to use sweet16 mode.
For more information about SWEET 16, see
-<htmlurl url="http://www.6502.org/source/interpreters/sweet16.htm"
-name="http://www.6502.org/source/interpreters/sweet16.htm">.
+<url url="http://www.6502.org/source/interpreters/sweet16.htm">.
<sect1>Number format<p>
prefer the "cheap" local labels). Nevertheless, unnamed labels are
convenient in some situations, so it's your decision.
-<bf/Note:/ <ref id="scopes" name="Scopes"> organize named symbols, not
+<em/Note:/ <ref id="scopes" name="Scopes"> organize named symbols, not
unnamed ones, so scopes don't have an effect on unnamed labels.
This is the reason why a procedure must have a name. If you want a scope
without a name, use <tt/<ref id=".SCOPE" name=".SCOPE">/.
-<bf/Note:/ As you can see from the example above, scopes and symbols live in
+<em/Note:/ As you can see from the example above, scopes and symbols live in
different namespaces. There can be a symbol named <tt/foo/ and a scope named
<tt/foo/ without any conflicts (but see the section titled <ref
id="scopesearch" name=""Scope search order"">).
Reading this pseudo variable will give the assembler version according to
the following formula:
- VER_MAJOR*$100 + VER_MINOR*$10 + VER_PATCH
+ VER_MAJOR*$100 + VER_MINOR*$10
It may be used to encode the assembler version or check the assembler for
special features not available with older versions.
Example:
- Version 2.11.1 of the assembler will return $2B1 as numerical constant when
+ Version 2.14 of the assembler will return $2E0 as numerical constant when
reading the pseudo variable <tt/.VERSION/.
<tscreen><verb>
lda #'a
</verb></tscreen>
- <bf/Note:/ This does not work in conjunction with <tt/.FEATURE
+ <em/Note:/ This does not work in conjunction with <tt/.FEATURE
loose_string_term/, since in this case the input would be ambiguous.
<tag><tt>org_per_seg</tt><label id="org_per_seg"></tag>
Switch the CPU instruction set. The command is followed by a string that
specifies the CPU. Possible values are those that can also be supplied to
the <tt><ref id="option--cpu" name="--cpu"></tt> command line option,
- namely: 6502, 6502X, 65SC02, 65C02, 65816, sunplus and HuC6280. Please
- note that support for the sunplus CPU is not available in the freeware
- version, because the instruction set of the sunplus CPU is "proprietary
- and confidential".
+ namely: 6502, 6502X, 65SC02, 65C02, 65816 and HuC6280.
See: <tt><ref id=".CPU" name=".CPU"></tt>,
<tt><ref id=".IFP02" name=".IFP02"></tt>,
<tt><ref id=".UNION" name=".UNION"></tt>
-<sect1><tt>.SUNPLUS</tt><label id=".SUNPLUS"><p>
-
- Enable the SunPlus instructions set. This command will not work in the
- freeware version of the assembler, because the instruction set is
- "proprietary and confidential".
-
- See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
- name=".PSC02"></tt>, <tt><ref id=".PC02" name=".PC02"></tt>, and
- <tt><ref id=".P816" name=".P816"></tt>
-
-
<sect1><tt>.TAG</tt><label id=".TAG"><p>
Allocate space for a struct or union.
beq Arg
bcc Arg
.endmacro
+
+ .macro bnz Arg
+ bne Arg
+ .endmacro
+
+ .macro bze Arg
+ beq Arg
+ .endmacro
+
</verb></tscreen>
CPU_65SC02
CPU_65C02
CPU_65816
- CPU_SUNPLUS
CPU_SWEET16
CPU_HUC6280
</verb></tscreen>
CPU_ISET_65SC02
CPU_ISET_65C02
CPU_ISET_65816
- CPU_ISET_SUNPLUS
CPU_ISET_SWEET16
CPU_ISET_HUC6280
</verb></tscreen>
compiler, depending on the target system selected:
<itemize>
-<item><tt/__APPLE2__/ - Target system is <tt/apple2/
+<item><tt/__APPLE2__/ - Target system is <tt/apple2/ or <tt/apple2enh/
<item><tt/__APPLE2ENH__/ - Target system is <tt/apple2enh/
-<item><tt/__ATARI__/ - Target system is <tt/atari/
+<item><tt/__ATARI5200__/ - Target system is <tt/atari5200/
+<item><tt/__ATARI__/ - Target system is <tt/atari/ or <tt/atarixl/
+<item><tt/__ATARIXL__/ - Target system is <tt/atarixl/
<item><tt/__ATMOS__/ - Target system is <tt/atmos/
<item><tt/__BBC__/ - Target system is <tt/bbc/
<item><tt/__C128__/ - Target system is <tt/c128/
-<item><tt/__C16__/ - Target system is <tt/c16/
+<item><tt/__C16__/ - Target system is <tt/c16/ or <tt/plus4/
<item><tt/__C64__/ - Target system is <tt/c64/
<item><tt/__CBM__/ - Target is a Commodore system
<item><tt/__CBM510__/ - Target system is <tt/cbm510/
<item><tt/__CBM610__/ - Target system is <tt/cbm610/
-<item><tt/__GEOS__/ - Target system is <tt/geos/
+<item><tt/__GEOS__/ - Target is a GEOS system
+<item><tt/__GEOS_APPLE__/ - Target system is <tt/geos-apple/
+<item><tt/__GEOS_CBM__/ - Target system is <tt/geos-cbm/
<item><tt/__LUNIX__/ - Target system is <tt/lunix/
+<item><tt/__LYNX__/ - Target system is <tt/lynx/
<item><tt/__NES__/ - Target system is <tt/nes/
<item><tt/__PET__/ - Target system is <tt/pet/
<item><tt/__PLUS4__/ - Target system is <tt/plus4/
+<item><tt/__SIM6502__/ - Target system is <tt/sim6502/
+<item><tt/__SIM65C02__/ - Target system is <tt/sim65c02/
<item><tt/__SUPERVISION__/ - Target system is <tt/supervision/
<item><tt/__VIC20__/ - Target system is <tt/vic20/
</itemize>
</enum>
-<sect>Bugs/Feedback<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
-(<htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">).
-
-
-
<sect>Copyright<p>
ca65 (and all cc65 binutils) are (C) Copyright 1998-2003 Ullrich von