All expressions are evaluated with (at least) 32 bit precision. An expression may contain constant values and any combination of internal and external symbols. Expressions that cannot be evaluated at assembly time are stored inside the object file for evaluation by the linker. Expressions referencing imported symbols must always be evaluated by the linker.
Sometimes, the assembler must know about the size of the value that is the result of an expression. This is usually the case, if a decision has to be made, to generate a zero page or an absolute memory references. In this case, the assembler has to make some assumptions about the result of an expression:
Note: If the assembler is not able to evaluate the expression at assembly time, the linker will evaluate it and check for range errors as soon as the result is known.
In the context of a boolean expression, any non zero value is evaluated as
true, any other value to false. The result of a boolean expression is 1 if
it's true, and zero if it's false. There are boolean operators with extreme
low precedence with version 2.x (where x > 0). The
operators are shortcut operators. That is, if the result of the expression is
already known, after evaluating the left hand side, the right hand side is
Sometimes an expression must evaluate to a constant without looking at any
further input. One such example is the
that decides if parts of the code are assembled or not. An expression used in
.IF command cannot reference a symbol defined later, because the
decision about the
.IF must be made at the point when it is read. If the
expression used in such a context contains only constant numerical values,
there is no problem. When unresolvable symbols are involved it may get harder
for the assembler to determine if the expression is actually constant, and it
is even possible to create expressions that aren't recognized as constant.
Simplifying the expressions will often help.
In cases where the result of the expression is not needed immediately, the assembler will delay evaluation until all input is read, at which point all symbols are known. So using arbitrary complex constant expressions is no problem in most cases.
|Built-in string functions||0|
|Unary bitwise not||1|
|Unary low-byte operator||1|
|Unary high-byte operator||1|
|Unary bank-byte operator||1|
|Binary bitwise xor||2|
|=||Compare operator (equal)||4|
|<>||Compare operator (not equal)||4|
|<||Compare operator (less)||4|
|>||Compare operator (greater)||4|
|<=||Compare operator (less or equal)||4|
|>=||Compare operator (greater or equal)||4|
To force a specific order of evaluation, parentheses may be used, as usual.