xxassignment ::=xxacc:=xxprimary|xxacc:=NEG xxprimary| xxassignment xxarithmetic xxprimary|xxacc:=xprimary| xxassignment shift coperand xxprimary ::=xxvalue|xxacc|xxcell xxarithmetic ::=+|-|++|-- rrassignment ::=A12:=rrprimary|A12:=NEG rrprimary|A12:=A12| rrassignment rrarithmetic rrprimary rrprimary ::=rrvalue|rrcell rrarithmetic ::=+|-|*|/
Accumulator assignments for long integers are very similar to those for integers. The basic form allows a long integer value, accumulator or cell to be assigned to a long integer accumulator. Long integer values have been defined in Section 4.5. The code generated usually consists of two instructions per operation (one operation on the top accumulator of the pair while the other operates on the bottom).
Some typical examples are:
X12:=273D; X23:= #7777777777D; X34:=LIIX; X45:=MINUS 32679D; X56:=LIIA(0); X67:=LIIA(X1+2);
Even for small integer constants, a pair of lower storage cells will be used to hold the value. Consequently X12:=273D; is less efficient in storage than X1:=0; X2:=273;. The monadic operator NEG can be used to assign the negative of the primary value to the accumulator. For example:
X70:=NEG LIIX; X01:=NEG X23;
Care should be taken that the same integer accumulator is not used on either side of the assignment. For example:
X56:=NEG X67;
will not give the result that would be expected as the code generated is equivalent to:
X6:=NEG CARRY X1; X5:=NEG X6;
In the case of the same long integer accumulator on both sides of the := symbol, no code is generated if it occurs on the same line while the accumulators are loaded from store if the split occurs after the :=. Thus:
X12:= X12+3D;
generates the code equivalent to:
X2:=(2); X1:=(1); X2:=X2++LIA(2); X1:=X1+LIA(1)
assuming LIA(1) and LIA(2) contained the constant 3 double length.
A general long integer accumulator assignment extends the simple form. As with integer assignments, the first part of the statement equivalent to the basic statement assigns a value to a long integer accumulator. The remaining terms of the statement then cause various arithmetic and shift operations to be performed on the contents of the long integer accumulator. These operations are performed strictly from left to right. The possible operations are similar to the arithmetic and shift operations defined for the integer accumulator assignments. The difference is that results apply to the 48 bit integer accumulator pair rather than a single integer accumulator. The full set of addition and subtraction operators are allowed including those which set CARRY (++ and --). Basically each operator/operand generates two instructions. In the case of the shift operations, use is made of the double-length instructions available on the 1900 so that, in this case, only a single order is often required. Some examples are:
X67:=X67 SLA 2 - LIIA(2) SRL 3; X12:=X67 - LIIX * LIIA(X3);
It is possible in some circumstances to use integer primaries in long integer assignments. Frequently the code generated is not what would be expected. As a general rule the address of the integer primary is assumed to be that of a long integer quantity so that the contents of the next address are also used. For example:
X67:=LIA(2);
does not set X67 equal to the value of LIA(2) but that contained in LIA(2) and LIA(3). Short integer quantities are compiled correctly so that X67:=3; gives the desired result. However, X67:=32670; accesses the addresses assigned to 32670 and also the following address which could contain anything. It is, therefore, dangerous to mix long integer and integer primaries in a statement even though the compiler does not fault it. The result will almost certainly be different from that expected.
The PLASYD compiler does allow * and / to be used in long integer assignments. However, the results are not what the user could normally expect. Consequently,their use is not advised. Basically the multiply only operates on the top halves of the long integer quantities, while the divide takes the 48 bit quantity and divides it by the top 24 bits of the operand. It would be sensible for anyone attempting to use these operators to examine the code generated first.
Accumulator assignments for long reals are quite simple in form. The basic assignment allows the long real accumulator to be assigned a long real value or a long real primary. For example:
A12:=1.75L; A12:=3.97825L; A12:=MINUS 9.58& MINUS 25L; A12:=LRRX; A12:=LRRA(2);
The monadic operator NEG can be used to assign the negative of the primary value to the long real accumulator. For example:
A12:=NEG 1.75L; A12:=NEG LRRX;
The general long real accumulator assignment extends the basic form. The first part, equivalent to the basic statement, assigns a value to the long real accumulator. The remaining terms of the statement then cause various arithmetic operations to be performed on the contents of the long real accumulator. These operations are performed strictly from left to right. For example:
A12:=A12+LRRX*LRRA(0)-LRRA(2)/LRRA(4); A12:=LRRX*LRRX+LRRA;