Previous page:
Assembler Syntax
Next page:
Cross-Platform Assembler
Spec File Syntax
Syntax is based mainly on standard BBC assembly syntax as that is the context this application was originally written for. The following describes the main points:
Only one command per line is allowed (multiple-command lines make code difficult to read and should be avoided anyway! ;).
Comments are introduced by a backslash character and extend to the end of the line.
A label may appear on a line of its own and refers to the next address that would occupy a command.
Otherwise, a line consists of an optional label followed by a command mnemonic seperated by white space. An optional argument may follow further white space and must match one of the addressing mode patterns in the spec file.
Mnemonics and psuedo-commands are case insensitive.
The following pseudo-commands are recognised:
EQUB
the arg is a byte to add directly to the output at the current address;
EQUW
the arg is a word (2 bytes) to add directly to the output at the current address in machine host byte order;
EQUR
the arg is a word to add directly to the output at the current address in high,low byte order;
EQUS
the arg is a string (optionally surrounded by double quotes) and the byte codes for each character are added directly to the output at the current address.
Expressions in arguments (and byte specifiers in the spec file) are allowed as follows:
positive and negative integers;
"pc" specifies the current program counter (will refer to the address of the first byte of the op-code);
(expr) used to group expressions - doesn't work quite how you think so beware!
expr + expr specifies the sum of two expressions;
expr - expr specifies the difference between two expressions;
expr mod expr specifies the first expression modulo the second;
expr div expr specifies integer division;
&expr means the expression treated as a hex number;
asc "x" specifies the ascii code for the character between double quotes;
a label will be expanded to its address.
Fixed address labels can be specified on a line of their own as:
label=value
where the value must be preceded by "&" or "0x" to be recognised as hex.
A label specification within the code must be preceded by a dot and use of a label in an expression must not include the dot.
Previous page:
Assembler Syntax
Next page:
Cross-Platform Assembler
Spec File Syntax