Skip to content

Appendices02

Appendix 2 — Expression Operators ​

Operator table ​

Operators in precedence order, lowest to highest. Operators at the same precedence level are left-associative.

OperatorOperationPrecedence
|bitwise OR1 (lowest)
^bitwise XOR2
&bitwise AND3
<<left shift4
>>right shift4
+add5
-subtract5
*multiply6
/integer divide6
%modulo6 (highest binary)

Unary operators (highest precedence): + (identity), - (negate), ~ (bitwise NOT). Parentheses group sub-expressions and override precedence.

All expressions are evaluated by the assembler before the binary is written.

Numeric literal formats ​

AZM accepts eight numeric literal forms. They can be mixed within one expression.

FormExampleBaseNotes
$ prefix$FF, $0100hexBare $, or $ before a non-hex character, is the current assembly address
0x prefix0xFF, 0x2Ahexprefix is case-insensitive
Trailing H/h0FFH, 02Ahhexmust start with a decimal digit; FFH parses as a symbol name
% prefix%10101010, %1111binary
0b prefix0b10101010, 0b1111binaryprefix is case-insensitive
Trailing B/b10101010B, 10bbinary
Plain decimal42, 255, 0decimal
Quoted character'A', "Z"ASCII valuesingle character; valid in any expression context

Trailing-H rule: the token must begin with a decimal digit (0–9). 0FFH is hex 255. FFH starts with a letter, so the parser reads it as a symbol name. The forms $FF and 0FFH force hexadecimal interpretation.

% has two roles: a % at the start of a value is a binary literal prefix; a % between two expressions is the modulo operator.