SPRUI03E June 2015 – January 2023
You can manipulate substitution symbols with the .asg and .eval directives.
For the .asg directive, the quotation marks are optional. If there are no quotation marks, the assembler reads characters up to the first comma and removes leading and trailing blanks. In either case, a character string is read and assigned to the substitution symbol. The syntax of the .asg directive is:
.asg["]character string["], substitution symbol |
The .asg Directive shows character strings being assigned to substitution symbols.
.asg "A4", RETVAL ; return value
The .eval directive evaluates the expression and assigns the string value of the result to the substitution symbol. If the expression is not well defined, the assembler generates an error and assigns the null string to the symbol. The syntax of the .eval directive is:
.eval well-defined expression, substitution symbol |
The .eval Directive shows arithmetic being performed on substitution symbols.
.asg 1,counter
.loop 100
.word counter
.eval counter + 1,counter
.endloop
In The .eval Directive, the .asg directive could be replaced with the .eval directive (.eval 1, counter) without changing the output. In simple cases like this, you can use .eval and .asg interchangeably. However, you must use .eval if you want to calculate a value from an expression. While .asg only assigns a character string to a substitution symbol, .eval evaluates an expression and then assigns the character string equivalent to a substitution symbol.
See Assign a Substitution Symbol for more information about the .asg and .eval assembler directives.