| S | M | G | F | K | N |
| (1) | (1) | (3) | (3) | (2) | (10) |
S = Program break digit - this digit is only used when using the machine in a multi-level mode.
M = The mode bit
G and F (Group and Function) together form the function code and are sometimes referred to by the single letter F.
K = The modifier,
| K = 0 | No modifier |
| K = 1 | B-register |
| K = 2 | Accumulator |
| K = 3 | Sequence Control Register (S.C.R.) |
N = The address bits.
For convenience, the instruction format of the 502 program sheet is arranged in a slightly different sequence, illustrated on the specimen. The G and F bits are grouped under the single heading F and are entered in the first column; and the K-digit and the store mode bit occupy the last two columns.
| e.g. | (ii) | 10 24 | - add 24 into the accumulator | a' = a + 24 | |
| (iii) | 11 24 | - subtract 24 from the accumulator | a' = a - 24 | ||
| (iv) | 12 24 | - subtract accumulator from 24 | a' = 24 - a' | ||
| (v) | To clear the accumulator | write 13 0 | |||
| (vi) | To count up | write 10 1 | |||
| (vii) | To count down | write 11 1 | |||
When the mode bit is a one - represented by a colon in the program sheet - the N bits are used to specify an address in the main store. The contents of the address specified are used in these functions. Thus if we indicate the contents of a main store address by the symbol (N) the meaning of each function is as follows.
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 10 | : | N | a' = a + (N) | ||
| 11 | : | N | a' = a - (N) | ||
| 12 | : | N | a' = (N) - a | ||
| 13 | : | N | a' = (N) |
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 10 | : | 65 | a' = a + 99 = 101 | ||
| 11 | : | 65 | a' = a - 99 = -97 | ||
| 12 | : | 65 | a' = 99 - a = 97 | ||
| 13 | : | 65 | a' = 99 |
When F > 3 the effect is to write the result into the main store location specified by N. Thus if (N)' represents the new contents of main store location N:
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 14 | : | N | (N)' = (N) + a | ||
| 15 | : | N | (N)' = a - (N) | ||
| 16 | : | N | (N)' = (N) - a | ||
| 17 | : | N | (N)' = a |
Suppose x = 10 and the program commences at location 50.
|
Address of
Instruction |
F | M | A | B | S | Comments |
|---|---|---|---|---|---|---|
| 50 | 13 | : | 600 | Write the first number to the accumulator | ||
| 51 | 10 | : | 601 | Add in the second number | ||
| 52 | 10 | : | 602 | Add in the third number | ||
| 53 | 10 | : | 603 | Add in the fourth number | ||
| 54 | 10 | : | 604 | Add in the fifth number | ||
| 55 | 10 | : | 605 | Add in the sixth number | ||
| 56 | 10 | : | 606 | Add in the seventh number | ||
| 57 | 10 | : | 607 | Add in the eighth number | ||
| 58 | 10 | : | 608 | Add in the ninth number | ||
| 59 | 10 | : | 609 | Add in the tenth number | ||
| 60 | 17 | : | 599 | Store total |
Using b to denote the original contents of the B-register and b' tp denote the new contents, then:
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 00 | N | b' = b + N | |||
| 01 | N | b' = b - N | |||
| 02 | N | b' = N - b | |||
| 03 | N | b' = N |
When M = 1:
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 00 | : | N | b' = b + (N) | ||
| 01 | : | N | b' = b - (N) | ||
| 02 | : | N | b' = (N) - b | ||
| 03 | : | N | b' = (N) | ||
| 04 | : | N | (N)' = (N) + b | ||
| 05 | : | N | (N)' = b - (N) | ||
| 06 | : | N | (N)' = (N) - b | ||
| 07 | : | N | (N)' = b |
|
Address of
Instruction |
F | M | A | B | S | Comments |
|---|---|---|---|---|---|---|
| 50 | 03 | : | 600 | Write the first number to the B-register | ||
| 51 | 00 | : | 601 | Add in the second number | ||
| 52 | 00 | : | 602 | Add in the third number | ||
| 53 | 00 | : | 603 | Add in the fourth number | ||
| 54 | 00 | : | 604 | Add in the fifth number | ||
| 55 | 00 | : | 605 | Add in the sixth number | ||
| 56 | 00 | : | 606 | Add in the seventh number | ||
| 57 | 00 | : | 607 | Add in the eighth number | ||
| 58 | 00 | : | 608 | Add in the ninth number | ||
| 59 | 00 | : | 609 | Add in the tenth number | ||
| 60 | 07 | : | 599 | Store total |
These two groups bear the same resemblance to each other as groups 0 and 1 orders, i.e. group 2 deals with b-line operations and group 3 deals with accumulator operations. Representing the original contents of a fast store location by n and the new contents by n', then
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 20 | N | b' = b + n | |||
| 21 | N | b' = b - n | |||
| 22 | N | b' = n - b | |||
| 23 | N | b' = n | |||
| 24 | N | n' = b + n | |||
| 25 | N | n' = b - n | |||
| 26 | N | n' = n - b | |||
| 27 | N | n' = b |
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 30 | N | a' = a + n | |||
| 31 | N | a' = a - n | |||
| 32 | N | a' = n - a | |||
| 33 | N | a' = n | |||
| 34 | N | a' = a + n | |||
| 35 | N | a' = a - n | |||
| 36 | N | a' = n - a | |||
| 37 | N | a' = a |
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 33 | 123 | a' = x | |||
| 30 | 123 | a' = 2x | |||
| 31 | 124 | a' = 2x - y | |||
| 10 | 3 | a' = 2x - y + 3 | |||
| 27 | 125 | store result |
or
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 23 | 123 | b' = x | |||
| 20 | 123 | b' = 2x | |||
| 21 | 124 | b' = 2x - y | |||
| 00 | 3 | b' = 2x - y + 3 | |||
| 27 | 125 | store b |
When M=1, the instructions deal with the contents of a main store location specified by N, e.g. if M=1 and fast store address 64 contains +85 and main store address 85 contains +700 the instruction 33 : 64 will write 700 in the accumulator.
Thus using (n) to indicate the contents of the main store location specified by N.
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 20 | : | N | b' = b + (n) | ||
| 21 | : | N | b' = b - (n) | ||
| 22 | : | N | b' = (n) - b | ||
| 23 | : | N | b' = (n) | ||
| 24 | : | N | (n)' = (n) + b | ||
| 25 | : | N | (n)' = b - (n) | ||
| 26 | : | N | (n)' = (n) - b | ||
| 27 | : | N | (n)' = b |
| F | M | A | B | S | Comments |
|---|---|---|---|---|---|
| 30 | : | N | a' = a + (n) | ||
| 31 | : | N | a' = a - (n) | ||
| 32 | : | N | a' = (n) - a | ||
| 33 | : | N | a' = (n) | ||
| 34 | : | N | (n)' = (n) + a | ||
| 35 | : | N | (n)' = a - (n) | ||
| 36 | : | N | (n)' = (n) - a | ||
| 37 | : | N | (n)' = a |
| 54 | N | means n' = n + 1 | |
| 54 : | N | means (N)' = (N) + 1 |
| 55 | N | means n' = n - 1 | |
| 55 : | N | means (N)' = (N) - 1 |
| (a) | 50 | N | means jump to N in the fast store, i.e. s' = N (f.s.) |
| 50 : | N | means jump to N in the main store, i.e. s' = N (m.s.) | |
| (b) | 51 | N | means reduce s by N, i.e. s' = s - N (fast store) |
| 51 : | N | means reduce s by N in main store, i.e. s' = s - N (main store) |
A stop instruction could therefore be:
| 51 | 1 | ||
| or | 51 : | 1 | depending on the store being used. |
| 46 [:] | N | means if a=0 set s' = N in fast store | |
| 46 : | N | means if a=0 set s'=N in main store | |
| if a ≠ 0, the sequence control register operates in the normal manner, i.e. s' = s + 1 | |||
| 42 [:] | N | means if b=0 set s'=N in fast store | |
| 42 : | N | means if b=0 set s'=N in main store | |
This allows us to do example A by another method - by using a count of ten and counting down until this is zero.
|
Address of
Instruction |
F | M | A | B | S | Comments |
|---|---|---|---|---|---|---|
| 50 | 13 | 10 | ) Set count of 10 in location 59 | |||
| 51 | 17 | : | 59 | ) | ||
| 52 | 13 | : | 600 | ) Form sum of ten numbers in 599 | ||
| 53 | 14 | : | 599 | ) | ||
| 54 | 55 | : | 59 | Count down in count location | ||
| 55 | 13 | : | 59 | ) Test count location | ||
| 56 | 46 | : | 56 | ) if zero STOP | ||
| 57 | 54 | : | 52 | Modify instruction 52 | ||
| 58 | 50 | : | 52 | Jump back |
The program can be corrected as follows:
|
Address of
Instruction |
F | M | A | B | S | Comments |
|---|---|---|---|---|---|---|
| 46 | 13 | 0 | ) Clear location which holds total | |||
| 47 | 17 | : | 599 | ) | ||
| 48 | 13 | : | 60 | ) Set instruction 52 | ||
| 49 | 17 | : | 52 | ) |
| 60 | 13 | : | 600 |
Or it could be modified as follows:
|
Address of
Instruction |
F | M | A | B | S | Comments |
|---|---|---|---|---|---|---|
| 48 | 13 | 0 | ) Clear result location | |||
| 49 | 17 | : | 599 | ) | ||
| 50 | 13 | 10 | ) Set count = 10 | |||
| 51 | 17 | : | 63 | ) | ||
| 52 | 13 | : | 600 | ) Form sum | ||
| 53 | 14 | : | 599 | ) | ||
| 54 | 55 | : | 63 | Count down in count | ||
| 55 | 13 | : | 63 | ) Test count = zero | ||
| 56 | 46 | : | 59 | ) | ||
| 57 | 54 | : | 52 | ) Otherwise modify instruction 52 | ||
| 58 | 50 | : | 52 | ) | ||
| 59 | 13 | : | 62 | ) Replace instruction 52 | ||
| 60 | 17 | : | 52 | ) | ||
| 61 | 50 | : | 61 | ) STOP | ||
| 62 | 13 | : | 600 | ) Used to replace instruction 52 | ||
| 63 | ) Used for count location |
| 44 | N | means if a=0 or a positive set s' = N in fast store |
| 44 : | N | means if a=0 or a positive set s' = N in main store |
| 45 | N | means if a is negative set s' = N in fast store |
| 45 : | N | means if a is negative set s' = N in main store |
| 47 | N | means if the overflow indicator is set s' = N in fast store |
| 47 : | N | means if the overflow indicator is set s' = N in main store |
Thus if: 524287 + N
or: -524287 - N (where N >
1) is attempted the overflow
indicator is set.
The overflow indicator is cleared when it is examined by a 47 order. No other order will clear overflow; once overflow is set it remains set until examined.
As the computer regards everything as a fraction this should be expressed as follows: x ± y = z. Overflow if set when 1 ≤ z < -1.
| 40 | N | means b' = b + 1. If now b=0 then s'=s+1 | ||
| but if now b ≠ 0 then s'=N (fast store) | ||||
| 40 : | N | means b' = b + 1. If now b=0 then s'=s+1 | ||
| but if now b ≠ 0 then s'=N (main store) | ||||
| 41 | N | means b' = b - 1. If now b=0 then s'=s+1 | ||
| but if now b ≠ 0 then s'=N (fast store) | ||||
| 41 : | N | means b' = b - 1. If now b=0 then s'=s+1 | ||
| but if now b ≠ 0 then s'=N (main store) | ||||
| 43 | N | means jump to N in the fast store (s' = N) | |
| 43 : | N | means jump to N in the main store (s' = N) |
In addition to changing the contents of the sequence control register to N the previous contents of the sequence control register are store[d] in b.
| Thus: | b' = s+1 |
When the subroutine jump is from a main store program in addition to s + 1 being stored in b the most significant bit of b is set to indicate that it is from a main store program.
|
Address of
Instruction |
F | M | A | B | S | Comments |
|---|---|---|---|---|---|---|
| 50 | 13 | 0 | ) Clear result location | |||
| 51 | 17 | : | 599 | ) | ||
| 52 | 13 | : | 60 | ) | ||
| 53 | 17 | : | 55 | ) Set instruction 55 | ||
| 54 | 03 | 10 | Set b = 10 | |||
| 55 | 13 | : | 600 | ) Form sum | ||
| 56 | 14 | : | 599 | ) | ||
| 57 | 54 | : | 55 | Count up in instruction 55 | ||
| 58 | 41 | : | 55 | b' = b - 1 If b≠0 jump to 55 | ||
| 59 | 50 | : | 59 | STOP | ||
| 60 | 13 | : | 600 |
It is therefore found useful to have a supplementary register into which these bits can be placed. This register is known as the auxiliary register and it is 20-its long. However the most significant bit of this register[s] is frequently ignored - so it can best be regarded as a 19-bit register. Since the computer regards all numbers as fractions the multiplication of two large fractions need not neccesarily affect the auxiliary register. Thus .25 x .5 = .125.
| Accumulator | 00100 | 00000 | 00000 | 00000 | |||
| X | |||||||
| Store specified | 01000 | 00000 | 00000 | 00000 | |||
| = | |||||||
| Accumulator | 00010 | 00000 | 00000 | 00000 | |||
| R | 00000 | 00000 | 00000 | 00000 |
Integers are regarded by the computer as fractions scaled down by 2 -19 :
3 x 2 -19 x 3 x 2 -19 = 9 x 2 -38
or:
| Accumulator | 00000 | 00000 | 00000 | 00011 | |||
| X | |||||||
| Store specified | 00000 | 00000 | 00000 | 00011 | |||
| = | |||||||
| Accumulator | 00000 | 00000 | 00000 | 00000 | |||
| R | 00000 | 00000 | 00000 | 01001 |
The order that affects a register in this manner is the 64 order, i.e. double length multiplication. Thus:
| 64 | N | means ar' = a x n | |
| 64 : | N | means ar' = a x (N) |
There is also a single-length multiplication order (65 order) - this could have been used for the first example above. This produces a rounded multiplication; the auxiliary register being cleared by the instruction. Thus:
| 65 | N | means a' = a x n and r' = 0 | |
| 65 : | N | means a' = a x (N) and r' = 0 |
| 66 | N | means r' = ar/n and a' = ar - ar' | |
| 66 : | N | means r' = ar/(N) and a' = ar - (n)r' |
| 67 | N | means a' = ar / n | |
| 67 : | N | means a' = ar/(N) |
| 53 | N | means r' = n | |
| 53 : | N | means r'= (N) | |
| 57 | N | means n' = r | |
| 57 : | N | means (N)' = r |
In this function the N digits are used to specify the number of places to be shifted. (The most significant bit of R being regarded as non-existent). Thus 62 19 would move the auxiliary register into the accumulator.
The effect of this function is to multiply the double-length ar by 2 N . Thus 62 1 means double ar.
Right shifts: Halving operations are achieved by using this order and specifying -N in the N digits. (alternatively it is possible to specify 1024-N for right shifts). Thus 62 -19 or 62 1005 would move the accumulator into the auxiliary register.
This function is an arithmetic shift thus the correct sign is maintained unless overflow occurs.
e.g. 62 -4 would have the following effect
| a = | 1.1011 00111 00011 11000 | r = | 01111 10000 01111 11000 |
| a'= | 1.1111 10110 01110 00111 | r'= | 01000 11111 00000 11111 |
Single length arithmetic shift (61) has the same effect as a 62 order but it does not affect the auxiliary register.
Logical shift (60) is a single length shift of the contents of the accumulator, without sign regeneration. Zero's are inserted where digits are missing.
If the order illustrated previously had been 60 -4 the result would have been:
| a'= | 00001 10110 01110 00111 |
| a | = | 01000 10001 11001 01111 |
| n | = | 11111 00111 00000 00101 |
| a & n | = | 01000 00001 00000 00101 |
| 52 | N | means a' = a & n |
| 52 : | N | means a' = a & (N) |
| 56 | N | means n' = a & n |
| 56 : | N | means (N)' = a & (N) |
This order finds the square root of the sum of the accumulator and the store location specified by N. Thus:
| 63 | N | means a' = (a + n) ½ |
| 63 : | N | means a' = (a + (N)) ½ |
Thus if b = 10 and the instruction 13 : 500 /1 is used this will set the contents of the main store address 510 into the accumulator.
Using a modifier to sum the numbers of example A.
|
Address of
Instruction |
F | M | A | B | S | Comments |
| 50 | 13 | 0 | ) Clear result location | |||
| 51 | 17 | : | 599 | ) | ||
| 52 | 03 | 10 | ||||
| 53 | 13 | : | 599 | /1 | ||
| 54 | 14 | : | 599 | |||
| 55 | 41 | : | 53 | |||
| 56 | 50 | : | 56 |
All types of instructions can be modified. Thus if b = 10 and fast store location 35 holds +84:
| 13 | 5 /1 | means a' = 15 |
| 33 | 25 /1 | means a' = contents of fast store location 35 = 84 |
| 33 : | 25 /1 | means a' = contents of main store location 84 |
| 62 | 3 /1 | means ar' = ar x 2 13 |
etc.
When k = 2 (indicated by /2) the accumulator is used as a modifier in the same manner as above.
If instruction 53 above had been 13 : 599 /2 the effect on this occasion would be to write the contents of 599 into the accumulator, and since this is zero the only effect of the program above would be to count zero into 599.
Note that it is possible to use the previous contents of the accumulator to modify an accumulator instruction; this also applies to b-line [modificatio] modification. Thus 13 10 /2 and 10 10 will have the same effect.
|
Address of
Instruction |
F | M | A | B | S | Comments |
|---|---|---|---|---|---|---|
| 200 | 03 | 15 | Set b' = 15 | |||
| 201 | 13 | 0 | ) set modifier = 0 | |||
| 202 | 17 | : | 216 | ) | ||
| 203 | 07 | : | 217 | store b | ||
| 204 | 00 | : | 216 | b' = b + modifier | ||
| 205 | 33 | 599 | /1 | ) compare contents of two | ||
| 206 | 31 | 600 | [/1] | ) consecutive locations | ||
| 207 | 45 | : | 210 | |||
| 208 | 34 | 600 | /1 | ) exchange the values in the | ||
| 209 | 36 | 599 | /1 | ) [in the] two locations | ||
| 210 | 01 | : | 216 | Subtract modifier | ||
| 211 | 41 | : | 204 |
Count down in b and jump if not
zero |
||
| 212 | 03 | : | 217 |
Select the b value stored in
location 217 above |
||
| 213 | 54 | : | 216 | Add 1 to modifier | ||
| 214 | 41 | : | 203 |
Count down in b and if b ≠ 0
jump back |
||
| 215 | 50 | : | 215 | STOP | ||
| 216 | +0 | Modifier | ||||
| 217 | +0 |
b-line store at beginning of each
loop |
The above program compares the contents of each loaction with the next, gradually moving the smallest to the beginning. It then takes the remaining 15 numbers and compares them, moving the smallest of these to the beginning, and then compares the remaining 14 numbers moving the smallest of them to the beginning. It continues in a similar manner until all the numbers are in their correct order.
It is possible t write negative numbers to the acuumulator or b-line directly.
| i.e. | 11 5 /2 | will subtract a + 5 from a therefore a = -5 |
| 01 5 /1 | will subtract b + 5 from b therefore b = -5 |
The sequence control register can also be used as a modifier. i.e. when K = 3 (/3 in the order code), this takes the prese[n]t contents of the sequence control register and adds these to the address digits before obeying the instruction.
The sequence control register can be used as a modifier when attempting to write a subroutine for placing anywhere in the store.
Example E could be changed to a general routine for any store location as below.
|
Address [of]
Instruction |
F | M | A | B | S | [Comments] |
|---|---|---|---|---|---|---|
| x+0 | 56 | : | 7 | /3 | ||
| +1 | 50 | : | 6 | /3 | ||
| +2 | 13 | 0 | ) Clear results location | |||
| +3 | 17 | : | 599 | ) | ||
| +4 | 13 | 10 | ) Set modifier | |||
| +5 | 17 | : | 10 | /3 | ) | |
| +6 | 13 | : | 8 | /3 | ) Set instruction in x + 8 | |
| +7 | 17 | : | 1 | /3 | ) | |
| +8 | 13 | : | 600 | ) Form sum | ||
| +9 | 14 | : | 599 | ) | ||
| +10 | 55 | : | 5 | /3 | ) Count down in modifier | |
| +11 | 13 | : | 4 | /3 | ) | |
| +12 | 46 | : | 1 | /3 | If zero jump to end | |
| +13 | 51 | : | 14 | Jump back | ||
| +14 | 51 | : | 1 | [STOP] | ||
| +15 | 13 | : | 600 | |||
| +16 | +0 | Modifier |
Note that entry to this program is made at instruction x + 2. This is because, when using the sequence control register as a modifier, only locations following the present location can be addressed by this method, And, since in this program it is neccesary to modify an instruction after having obeyed that instruction, it is neccesary to jump to a section of program which is deliberately set before the beginning of the program proper.
Example H would therefore be written:
|
Address [of]
Instruction |
F | M | A | B | S |
|---|---|---|---|---|---|
| x+0 | 13 | 0 | |||
| +1 | 17 | : | 599 | ||
| +2 | 03 | 0 | |||
| +3 | 13 | : | 599 | /1 | |
| +4 | 14 | : | 599 | ||
| +5 | 41 | : | 1 | /3 | |
| +6 | 51 | : | 1 | ||
| +7 | 51 | : | 5 |
As was mentioned earlier the fast store is 1,024 words long and therefore every location from 0-1.023 can be addressed directly. This is not so in the case of the main store where there are 16.384 locations: every location > 1,023 must therefore be accessed indirectly.
i.e. If b = 2048, then 13 : 74 /1 would write the contents of main store location 2122 into the accumulator.
Similarly, if a = 2048, then 03 : 74 /1[2] would write the contents of main store location 2122 into the b-register.
| (a) | No address prior to the current address can be accessed by this method. |
| (b) | Only addresses within the next 1,024 words can be accessed with this method. |
| 70 | 1 - | add the characters under the tape reader into the accumulator |
| 73 | 1 - | write the character under the tape reader into the accumulator |
| 77 | 1 - | punch the l.s. 5 bits of accumulator on paper tape. |
Back
-
Contents
-
Next
Page created by Bill Purvis, last update 22nd November 2003
Contact me at: mailto:bill 'at' beeb.net
include "../../count.php";
countPage("ccs_502_502feat03.html");
?>