Contact us Heritage collections Image license terms
HOME ACL Associates Technology Literature Applications Society Software revisited
Further reading □ Contents1. Introduction2. Basic symbols and comments3. Identifiers, accumulators and cells4. Types and values5. Addresses and storage allocation6. Simple cell designation7. Assignment statements8. Integer accumulator assignments9. Real accumulator assignments10. Long accumulator assignments11. Cell assignments12. Block structure13. Procedures and labels14. Conditional and control statements15. Functions16. Cell declarations17. Synonym declarations18. Storage allocation19. Subcompilation and global storage20. Define statements, conditional compilation and include statements21. Compiler directives22. FORTRAN/PLASYD mixed programming23. ALGOL/PLASYD mixed programming24. Useful library routines25. Use of TASK macro to compile PLASYD programs26. SMO cell designation27. Compiler output28. PLAN instructions not provided for in PLASYD □ Appendices □ 1: Errors and comments2: 1900 character set3: Syntax definitions in alphabetical order4: Use of program XMED5: 1900 order code6: Code genereated for typical PLASYD statements7: A sample PLASYD program8: Less commonly used directivesReferences
ACD C&A INF CCD CISD Archives Contact us Heritage archives Image license terms

Search

   
ACLLiteratureICL 1906A manualsPLASYD
ACLLiteratureICL 1906A manualsPLASYD
ACL ACD C&A INF CCD CISD Archives
Further reading

Contents1. Introduction2. Basic symbols and comments3. Identifiers, accumulators and cells4. Types and values5. Addresses and storage allocation6. Simple cell designation7. Assignment statements8. Integer accumulator assignments9. Real accumulator assignments10. Long accumulator assignments11. Cell assignments12. Block structure13. Procedures and labels14. Conditional and control statements15. Functions16. Cell declarations17. Synonym declarations18. Storage allocation19. Subcompilation and global storage20. Define statements, conditional compilation and include statements21. Compiler directives22. FORTRAN/PLASYD mixed programming23. ALGOL/PLASYD mixed programming24. Useful library routines25. Use of TASK macro to compile PLASYD programs26. SMO cell designation27. Compiler output28. PLAN instructions not provided for in PLASYD
Appendices
1: Errors and comments2: 1900 character set3: Syntax definitions in alphabetical order4: Use of program XMED5: 1900 order code6: Code genereated for typical PLASYD statements7: A sample PLASYD program8: Less commonly used directivesReferences

8. INTEGER ACCUMULATOR ASSIGNMENTS

8.1 Syntax

xassignment  ::=  xacc:=xprimary|xacc:=address|xasgn + address|
                  xasgn-wordaddress|xacc:=monadic xprimary|
                  xacc:=CNT coperand|xassignment  xarithmetic xprimary|
                  xassignment logical xprimary|xassignment shift coperand
xasgn        ::=  X0:=X0|X1:=X1|X2:=X2|X3:=X3|X4:=X4|X5:=X5|X6:=X6|X7:=X7
xprimary     ::=  xvalue|xacc|xcell
αcell        ::=  simpleαcell|smoαcell  {α=x|r|xx|rr}
monadic      ::=  NEG|EX|CH|CARRY|NEG CARRY
coperand     ::=  integer|octalinteger|modifier!simplexcell
xarithmetic  ::=  +|++|-|--|*|/
logical      ::=  AND|OR|ER
shift        ::=  SLL|SRL|SLA|SRA|SRAV|SLC|SRC
address      ::=  wordaddress|CHAR integer|CHAR integer OF wordaddress|
                  @ identifier
wordaddress  ::=  $ extendedcell|@ extendedcell|£ identifier
extendedcell ::=  cell|upperidentifier (integer)|upperidentifier (-integer)
cell         ::=  xcell|rcell|xxcell|rrcell

8.2 Basic Integer Accumulator Assignment

xacc:= xprimary

