Using it
ca65
NES 6502, ca65 syntax (assemble + link).
--dialect also accepts nes.
Directives
44 directives, 151 spellings. This is the list the parser looks a word up in, so a spelling here is one the assembler accepts and a spelling missing from it is one it refuses.
| Directive | Spellings | Notes |
|---|---|---|
align |
.align |
|
asciiz |
.asciiz |
|
assert |
.assert |
|
autoimport |
.autoimport |
Accepted and discarded — it changes no bytes |
bankbytes |
.bankbytes |
|
bytes |
.byte, .byt |
|
conditional |
.if, .ifdef, .ifndef, .ifblank, .ifnblank, .ifconst, .ifnconst, .ifp02, .ifp4510, .ifp816, .ifpc02, .ifpsc02, .ifref, .ifnref, .elseif, .else, .endif |
|
cpu |
.setcpu, .pushcpu, .popcpu, .smart, .p02, .p4510, .p816, .pc02, .psc02 |
|
dbyt |
.dbyt |
|
dword |
.dword |
|
end |
.end |
|
endmacro |
.endmacro, .endmac |
|
export |
.export, .exportzp |
|
expression-word |
.bankbyte, .blank, .concat, .const, .def, .defined, .definedmacro, .hibyte, .hiword, .ident, .ismnem, .ismnemonic, .left, .match, .mid, .right, .sprintf, .lobyte, .loword, .max, .min, .paramcount, .strat, .string, .strlen, .tcount, .xmatch |
Used inside an expression, not as a statement |
faraddr |
.faraddr |
|
forceimport |
.forceimport |
Refused, as the reference refuses it — only usable when a linker resolves it from another module, and asm198x emits a binary |
forceword |
.forceword |
Refused, as the reference refuses it — a word its tokenizer knows and its parser accepts in no position |
global |
.global, .globalzp |
|
hibytes |
.hibytes |
|
import |
.import, .importzp |
|
incbin |
.incbin |
|
include |
.include |
|
listing |
.list, .listbytes, .pagelen, .pagelength, .debuginfo, .dbg, .fileopt, .fopt |
Accepted and discarded — it changes no bytes |
lobytes |
.lobytes |
|
local |
.local |
|
macro |
.macro, .mac |
|
message |
.warning, .error, .fatal |
|
operator |
.and, .bitand, .bitnot, .bitor, .bitxor, .mod, .not, .or, .shl, .shr, .xor |
Used inside an expression, not as a statement |
out |
.out |
|
placement |
.org, .reloc |
|
records |
.struct, .endstruct, .union, .endunion, .enum, .endenum, .tag |
|
register-widths |
.asize, .isize |
Refused, as the reference refuses it — only valid in 65816 mode, and this leg assembles a 6502 |
repeat |
.repeat, .endrepeat |
|
res |
.res |
|
scopes |
.proc, .endproc, .scope, .endscope |
|
segment |
.segment |
|
segment-shorthand |
.code, .data, .bss, .rodata, .zeropage, .pushseg, .popseg |
|
sizeof |
.sizeof |
Used inside an expression, not as a statement |
text-defines |
.define, .undef, .undefine |
|
unsupported-conditionals |
.ref, .referenced |
Used inside an expression, not as a statement |
unsupported-macros |
.delmac, .delmacro, .macpack |
Recognised, and not implemented |
unsupported-parse-options |
.linecont, .case, .charmap, .localchar, .feature, .null |
Recognised, and not implemented |
unsupported-symbol |
.condes, .constructor, .destructor, .interruptor |
Recognised, and not implemented |
words |
.word, .addr |
Instruction mnemonics are not listed here — they come from the instruction-set spec and have their own reference.
Projects in more than one file
A relative request is looked for in the including file’s directory, then each enclosing includer’s, then in the -I search directories in the order they were given.
The anchor is pinned against this dialect’s own reference assembler, and the dialects genuinely disagree — Projects in more than one file has the comparison.
Elsewhere
- Dialects — every dialect and what each is the syntax of
- Where we differ — every known difference from a reference assembler
- Moving a project across — adopting this on a project that already builds