6. SIMPLE CELL DESIGNATION
6.1 Syntax
simpleαcell ::= lowerαidentifier|lowerαidentifier(integer)|
lowerαidentifier(-integer)|(integer)|(modifier)|
(modifier + integer)|αidentifier(modifier)|
αidentifier(modifier+integer)|
αidentifier(modifier-integer) {α=x|r|xx|rr}
6.2 Addresses
This section describes the simpler formats for accessing the contents of storage cells.
The syntax above defines an address of a storage location. The assignment statements to be defined
later either deposit a new value into this location or access its contents.
If the value of the integer used in the syntax is I, the contents of the modifier is X,
and the displacement of the identifier is $ then the address specified in each case is:
lowerαidentifier $
lowerαidentifier(integer) $ + I
lowerαidentifier(-integer) $ - I
(integer) I
(modifier) X
(modifier + integer) X + I
αidentifier(modifier) $ + X
αidentifier(modifier + integer) $ + X + I
αidentifier(modifier - integer) $ + X - I
The addresses calculated must have 0 ≤ $-I, I, $+I < 4096.
For upper identifiers, it is usual for the modifier to contain the base address of the domain.
6.3 Specific Points
Specific points concerning the various types of cell designation can be illustrated using the following
example. These declarations are assumed for all examples in the sections following.
LOWER
REAL LRX, LRA(20), LRY;
INTEGER LIX,LIA(10);
LONG INTEGER LIIX, LIIA(4);
LONG REAL LRRX, LRRA(2);
LOWEND;
BASE;
INTEGER UIA(12), UIX;
REAL URX, URA(10);
- (a) lowerαidentifier:
- this can be referenced by specifying its
identifier alone. The first element of an array is considered to be a simple cell as well.
Therefore LRA specifies the address of the first word of the array LRA. Thus legal cell designations are:
LRX, LRA, LRY, LIX, LIA while both UIA and UIX are not as they are upper identifiers
- (b) lowerαidentifier(integer), lowerαidentifier(-integer):
- this
designation is primarily used for accessing the individual elements of an array. Thus LIA(0), LIA(1), .... LIA(9)
are the designations of the elements of the array LIA. Note that the elements are LIA(0) to LIA(9) and
not LIA(1) to LLA(10). In the case of a real array, each element takes up two words of storage.
Consequently the elements of the real array have designations LRA(0), LRA(2), LRA(4), .... LRA(38).
- There is no check made on the size of the integer to ensure that the accessing is not outside the bounds
of an array nor is there any reason why scalar identifiers should not be accessed in this way.
Thus both LRX and LRX(0) designate the scalar LRX. Similarly LRX(2) is equivalent to LRA(0)
which is equivalent to LRY(-40). All refer to the second real quantity, LRA(0), in the lower declaration.
The address obtained by adding the fixed index to the identifier must always be in the range 0 to 4095.
- The equivalencing of scalars and arrays in this way allows the programmer to declare effectively
one array and to name individual elements of it.
Thus LRX could be considered as a 22 element array whose second element is called LRA and last element LRY.
- (c) (integer), (modifier), (modifier+integer):
- the quantity in
brackets defines the actual address of the cell being designated.
Thus (30) is the thirtieth word of the core store, (X1) is the cell whose address is currently stored in X1
and (X1+3) is the cell 3 further on from the previous one.
It is possible to access the integer accumulators in this way as they are also the first cells of the 1900 store.
Thus (1) designates cell 1 which is also X1. In the case of a cell designated using a modifier,
the address will be truncated to the lower 15 or 22 bits depending on the addressing mode in use.
The value of the integer must be in the range 0 to 4095 but the value of the expression if a modifier
is used may be any possible store location of the machine.
By loading the modifier with an address this provides one method of accessing upper storage cells.
For example if X1 contains the base address of the upper storage domain containing UIA and UIX (£UIA or @UIA)
then (X1) designates UIA(0) and (X1+12) designates UIX.
- (d) αidentifier(modifier), αidentifier (modifier+integer), αidentifier (modifier-integer):
- for lower identifiers, this method of designation is primarily used for accessing individual elements of
arrays. The modifier and integer between them define the number of words that the address is displaced from the
address of the identifier. For example, if X1 contains 3 then LIA(X1) is equivalent to LIA(3) and LIA(X1+2)
is equivalent to LIA(5). The address defined in this way
must be a lower address between 0 and 4095. One other limitation is that the part of the address
other than that in the modifier should be positive. Therefore LRX(X1-8000) is not allowed even if X1
contains 8000.
- For upper identifiers, this provides the main method of designation.
If the modifier contains the address of the base of the domain (in our example X1 could contain £UIA)
then the remainder of the address specifies the element of the domain. For example, if X1 contains £UIA,
then UIA(X1) defines the first element of the array UIA and UIX(X1) defines the scalar UIX.
This is because the identifier itself specifies the displacement from the base address.
Similarly UIA(X1+12) also defines UIX. Note that UIA(3) is meaningless and upper identifiers must always be
accessed using a modifier. One limitation is that the part of the address other than the
modifier (that is the displacement specified by the identifier with the possible addition or subtraction
of the integer) must be in the range 0 to 4095.
Thus UIA(X1-1) or UIX(X1-13) are both illegal even if the current value of X1 is £UIA+10.
Although the modifier usually contains the base of the domain, this is not essential and there is no reason
why £UIA+1 should not be stored in X1. In this case UIA(X1) defines the element UIA(1) while UIA(X1+11)
defines UIX.
6.4 Instructions Generated
PLASYD will normally generate a single 1906A order for each operator/operand pair when operands (cells)
are defined as simplexcell or simplercell.
For long integers and long reals, more than one instruction is often generated.
A more complex mode of cell designation involving the SMO order will be described later.
In general, the user can perform most of the functions he requires without needing the SMO designation.