Section 3.10

Group 10

The legal functions in this group are concerned with converting data from one form to another within the working store.

Function-number  [1010 000]

(See also Section 4.4.6)

In the description of the effects of this function, the following notation is used, in addition to that specified in Section 0.4.

xi       - the i-th character in the word x;  i=0(1)7
yi       - the i-th character in the word y;  i=0(1)7
n       - contents of a register in the arithmetic unit.
di       - the value of the l.s. 4 bits of xi
Gi       - the m.s. 2 bits of xi
ri       - the value of the l.s. 4 bits of yi
Ti       - the m.s. 2 bits of yi

F   - denotes a failure; the Monitor Routine is entered and the failure is regarded as being caused by an impermissible operand (see 5.2).

3-address:  z' = r7(r6(.....(r1(r0z+d0)+d1)+....)+d7
2-address;  x' = r7(r6(.....(r1d0+d1)+d2)+...)+d7

OVR will be set if the binary integer would exceed single-length capacity.  This cannot happen from a single 2-address 100-instruction but may happen if using two 100-instructions as in the example later in this section.  Given a number, as 6-bit characters, in X, convert it to a binary integer according to radices set in Y, writing the result into Z or X.  In 3-address form the initial content of Z is taken into account in forming the binary integer but not in 2-address form.

In essence, the function operates as follows:- in 3-address form z is copied into a register in the A.U.; in 2-address form this register is cleared.  The content of this register is then multiplied by r0, the value of the l.s. 4 bits of character y0.  To the result is added d0, the value of the l.s. 4 bits of character x0.  Then this result is in turn multiplied by r1, and d1 added.  This process of multiplication and addition is repeated until all characters have been dealt with.

Since the radices ri are set by program, the 100-instruction permits conversion of mixed-radix data.

It should be noted that the arithmetical processes involved require that, in the chosen internal code, the digits 0, 1, 2, ...., 11 shall be such that the values of their l.s. 4 bits shall be the value of the digit, e.g. 7 must have 0111 as its l.s. 4 bits.

The various Ti, the m.s. 2 bits in each radix character, are used to prescribe checks and special actions to be made concerning the Gi, the m.s. 2 bits of the appropriate datum-character; namely:-

If Ti is

  (i)     00,     perform conversion if Gi is 00 or 01
 (ii)     01,     perform conversion if Gi is also 01
(iii)     10,     perform conversion regardless of Gi
(iv)     11,     perform conversion regardless of Gi and also treat di as zero.

Also, in cases (i), (ii) and (iii) a check is made that di < ri.  Failure to satisfy any one or more of these checks leads to an ‘impermissible operand’ interruption followed by entry to the monitor routine.

(A flow-diagram of the full process is given on page 4 of this section.)

These checks are designed primarily to facilitate reading from punched cards.  In fact, the 100-function is suitable only for fixed-format data; it should not be used for variable-format data.

Referring to section 4.4 pp 2, 3 and 4, it is seen that if a single hole is punched in a card column (usually representing a digit 0 to 9 in the card code) then the v (or xi) character formed on reading that column has the value of di equal to the number of the row punched while Gi is made 01.  Thus, if this character is converted by a radix character with Ti = 01, a check is made that there is one hole, and only one, in rows 0 to 9 of the card, i.e. that the punching represents a decimal digit.  If the punching may be a single hole in any row (i.e. a duodecimal digit) then Gi will be 00 (if rows 10 or 11 punched) or 01 (if single punching in rows 0 to 9) and, to convert and check, Ti should be 00.

Ti = 11 may be used to ignore non-numerical characters within the fixed format.

The various possible Ti, namely 00, 01,10 and 11 may be set on program input by adding 0, 16, 32 and 48 respectively to the value of ri.  Thus, to set ri = 10 and Ti = 01, the character yi can be written as 26 or as 10+16.

If the characters to be converted are in a single word and if the programmer is prepared to overwrite them by the binary integer then a 2-address 100-instruction can be used.  If the characters occupy more than one word or if the characters must not be overwritten, the 3-address form should be used (in the latter case, Z must first be cleared to zero).  Thus, suppose that a sterling quantity has been read, in character form into A100 and A101, the m.s. characters being in A100.  To produce a single-length binary result when converted to pence, the sum must not exceed £586406201480/10/7 of which the first 7 digits (up to 5864062) may be right-justified in A100, and the last 5 digits of £ together with two digits for shillings and one for pence may be in A101.