The basic integer accumulator assignment sets the defined accumulator equal to the value of the primary specified. This is divided into three kinds:

  1. Assigning a Value: one of the integer values defined in Section 4.3 is assigned to the integer accumulator specified. Examples are:
    X1:=3671;  X2:=MINUS  6;   X3:= # 770;   X4:=12T15;   X5:=MINUS   80000T12; 
    X6:=257CNT; X7:= 'ABCD';   X3:=   "A";
    
    Assignment of an integer value which can be stored in 12 bits takes no extra storage. Integer values outside this range will cause the constant's value to be stored in lower and accessed from there. Several uses of the same value in one segment will result in only one lower storage cell being set aside.
  2. Assigning an Accumulator: in the case of integer accumulators it is possible to transfer values from one accumulator to another. For example:
    X1:=X3; X2:=X2; X5:=X7;
    
    The code generated for X1:=X3 is equivalent to X1:=(3). In the case of an assignment to the same accumulator, this usually does not generate any code. However, code is generated if the assignment is split between two lines. Thus:
    X2:=X2;
    X2:=
    X2;
    
    would compile code in the second assignment but not in the first.
  3. Assigning a Cell: any of the simple cell designators defined in Section 6 can be used to assign the contents of the cell to an integer accumulator. For example:
    X1:=LIX; X2:=LIA(3); X3:=LIA(-1); X4:=(3);
    X5:= (X2); X6:= (X1+3); X7:=UIA(X1); X0:=UIA(X1+3);
    X7:=UIX(X1-12); X6:=LIX(X1+2); X5:=LIA(X1-3);
    
    When the type of cell is known, it must be integer.

8.3 Addresses

Integer cells and accumulators may be assigned values which are addresses. The use of variables with such values has been described in the section on cell designations. An address takes one of the following forms:

  1. Displacement ($ extendedcell): the address is defined as the displacement of the cell which is the number of words that the cell designator is displaced from the base of its domain. In the case of a lower cell, this is the address of the cell itself. For an upper identifier, the address is the base of its domain. If the cell designator does not consist of a simple identifier but contains a modifier and perhaps an integer then these will be added to the address in the normal way. Values of such addresses may be greater than 4095. In addition to normal cell designators, it is possible to specify an upper identifier with a fixed index. If the integer accumulator X1 contains the value X then some example addresses with their values are:
    address           value
    $LRX              @LRX
    $LRA(4)           @LRX+5
    $LRX(X1+3)        @LRX+X+3
    $UIA              0
    $UIA(2)           2
    $UIX              12
    $UIX(-2)          10
    
  2. Base (£identifier): the address is defined as the base of the domain containing the identifier. In the case of lower cells it is identically zero. Note that only identifiers are allowed and £LRX(3) is illegal. Some example addresses with values are:
    address    value
    £LRX       0
    £LRA       0
    £LIA       0
    £UIA       @UIA
    £UIX       @UIA
    
  3. Complete address (@extended cell): this is the complete address of a cell in words. It is equal to the displacement of a cell added to the base address. Thus @Y is always identically equal to £Y+$Y. Some examples are:
    address                value
    @LRX                   @LRX
    @LRX(X1+3)             @LRX+X+3
    @UIA                   @UIA
    @UIA(2)                @UIA+2
    @UIX                   @UIA+12
    @UIX(-2)               @UIA+10
    
    As well as defining cell addresses in this way, this format can also be used to specify the address of a PLASYD label or procedure. These will be defined later.
  4. Character address. A 1900 word can be thought of as containing four 6-bit characters. In some 1900 instructions, the contents of a modifier or accumulator can be taken as an address with the top two bits defining the character position (0,1,2 or 3) and the remaining 22 bits defining the word address. In the simpler form, it defines a character address only, while in the more complex form it defines the word address as well. For example:
    address             character value      word
    CHAR 3                    3               0
    CHAR 2 of $UIX(-2)        2               10
    CHAR 1 of @UIA(2)         1               @UIA+2
    CHAR 6 of @UIA            2               @UIA+1
    
    The compilation of addresses with the character position defined greater or equal to 4 tends to be inefficient and is not therefore advisable.

8.4 Address Assignments

xacc:=address 
xasgn+address
xasgn-wordaddress

The simplest address assignment sets an integer accumulator equal to one of the addresses specified above. For example:

X1:=$LRX; X2:=£UIA; X3:=@UIX(-2);
X4:=CHAR 3; X5:=CHAR 1 OF @UIA(2);

The more complex forms allow an address to be added to the contents of an integer accumulator or a word address to be subtracted from the contents of the accumulator. Note that a character address cannot be subtracted from the accumulator. Some examples are:

X1:=X1+CHAR 3; X2:=X2+@UIX(-2); 
X3:=X3+CHAR 1 OF @UIA(2); 
X4:=X4-@UIX(-2); X5:=X5-£UIX;

