## Expression Operators

The built-in assembler provides a variety of operators. Precedence rules are different from that of the Delphi language; for example, in an asm statement, AND has lower precedence than the addition and subtraction operators. The following table lists the built-in assembler's expression operators in decreasing order of precedence.

Precedence of built-in assembler expression operators

Operators |
Remarks |
Precedence |

& |
highest | |

(... ), [... ],., HIGH, LOW | ||

+, - |
unary + and | |

OFFSET, TYPE, PTR, *, /, MOD, SHL, SHR, +, |
-binary + and |
- |

NOT, AND, OR, XOR |
lowest |

The following table defines the built-in assembler's expression operators. Definitions of built-in assembler expression operators

Operator

### Description

& Identifier override. The identifier immediately following the ampersand is treated as a user-defined symbol, even if the spelling is the same as a built-in assembler reserved symbol.

- Subexpression. Expressions within parentheses are evaluated completely prior to being treated as a single expression element. Another expression can precede the expression within the parentheses; the result in this case is the sum of the values of the two expressions, with the type of the first expression.
- Memory reference. The expression within brackets is evaluated completely prior to being treated as

Structure member selector. The result is the sum of the expression before the period and the | |

expression after the period, with the type of the expression after the period. Symbols belonging to the | |

scope identified by the expression before the period can be accessed in the expression after the period. | |

HIGH |
Returns the high-order 8 bits of the word-sized expression following the operator. The expression must |

be an absolute immediate value. | |

LOW |
Returns the low-order 8 bits of the word-sized expression following the operator. The expression must |

be an absolute immediate value. | |

+ |
Unary plus. Returns the expression following the plus with no changes. The expression must be an |

absolute immediate value. | |

- |
Unary minus. Returns the negated value of the expression following the minus. The expression must |

be an absolute immediate value. | |

+ |
Addition. The expressions can be immediate values or memory references, but only one of the |

expressions can be a relocatable value. If one of the expressions is a relocatable value, the result is | |

also a relocatable value. If either of the expressions is a memory reference, the result is also a memory | |

reference. | |

- |
Subtraction. The first expression can have any class, but the second expression must be an absolute |

immediate value. The result has the same class as the first expression. | |

Segment override. Instructs the assembler that the expression after the colon belongs to the segment | |

given by the segment register name (CS, DS, SS, FS, GS, or ES) before the colon. The result is a | |

memory reference with the value of the expression after the colon. When a segment override is used | |

in an instruction operand, the instruction is prefixed with an appropriate segment-override prefix | |

instruction to ensure that the indicated segment is selected. | |

OFFSET |
Returns the offset part (double word) of the expression following the operator. The result is an |

immediate value. | |

TYPE |
Returns the type (size in bytes) of the expression following the operator. The type of an immediate |

value is 0. | |

PTR |
Typecast operator. The result is a memory reference with the value of the expression following the |

operator and the type of the expression in front of the operator. | |

* |
Multiplication. Both expressions must be absolute immediate values, and the result is an absolute |

immediate value. | |

/ |
Integer division. Both expressions must be absolute immediate values, and the result is an absolute |

immediate value. |

MOD Remainder after integer division. Both expressions must be absolute immediate values, and the result is an absolute immediate value.

SHL |
Logical shift left. Both expressions must be absolute immediate values, and the result is an absolute |

immediate value. | |

SHR |
Logical shift right. Both expressions must be absolute immediate values, and the result is an absolute |

immediate value. | |

NOT |
Bitwise negation. The expression must be an absolute immediate value, and the result is an absolute |

immediate value. | |

AND |
Bitwise AND. Both expressions must be absolute immediate values, and the result is an absolute |

immediate value. | |

OR |
Bitwise OR. Both expressions must be absolute immediate values, and the result is an absolute |

immediate value. | |

XOR |
Bitwise exclusive OR. Both expressions must be absolute immediate values, and the result is an |

absolute immediate value. |

## Project Management Made Easy

What you need to know aboutâ€¦ Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

## Post a comment