### Numbers in parentheses

Assuming that we were programmers at a scientific calculation headquarters, in an institute of technology or an industrial undertaking, and that we handed our manager and programmer-in-chief this program for adding up 50 numbers, what would he do? At a guess, he would first turn pale and then red and then ...

One thing would quickly become clear to us at any rate: he would not approve of our program. Perhaps he would also explain the reason why; it needs too many memory cells.

Our addition program requires 50 storage locations to be prepared for the 50 numbers to be added together - a requirement, of course, that is essential. But we will have to find another 51 storage places for the 51 instructions in our program - and that is too much. Storage locations are among the most expensive assets of a computer. Providing every number to be used in an addition with its own instruction would mean that the storages would have to be almost twice as large.

So what is to be done? Maybe we cold manage with a single adding-instruction, to be repeated for every number? In that case, care would have to be taken to see that the address to which the instruction refers would be altered every time.

That can be done! You will remember the index registers we were talking about in the last chapter. Their contents can be added to the address part of an instruction so that the latter can apply to new addresses. Now if we could arrange for one of the index registers to add one number for each instruction as it arrives, so that the address of the adding-instruction is increased by one figure at a time, then we could ... Exactly!

Let's try the idea out at once. We take the index register 8 (in symbol-language, I 8) and note that at the start it contains nothing but duck´s eggs:

0000 = > I 8

It may already have occurred to you that numbers in parentheses when they appear in symbol-language - for example, (2401) - mean that they refer to an address. If the figures have no brackets - like the 0000 above - they are pure numbers, namely the contents of an address or of a register. In future, we shall put the numbers of addresses in parentheses when these numbers appear in the text of this site, to be consistent. But now we want to continue work on our program. The first instruction has put I 8 at zero. The second - as before - must bring the contents of the first address into the accumulator: (1001) = > A

At the third instruction we start adding. So that we won't forget always to add the contents of index register 8 to the address of the instruction, we do not merely write down the address (1002) just like that; we tack on to it the number of the register: ( 1002/8). And we note as the next instruction:

(1002/8) + A

Here, for the first time, there is no immediate change in address (1002), despite the appended index register 8, for the register still contains nothing but zeros, and (1002) plus 0000 remains (1002). But the following addition will bring an alteration. The next instruction goes to index register 8, and instructs it to add a 1 - written 0001 - to the zeros:

I 8 + 0001

And now we need no new instruction: the instruction unit can reach back for the instruction before last:

(1002/8) + A

For in the meantime a 1 has appeared in the index register, and the address to which the instruction applies is therefore no longer (1002) but (1003). So the contents of (1003) are now added to the contents of the accumulator, and the next step is a repetition of the instruction.

I 8 + 0001

which increases the content of the I 8 from 0001 to 0002. Now the instruction unit can jump back at the command:

(1002/8) + A

and continue in the same way: one step forward, one step back. This recall of the program in obedience to a previous instruction is announced by a "jump instruction":

S, ≠

and an arrow (red). The sequence of the instructions then looks like this:

 -> |    -- 0000 (1001) (1002/8) I 8 S, = > I 8 = > A + A + 0001 ≠

In its present state, this program has only one fault: it will never tire and never stop counting, and in due time it would certainly get around to adding up the oddest things. All we ask, however, is that it shall add up 50 numbers. The machine must stop work after it has processed the fiftieth number - or, which amounts to the same thing, after the contents of the index register have risen to 49.

The jump instruction >>>>

First printed in Germany: 1963