Table of Contents
Previous topic Next topic
CROSS ASSEMBLER->Assembler Expressions->Assembler Expressions
Expressions are placed in the operand field and are evaluated by the cross-assembler to give a numerical integer value. An expression may be used anywhere within the operand field where a numerical value is expected. The expression evaluator within the cross-assembler will use 32 bit integer arithmetic to calculate the value of the expression.
The expression may consist of symbols, numbers, literals and operators. Parentheses may be used to define a particular order of precedence. Parentheses can be nested.
The following operators are allowed:
|Shift left ||<<|
|Logical exclusive OR||~|
These operators take the following precedence:
() Expressions within parentheses are evaluated first.
<< >> Shift operations are performed next.
& ! ~ Logical AND, OR and exclusive OR have the next priority.
* / Multiplication and division are evaluated next.
+ - Addition and subtraction are evaluated last.
Operators with the same precedence are evaluated from left to right.
Two further operators, which can only be used with section names, are `size and `base. `size(<section-name>) evaluates to the size of a section. `base(<section-name>) evaluates to the base address of a section.
It is not essential to use the `base operator since <section-name> on its own also evaluates to the base address of the section. However, since the `size and `base operators are supported by some other assemblers it is supported for compatibility reasons.