Next: , Previous: Expressions, Up: MIXAL


2.2.4 W-expressions

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:

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).