It should be remembered that the character position of an address will normally cause the two most significant bits of the integer accumulator to be set. If the accumulator contains a large value then care should be taken to ensure that an addition does not cause overflow into these two bits.

Some comments on the code generated for address assignment are:

  1. Addition of just the CHAR part of an address will be done by repeated use of the BCHX instructions. Thus X1:=X1+CHAR 7 will generate seven instructions.
  2. To assign, add or subtract an identifier base always takes one instruction.
  3. To assign, add or subtract a word displacement takes one instruction at least and more than one if a SMO index is used.
  4. To assign, add or subtract a cell address takes at least one instruction for a lower identifier and at least two for an upper identifier.
  5. If the address of the identifier used is not yet known, ie it is a label or a procedure which has not yet been declared, and an incremented form of address is used, then incorrect code will be generated. No error message or warning will be given.
  6. If the address of a word in upper storage is subtracted from an accumulator then incorrect code will normally be generated. No error message or warning will be given.

8.5 Monadic Operators

The primary on the right of the assignment may be preceded by a monadic operator. The effect on the assignment is as follows:

  1. NEG: the integer accumulator is assigned the negative of the primary value. For small constants (less than 12 bits) no lower storage is used and the code generated is faster than that using MINUS. Thus X1:=NEG 3 is preferred to X1:=MINUS 3.
  2. EX: the lower 9 bits of the primary specified are assigned to the integer accumulator. Constants will require lower storage. Consequently, X4:=EX 3 uses lower storage but X3:=3; X4:=EX X3 does not.
  3. CH: the result of the CH operator depends on whether the primary is defined using a modifier or not. In the unmodified form, the CH operator sets the specified accumulator equal to the lower 6 bits of the primary. If the primary is defined using a modifier, then the address is taken as a character address and the lower 6 bits of the integer accumulator are set equal to this character position. For example, if LIX contains the constant ABCD then the value of X1 will be:
    X1:=CH 33;                   'A'     that  is    #00000041
    X1:=CH LIX;                  'D'     that  is    #00000044
    X2:=0;
    X1:=CH LIX(X2);              'A'     that is     #00000041
    X2:=CHAR 2;
    X1:=CH LIX(X2);              'C'     that is     #00000043
    
  4. CARRY: the integer accumulator is assigned the value of the primary without its most significant bit. The CARRY register is set if the most significant bit of the primary is set. As in all 1900 integer arithmetic, the value of the primary will be incremented by the value of the CARRY bit. For example if LIX contains 37777777 and CARRY is set, then X1:=CARRY LIX; will set X1 to 0 and will propagate the CARRY leaving the CARRY register set.
  5. NEG CARRY: the value of the primary is first negated and the operator CARRY is performed on the result.

The monadic operators do not cause additional machine instructions to be obeyed. In the case of CARRY and NEG, small constants do not require lower storage but with EX and CH they do.

8.6 Count Assignments

xacc:=CNT coperand

The integer accumulators can be set up to contain a count in the bits 0 to 8 and a modifier in the remainder of the accumulator. Special branch instructions in the order code allow the modifier to be incremented, the counter to be decremented and the branch to occur if the count is non-zero. As bits 0 and 1 are used to define a character position in a word, it is usual for the count to be set less than or equal to 127.

The effect of the counter assignment is to set the top 9 bits of the accumulator specified to the value of the coperand. The remaining bits are set to zero. If an integer constant is used as the coperand then its value must be less than 512. Similarly, an octal constant must be less than #1000. If the coperand is a cell designation then this will generate an additional order (which is a SMO). Typical examples are:

X1:=CNT 127; X1:=CNT #177; 
X1:=CNT LIX; X1:=CNT LIA(X2); 
X4:=CNT X2;  X4:=CNT (X2);

It is more efficient to load a count by:

X1:=CNT 127;

than using:

X1:=127CNT;

The latter generates a constant in lower storage.

8.7 General Integer Accumulator Assignment

xassignment xarithmetic xprimary 
xassignment logical     xprimary 
xassignment shift       coperand

So far, we have considered the simple examples of assigning a value to an integer accumulator. A general assignment statement can assign a value and then cause various arithmetic or logical operations to be performed on the contents of the accumulator. These operations are performed in the order specified within the statement, that is, strictly left to right and not in the normal arithmetical hierarchy order. For example:

X1:=X2+LIX*LIA(2)-X1;

is equivalent to:

X1:=X2; X1:=X1+LIX; X1:=X1*LIA(2); X1:=X1-X1;

