Long options:
--auto-import Mark unresolved symbols as import
+ --bin-include-dir dir Set a search path for binary includes
--cpu type Set cpu type
--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
---------------------------------------------------------------------------
</verb></tscreen>
-
+
<sect1>Command line options in detail<p>
Here is a description of all the command line options:
<descrip>
+ <label id="option--bin-include-dir">
+ <tag><tt>--bin-include-dir dir</tt></tag>
+
+ Name a directory which is searched for binary 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. See also the section about <ref id="search-paths"
+ name="search paths">.
+
+
<label id="option--cpu">
<tag><tt>--cpu type</tt></tag>
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>
monitor.
+ <label id="option-h">
<tag><tt>-h, --help</tt></tag>
Print the short option summary shown above.
+ <label id="option-i">
<tag><tt>-i, --ignore-case</tt></tag>
This option makes the assembler case insensitive on identifiers and labels.
<tt><ref id=".CASE" name=".CASE"></tt> control command.
+ <label id="option-l">
<tag><tt>-l, --listing</tt></tag>
Generate an assembler listing. The listing file will always have the
may change in future versions.
+ <label id="option--list-bytes">
<tag><tt>--list-bytes n</tt></tag>
Set the maximum number of bytes printed in the listing for one line of
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
when debugging the builtin macro packages.
+ <label id="option-mm">
<tag><tt>-mm model, --memory-model model</tt></tag>
Define the default memory model. Possible model specifiers are near, far and
huge.
+ <label id="option-o">
<tag><tt>-o name</tt></tag>
The default output name is the name of the input file with the extension
the source file, or, if -o is given, the full path in this name is used.
+ <label id="option--pagelength">
<tag><tt>--pagelength n</tt></tag>
sets the length of a listing page in lines. See the <tt><ref
id=".PAGELENGTH" name=".PAGELENGTH"></tt> directive for more information.
+ <label id="option-s">
<tag><tt>-s, --smart-mode</tt></tag>
In smart mode (enabled by -s or the <tt><ref id=".SMART" name=".SMART"></tt>
compiler, see there for a list.
+ <label id="option-v">
<tag><tt>-v, --verbose</tt></tag>
Increase the assembler verbosity. Usually only needed for debugging
verbose output.
+ <label id="option-D">
<tag><tt>-D</tt></tag>
This option allows you to define symbols on the command line. Without a
you may have to quote the expression.
+ <label id="option-I">
<tag><tt>-I dir, --include-dir dir</tt></tag>
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.
+ additional directories. See also the section about <ref id="search-paths"
+ name="search paths">.
+ <label id="option-U">
<tag><tt>-U, --auto-import</tt></tag>
Mark symbols that are not defined in the sources as imported symbols. This
which is not always true for assembler programmers.
+ <label id="option-V">
<tag><tt>-V, --version</tt></tag>
Print the version number of the assembler. If you send any suggestions
<p>
+
+<sect>Search paths<label id="search-paths"><p>
+
+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 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.
+</enum>
+
+Binary include files are searched in the following places:
+
+<enum>
+<item>The current directory.
+<item>Any directory added with the <tt/<ref id="option--bin-include-dir"
+name="--bin-include-dir">/ option on the command line.
+</enum>
+
+
+
<sect>Input format<p>
<sect1>Assembler syntax<p>
<sect>Symbols and labels<p>
+A symbol or label is an identifier that starts with a letter and is followed
+by letters and digits. Depending on some features enabled (see
+<tt><ref id="at_in_identifiers" name="at_in_identifiers"></tt>,
+<tt><ref id="dollar_in_identifiers" name="dollar_in_identifiers"></tt> and
+<tt><ref id="leading_dot_in_identifiers" name="leading_dot_in_identifiers"></tt>)
+other characters may be present. Use of identifiers consisting of a single
+character will not work in all cases, because some of these identifiers are
+reserved keywords (for example "A" is not a valid identifier for a label,
+because it is the keyword for the accumulator).
+
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.
-
<sect1>Numeric constants<p>
Numeric constants are defined using the equal sign or the label assignment
<tscreen><verb>
.proc foo
...
- .endscope
+ .endproc
</verb></tscreen>
is actually the same as
Add an assertion. The command is followed by an expression, an action
specifier, and an optional message that is output in case the assertion
fails. If no message was given, the string "Assertion failed" is used. The
- action specifier may be one of <tt/warning/ or <tt/error/. The assertion is
- evaluated by the assembler if possible, and also passed to the linker in the
- object file (if one is generated). The linker will then evaluate the
+ action specifier may be one of <tt/warning/, <tt/error/, <tt/ldwarning/ or
+ <tt/lderror/. In the former two cases, the assertion is evaluated by the
+ assembler if possible, and in any case, it's also passed to the linker in
+ the object file (if one is generated). The linker will then evaluate the
expression when segment placement has been done.
Example:
when the output file is written, and abort with an error if this is not
the case. More complex expressions are possible. The action specifier
<tt/warning/ outputs a warning, while the <tt/error/ specifier outputs
- an error message. In the latter case, generation if the output file is
+ an error message. In the latter case, generation of the output file is
suppressed in both the assembler and linker.
.autoimport + ; Switch on auto import
</verb></tscreen>
+<sect1><tt>.BANKBYTES</tt><label id=".BANKBYTES"><p>
+
+ Define byte sized data by extracting only the bank byte (that is, bits 16-23) from
+ each expression. This is equivalent to <tt><ref id=".BYTE" name=".BYTE"></tt> with
+ the operator '^' prepended to each expression in its list.
+
+ Example:
+
+ <tscreen><verb>
+ .define MyTable TableItem0, TableItem1, TableItem2, TableItem3
+
+ TableLookupLo: .lobytes MyTable
+ TableLookupHi: .hibytes MyTable
+ TableLookupBank: .bankbytes MyTable
+ </verb></tscreen>
+
+ which is equivalent to
+
+ <tscreen><verb>
+ TableLookupLo: .byte <TableItem0, <TableItem1, <TableItem2, <TableItem3
+ TableLookupHi: .byte >TableItem0, >TableItem1, >TableItem2, >TableItem3
+ TableLookupBank: .byte ^TableItem0, ^TableItem1, ^TableItem2, ^TableItem3
+ </verb></tscreen>
+
+ See also: <tt><ref id=".BYTE" name=".BYTE"></tt>,
+ <tt><ref id=".HIBYTES" name=".HIBYTES"></tt>,
+ <tt><ref id=".LOBYTES" name=".LOBYTES"></tt>
+
<sect1><tt>.BSS</tt><label id=".BSS"><p>
<descrip>
- <tag><tt>at_in_identifiers</tt></tag>
+ <tag><tt>at_in_identifiers</tt><label id="at_in_identifiers"></tag>
Accept the at character (`@') as a valid character in identifiers. The
at character is not allowed to start an identifier, even with this
feature enabled.
- <tag><tt>dollar_in_identifiers</tt></tag>
+ <tag><tt>c_comments</tt></tag>
+
+ Allow C like comments using <tt>/*</tt> and <tt>*/</tt> as left and right
+ comment terminators. Note that C comments may not be nested. There's also a
+ pitfall when using C like comments: All statements must be terminated by
+ "end-of-line". Using C like comments, it is possible to hide the newline,
+ which results in error messages. See the following non working example:
+
+ <tscreen><verb>
+ lda #$00 /* This comment hides the newline
+*/ sta $82
+ </verb></tscreen>
+
+ <tag><tt>dollar_in_identifiers</tt><label id="dollar_in_identifiers"></tag>
Accept the dollar sign (`$') as a valid character in identifiers. The
- at character is not allowed to start an identifier, even with this
+ dollar character is not allowed to start an identifier, even with this
feature enabled.
<tag><tt>dollar_is_pc</tt></tag>
Allow labels without a trailing colon. These labels are only accepted,
if they start at the beginning of a line (no leading white space).
- <tag><tt>leading_dot_in_identifiers</tt></tag>
+ <tag><tt>leading_dot_in_identifiers</tt><label id="leading_dot_in_identifiers"></tag>
Accept the dot (`.') as the first character of an identifier. This may be
used for example to create macro names that start with a dot emulating
.globalzp foo, bar
</verb></tscreen>
+<sect1><tt>.HIBYTES</tt><label id=".HIBYTES"><p>
+
+ Define byte sized data by extracting only the high byte (that is, bits 8-15) from
+ each expression. This is equivalent to <tt><ref id=".BYTE" name=".BYTE"></tt> with
+ the operator '>' prepended to each expression in its list.
+
+ Example:
+
+ <tscreen><verb>
+ .lobytes $1234, $2345, $3456, $4567
+ .hibytes $fedc, $edcb, $dcba, $cba9
+ </verb></tscreen>
+
+ which is equivalent to
+
+ <tscreen><verb>
+ .byte $34, $45, $56, $67
+ .byte $fe, $ed, $dc, $cb
+ </verb></tscreen>
+
+ Example:
+
+ <tscreen><verb>
+ .define MyTable TableItem0, TableItem1, TableItem2, TableItem3
+
+ TableLookupLo: .lobytes MyTable
+ TableLookupHi: .hibytes MyTable
+ </verb></tscreen>
+
+ which is equivalent to
+
+ <tscreen><verb>
+ TableLookupLo: .byte <TableItem0, <TableItem1, <TableItem2, <TableItem3
+ TableLookupHi: .byte >TableItem0, >TableItem1, >TableItem2, >TableItem3
+ </verb></tscreen>
+
+ See also: <tt><ref id=".BYTE" name=".BYTE"></tt>,
+ <tt><ref id=".LOBYTES" name=".LOBYTES"></tt>,
+ <tt><ref id=".BANKBYTES" name=".BANKBYTES"></tt>
+
<sect1><tt>.I16</tt><label id=".I16"><p>
</verb></tscreen>
+<sect1><tt>.LOBYTES</tt><label id=".LOBYTES"><p>
+
+ Define byte sized data by extracting only the low byte (that is, bits 0-7) from
+ each expression. This is equivalent to <tt><ref id=".BYTE" name=".BYTE"></tt> with
+ the operator '<' prepended to each expression in its list.
+
+ Example:
+
+ <tscreen><verb>
+ .lobytes $1234, $2345, $3456, $4567
+ .hibytes $fedc, $edcb, $dcba, $cba9
+ </verb></tscreen>
+
+ which is equivalent to
+
+ <tscreen><verb>
+ .byte $34, $45, $56, $67
+ .byte $fe, $ed, $dc, $cb
+ </verb></tscreen>
+
+ Example:
+
+ <tscreen><verb>
+ .define MyTable TableItem0, TableItem1, TableItem2, TableItem3
+
+ TableLookupLo: .lobytes MyTable
+ TableLookupHi: .hibytes MyTable
+ </verb></tscreen>
+
+ which is equivalent to
+
+ <tscreen><verb>
+ TableLookupLo: .byte <TableItem0, <TableItem1, <TableItem2, <TableItem3
+ TableLookupHi: .byte >TableItem0, >TableItem1, >TableItem2, >TableItem3
+ </verb></tscreen>
+
+ See also: <tt><ref id=".BYTE" name=".BYTE"></tt>,
+ <tt><ref id=".HIBYTES" name=".HIBYTES"></tt>,
+ <tt><ref id=".BANKBYTES" name=".BANKBYTES"></tt>
+
+
<sect1><tt>.LOCAL</tt><label id=".LOCAL"><p>
This command may only be used inside a macro definition. It declares a
compiler, depending on the target system selected:
<itemize>
-<item><tt/__ACE__/ - Target system is <tt/ace/
<item><tt/__APPLE2__/ - Target system is <tt/apple2/
<item><tt/__APPLE2ENH__/ - Target system is <tt/apple2enh/
<item><tt/__ATARI__/ - Target system is <tt/atari/
<sect>Structs and unions<label id="structs"><p>
-<sect1>Overview<p>
+<sect1>Structs and unions Overview<p>
Structs and unions are special forms of <ref id="scopes" name="scopes">. They
are to some degree comparable to their C counterparts. Both have a list of
useful for assembler programs.
-<sect1>Overview<p>
+<sect1>Module constructors/destructors Overview<p>
Using the <tt><ref id=".CONSTRUCTOR" name=".CONSTRUCTOR"></tt>, <tt><ref
id=".DESTRUCTOR" name=".DESTRUCTOR"></tt> and <tt><ref id=".INTERRUPTOR"