# DSA Assembly Language Specification **Status:** Draft, grounded in the current `assembler` crate (`model.rs`, `expand.rs`, `resolver.rs`, `codegen.rs`) and the example programs `print.dsa`, `bf.dsa`, `animation.dsa`, `serial.dsa`. This describes the assembly language as the current pipeline actually implements it — pseudo-op expansion, symbol resolution, and argument order all reflect the real `expand.rs`/`codegen.rs` logic, not just the ISA's hardware semantics (see the companion ISA spec for those). --- ## 1. Source File Structure A `.dsa` file is a sequence of directives, labels, and instructions. Comments start with `//` and run to end of line. ```asm include print "./print.dsa" // pulls in another module by relative path dw display: 0x20000 // data declaration with a label db message: "hello\0" // string data start: // a label — marks the address of the next node lli 0, rg0 ... ``` ### 1.1 Modules and `include` ```asm include "" ``` `` becomes the namespace prefix used to reference symbols from that file — e.g. `include print "./print.dsa"` lets you call `print::print`, `print::newline`, etc. Each included file is compiled once per program even if reached via multiple include paths (deduplicated by canonicalized file path). Symbols are disambiguated internally by a hash of the defining file's path, not by name alone — two files can each define a label called `start` without collision, as long as they're referenced through their respective module namespace. **Known limitation:** cross-module symbol references (`module::symbol`) resolve correctly today because the current pipeline concatenates all included files' nodes into one list before running symbol resolution — it is not yet a true separate-compilation linker. A planned `DsoBinary` intermediate format (see the compiler roadmap if there is one available) will make per-file compilation independent of the whole program; until then, changing any included file requires reassembling the whole program. --- ## 2. Data Declarations | Directive | Unit size | Meaning | |-------------------------|------------------------------------|-------------------------------------------------| | `db