cpu-as is a two-pass assembler. It resolves labels across
all input files, emits a flat little-endian image based at address zero, and
reports source filename and line number for every diagnostic.
cargo run --release -p cpu-assembler -- \
-o build/demo.bin firmware/demo/main.sComments start with # or ;. Registers are r0 through r15, with sp and
lr aliases. Decimal, hexadecimal, binary, character, and underscore-separated
literals are accepted. Memory operands use offset(base).
Supported directives are .section, .text, .rodata, .data, .bss,
.global, .byte, .half, .word, .ascii, .asciz, .zero, .space, and
.align. Sections are source-order markers in the flat format; callers control
layout by source order. .align n aligns to 2^n bytes and .org address
provides explicit forward-only placement.
All base mnemonics in docs/isa.md are supported, plus LI, LA, MOV, CALL,
RET, PUSH, and POP. LI/LA use a fixed seven-instruction byte-building
sequence. This represents every 32-bit value without a hidden temporary register
and keeps first-pass addresses stable.