next up previous
Next: Programming Principles Up: Alan Turing's Manual for Previous: Starting the machine



The machine has a very great flexibility. Although this has obvious advantages, it has also certain disadvantages which can become serious unless precautions are taken. It is for instance possible to alter the whole content of the electronic and magnetic stores merely by putting an appropriate tape on the input. Although we may be often glad of this fact it increases the possible damage which can be caused by mistakes. The remedy for this kind of difficulty lies in the introduction of conventions. These are in effect decisions to restrict the freedom or flexibility of the machine in various ways. It is hoped that the loss of flexibility will be fully compensated for by the advantages of the resulting reduction of the uncertainty of the state of the machine. The conventions are mostly not to be regarded as absolute commands or prohibitions, but rather as normal procedure, any deviation from which must be noted in the descriptions of the routines in which they occur.

Since these conventions do not form any part of the physical machine the user has the alternative of ignoring them altogether. Likewise he can if he wishes ignore altogether the whole of what is said about actual programmes and (at his peril) make his own from scratch, if he considers it advisable. The conventions should not be regarded as pure tyranny, but to know that they have been obeyed in the programmes one is using is a great comfort. Moreover they enable one to reduce considerably the lengths of official accounts of routines, since they allow a great deal to be taken for granted.

The permanent information PERM. The routine changing sequence

There are certain expressions which it is desirable to keep constantly available in the electronic store. The amount of material which should be so kept is a matter of opinion. At present it is proposed to keep only the powers of two and the `routine changing sequence'. The details of this material are shown on the accompanying diagram. The forty powers of two are obtained without using more than forty-one short lines, although each power occupies a long line. However the addresses of those are not in linear sequence. This means that if we wish to use some particular power in an instruction we can do so, but if for instance we want to find $2^{[\tp{/+}]_+}$, a somewhat lengthy process involving a test instruction is required. Sometimes this has to be done, e.g. in the routines for the logarithm and the reciprocal. In these cases the forty one lines of PERM are combined with a further forty lines which are put into the electronic store simultaneously with the routines which require them.

[The listing of PERM is actually at the end of the manuscript; it is as follows:

/ / / / & / & / / / / \\
E / / / & E & / / / @ \\
/ / / / &...
& M & {\rm Working}\\
& X & {\rm Space}\\
& V & \\
& ! &

The routine changing sequence is entered by the instruction NS/P. The ``special working space'' is scratch space which any routine may overwrite at any time.]

The purpose of the routine changing sequence is to enable routines to be changed without having a lot of preparatory bother in the routine which is being left, but fairly quickly and certainly. A certain amount of preparatory bother is unavoidable. When leaving any routine it is necessary to specify the new routine which is being entered. We do it with a long line which is called the `cue' for the new routine. When leaving a master routine for a subroutine it is also necessary to specify what is to be done when the operations of the subroutine are over. This is done with another forty digit line, called the `link'. When leaving the subroutine the `link' will become a cue, and will normally lead back to the master routine.

The preparation to leave a routine will always include putting the cue into VS where the routine changing sequence will find it and deal with it. This setting of the cue may be done just before leaving the routine, though it can be done at any previous time, provided no subroutine intervenes. With routines which have no subroutines the cue is often planted immediately after entering the routine itself. If a link is required it should be put into the least significant half of the accumulator immediately before leaving the routine. On entering the subroutine the link may be planted in VS at once, or if there are lesser subroutines, may be temporarily stored elsewhere.

The cue itself is required to specify the new routine which is being entered. Two different systems are used according to whether the routine in question is or is not `of fixed abode', i.e., whether it is always kept in the same track or not. The cue itself determines which type it belongs to, and the routine changing sequence recognises the type and acts accordingly. The two types are called `true cues' and `false cues'. True cues end with 0 and are used with routines of fixed abode. False cues end with 1 and are used with routines of no fixed abode. The cues will be described here from the point of view of their treatment by the routine changing sequence. The same information is given again on p. [*] from a rather different point of view. [That discussion in fact describes their format, which includes a magnetic instruction to load the routine off the magnetic wheel (or for false cues, a pointer to the magnetic page containing one, and a location on that page), a crude checksum, and the address of the first instruction once the new routine has been loaded into the electronic store; the reader may wish to turn ahead for details before coming back here to see the details of how a cue is followed.]

The first step after entering the routine changing sequence is to deposit the link temporarily in VK, leaving the accumulator clear and free for other purposes. This is the instruction VKTA. The next instruction is JS/L [orig. FS/L] which is a dummy stop. This will be encountered whenever routines are changed, and enables one, when testing out routines by hand, to speed through subroutines known to be sound. The next two instructions VSTF and CK/H discriminate between the true and false cues. Let us take first the case of a true cue. The next instruction is £S/:, and obeys the magnetic instruction part of the cue. The next five instructions form the quantity $\{1025([\tp{/E}]-[\tp{/A}])\}_0^{19}$ whose value depends on the preceding magnetic transfer and, if the wrong transfer is made, is likely to have the wrong value. The correct value is contained in digits 10-19 of the cue. The next four instructions are concerned with verifying whether the value obtained agrees with the value given in the cue. If the value is wrong a middle C hoot occurs. If the value is right the routine is entered by the instruction VS/P, using the control transfer number part of the cue.

In the case of a false cue a new magnetic instruction is constructed and obeyed, resulting in [the] left half of the track mentioned in digits 30-38 of the cue being transferred to [electronic] p.0. The line of this track named in digits 20-29 is then transferred to the short line £S. The routine changing sequence is then reentered. But now there is a new line in £S, not ending in 1, so that the content of VS is now treated as a true cue. The part of the routine changing sequence which deals with false cues is in [electronic] p.7.

Connected with PERM we have the conventions

That it is assumed, unless otherwise specified, that PERM is present both at the beginning and at the end of a routine, i.e. that the contents of lines /: to XS are as shown in Fig. F.

That the retreat from a routine is fully provided for by leaving the cue for the retreat as a link in the accumulator (L).

That to describe the method of entering a routine it is sufficient to specify the cue, in the manner described below (p. [*]).

The lines /E and /A should not be left empty in a routine, and should not be used as working space in a routine.

Restricted use of electronic stores. Normal duties of pages.

It must now be explained that it is very doubtful whether the sixteen pages of electronic store will ever be available. In any case it is advisable not to use more of the store than is really necessary, on account of the difficulties of servicing. However it is futile to practice excessive space economy with a routine which is normally to be used in connection with others which practice less economy. It is necessary therefore to have fairly definite understandings about how much may be used. The following may be assumed

Five pages of electronic store will always be available. In other words it is not recommended that any programming be done for a machine with less store.

No `library' programming should be done on the assumption that more than eight pages will ever be available.

