In order to load programs into the 803, a short program is needed that can read the program from a paper tape and write the contents into the store. It is possible to enter such a program from the keyboard and store it, but it would be tedious and error-prone. In order to store a pair of instructions (one word) several operations are needed:
As you can see this is not an easy process, and it is fortunate that the designers of the 803 thought so too. As a result, they devised a very short program, and arranged for it to be permanently available. The program takes only four words of store and these appear to be stored in the first four words of the 803 store. They are hard-wired and so cannot be overwritten, indeed, they cannot be read either, as attempting to do so returns a value of zero. They can, however, be executed, and are sufficient to load a larger program into the store. This can either be a short self-contained program, or a bootstrap loader which can then load a much larger program, and may include sum-checking to ensure that the program has not been corrupted, as happens occasionally if a tape gets slightly damaged.
The built-in loader was referred to as Initial Instructions (II) or by the name in which it appeared in the program library: T1. Paper tapes that were intended to be read by this program were said to be in T1 format.
The program is, as I have said, only four words, or eight instructions and is shown here:
This short program makes use of location 4 in the store, the first word following this program, to contain the address of the next word to be loaded. At least, that is not quite true, it is the address minus 4.
The program starts by clearing this location [26 4], then by clearing the accumulator [06 0]. It then enters the outer loop of the program and increments the load address [22 4 /]. The slash in the B-column means that the contents of location 4 (now set to one) is added to the second instruction in word 1 [16 3], giving [16 4] and so the zero in the accumulator is written into location 4, and the accumulator is set to zero (which it was already, but that's bye the bye). The inner loop of the program starts at word 2, with [55 5]. This shifts the accumulator left by 5 bits. As it is zero, not much happens here but it gets interesting later. The second instruction in word 2 reads in a character from the paper tape [71 0]. The 5 bits read from tape are or-ed into the accumulator. As it has just been shifted left by five bits, the bottom five bits are zeros, so the operation is just to set the character in these bottom five bits. The final word  of the program contains two jump instructions. The first tests for overflow [43 1] which won't have happened at this stage, so it continues on to execute the second instruction [40 2] which takes it back to word 2.
When a paper tape is loaded by the operator, the tape is always placed with the blank leader under the read head. So the first few characters read are always zeros. As a result, the 803 simply loops around words 2 and 3 until it encounters non-blank characters.
At this point the accumulator becomes non-zero, and the characters read in get shifted along until the eight characters have been read. The first non-blank character always has a high bit set, either 10000 or 01000. After being shifted 7 times, this bit causes the overflow flag to be set, either the accumulator has changed sign or a bit has been shifted out the top of the accumulator. Either way, the jump in the first half of word 3 [43 1] is taken, and the 803 moves to word 1. Here it increments word 4 (which had been set back to 0) to 1 (for the second time) and then the second word stores the content of the accumulator in location 4. The accumulator is then set back to zero and the inner loop is re-entered. The next 8 characters (ignoring any intervening blanks, of course) are packed up in the same way as the first word, and this is then stored in the location determined by the new content of word 4. Subsequent blocks of 8 characters are then stored at the locations that follow this.
It can be seen that the tape format should be a sequence of words, each word being stored as eight characters. Since 8 5-bit characters gives 40 bits and the 803 word is only 39 bits, the top bit is discarded. The first character of each block may be modified by adding in 10000 so as to force the overflow, although if the next bit is already a one this is not strictly neccesary. Some programmers always set the bit, others only set it when strictly needed. The first of these words defines the load address for the subsequent words. The value specified should be 4 less than the address intended to allow for the offset in this program. The remaining words handled by T1 are loaded into the store starting at the address given by the first word plus 4.
Since this is a very simple program, one might expect that there would be a problem when it gets to the end of the program to be loaded. Indeed, if no special action is taken, a program could be loaded and the tape reader would run off the end of the tape. The operator could then press SYSTEM RESET to clear the BUSY condition and set up a jump on the WG to enter the program just loaded.
However, the designers had another trick up their sleeves. If the program being loaded is being read into the top of the store, then the address will wrap around at the top of the store, and then subtle effects come into play. What the programmer does is to encode 4 words of zeros, which the machine will attempt to load into the first four words of the store. Since the Initial Instructions are hard-wired this has no effect, but when it overwrites word 4, then the new value can have a dramatic effect. The instruction modification that takes place adds the contents of word 4 to the whole of the second instruction in word 1. Suppose the value that was written into location 4 was [22 8062]. This would be incremented to [22 8063] and then added to [16 3] to give [40 8066] which is a jump instruction. The Initial Instructions would therefore jump to word 8066 in the store where the program just loaded presumably starts. In practice, it's a little bit more complicated as the [16 3] instruction is modified to [17 4] on that word, and the inner loop doesn't read 8 characters, only 1, but I'm sure you get the idea. It certainly works and I consider this to be one of the most ingenious programs ever written! Other machines (e.g. IBM 360) had some special hardware which would read a block from the input device into a fixed place in store and execute it, but this just uses standard instructions to achieve its ends.
Page created by Bill Purvis, last update: 5th January, 2004
|You are visitor number 82|