You can use variables in GASP to represent strings, registers, or
the results of expressions.
You must distinguish two kinds of variables:
1. Variables defined with `.EQU' or `.ASSIGN'. To evaluate this kind
of variable in your assembly output, simply mention its name. For
example, these two lines define and use a variable `eg':
eg .EQU FLIP-64
*Do not use* this kind of variable in conditional expressions or
while loops; GASP only evaluates these variables when writing
2. Variables for use during preprocessing. You can define these with
`.ASSIGNC' or `.ASSIGNA'. To evaluate this kind of variable,
write `\&' before the variable name; for example,
opcit .ASSIGNA 47
.AWHILE \&opcit GT 0
GASP treats macro arguments almost the same way, but to evaluate
them you use the prefix `\' rather than `\&'. Note: Defining your
`PVAR .EQU EXPR'
Assign preprocessor variable PVAR the value of the expression
EXPR. There are no restrictions on redefinition; use `.EQU' with
the same PVAR as often as you find it convenient.
`PVAR .ASSIGN EXPR'
Almost the same as `.EQU', save that you may not redefine PVAR
using `.ASSIGN' once it has a value.
`PVAR .ASSIGNA AEXPR'
Define a variable with a numeric value, for use during
preprocessing. AEXPR must be an absolute expression. You can
redefine variables with `.ASSIGNA' at any time.
`PVAR .ASSIGNC "STR"'
Define a variable with a string value, for use during
preprocessing. You can redefine variables with `.ASSIGNC' at any
`PVAR .REG (REGISTER)'
Use `.REG' to define a variable that represents a register. In
particular, REGISTER is *not evaluated* as an expression. You may
use `.REG' at will to redefine register variables.
All these directives accept the variable name in the "label"
position, that is at the left margin. You may specify a colon after
the variable name if you wish; the first example above could have
started `eg:' with the same effect.
Next: Macros Prev: Loops Up: Commands
[ Dokumentation lokal installierter Software ]