The decision as to which of the sixteen tubes should be made functional is at our disposal. It seems preferable that these should be chosen amongst the first eight, although it might be difficult to give any very convincing reasons for doing so. Of these any five may be taken, but it is desirable that a particular five be chosen and not altered. This is essential if library routines are used. The selection which has been chosen is 0,1,2,4,7, i.e. columns /,E,@,A,:,S,¼,D,C,K. This selection may appear somewhat arbitrary. It may appear less so after it has been explained how these pages will normally be used.

Pages 0 and 1 (columns /,E,@,A) are customarily used to contain routines, i.e. instructions together with auxiliary fixed numbers etc. The magnetic transfers applied in the routine changing sequence will normally be to one or both of these pages.

Page 2 (columns :,S) contains most of PERM

Page 4 (columns ¼,D) is used as systematic working space, i.e. whenever it is required to store tables or other material systematically arranged it is recommended that this page be used.

Page 7 (columns C,K) is used as unsystematic working space, i.e. its content is largely unrelated long lines. It also includes a part of PERM viz. the part of the routine changing sequence concerned with false cues.

The uses of the other three pages if ever available is anticipated as follows

Page 3 (columns I,U) may be used either as a further part of PERM or as a more unsystematic or systematic working space or any combination of these. The lines used for the former applications should preferably be the earlier ones so that the systematic working space may consist of consecutive lines.

Page 5 (columns R,J) will be available as additional systematic working space.

Page 6 (columns N,F) will be available for systematic or unsystematic working space, the latter preferably being restricted to the later lines.

These decisions and suggestions have been influenced by the following considerations.

The choice of the five pages must be convenient when there are only five available, but must also be convenient when there are six, seven or eight.

The routines must be restricted to relatively few pages so as not to interfere with other forms of storage.

Similarly used pages should preferably be partnered. This applies particularly to systematic working space and to the space used for routines.

Systematic working space should if possible consist of consecutive lines.

The powers of two must be consecutive with the space used for routines.

The first few instructions after operating KEC are taken from column /.

These suggestions are supported by the following conventions

