Skip to content

Atom Book 1 — Assembler Reference101

Directive Reference ​

Atom has two directive groups. Bare assembler directives control assembly. % directives control source preparation and are removed before assembly. Both groups are case-insensitive.

Assembler directives ​

DirectiveSyntaxEffectHosts
EQUNAME EQU EXPR or NAME: EQU EXPRDeclares one resolved constant without changing private scopeNode, CP/M
ORGORG EXPRSets the logical output cursor; emits no byteNode, CP/M
DBDB ITEM[,ITEM…]Emits low bytes from expressions and decoded double-quoted stringsNode, CP/M
DWDW EXPR[,EXPR…]Emits little-endian wordsNode, CP/M
DSDS COUNTReserves uninitialised bytes and advances the cursorNode, CP/M
DSDS COUNT,FILLEmits COUNT initialized fill bytesNode, CP/M
ALIGNALIGN BOUNDARYEmits zeros to the next address divisible by a positive boundaryNode, CP/M
INCBININCBIN "PATH"[,COUNT]Emits the first COUNT bytes of a binary file, or the whole file on Node when COUNT is omittedNode, CP/M
CSTRCSTR "TEXT"Emits decoded bytes followed by zeroNode, CP/M
PSTRPSTR "TEXT"Emits a decoded-byte count followed by the bytesNode, CP/M
ISTRISTR "TEXT"Sets bit 7 on the final decoded byte; empty text emits nothingNode, CP/M

Dotted directive aliases are invalid. A leading period begins a private symbol:

asm
ORG 4000H       ; ASSEMBLER DIRECTIVE
.ORG:           ; PRIVATE LABEL

EQU, ORG, DS, and ALIGN require already resolved expressions. DB and DW accept Atom's restricted forward affine form. The INCBIN count is a numeric literal. CP/M requires it and uses a current-drive 8.3 name for PATH.

Preprocessor directives ​

DirectiveSyntaxEffectHosts
%DEFINE%DEFINE NAME VALUEBinds one immutable 16-bit host value in the entry headerNode, CP/M
%INCLUDE%INCLUDE "PATH"Adds one import-once dependency edge from a leading part headerNode, CP/M
%IF%IF VALUESelects the following branch when the value is non-zeroNode, CP/M
%ELSE%ELSESelects the alternate branchNode, CP/M
%ENDIF%ENDIFCloses the current host conditionalNode, CP/M

%DEFINE performs no source substitution and declares no assembler symbol. Dependencies may test entry definitions but may not add definitions. Body conditionals may select ordinary source but cannot add includes or definitions.

The Node preprocessor replaces directive and inactive lines with spaces while preserving CR and LF bytes. The CP/M preprocessor turns each directive into an assembler comment and masks inactive lines. Both retain the original line and byte positions for diagnostics.

On CP/M, %DEFINE lines must come before any %INCLUDE or conditional directive, with at most 32 definitions. Conditionals nest up to 16 levels.