The index registers, or short accumulators, are known as B-registers on Atlas. There are 128 B-registers. 120 of these are constructed from a very fast core store and are used for general purposes. The remaining 8 are flip-flop registers, used for special purposes. The B-registers have addresses from zero to 127, and are referred to by prefixing the address with the letter B or b. Thus B61 is B-register with address 61 and b61 is the contents of this B-register.
These are the first 120 registers BO to B119. Each consists of 24 bits of which the most significant (digit 0) is taken to be the sign digit. For purposes of modification and counting, integers are held one octal place up from the least-significant end of a word, so the binary point is assumed to lie between digits 20 and 21. Thus a B-register can hold a 21-bit signed integer with an octal fraction.
The contents of a B-register are usually written as a signed decimal number and an octal fraction, the two parts separated by a point. Thus 15.3, -2.7, 6.0 etc. When the octal fraction is zero it is usually omitted, the point of course also being omitted. The number in a B-register can take any value in the range -220 to +220 - 0.1 inclusive. An exception is B0, whose contents are always zero.
Programmers are warned to refer to section 4.10 before using B81-119, whose contents are liable to be overwritten.
The basic instructions which operate on B-registers have already been mentioned. They are known as B-codes and B-Test codes, and will now be described in detail.
In the following instructions, arithmetic takes place between a 24-bit number in the store and a number in the Ba B-register. The address is modified by the contents of Bm, the other B-register, to give the half-word store address S of the operand. The contents of this are known as s.
Function | Description | Notation |
---|---|---|
101 | Transfer s to Ba | ba' = s |
103 | Transfer s negatively into Ba | ba' = -s |
104 | Ad s to the contents of Ba | ba' = ba + s |
102 | Subtracts s from ba | ba' = ba - s |
100 | Negate ba and add s to it | ba' = -ba + s |
111 | Store ba negatively at S | s' = -ba |
113 | Store ba at S | s' = ba |
114 | Add ba into the contents of S | s' = s + ba |
112 | Negate the contents of S and add ba | s' = -s + ba |
110 | Subtract ba from the contents of S | s' = s - ba |
Example: If m is held at address 5.4 and n at 6.4, place 3m-2n at 6, using B1 as working space.
101 1 0 5.4 transfer m to B1 113 1 0 6 store m in half-word 6.0 102 1 0 6.4 m-n in B1 114 1 0 6 2m-n in 6 114 1 0 6 3m-2n in 6
There are instructions provided which use the address as an operand. That is, N + bm, instead of giving the address of the operand, is used directly as a number n.
Function | Description | Notation |
---|---|---|
121 | Place n in Ba | ba' = n |
123 | Place a negatively in Ba | ba' = -n |
124 | Add n to the contents of Ba | ba' = ba + n |
122 | Subtract n from ba | ba' = ba - n |
120 | Negate ba and add n | ba' = -ba + n |
Examples:
1. Replace the number m in 17.4 by the number 64 - m
121 1 0 64 put 64 into B1 112 1 0 17.4 -m + 64 in 17.4
2. Copy the number in B2 into B3
121 3 2 0 b3' = 0 + b2
This has the effect of placing 0, modified by the contents of B2, into B3 i.e. places b2 into B3.
3. Similarly, the number in B4, for example, can be doubled by the instruction
124 4 4 0 b4' = b4 + b4 + 0
Three types of logical operations can be carried out in B-register arithmetic. These are collating, non-equivalencing and OR ing. They operate on pairs of numbers simply as strings of binary digits, and form a third number from the pair.
The collate operation, which is denoted by &, gives a 1 in the result in every position where both numbers have a 1, and O's elsewhere. For example, the result of collating
00010110 with 01110100 is 00010100
The non-equivalence operation, denoted by neqv gives a 1 in the positions in which the corresponding digits of the two numbers differ, and O's elsewhere.
The result of non-equivalencing
00010110 with 01110100 is 01100010
The OR operation, denoted by or, gives 1 in those positions in which either (or both) of the corresponding digits of the two numbers is a 1, and 0's elsewhere.
The result of ORing
00010110 with 01110100 is 01110110
Function | Description | Notation |
---|---|---|
107 | Collate the digits of Ba with the digits of s placing the result in Ba | ba' = ba & s |
106 | Non-equivalence ba with s, placing the result in Ba | ba' = ba neqv s |
147 | OR ba with s, placing the result in Ba | ba' = ba or s |
117 | As 107, but placing the result in S | s' = s & ba |
116 | As 106, but placing the result in S | s' = s neqv ba |
127 | Collate ba with n, placing the result in Ba | ba' = ba & n |
126 | Non-equivalence ba with n, placing the result in Ba | ba' = ba neqv n |
167 | OR ba with n, placing the result in Ba | ba' = ba or n |
Examples:
1. Clear the most-significant 17 bits of B99 and leave the other bits unchanged.
127 99 0 15.7 Collate b99 with a number consisting of ones in the 7 required positions.
When n is used in this way it is called a mask. It is often inconvenient to have to work out masks as decimal numbers with an octal fraction, so other ways of writing the address are allowed.
For example, if it is required to leave the most-significant 7 bits unchanged and to clear the rest of B99, then the mask required consists of ones in the 7 most-significant positions (0 - 6).
The two letters K and J introduce numbers written in octal notation.
K, followed by up to seven octal digits, positions the number from digit 20 upwards. Thus K 3642 places the number 00036420 in the address position. Octal zero's at the most-significant end may be omitted, and the least-significant octal fraction if present has to be separated from the number by a point. e.g. K5252525.2 fills the address digits with alternate ones and zeros.
J followed by up to eight octal digits, has the effect of compiling these digits from the most-significant end. That is, the first octal digit goes into bits 0 - 2 the next to 3 - 5 etc. Less-significant zeros may be omitted. Thus J142 places the number 14200000 in the address digits.
2. To leave the most-significant 7 bits of B99 unchanged and to clear the other digits
127 99 0 J771 Collate b99 with a mask consisting of ones in the top 7 positions.
3. Replace the number in B62 'with a number such that where there are now zeros and where there were zeros there are now ones. This is known as the l' s complement
127 62 0 J77777777 non-equivalence with a mask consisting of all ones. The mask could also be written K7777777.7 or -0.1
Forming the 1's complement of' a number is often not so simple as in this example, so the operator '(prime) has been provided. Any number followed by ' is interpreted as the 1's complement of that number. Thus the instruction could have been written
126 62 0 0'
There are two other logical instructions on Atlas, and these use bm as a further operand.
Function | Description | Notation |
---|---|---|
165 | Collate bm with n and place the result in Ba, leaving bm unchanged | ba' = ba & n |
164 | Collate bm with n and add the result into Ba, leaving bm unchanged | ba' = ba + (bm& n) |
Note: If Bm is B0 in the 164 and 165 instructions, then bm & n gives n rather than O.
Example:
Add the 6-bit character in digits 6 - 11 of B1 into B2.
164 2 1 J0077
The following test instructions test bm, and transfer n into Ba if the test succeeds. n cannot be modified as bm is used. If the test fails, ba is unchanged.
Function | Description | Notation |
---|---|---|
214 | If bm is zero, place n in Ba | If bm = 0, ba' = n |
215 | If bm is not zero, place n in Ba | If bm ≠ 0, ba' = n |
216 | If bm is greater than or equal to zero, place n in Ba | If bm ≥ 0, ba' = n |
217 | If bm is less than zero, place n in Ba | If bm < 0, ba' = n |
These tests can be used with any B-registers but are most often used to cause a change of control if a certain condition is satisfied, so the control registers will now be described.
There are three control registers, only one of which is in operation at any given time. These are called main control, extracode control and interrupt control, and are the three special B-registers B127, B126 and B125 respectively. When a program is being obeyed, the address of the current instruction is held in the relevant control register. The control register is increased by one just before the instruction is obeyed in anticipation of the next instruction. Ordinary programs can use only B127.
Unconditional jumps to some address S are effected by placing this address in the control register
121 127 0 5 causes the following instructions to be taken from location 5 onwards
Example: Two numbers a and b are in locations 14 and 14.4. A program which requires these numbers is in locations from 100.
If a < 0, b ≥ 0 enter this program at register 100
If a < 0, b < 0 enter this program at register 101
If a ≥ 0, b ≥ 0 enter this program at register 102
If a ≥ 0, b < 0 enter this program at register 103
The program is 7 instructions long; let it occupy the first 7 registers of store.
Register Contents 0 101 1 0 14 place a in B1 1 101 2 0 14.4 place b in B2 2 216 127 1 5 if a ≥ 0, jump to register 5 3 217 127 2 101 if b < 0, jump to 101 4 121 127 0 100 if not, a < 0, b ≥ 0 so jump to 100 5 216 127 2 102 if a ≥ 0, b ≥ 0, jump to 102 6 121 127 0 103 if not, a ≥ 0, b < 0, so jump to 103
When writing a program it is helpful to show the possible routes of jumps with arrows. Unconditional jumps are often underlined to indicate a definite break in control.
Although it is not necessary for the ordinary programmer to know about many of these special-purpose B-registers, details of them are given here for the sake of completeness.
It has been mentioned that there are three control registers, B125, B126 and B127, which are called interrupt control (I), extracode control (E) and main control (M) respectively. Ordinary programs use B127, and are prevented from having access to the subsidiary store and V-store.
Interrupt control is used in short routines within the Supervisor, which mainly deal with peripheral equipments. These routines are entered automatically whenever any peripheral equipment needs attention, e.g. when a tape reader has read a character. Occasionally the Supervisor will need to enter relatively longer routines to deal with the cause of interruption, e.g. on completion of the input of a paper tape. Whilst in interrupt control, further interrupts are not possible, so control is switched to extracode whenever the Supervisor enters a more lengthy routine. Both I and E control allow the Supervisor access to all the machine, but extracode control programs can also be interrupted and restarted in the same way as ordinary programs.
Extracode control is also used when any of the 300 or so subroutine in the fixed store are being obeyed. These subroutines have automatic entry and exit and are known as extracodes. When an extracode instruction is encountered, the relevant subroutine entry is placed in B126 and control switched to E. After the final subroutine instruction, control is reswitched to M which holds the address of the next program instruction. (The current control register is always increased by one before the instruction is obeyed.)
B124 has been introduced as the accumulator exponent ay. It consists of only the 9 most significant digits (0-8) the remaining 15 being always zero. Exponent arithmetic can be carried out by using B-code instructions. When this is done care must be taken to position exponents correctly in the digit positions 1-8 and to set the guard digit (bit 0) correctly.
Example:
121 124 0 J004 sets the exponent to +4
B123 is a B-register with the special property that a number read from it, instead of being the number last written to it, is the characteristic of the logarithm to base two of the eight least-significant digits of that number.
Input to B123 Output from B123 Digits 0-15 16 17 18 19 20 21 22 23 0-16 17 18 19 20 21-23 x 0 0 0 0 0 0 0 1 0 0 0 0 0 0 x 0 0 0 0 0 0 1 x 0 0 0 0 1 0 x 0 0 0 0 0 1 x x 0 0 0 1 0 0 x 0 0 0 0 1 x x x 0 0 0 1 1 0 x 0 0 0 1 x x x x 0 0 1 0 0 0 x 0 0 1 x x x x x 0 0 1 0 1 0 x 0 1 x x x x x x 0 0 1 1 0 0 x 1 x x x x x x x 0 0 1 1 1 0 x 0 0 0 0 0 0 0 0 0 1 0 0 0 0
Using B123, the Supervisor can identify the exact cause of an interrupt as a result of obeying from two to six instructions.
The programmer cannot use B123 directly because of the danger of an intervening interrupt which would alter the contents before they could be read out. A similar warning applies to B125, B126 and to all the B-registers B100-B118.
B122 and B121 are again B-registers provided with special circuitry. Their function is to allow indirect addressing and modification of the Ba operand in an instruction.
B121 behaves as a normal B-register except that it consists of only seven digits (15-21), the remaining bits being always zero. These seven bits allow B121 to hold any of the numbers 0, 0.4, 1, 1.4, ...'. up to 63.4. When B121 is used in conjunction with B122 its contents are interpreted as the address of a B-register in the range 0-127. That is, 0.4 =B1, 1 =B2, ...... up to 63.4 =B127, the B-register address starting from digit 15.
B122 is called the B-substitution register, which gives an indication of its function. When B122 is encountered as Ba in an instruction:
A few examples will make this clearer.
Example 1
121 121 0 J8.4 sets b121 = B17 address 121 122 0 1 will place the number 1 in B17
Example 2
It is required to copy the contents of B87 into B8O, B76, B72 and so on (every fourth B-register) leaving the other B-registers unchanged.
This could be done by the sequence of instructions
121 80 87 0 copy B87 into B80 121 76 87 0 copy B87 into B80 121 72 87 0 copy B87 into B80 121 68 87 0 copy B87 into B80
etc ...... for 19 instructions in all but by using B121 and B122 we can write a short loop of instructions.
6 121 121 0 40 set address of B80 in B121 7 121 122 87 0 copy b87; into B80 first time B76 second time etc. 8 122 121 0 2 subtract 4 from the B-address 9 215 127 121 7 if B121 ≠ 0, jump to the instruction in location 7
When b121 = 0 the jump does not take place, and the program proceeds to the next instruction.
B121 and B122 play an important part in the extracodes. When an extracode instruction is met, just before control is switched to extracode, the Ba digits in the instruction are copied into B121. This allows the extracode routine to operate on Ba by using B122. B-register 119 is also set up in a special way when an extracode instruction is met, to enable the extracode routine to obtain the store operand involved. This is described later.
In between a program's extracode instructions the programmer is able to use B121, B122 as he likes, but caution must be exercised to avoid inadvertent over-writing of their contents when an extracode instruction is called for.
B122 only operates as the B-substitution register when it is in the Ba digits of an instruction. In the two other circumstances possible, its value is zero. These are:
121 1 122 0 always put zero in B1
121 121 0 61 set b121 = B122 113 122 0 100 writes the number zero into store location 100
Any number written into B120 is displayed as 24 digits on neon lamps on the engineers console. Thus:-
121 120 0 J52525252 displays alternate ones and zeros
The engineers console is not normally available for use by the programmer.
Whenever it is attempted to read from B120, the number read out is always zero.
The technique of modification has already been introduced.
In Atlas instructions, the contents of any of the B-registers not directly concerned in the operation may be used to modify the address. Thus, the instruction
324 0 3 100
copies the ocontents of location (100 + b3) into the accumulator (and standardises the result).
Suppose we have 20 unstandardised floating-point numbers stored in locations 100-119, and it is required to standardise these numbers and restore them in the same locations. A program to do this might be as follows:-
10 121 3 0 19 set 19 in B3 11 324 0 3 100 am' = s, standardised 12 356 0 3 100 s' = am 13 122 3 0 1 subtract 1 from b3 14 216 127 3 11 jump to location 11 if b3 ≥ 0
B3 is used as the modifier and to ensure that the loop is cycled 20 times. This latter process, counting, is of such frequent occurrence that eight basic counting instructions have been provided.
The most important of these are:-
Function | Description | Notation |
---|---|---|
200 | If the contents of Bm are non-zero, add 0.4 into Bm and place n in Ba. If bm = 0, bm and ba are unchanged. | If bm ≠ 0, bm' = bm + 0.4 and ba' = n |
201 | As 200 but increase bm by 1 | If bm ≠ 0, bm' = bm + 1 and ba' = n |
202 | If bm is non-zero, subtract 0.4 from it and plaoe n in Ba | If bm ≠ 0, bm' = bm - 0.4 and ba' = n |
203 | As 202 but subtract 1 from bm | If bm ≠ 0, bm' = bm - 1 and ba' = n |
Note: About instructions 200, 201, 202, 203 : If Ba and Bm are the same B-line and the test succeeds, its final contents are n. If Bm is B127 (and Ba is not), these instructions Give an unpredictable result.
The last two instructions in the example above would be replaced by
203 127 3 11 If b3 ≠ 0, b3' = b3 -1 and b127' = 11. i.e. jump back with b3 reduced by one.
Examples:
1. At the addresses 50-99.4 inclusive there are 100 half-words. Find how many of these numbers are zero and leave the answer in B7.
0 121 7 0 0 start count of numbers = 0 1 121 2 0 49.4 set count/modifier in B2 2 101 3 2 50 number to B3 3 215 127 3 5 jump to 5 if b3 ≠ 0 4 124 7 0 1 if b3 = 0, add 1 to b7 5 202 127 2 2 count
2. To clear the B-registers B1 to B100
0 121 121 0 50 set count/modifier in B122 1 121 122 0 0 clear B100 first time, then B99 etc. 2 202 127 121 1 count reducing b121 by 0.4 each time and jump back
The B-test register Bt consists of two digits only.
When a number is written to Bt, one of these digits is set to show whether the number is = 0 or ≠ 0, and the other to show whether it is ≥ 0 or < O.
Instructions are provided to write numbers to Bt, to test the above mentioned conditions, and to count. These are:-
Function | Description | Notation |
---|---|---|
152 | Set the B-test register by writing to it the contents of Ba minus the contents of S. ba and s are unchanged. | bt' = ba - s |
150 | Set Bt by writing s minus ba to it. s and ba are unchanged. | bt' = s - ba |
172 | Set Bt by writing ba minus n to it. | bt' = ba - n |
170 | Set Bt by writing n minus ba to it. | bt' = n- ba |
224 | If Bt is set equal to zero place n in Ba. | If bt = 0, ba' = n |
225 | If Bt is set not equal to zero place n in Ba | If bt ≠ 0, ba' = n |
226 | If Bt is set greater than or equal to zero, place n in Ba | If bt ≥ 0, ba' = n |
227 | If Bt is set less than zero, place n in Ba | If bt < 0, ba' = n |
220 | If Bt is set non-zero, place n in Ba and add 0.4 to bm. If Bt is set zero, do nothing | If bt ≠ 0, bm' = bm + 0.4 and ba' = n |
221 | If bt ≠ 0, place n in Ba and add 1 to bm | If bt ≠ 0, bm' = bm + 1 and ba' = n |
222 | As 220 but subtract 0.4 from bm | If bt ≠ 0, bm' = bm - 0.4 and ba' = n |
223 | As 221 but subtract 1 | If bt ≠ 0, bm' = bm - 1 and ba' = n |
Note: In instructions 220, 221, 222, 223, if Ba and Bm are the same B-line and the test succeeds, its final contents are n. If Bm is B127 (but Ba is not), these instructions give an unpredictable result.
Bt is not directly addressed; Bt instructions are recognised by the function digits. The instructions to set Bt are useful for comparing numbers, as the operands are not altered.
The conditional transfer instructions, 224-227 are used to cause a conditional jump, and as bm does not take part in the instructions it can be used to modify n, giving a. modified address for the conditional jump.
Example:
In 100 to 199.4 inclusive there are 200 half-words. Find the lowest address of this range which contains the number -3 and store this in 99.4. If no such number exists, set 99.4 = -0.1
0 121 1 0 -3 set required number in B1 1 121 2 0 100 first address in B2 2 152 1 2 0 bt' = ba - s 3 224 127 0 7 jump if bt = 0, i.e. s = -3 4 170 2 0 199.4 bt' = 199.4 - ba 5 220 127 2 2 if bt ≠ 0, b2' = b2 + 0.4, jump back 6 121 2 0 -0.1 if search fails, set -0.1 7 113 2 0 99.4 store result
Four instructions are provided which shift the number in Ba. These shifts are either of six places up or of one place down, and are circular shifts. That is, digits which are shifted out of the register at one end re-appear at the other end.
The main purpose of these instructions is to assist in the manipulation of 6-bit characters and to provide ways of shifting ba any specified number of places.
Function | Description | Notation |
---|---|---|
105 | Shift ba up 6 places, copying the initial 6 most-significant bits into the least-significant 6 bits, then add s into ba | ba' = 26 ba + s, (circular shift) |
125 | Shift ba as in 105, then add n | ba' = 26 ba + n, (circular shift) |
143 | Shift ba down one place, copying the initial least-significant digit into the new most-significant position, then subtract s | ba' = 2-1 ba - s, (circular shift) |
163 | Shift ba as in 143, then subtract n | ba' = 2-1 ba - n, (circular shift) |
These basic instructions are intended to be used by extracodes which provide more useful shift functions.
Two further test instructions can be used to test the least-significant bit of Bm. These instructions can be used, for example, to identify a character address.
Function | Description | Notation |
---|---|---|
210 | If the least-significant bit in Bm is a one, place n in Ba | If bm is odd, ba' = n |
211 | If the least-significant bit in Bm is a zero, place n in Ba | If bm is even, ba' = n |
Note particularly that it is the very least-significant bit that is tested, and that if Bm contains an address these instructions do not detect whether the address refers to an even or odd numbered word in the store, but rather whether it refers to an even or odd numbered character within the word.
Example:
B1 contains a character address, A.k say. Place this character in digits 18 to 23 (character position 3) of B2 and clear the rest of B2 (digits 0 to 17)
0 101 2 1 0 Read the half-word into B2 1 210 127 1 3 Jump if k is .1 or .3 in the half word 2 125 2 0 0 shift up and around six places 3 163 1 1 0 shift b1 down and round one place, then subtract the original contents of b11 from this. This makes b1 even, if k is .0 or .3 4 211 127 1 7 jump if k=.0 or .3 in half-word 5 125 2 0 0 shift up 12 bits, circularly. The 6 125 2 0 0 required character is now in c3 of B2 7 127 2 0 7.7 clear the unwanted digits
A similar program to this is obeyed, under extracode control, when the programmer specifies extracode 1250.
1250 Ba Bm S
places character s in Ba, clearing the other digits of Ba. So the example above would be simply achieved by
1250 2 1 0
Although B81-B119 were included in section 4.1 as general purpose B-registers, they are of limited utility for the ordinary programmer, since they are each used by one or more of the system routines which may assume control during the running of the object program. Before using any of these B-registers, the B-test register, the substitution register, or the B-carry digit, the programmer must check to see that there is no danger of their contents being overwritten before he has finished with them.
The routines which use these B-registers are as follows:-
B81-89 | Library routines |
B90 | Return link from library routines |
B91-97 | Extracodes |
B98-99 | The logical Accumulator and some less common extracodes |
B100-110 | Supervisor |
B111-118 | Interrupt routines |
B119 | Extracode operand address |
B121, 122 | Extracodes, library routines |
Bt, Bc | Extracodes, library routines |
It should be noted that the library routines may use extracodes. This means that when library programs are in use, no B-line above B80 should be used (except for B90). Provided no reference is made to library routines, B81 - B90 may be freely used. Similarly B81 to B99, B119, B121, B122, Bt and Bc are safe to use when neither extracodes nor library routines are in use. It is never safe for an ordinary program to use B100-B118, since an interrupt can occur at any time and cause control to be transferred to the Supervisor.
When any one of the four addition codes
104 ba' = ba + s 114 s' = ba + s 124 ba' = ba + n 164 ba' = ba + (bm & n)
is used to add two 24-bit quantities, bit 23 of line 6 of the V-store is set to 1 if there is a carry from the addition.
Thus for example the addition of any two 24-bit numbers whose left-most bit is a 1 sets the B-carry digit to one. If there is no carry, the B-carry digit is set to 0. When an ABL program is entered the B-carry digit is clear.
The singly-modified extracode 1223 loads Ba with n if the B-carry digit is set to 1 and does nothing if it is not set. (The extracode does not affect the state of the B-carry digit.) The following example uses 1223 to add B1 to B2 and then add the carry, if any, to the bottom of B3. Thus the contents of B1 and B2 are here regarded as 24-bit positive integers whose double length sum is placed in B3 and B2 with the most significant half in B3.
Example:
124 2 1 0 1223 3 3 Y1
Similarly each of the ten instructions
100 ba' = s - ba 102 ba' = ba - s 110 s' = s - ba 112 s' = ba - s 120 ba' = n - ba 122 ba' = ba - n 150 bt' = s - ba 152 bt' = ba - s 170 ba' = n - ba 172 bt' = ba - n
set the B-carry digit to 1 when, regarded as 24-bit positive integers, a larger number is subtracted from a smaller. Otherwise these codes set B-carry to zero. For example, the B-carry digit is set to 1 by the instruction 172, 0, 0, 1.
Example:
In the previous example b1 was added to b2 and the double length sum held in B3 and B2. The following two instructions would subtract b1 off again from the double length sum.
122 2 1 0 1223 3 3 -Y1