That in all library routines the instructions must be kept in columns /,E,@,A.

All alterations of lines on pages 3-7 must be mentioned in the account of the properties of the routine, with the exception of long lines GK,MK,VK.

It is intended that lines GK,MK,VK be used as special short form working space i.e. to contain quantities which are no longer of interest once the routine is finished. Lines MK and VK are in any case used in the routine changing sequence. It will be seen that the presence of these three lines and the part of PERM on page 7 makes this page useless for systematic working space. If further short term working space is required one may use those lines of pages 0,1 which contain instructions which will not be obeyed again before they are wiped out by a magnetic transfer. It should hardly ever be necessary to use any other part of the unsystematic working space as special working space [i.e., scratch space].

The normal uses of the pages are set out briefly again on Fig. G.

B-tube conventions

The conventions concerning the use of the B-tube are

At the end of a routine B0=//// unless otherwise stated. Indeed any alteration of B0 requires special mention.

Uses of the B tube resulting in the function number part of an actual instruction differing from that of the corresponding presumptive instruction, need special attention.

When a choice of B lines is available the higher number is to be preferred.

Alterations of B lines other than B6, B7 must be mentioned.

It may be remarked that B7 is used in the routine changing sequence.

Conventions regarding the use of magnetic storage

There are a number of different ways of using magnetic storage which are worth distinguishing.

Tracks containing fixed information, namely a number of different routines of rather general application and PERM.

Tracks used to contain other routines, which are changed from time to time, but not as part of a computation.

Tracks used for working space.

Tracks used for systematic working space.

Tracks used for special working space.
It is not yet necessary to make many decisions yet about which tracks should be used for which purposes. We may perhaps decide

Tracks 0-15 are for permanent routines. The writing will normally be suppressed for this block of tracks.

Tracks 16-31 are for less permanent routines as b) above. Writing is suppressed during computations.

Tracks 32 to 63 are working space. Track 32 is special working space, i.e. its content may be altered in a subroutine without mention. Unsystematic working space should preferably be in the earlier tracks of these two blocks.

The formal mode of operation

There are a number of modes or styles in which the machine may be used, and each mode has its conventions restricting the operations considered admissible. The engineers for instance will consider the removal of a valve or the connection of two points temporarily with crocodile clips to be admissible, but would frown on certain uses of a hatchet. The removal of valves and all alterations of connections are certainly not permitted to the programmers and other users, and they have additional taboos of their own. There are in fact a number of modes of operation which might be distinguished, but only the formal mode will be mentioned here. This mode has rather stringent and definite conventions. The advantage of working in the formal mode is that the output recorded by the printer gives a complete description of what was done in any computation. A scrutiny of this record, together with certain other documents should tell one all that one wishes to know. In particular this record shows all the arbitrary choices made by the man in control of the machine, so that there is no question of trying to remember what was done at certain critical points.

The conventions involved in the formal mode are of two kinds, restrictions on the programming and punching of tapes, and restrictions on the actions of the man in control of the machine.

Restrictions on the actions of the man in control

The only operations permitted are the changing of input tapes and of the hand switches H, operation of KEC and KAC, and tearing off of the punched and printed outputs. These operations may only be carried out as permitted in (b) to (g).

These actions may only be performed when certain printed signals are given by the machine. The details of this are described in the official account of the routine ACTION. For instance when a tape is to be changed + + CHANGE::........- is printed and a hoot occurs. The full stops represent a `descriptive word' of eight characters giving the controller some indication of how to choose the next tape to put in.

Only specially marked `titled tapes' may be used.

The programmer issues instructions both to the machine and to the controller. The latter may be as complicated as the programmer considers advisable, but must of course be consistent with (a), (b) and (c). The complete programme is restricted by the further conditions:-

The actions which the programmer permits the controller at any stage must be determinable from the previous printed output.

This ensures that the programmer, looking at the printed output afterwards, will be able to verify that his instructions were obeyed, always assuming that the machine made no mistake and that (a),(b) and (c) were not disregarded. The routine ACTION is constructed so as to make a printed record of every action of the controller, assuming he has obeyed (a),(b) and (c).

Instructions involving H are only used as follows. Instruction // is only used in the first few lines of the self-starter routine INITIAL, kept in track 0L [i.e., track 0 (left)]. Instruction /: is only used in the routine ACTION already referred to.

Special magnetic instructions, concerning input or output, are only obeyed in specially constructed input and output routines, more specifically in INPUT, OUTPUTA, ACTION and WRITE.

