Skip to content

Atom Appendices02

Appendix 2 — Expressions and Numeric Forms

Operator table

Operators appear from lowest to highest precedence. Operators at the same level associate from left to right.

OperatorOperationPrecedence
|Bitwise OR1
^Bitwise XOR2
&Bitwise AND3
<<Left shift4
>>Right shift4
+Add5
-Subtract5
*Multiply6
/Integer division, truncating towards zero6
%Remainder with the dividend's sign6
unary +Identity7
unary -Negation7
~Bitwise NOT7

Parentheses and values have the highest precedence. Shift counts range from 0 through 23.

Numeric forms

FormExampleBaseNotes
Plain decimal42100 through 65,535
$ prefix$2A16Bare $ is the current output address
Intel H suffix02AH16Must begin with a decimal digit
% prefix%1010102% between expressions is remainder
Intel B suffix101010B2Must contain only binary digits
Character'A'Decodes to exactly one byte

Numeric syntax is case-insensitive. 0FFH is hexadecimal 255; FFH is a symbol name because it begins with a letter.

Concrete and forward domains

Concrete evaluation uses signed 24-bit intermediates and accepts a final value from −32,768 through 65,535. The receiving field applies its own range.

A forward value stores one symbol plus an addend from −128 through 127. Addition and subtraction are accepted only while they preserve that affine form. LOW() and HIGH() may be its outermost operation.

FormForward status
TARGETAccepted
TARGET+5Accepted
5+TARGETAccepted
TARGET-(2*3)Accepted
LOW(TARGET+1)Accepted in compatible byte fields
TARGET1+TARGET2Rejected
TARGET*2Rejected
-TARGETRejected
LOW(TARGET)+1Rejected