Function Number 120 [1100 000]
If Y > 0 zm' =
number of l-bits in bits 0 to Y-1 of x, zs' = inverse of bit Y of x;
rest of z' clear.
If Y = 0 zm' = 0, zs' = inverse of bit 0 of x; rest of z' clear.
If Y < 0 zm' = number of 1-bits in bits 47 to 48+Y of x,
zs' = inverse of bit 47+Y of x; rest of z' clear.
(2) As 3-address but with x' in place of z'.
Count 1-bits (sideways add). If Y ≥ 0 then 1-bits are counted from the m.s. end of x, if Y < 0 from the l.s. end of x. The number of 1-bits in the first |Y| bits of x is written into zm or xm and the sign bit of Z or X is set to the inverse of the next bit of x.
The formation of the signed Y is done as described for group 5 instructions (see 3.5 page 3). Note that if Y > 48 or Y ≤ -48 the effect will be as if Y = 48 (except for the time). This instruction is used in a wide variety of subtle programming tricks, the most common being to form a dense set from a scattered set.
Function Number 121 [1100 001]
(3) z' = x shifted circularly right Y places (Y
(2) x' = x shifted circularly right Y places (Y signed).
Shift x circularly right Y places if Y ≥ 0 or circularly left -Y places if Y < 0 writing the result to Z (3-address) or to X (2-address). The instruction cannot set overflow.
The signed shift number Y is formed as described in section 3.5, page 3, except that if Y (after negation if necessary) is greater than 255 the Monitor Routine is entered - it takes the shift number modulo 48 and thus gives the correct result.
Function Number 122 [1100 010]
(3) x' = y shifted circularly left Z characters.
(2) x' = y shifted circularly left zc characters.
In 3-address form y is shifted circularly left Z characters (i.e. 6Z bits) and written into X - only the l.s. 3 bits of Z are in fact used. This instruction is useful when it is desired to shift and copy into a register (not an accumulator) or into a replaced address. It is often faster than the 121 instruction as the shifting is done by characters in the store transfer gates and the time is independent of the number of places shifted.
In the two-address form z is effectively a character modifier. The X and/or Y addresses are modified in the usual way and the number of characters to be shifted is then taken from the m.s. 3 bits of z; y is shifted circularly left this number of character positions and written into X. Thus if an integer in z is shifted circularly right 3 places it may be used as a character modifier - i.e. when used as the modifier in a Y modified 122 instruction, it will cause the selected character to be placed in the m.s. 6 bits of x - i.e. the 122 can be used as a table lookup instruction on a table with entries of length 6, 12 or 24 bits. The desired character can be made to appear at the l.s. end of x by suitably arranging the table. The character modifier can be stepped by a 115 instruction. Note that zc is always used to modify the Y address (effectively) irrespective of whether X or Y or both is modified.
Function Number 123 [1100 011]
(3) Append y to x:L
Z3 characters down
(2) Append y to x:L zc characters down
where Z3 is the integer contained in the l.s. 3 bits of Z.
Append field: let n=Z3 (3 address) or zc (2 address). Then the 123 instruction leaves the first n characters of x:L unchanged, replaces the next 8 characters of x:L by the whole of y and clears the remaining 8-n characters (note that 0 ≤ n ≤ 7).
The instruction is used to pack information head to tail, usually over several words; the most common case being the preparation of information for output. The three address form can be used if it is known where within the words the information is to be put; the two address form is used when this is given by a character modifier as for the 122 instruction; for the 123 instruction it is usually convenient to regard the character modifier as modifying X. After the 123 the character modifier can be suitably stepped by a 115 instruction - thus the packing can be done by 123 and 115 instructions without the programmer being conscious of word boundaries.
Function Number 124 [1100 100]
In this instruction x is shifted n places. Y is treated as signed (see 3.5 page 3) and |Y| specifies the maximum value of n unless Y>255 or Y<-255 in which case n≤255.
0 x' = x shifted up logically the number of places required to
shift off the m.s. 1-bit, but at most Y places.
z' = n if a 1-bit has been shifted off, otherwise zs' = 1 and zm' = n
If Y < 0 x' = x shifted
down logically the number of places required to shift off the l.s. 1-bit, but at
most -Y places.
z' = n if a 1-bit has been shifted off, otherwise zs' = 1 and zm' = n.
(2) As for 3-address but x' = n (or xs' = 1 and xm' = n). Find left or right most 1-bit: x is shifted up or down (depending on the sign of Y) until either a 1-bit has been shifted off or it has been shifted |Y| places. The number of places shifted is written into Z in the 3-address form and into X in the 2-address form. If there are no 1-bits in the m.s, or l.s. |Y| places of x then the sign bit of Z or X is set equal to 1.
An exception to the above rule occurs if X=Z in the 3-address form. In this case, since z is written first
z' = x shifted up (or down) n places and the number of places shifted is lost.
This instruction is commonly used to operate on fields where each bit represents a distinct entity. Note that after the instructions:
53 SPUD (BUZZ)
the m.s. 1-bit of SPUD has been removed.
Function Number 125 [1100 101]
(3) x:F' = (x:F+v)2m zI' = zI - m OVR' = 0
v = 0 if OVR is clear
v = +2 if OVR is set and x<0
v = -2 if OVR is set and x≥0
and m is chosen so that -1 ≤ m ≤ Y and ½ ≤ x:F' < 1 or -1 ≤ x:F' < -½
or m = Y, when -½ ≤ x:F' < -½
Standardise double-length floating point number. This instruction is intended for use on double-length floating point numbers (see Section 2.0 p.5(iv)). x:F is regarded as a double-length argument and zI as the exponent. In general, x:F is shifted up until it lies in the range ½ ≤ x:F < 1 or -1 ≤ x:F < ½ and the number of places shifted is subtracted from zI. The instruction further assumes that if overflow is set, it is only one bit and is due to a previous fixed-point operation on x:F. In this case the correct value of x:F is formed in the arithmetic unit before the standardising takes place. After the operation OVR is left clear even if z overflows. Y is used to specify the maximum number of places to be shifted and if the number cannot be standardised with m ≤ Y then x:F is left in the range -½ ≤ x:F < ½ and m=Y.
A number of special cases arise.
(i) If x:F is not a standard double-length fraction, i.e. x*<0, an impermissible operand suspension will occur.
(ii) In the case where m = -1 (which can only happen if OVR is set) x:F is shifted down unrounded.
(iii) The operations in the arithmetic unit take place in the following order.
Read x - Read x* - Shift x: - write x - write x* - Read z - Subtract m - write z.
If, therefore, Z = X or X + 1, m will be subtracted from the appropriate operand (x' or x*').
Function Number 126 [1100 110]
z' + ey'
= x + ey
0 OVR' = 0
where v = 0 if OVR clear; v = +2 if OVR set, y< 0; v = -2 if OVR set, y ≥ 0
(2) As 3-address but with x' in place of z'
Justify double-length number. This instruction performs the “carry” between the two halves of a double-length number - it assumes that OVR, if set, was set in operations in the l.s. half and that there was only one bit of overflow. It is thus normally necessary to obey a 126 instruction after every operation on the l.s. halves of double length numbers. The value of the carry =
0 if OVR
-1 if OVR clear y < 0
+1 if OVR set y < 0
-2 if OVR set y ≥ 0
This carry is added to x (and written into X or Z) and OVR and ys are cleared, OVR will be left clear unless the addition of the carry to x causes overflow.
If X=Y (2 address) or Z=Y (3 address) the arithmetic is correctly performed and the single result obtained will be the l.s. half (with sign bit and OVR cleared).
Function Number 127 [1100 111]
This instruction is illegal.