If the same accumulator appears before and after the := on the same line of code then no code is generated for that operation. Note that the last operation in this example always forces the result to be zero! If the instruction is split between two lines immediately after := then the accumulator specified is loaded from store. This may be of use in unsetting the CARRY register.

The three classes of operators are:

  1. Arithmetic: the possible operators are +, -, *, /, ++, --
    1. +, - : these have their standard meanings.
    2. *, / : these two operations do have the side effect of destroying the contents of a neighbouring accumulator (the neighbours of X7 are X6 and X0). In the case of multiplication, the next accumulator is set to zero. For division, the unrounded result is placed in the specified accumulator and the remainder in the preceding one. Thus: X6:=X6*3 destroys X7 while X6:=X6/3 destroys X5.
    3. ++,-- : these two operators are similar to + and - except that the top bit of the result is always reset to 0 and if CARRY has taken place then the CARRY register is set. The operators are useful when doing triple-length and multi-length working. For example, if a triple-length number is stored in LIA(1), LIA(2) and LIA(3) then the number can be loaded into X4, X5 and X6 and the constant 3 added to it by:
      X6:=LIA(3)++3; 
      X5:=CARRY LIA(2); 
      X4:=LIA(1);
      
      The number in X4, X5, X6 can have the number in LIA subtracted from it by:
      X6:=X6--LIA(3); 
      X5:=X5--LIA(2); 
      X4:=X4-LIA(1);
      
  2. Logical: the possible operators are AND, OR and ER which specify and, or and non-equivalence respectively. The accumulators and operators specified are taken as 24 bit quantities with the operations performed on corresponding bits.
  3. Shift: the possible operators are: SLL, SRL, SLA, SRA, SRAV, SLC, SRC. These are only allowed with the coperands specified in the Count Assignments. The meanings of the operators are:
    • SLL: Shift left logical. The top bits are lost and spaces created at the least significant end are filled with zeros.
    • SRL: Shift right logical. The least significant bits are lost and spaces created at the most significant end are filled with zeros.
    • SLA: Shift left arithmetic. The accumulator is regarded as a 24-bit signed number. The top bits are lost and spaces created at the least significant end are filled with zeros. The overflow register V is set if the value of the most significant bit undergoes any change during the shifting. It can therefore be used to multiply positive and negative numbers by powers of 2.
    • SRA: Shift right arithmetic. Similar to SLA. The least significant bits are lost. In the case of SRA the sign bit is propagated at the most significant end of the word. The result is therefore still arithmetically correct and is equivalent to dividing by a power of 2.
    • SRAV: Special shift right arithmetic. The result is identical to SRA if the overflow register V is clear. If V is set, the inverse of the most significant bit is propagated at the most significant end of the word. Bits shifted beyond the right hand end are lost except that the value of the final bit so shifted is added back into the result to round it off. The SRAV allows the original number to be recovered after overflow. For example
      X1:=X1 SLA 1 SRAV 1;
      
      leaves X1 unchanged even if overflow took place. To take the average of two numbers in X1 and X2:
      X1:=X1+X2 SRAV 1 
      
      which works even if the sum overflows.
    • SLC: Shift left circular. The 24 bits are regarded as a pattern which is circulated to the left the number of places specified. As a bit leaves the most significant end it re-appears in the space at the least significant end.
    • SRC: Shift right circular. Similar to SLC but the pattern is circulated to the right. As a bit leaves the least significant end it re-appears in the space at the most significant end.

If X1 contains #6541234 then the results of the following operations are:

X1:=X1 SLL 3; 65412340
X1:=X1 SRL 3; 07654123
X!:=X1 SLA 3; 65412340  V is not set
X1:=X1 SRA 3; 77654124
X1:=X1 SLC 3; 65412347
X1:=X1 SRC 3; 47654123

As before, the possible operands are restricted to coperands. Some examples are:

X1:=X1 SRL 4; X2:=X2 SLL #11 
X3:=LIX SLA X2; X4:=7 SLL LIA(X2-1);

From the syntax, it can be seen that there is complete freedom to mix operator/operand pairs of the types arithmetic, logical and shift. Thus:

X1:=X1 SRL 4 AND #77 OR CNT 127 + 4 - LIX;
⇑ Top of page
© Chilton Computing and UKRI Science and Technology Facilities Council webmaster@chilton-computing.org.uk
Our thanks to UKRI Science and Technology Facilities Council for hosting this site