To convert this sum to binary pence, the following instructions may be used:

   14  ACC    0

  100  A100  RAD1  ACC

  100  A101  RAD2  ACC

with the radices

RAD1)  10, 10, 10, 10, 10, 10, 10, 10

RAD2)  10, 10, 10, 10, 10,  2, 10, 12

ignoring any checking requirements.

The first instruction clears an accumulator, ready to receive the result of the first 100-instruction, which converts the m.s. digits of £'s as an ordinary decimal number.  The second 100-instruction completes the decimal conversion of the £'s and then carries out the mixed-radix conversions to shillings and pence successively.  (If the m.s. data-characters are in an accumulator, the first instruction is not necessary and the second can be 2-address.)


Function Number 101  [1010 001]

In the description of this function-number, the following notation is used, in addition to that of Section 0.4.

Ci,   the complete 6-bit character formed in the inner loop.

fi,    the currently remaining fractional part of the number being converted.

di,   the value of the l.s. 4 bits of the character formed in the inner loop

ri,    the value of the l.s. 4 bits of the i-th radix-character

Ti,   the m,s, 2 bits of the i-th radix-character

b,    an indicator.  Initially clear, this is set when the first significant character is formed.

q,    an indicator.  It is set if the sign of the number to be converted is not the same as the sign of y, otherwise it is clear.

3-address:   x' = characters resulting from conversion of z according to information in Y and Y+1.
2-address:   x' = characters resulting from conversion of x according to information in Y and Y+1

Y contains an number by which z (or x) is to be divided (see Examples in Section 10.2 for particular cases).  Y+1 contains characters each of which represents one radix and zero-suppression information for the appropriate character.  y=0 causes impermissible operand action.

A flow-diagram for the 101-instruction is given on page 7 of this section.  Broadly, the operation of this instruction can be described as follows.

The number N to be converted is read from Z or X.   If the signs of N and y are not the same, q is set to record the fact.  N is then divided by y to give a non negative result and the stored quotient is inverted if q is set.  The fractional part is rounded up to 32 binary places.

If the integral part of the quotient is non-zero, OVR and b are set to record the fact that preceding significant digits exist (but will not be produced by this instruction alone).

The fractional part f0 of the quotient is then multiplied by r0.  In general the result has an integral part d0 and a fractional part f1.  d0 is converted to the appropriate character C0 (by adding l6 if d0 0 or by special action if d0 = 0), which is stored.  Thereafter f1 is multiplied by r1, giving d1, C1 and f2; f2 is multiplied by r2 and so on until all eight successive characters have been formed.  These are then written away in X.

The effects of the various possible Ti are:-

If Ti is 00 a non-significant zero is converted as:  SP
If Ti is 01 a non-significant zero is converted as:  0
If Ti is 10 a non-significant zero is converted as:  Full stop
If Ti is 11 a non-significant zero is converted as:  UC

These Ti are set by adding 0, 16, 32 and 48 respectively to the corresponding radix.  It should be noted that a zero produced by radix 1 or 2 (radix 1 always produces a zero) is treated as non-significant, even though a significant digit may have been produced previously.

OVR is set if:-

(i)  |y| |z| (or |x| if 2-address) i.e. if, when z (or x) is divided by y, the integral part is non-zero.
(ii) If q is set (i.e. zs (or xs) ys) and the character immediately preceding the first significant digit-character is anything other than SP so that it cannot be replaced by a minus-sign.

The number in Y is normally the product of the radices given in Y+1.  If this is not so the effect is to divide the number to be converted by y/Pri - though care must be taken if the result is required exactly as the initial division is only evaluated to 32 binary places.  For examples of this use of the 101-instruction see section 10.2.

Note that if one of x or y is negative and no significant digit is stored than the result is undefined.


Function Number 102  [1010 010]

3-address:  zG' = xF.2Y          2-address:  xG' = xF.2Y

Convert a fixed-point number to floating-point form; multiply the fixed-point fraction in X by 2Y, Y being treated as signed, and convert the result to standard single-length floating-point form, writing it into Z or X.  The conversion may be rounded or unrounded (see section 5.2.5).  Floating-point overflow will occur if the result is numerically too large (see section 5.2.3) and underflow if the result is numerically too small (see 3.9).

