Expressions

An expression is a combination of symbols, numeric constants, and operators that uses standard arithmetic notation to yield a result. Expressions can be absolute or relocatable.

Absolute Expressions

An expression is absolute when it is not subject to link-time relocation. An absolute expression may contain relocatable symbols, but they must reduce to pairs of the form (R 1 -R 2 ), where R 1 and R 2 are relocatable symbols defined in the same section in the current source file.

Relocatable Expressions

An expression is relocatable when it is subject to link-time relocation. A relocatable expression contains a relocatable symbol, and may contain an absolute expression. If a relocatable expression contains an absolute expression, it must be reducible to the form (R+K), where R is either a relocatable symbol defined in the current source file, or an undefined symbol, and K is an absolute expression. The address of the relocatable symbol is defined in link time.

Operators

The assembly operators indicate arithmetic or bitwise-logic calculations. Parentheses (()) determine the order in which calculations occur. The assembler evaluates all operators of the same precedence from left to right.

The assembler evaluates all operators according to their level of precedence. Table below lists the operator precedence rules from lowest to highest.

Precedence of Arithmetic and Bitwise Logic Operations

Precedence

Operator Symbol

Operation

0 (Low)

+

-

|

^

Addition

Subtraction

Bitwise inclusive OR

Bitwise exclusive OR

1 (Medium)

*

/

%

<<

>>

&

Multiplication

Division

Remainder

Shift Left

Arithmetic shift right

Bitwise A ND

2 (High)

-

~

Unary negation

Unary one’s complement

Link-relocation Operators

Link-relocation operators generate link-relocation entries in expressions. See Link-relocation Operators for a list of the link-relocation operators.