Next: , Previous: , Up: MIXAL   [Contents][Index]


2.2.3 Expressions

The ADDRESS, INDEX and MOD fields of a MIXAL instruction can be expressions, formed by numbers, identifiers and binary operators (+ - * / // :). + and - can also be used as unary operators. Operator precedence is from left to right: there is no other operator precedence rule, and parentheses cannot be used for grouping. A stand-alone asterisk denotes the current memory location; thus, for instance,

     4+2**

evaluates to 6 (4 plus 2) times the current memory location. White space is not allowed within expressions.

The special binary operator : has the same meaning as in fspecs, i.e.,

A:B = 8*A + B

while A//B stands for the quotient of the ten-byte number A 00 00 00 00 00 (that is, A right-padded with 5 null bytes or, what amounts to the same, multiplied by 64 to the fifth power) divided by B. Sample expressions are:

18-8*3 = 30
14/3 = 4
1+3:11 = 4:11 = 43
1//64 = (01 00 00 00 00 00)/(00 00 00 01 00) = (01 00 00 00 00)

Note that all MIXAL expressions evaluate to a MIX word (by definition).

All symbols appearing within an expression must be previously defined. Future references are only allowed when appearing standalone (or modified by an unary operator) in the ADDRESS part of a MIXAL instruction, e.g.

* OK: stand alone future reference
         STA  -S1(1:5)
* ERROR: future reference in expression
         LDX  2-S1
S1       LD1  2000