Y may be regarded as a shift-number and is formed according to the rules given in section 3.5, page 3.

The fraction xF may have been produced by some arithmetical operation which set OVR.  If the overflow was of one bit only, the correct result from 102-instruction is still obtained, as follows.

If, when the 102-instruction is encountered, OVR is clear, the conversion proceeds normally.  However, if OVR is set then ±2.0 is added to xF before it is standardised, the sign being opposite to that of xF.  The number of places needed to standardise the result (negative if OVR set) is then subtracted from 128+Y and this result stored as the exponent (l.s. 8 bits in xG).  Thus it is necessary to ensure that the state of OVR at the instant a 102-instruction is obeyed is the same as its state immediately after the formation of xF, regardless of what may have happened to OVR in the meantime.  Also, of course, derivation of xF by multiplication, shifting or division may produce more than 1 bit of overflow.

OVR is left clear unless zG' overflows.

Function Number 103  [1010 011]

3-address:  zF' = xG.2Y          2-address:  xF' = xG.2Y

Convert a floating-point number to fixed-point form: multiply the standard single-length floating-point number in X by 2Y, Y being treated as signed, convert it to a fixed-point rounded fraction, and write the result into Z or X.

If x is not properly standardised, suspension will occur/due to 'impermissible operand'.  OVR will occur if the result is not within single-length range for a fixed-point fraction.

Y may be regarded as a shift-number and is formed according to the rules of section 3.5 page 3.

Function Number 104  [1010 100]

Conversion after input from punched-card: given four pairs of characters in X, extract the corresponding four characters in the internal code from a code table starting in Y, then:-

3-address:  zu' = zm,  zm = the four characters formed.
2-address:  xu' = 0,  xm' = the four characters formed.

OVR cannot be set.

The main details of the conversion and sample code-tables are given in section 4.4, pp.7 to 11.  The generation, by hardware, of the four pairs of characters in X is described in section 4.4 pp.2, 3 and 4.  Erroneous punching will be detected either automatically on reading the card (case (iii) of section 4.4.3) or by an 'erase' character being extracted from the code-table to represent the wrongly-punched column.  The latter case can be detected by program by using an 84-or 85-instruction to search for ER in the result of the 104-instruction (by putting Z=63 in the 84- or 85- instruction).

Suppose that a card has been read in Mode 2 into the store area BUFF to BUFF+19, that the table of section 4.4 p.10 is in TAB to TAB+23 and that it is required to convert the data from columns 1 to 8 to alpha-numeric characters in A7.  Then the instructions

  104  BUFF    TAB  A7
  104  BUFF+1  TAB  A7
   84  ERROR   A7   63

will do this and jump to ERROR if any of these eight columns carried illegal punching.

If these columns represent purely numerical data to be converted to binary it is not necessary to use the 104-instruction, since the stored v characters are directly related to the value of the numerical digit punched.  Thus if columns 1 to 8 represent the eight digits of a decimal number (with zeros punched), the number may be converted to binary by

    52  BUFF        24         A7
    10   A7       (BUFF+1)
   100   A7        RAD

with RAD) 10+16, 10+16, 10+16, 10+16, 10+16, 10+16, 10+16, 10+16

an error-interruption occurring if the punching in any column is not confined to a single hole in rows 0 to 9, possibly with punching in rows 10 and 11.  Normally, a column punched in both curtates represents a non-numerical character.  Consequently this method of conversion, by ignoring the u-characters, may convert non-numerical characters (whether punched legitimately or in error) as numerical characters.

The detailed action of the instruction is as follows:

Bits 2-5 of characters 0 and 4 of x are taken in the order

D26, D27, D28, D29, D2, D3, D4, D5

the first five of these bits are used as the word modifier and the last three as a character modifier, relative to Y.  This modifier gives a character from the table which is the first of the four characters formed.  The other three characters are formed similarly from characters 1 and 5, 2 and 6, 3 and 7 respectively of x.  If x has been read from cards in a coded mode the bottom 4 bits of 0 are guaranteed to have a value less than 12, whatever the punching, so that in this case a 24 word table is sufficient.  If x is an arbitrary word, 32 words of table may be needed.

Function Number 105  [1010 101]

Function Number 106  [1010 110]

Function Number 107  [1010 111]

These three function-numbers are unassigned and therefore illegal in any form.