Section 3.14

Group 14

3.14.1   Instructions 140-143 - transfers, regions

The instructions 140 to l43 are concerned with peripheral or other transfers normally affecting a block of registers.  Except for the 143 instruction - which copies identical information to all words in the block - these instructions occur in pairs, the second of which must always be a 142; the first member of the pair is a 140, 141 or 142 for transfers involving peripherals, the drum and other parts of the working store respectively.  No instructions, other than 116 or 117, are allowed between the two members of the pair - an isolated 140, 141 or 142 instruction is illegal.  The pair of instructions, together with any 116 or 117 instructions before either or both members of the pair, constitutes one compound instruction or string as described in Section 3.11, page 4 and is subject to the restrictions described there.  Before the transfer is initiated the entire region specified is checked for lockouts - the instruction pair is locked out if any register in the region is locked out.

Function Number 140  [1110 000]

Select device Y in mode M.  (See Section 4.1 for modes.)

The instruction is normally written 140.M   0   Y  where M is an integer between 0 and 31 and Y is the name of the peripheral.  The mode, M, is stored in the m.s. 5 bits of the X-address; the rest of X is not used (though if X is replaced or modified, this is done normally, the mode being taken from the corresponding place in the effective X-address).  The Y address should be written as an asterisk followed by two letters and an integer between 0 and 31 e.g. *SP17.  The letters allowed are as follows:

SR = seven-track tape reader
FR = five-track tape reader
CR = card reader (80 cols)
VR = card reader (65 cols)
MT = magnetic tape
SP = seven-track tape punch
FP = five-track tape punch
CP = card punch
LP = line printer

Other more specialised devices will have appropriate letter pairs allocated to them.  The two letters are stored in 5 bits each (from A=1 to Z=26) followed by the 5 bits of the integer to give the 15 bit Y-address e.g. *SP17 is compiled by the input routine as

19 x 210 + 16 x 25 +17 =  19985

The machine address of a peripheral is an 8-bit number usually known as the k-bits.  The programmers' address is correlated with the machine address as follows:  while the program is running, absolute location 1 contains the address of the program's directory entry.  The eighth word of this directory is the start of a table of the peripherals reserved for the program - each entry of this table has the programmers' address of a peripheral device in its more significant half and the k-bits in the less significant half - the table being terminated by a clear word.  The microprogram of the 140-instruction searches this table in the same manner as the 146-instruction (q.v.); if the programmers' name is found the corresponding k-bits are extracted.  If the clear word is reached without the programmers' name being found then action occurs due to peripheral violation.  In Engineers and Monitoring Modes this search does not take place and the Y-address of the 140-instruction must be the actual k-bits.

The meaning of the mode depends on the peripheral concerned - unassigned modes will cause suspension due to illegal instruction.  All legal modes are of odd parity and, in general, modes with M<16 are for input transfers and M>16 for output transfers. For details of modes for individual peripheral devices please see the appropriate parts of section 4.  Mode 16 is rather special - in all cases except for the case of the Orion 2/1900 Direct Data Link, it disengages the device.  The 140.16 instruction must be followed by a 142-instruction as usual but the addresses in this 142-instruction are neither read nor checked.  Mode 13 interrogates the specified device; it writes one word of information into the address specified by the X-address of the following 142-instruction - the Y-address is not used and may take any value.  The contents of this word are described in section 5.5.  The 140.13, 142 instruction pair may be obeyed even if the device is busy or disengaged - thus enabling a program to test whether a device is engaged.

The above description applies equally to the two and three address forms of the instruction - in the 3-address form Z is not used.

Function Number 141  [1110 001]

Select drum in mode M, drum address Y.

The instruction is normally written 141.M  0  Y where M is an integer between 0 and 31 and Y is a drum address, relative to the program's drum datum points.

For this instruction a temporary notation is introduced - the fifteen bits of the X-address as written will be called X9 to X23  (X23 being the l.s. end) - X0. to X8 being the nine bits added during modification or replacement; a similar notation is used for Y.  In the simple case where the instruction is not replaced or modified, the mode is taken from X9 to X13.  Bits X14 to X22 are added into positions Y0 to Y8 thus giving a 24-bit drum address.  The 24-bit quantity may be written in the Y-address and will be correctly spread over the X and Y addresses by Basic or Symbolic Input - this is in fact always done if a mode has been written in the instruction.  Bit X23 is ignored.  If the X-address is replaced this combination of the X and Y addresses does not take place - in any case all pre-modification, replacement and internal modification are done after this operation thus giving a 24-bit Y-address, i.e. modification and replacement of X cannot affect the drum address.  The mode is taken from X9 to X13 after all modification and replacement of X has been done in the usual way.

There are only two normal modes available - mode 1 is "read from the drum", mode 21 is "write to the drum".  There is also an "interrogate" mode, M=13, but this does not give any information of use to the ordinary programmer; it is used within the Monitor Program.

When the machine is in Engineers' Mode the drum address, built up as above, is the actual address used on the drum.  In Programmers' Mode the drum datum point has to be added and a check made that the region specified is in the program's reserved region.  The microprogram of the 141-instruction looks at the word before the program's index word (whose address is given in absolute location 1); this word contains 224-N in its upper half, and D in its lower half where D is the drum datum point and N is the number of words in the reserved region.

If the machine has more than one drum control the situation is rather more complicated.  The program may now have several disconnected regions, one on each control, though they appear consecutively numbered to the programmer.  Suppose the program has regions starting at D1, D2, D3 of length N1, N2, N3 respectively.  Then the microprogram searches a table backwards starting at the word before the index word: successive entries in this table are:

