Topics

UTTORI ASM · IN DEVELOPMENT

6502 family directive reference

Browse native and ca65-style directives for 6502-family targets.

The active 65xx target combines core directives with plugin directives. Native keywords apply to 65xx.raw. Dotted forms below are the ca65-profile spelling. The leading . is the directive prefix.

Command Syntax Status & Effect
db, dc.b db value[,value...] Native 8-bit data
dw, dc.w dw value[,value...] Native little-endian 16-bit
dl, dc.l dl value[,value...] Native little-endian 24-bit
dd dd value[,value...] Native little-endian 32-bit
.byte, .byt .byte value[,value...] ca65 8-bit data
.addr, .word .word value[,value...] ca65 little-endian 16-bit
.dbyt .dbyt value[,value...] ca65 big-endian 16-bit
.faraddr .faraddr value[,value...] 24-bit little-endian
.dword .dword value[,value...] 32-bit little-endian
.lobytes, .hibytes .lobytes expr[,value...] Selected byte of each expression
.res .res count[, fill] Reserve/fill bytes
.align .align boundary[, fill] Pad to alignment
fillbyte/word/long/dword, fill fill count Native fill pattern
padbyte/word/long/dword, pad pad [address] Native pad
incsrc, include, .include include "file" Assemble a source file inline
includeonce includeonce Guard the current file once per stage
incbin incbin "file"[:range] Native/Asar binary include
.incbin .incbin "file"[, offset[, size]] ca65 binary include
org, .org org address Set write position
base base address|off Change or restore logical base
pushbase, pullbase, pushpc, pullpc no operands Save/restore PC or base
arch arch name Native CPU switch
.setcpu, .cpu .setcpu "CPU" ca65 CPU switch
.pushcpu, .popcpu no operands Save/restore CPU
.p02 … .pm740 no operands CPU shorthand
.ifp02 … .ifpm740 block syntax CPU predicate
.segment .segment "NAME" NES: open ld65 segment. ca65-raw: record name
.pushseg, .popseg no operands Save/restore flat segment name
namespace, pushns, pullns native namespace Native label prefixing
.scope / .endscope, .proc / .endproc .proc name Flattened lexical scope
.export, .import .export ident[, ident...] Session-global symbol
table, cleartable, pushtable, pulltable native Character mapping
struct, skip, endstruct native Non-emitting layout
undef, .undefine undef name Remove a define/symbol
if, elseif, else, endif block syntax Conditional assembly
.if, .ifdef, .ifndef block syntax ca65 conditionals
while, endwhile block syntax Native conditional repeat
for, endfor for name = start..end Inclusive counted loop
.repeat, .endrepeat .repeat count[, ident] ca65 counted repeat
macro, endmacro macro name(args) Native command macro
.macro, .endmacro .macro name args ca65 command macro
function function name(args) = expression Native numeric function
assert, .assert assert condition[, message] Fail when condition is zero
error error [message...] Always fail
warnpc warnpc address Fail when PC exceeds address
.local, .exitmacro any Rejected
.importzp, .exportzp, .globalzp, .forceimport, .autoimport any Rejected (object/linker)
.constructor, .destructor, .interruptor, .reloc, .debuginfo any Rejected (object/linker)