Next: Local symbols, Previous: Expressions, Up: MIXAL [Contents][Index]

Besides expressions, as described above (see Expressions), the MIXAL
assembler is able to handle the so called *w-expressions* as the
operands of the directives `ORIG`

, `EQU`

, `CON`

and
`END`

(see MIXAL directives). The general form of a
w-expression is the following:

WEXP = EXP[(EXP)][,WEXP]

where `EXP`

stands for an expression and square brackets denote
optional items. Thus, a w-expression is made by an expression, followed
by an optional expression between parenthesis, followed by any number
of similar constructs separated by commas. Sample w-expressions are:

2000 235(3) S1+3(S2),3000 S1,S2(3:5),23

W-expressions are evaluated from left to right as follows:

- Start with an accumulated result ‘
`w`’ equal to 0. - Take the first expression of the comma-separated list and evaluate
it. For instance, if the w-expression is ‘
`S1+2(2:4),2000(S2)`’, we evaluate first ‘`S1+2`’; let’s suppose that ‘`S1`’ equals 265230: then ‘`S1+2 = 265232 = + 00 01 00 48 16`’. - Evaluate the expression within parenthesis, reducing it to an f-spec
of the form ‘
`L:R`’. In our previous example, the expression between parenthesis already has the desired form: 2:4. - Substitute the bytes of the accumulated result ‘
`w`’ designated by the f-spec using those of the previous expression value. In our sample, ‘`w = + 00 00 00 00 00`’, and we must substitute bytes 2, 3 and 4 of ‘`w`’ using values from 265232. We need 3 bytes, and we take the least significant ones: 00, 48, and 16, and insert them in positions 2, 3 and 4 of ‘`w`’, obtaining ‘`w = + 00 00 48 16 00`’. - Repeat this operation with the remaining terms, acting on the new
value of ‘
`w`’. In our example, if, say, ‘`S2 = 1:1`’, we must substitute the first byte of ‘`w`’ using one byte (the least significant) from 2000, that is, 16 (since 2000 = + 00 00 00 31 16) and, therefore, we obtain ‘`w = + 16 00 48 16 00`’; summing up, we have obtained ‘`265232(1:4),2000(1:1) = + 16 00 48 16 00 = 268633088`’.

As a second example, in the w-expression

1(1:2),66(4:5)

we first take two bytes from 1 (00 and 01) and store them as bytes 1 and
2 of the result (obtaining ‘`+ 00 01 00 00 00`’) and, afterwards,
take two bytes from 66 (01 and 02) and store them as bytes 4 and 5 of
the result, obtaining ‘`+ 00 01 00 01 02`’ (262210). The process
is repeated for each new comma-separated example. For instance:

1(1:1),2(2:2),3(3:3),4(4:4) = 01 02 03 04 00

As stated before, w-expressions can only appear as the operands of MIXAL
directives taking a constant value (`ORIG`

, `EQU`

, `CON`

and `END`

). Future references are *not* allowed within
w-expressions (i.e., all symbols appearing in a w-expression must be
defined before it is used).

Next: Local symbols, Previous: Expressions, Up: MIXAL [Contents][Index]