Preprocessing is handled via gasp, available through older binutil packages. It is possible to disable it in ymain.c
This adds includes and macros. Example:
.include "x.s"
.macro woot a
lda \a
.endmacro
woot 2
It also requires that all instructions start at least one whitespace from the left side, or they are converted to labels.
gasp is invoked with "alternate" syntax, giving access to the "local" keyword, which enables labels within macros.
This means that the radix-translations available in gasp and other features also are available.
The assembler is line-oriented. Several line-types exists:
Contains an assembler instruction with arguments
Contains a directive to the assembler. Implemented directives are
cpu <any-string>
Not used. Just for compatibility.org <expression>
Start emitting code at<expression>
. Can also be written as an assignment,* = <expression>
Note: ORG doesn't work when using gasp!rorg <expression>
Keep emitting code at current PC, but treat branches, labels etc as if the code is at<expression>
rend
Stop relocated section and return to real PC
.byte <space-separated list of bytes or strings>
dc.b <comma-separated list of bytes or strings>
A comment begins with ; and reaches to the end of the current line
Any line may start with a label, on the format ":"
<expr
Lower eight bits of the expression>expr
Upper eight bits of the expression, shifted into a byteexpr+expr
Additionexpr-expr
Subtraction.
Current PC
Default radix is decimal. Hex is indicated with $
or 0x
You may include a binary file at current pc with pseudo-instruction "incbin". It expects a quoted string as filename, and it is case-sensitive if the platform is case-sensitive (eg unix).
example:
incbin "MUSIC.BIN"
If you have a program file to include and want to discard the load adress, use incprog instead.
Each changed PC results in a separate code segment file, which is directly loadable into the C64. (The first two bytes are the load address)
The segments may be linked into a large file with padded holes using l64.