The `titled tapes' provided for use under (c) must all begin with a titling sequence, i.e. a meaningful sequence beginning with Q, as described under the input routine. Precautions must be taken that no two titled tapes can have the same title i.e. the same initial meaningful sequence.

Precautions must be taken that when a hoot enjoins the tearing off of a tape from the output, this tape shall, if titled, obey the restrictions mentioned under (g).

If output sequences can be of indefinite length there is a danger that it may not be possible to determine the meaning of the output unambiguously. It must however be arranged that this can be done.

In general the programmer cannot be held responsible for the effects that may arise when his instructions are disregarded, any more than for those which are the result of errors in the machine. He will of course be well advised to have checks for both. The efficiency of his precautions will mainly affect his own work. To avoid it affecting the work of others it is advisable that title begin e.g. with the initials of the programmer, or with something identifying the job.

If the output were only on punched tape it would be quite difficult to ensure that (i) was obeyed, since any combination of characters might appear as part of the genuine output. For instance one might wish to have the machine calculate $\pi$ to a certain number of places, the number possibly being determined by the machine, and then to do something else. One might have the machine indicate the end of the digits of $\pi$ by writing DIGITSOFPIENDHERE. But there is no reason why this particular combination of digits should not be part of the binary expansion of $\pi$, indeed it almost certainly does appear somewhere, so that the appearance of this sequence of digits could not be taken as conclusive evidence that the machine had completed as much of the computation of $\pi$ as it was proposing to do. Of course it is vastly more probable that this is the case than that these characters were obtained as part of the binary form of $\pi$. The objections to making such assumptions are mainly aesthetic. It is satisfactory to be in a position to regard the behaviour of the machine as constituting the proof of some mathematical statement. It is less repugnant to those with pure mathematical training to be obliged to assume that the machine has made no mistake, than to have to admit that even if no mistake was made the required result does not quite follow. I personally, for instance, would prefer to have to admit a probability $10^{-20}$ that the machine had made a mistake, than to have to assume that a thousand consecutive zeros occur in the first million digits of $\pi$.

The condition (i) can fortunately easily be met if the printer is available. It is for instance easy to take precautions that - can never occur except when printed in ACTION. This justifies one in assuming that the warning signals given in ACTION actually are produced by that routine and are not some counterfeits produced in another way.

Replacability conventions

It is essential for the possibility of programming at all that the properties of the machine should hardly ever be changed. There are however certain features of the machine which can reasonably be described as `disadvantageous'. It is desirable to leave open the possibility that these features might at some time be removed. This suggests the convention

No disadvantageous feature of the machine should be used in a library routine.
This requires further definition. It is understood in connection with each such feature that it is known what modification improving the machine is contemplated. The routines must work whether such a modification has been introduced or not. The features at present recognised as disadvantageous are mentioned below.

Certain functions are not considered of particular value and rated as `foul'. These are /B, /", /X, , TE, TS, TU, TH, TY, TP, TQ, TM, TX, TV. The modifications envisaged are the changing of these to other operations, so that the convention amounts to the avoidance of their use. [Of these, the only ones with documented effects in the appendices are TE, TS, and TU which perform a logical `or' from the accumulator into storage (TE leaving the result in the accumulator as well).]

The exceptional nature of the line pairs at the end of a page (see p. [*]) is disadvantageous. The modification would consist in bringing these into line with the other line-pairs. The use of such line-pairs is to be avoided.

The sixty-fifth line facility is reckoned as disadvantageous for a slightly different reason, viz. that it is an inconvenience in the engineering, and it might at some time be abolished for engineering reasons. It certainly should not be used for any other purpose than checking.

Provided that input and output are always done through the official programmes the possibility of introducing improved input and output mechanisms remains open.

We must also recognize the possibility of altering routines, whilst leaving their essential properties, except for speed, unaltered. It is desirable that such changes should not affect the validity of the programmers which use them as subroutines. This suggests

No programme should depend on properties of its subroutines which are not mentioned in the official accounts of these subroutines. They should also not depend on the time of the subroutine.

The time restriction is not one which one is tempted to violate, and indeed one which could only be violated by use of the clock. Statements about the time of the routine itself will of course depend on the time of the subroutine, and are excepted, but it is desirable to state the former as a function of the latter.

next up previous
Next: Programming Principles Up: Alan Turing's Manual for Previous: Starting the machine
Robert S. Thau 2000-02-13