224-N1, D1;  224-N1-N2, D2-N1;  224-N1-N2-N3, D2-N1-N2; etc.

The search terminates when an entry is found such that adding the specified drum address to the upper half does not cause a change of sign or alternatively by the entry:  224-1, 0 which terminates the table.  If the transfer specified overlaps two or more regions the Monitor Program is entered - it splits the transfer into the appropriate transfers on the separate regions and obeys them successively.

The above description applies equally to the two and three address forms of the instruction - in the 3-address form Z is not used.

Function Number 142  [1110 010]

(a)  After 140 or 141 instruction.  Transfer Y words or characters to or from region starting at X.

(b)  A pair of 142 instructions thus;
       
142  X1  Y1
        142  X2  Y2

Copy Y2 words from region starting at X2 to region starting at X1 (Y1 is ignored).

(a)   After a 140-instruction the 142-instruction causes a transfer to be executed on the device and in the mode specified by the 140-instruction.  The working store region involved in the transfer starts at X and the transfer is of length Y words or characters, according to the device; sometimes Y specifies a maximum - e.g. read up to NL or at most Y characters.  Y may not exceed 32767.

E.g. the instruction pair

  140.1  0  *SR1
  142  BUZZ  40

Says "read up to NL or at most 40 characters from *SR1 and store them starting at working store address BUZZ". Note that the whole region specified (in this case from BUZZ to BUZZ+4) is checked for lockouts and reservations before the transfer is initiated so that the whole region must be within reservations even if the very first character is NL.

Similarly after a 141-instruction a transfer is initiated to or from the drum (according to whether the mode in the 141 is 21 or 1) from or to the working store area starting at X and of length Y words.

It is illegal for a 142 after a 140 or 141 to have Y=O (except for those modes which do not do a transfer).

(b)  A pair of 142-instructions does an internal transfer of length Y2 words from the region starting at X2 to that starting at X1.  The Y-address in the first 142, Y1 , is ignored.  Y2 may be zero, in which case the pair has no effect.  The regions

X1 to X1+Y2-1  and  X2 to X2+Y2-1

must both be within reservations and are checked for lockouts.  The transfer proceeds starting at the last word and working backwards unless the last word of the destination region lies within the source region - in which case it works forwards, thus always ensuring the correct result.  The instruction pair is harmless if X1=X2.

Note that whereas peripheral and drum transfers are merely initiated by the 142-instruction and subsequently proceed autonomously while the computer carries on with the program, internal transfers are executed immediately - as they use the core store full time.

The two and three address forms of the 142-instruction are identical - i.e. in the three address form Z is ignored.

In the case of peripheral and drum transfers the term 16Y represents the hesitations involved in the transfer - these are actually charged to the program when the instruction is obeyed but take place later - the timer of the program running hesitates when the computer hesitates to allow a word to be read from or written to the core store.  If the running program is not using the core store at the time it gets these 16 microsecs free.  In the cases where Y specifies a maximum the program is charged for the full number of hesitations even though they may not all take place.  Every peripheral or drum transfer causes at least one entry to the time-sharer.  The time spent in the time-sharer is not included in the above times, neither is it charged.

In the case of the 142-pair Y should be read as Y2 for both instructions - i.e. the time for the 142-pair is the fixed part of the times for the instructions plus 32 microsecs per word transferred.

Function Number 143  [1110 011]

(3) Write z to Y words starting at X.
(2) Clear (zeroize) Y words starting at X.

This instruction writes the same quantity (z or 0) into every word of the region X to X+Y-1.  The whole region is checked for reservations and lockouts before the instruction is obeyed. If Y=0 the instruction is a dummy.  The 3-address form with Z=A0 is treated as illegal by the hardware but is correctly interpreted by OMP.  Its use is not recommended; it does nothing which cannot be done by the 2-address form.

3.14.2  Instructions 144-146:  Table Search

The instructions 144, 145, 146 all search a table to find the first number with a particular property.  The table starts at X and the first number w (in location W) is found such that w satisfies a particular inequality or equality (according to function) relative to y.  W is then written into Z.  At the start of the instruction the microprogram does not know how far it will have to search so it checks lockouts and reservations as it goes along.  It is recommended that all tables to be searched should be terminated by a word guaranteed to end the search (otherwise if a wrong y comes along the search may continue till reservations are violated; such a word should be 1-e for the 144-instruction, -1.0 for the 145-instruction and any word with a zero lower half for the 146-instruction.

These instructions are all essentially 3-address instructions - the two-address forms are illegal.

Function Number 144  [1110 100]

(3)  W = address of first w such that W X, w y.  Then z' = W.
(2)  Illegal.

Search a table starting at X to find the first number w such that w is greater than or equal to y.  Then the address of w is written into Z.

Function Number 145  [1110 101]

(3)  W = address of first w such that W X, w y.  Then z' = W

(2)  Illegal.

Search a table starting at X to find the first number w such that w is less than or equal to y.  Then the address of w is written into Z.

Function Number 146  [1110 110]

(3)  W=address of first w such that W X, wu = yu or wm = 0.  Then z' = W

(2)  Illegal.

Search a table starting at X to find the first number w such that the upper half of w equals the upper half of y or the lower half of w=0.  Then the address of w is written into Z.

Function Number 147  [1110 111]

This instruction is illegal.

Orion 2 differences

The information in this section refers in general both to Orion 1 and Orion 2.  Described here are the differences to be noted when reading this for Orion 2.

Differences arise because the object program's peripheral transfer instructions are extracoded.  (See 4.1 for more details)

The K-bits on Orion 2 are sequential and are not checked for odd parity.

The 143 instruction - the 3-address form with Z = A0, is not treated as illegal by the hardware.