Current Page : Ferranti Mark1 Manual 1st Edition (Turing) -- Contents, Index, List of facsimile pages; 2nd edition (revised Brooker) -- Contents, Comments and Corrections; Bottom of Page

Programmers' Handbook (1st Edition) for the
Manchester Electronic Computer Mark II

A.M. Turing, 1951

Table of Contents

This is an edited list of the contents of the handbook from the transcription by Robert Thau from MIT. Copies of his transcription in both HTML and PDF are included on this website with his kind permission. The headings and subheadings are linked into his HTML transcription. The numbered links, e.g 3, (or letters, e.g. (B)) give the page number in the original manual, and by following the link you can see a facsimile of the original page from The Turing Archive for the History of Computing.

Note that page references in the manual are of course to numbered pages in the original, which bear no relation to the PDF page numbers or to the HTML pages. In such cases a link is given in both PDF and HTML versions to the approximate relevant area of the original page. But whereas the PDF version gives the original page number, the HTML version leaves it blank.


00 Preface
01 1 General Remarks on Electronic Computers
01 2 Scales of notation
04 3 The Forms of Storage Used
07 4 Description of the Reduced Machine
09 5 Examples of programmes on the reduced machine. -- 10 MULREP listing -- 12 Check sheets -- 13 [SUMPGA listing] -- 14 [SUMPGA check sheet] -- 14 Exercise
15 6 The multiplier and the double length accumulator
18 7 The logical operations -- Example of use of '&' -- Example for reader
19 8 The B-tube. -- 23 SUMPGB -- Exercise
24 9 Miscellaneous special functions -- Dummy stops -- The hooter -- 25 The hand switches -- The position of the most significant digit -- The random numbers generator -- 26 The clock -- The sixty-fifth lines -- [Relative branches] -- 27 The time occupied by various operations
27 10 The magnetic wheel
31 11 The input and output mechanisms -- [Examples] 33 Examples of magnetic instructions, Exercises -- 34 [Library input routines] Warning character J, Warning character K, Warning character Z, Warning character Q, Warning character ", Warning character X, [Input routine timing] -- 36 Tape handling equipment
37 12 The console
44 13 Starting the machine
48 14 Conventions -- 49 The permanent information PERM. The routine changing sequence -- 51 Restricted use of electronic stores. Normal duties of pages. -- 54 B-tube conventions -- 54 Conventions regarding the use of magnetic storage -- 55 The formal mode of operation -- 58 Replacability conventions
59 15 Programming Principles -- 61 (i) Make a plan -- 63 (ii) Break the problem down -- (iii) Do the programming of the new subroutines -- 65 (iv) Programme the main routine
65 16 Programming hints -- Manoevring space -- Do programming directly in teleprint code -- 66 Counting procedure -- 67 Discrimination by control transfer -- The B-tube as shunting station -- 68 Omission of counting -- Alternative entry -- 69 Changing sign in the accumulator -- Twenty-digit numbers -- Clearing the accumulator -- Electronic space economy measures (70 Duplication of use of lines, 71 Sandwiching, Positioning of dummy stops, Relative control transfers, Inaccurate numbers, Changeling instructions) -- 72 Wholesale reciprocals -- Tchebysheff polynomials
73 17 The official account of a routine
76 18 Tapes -- 77 Writing tapes -- 78 Job-steering tapes -- 79 Directories
79 19 Checking procedures -- Measures concerning machine breakdown -- Measures against intermittent error -- 81 Measures against wrong programmes -- 83 Measures against routines wrong in magnetic tracks -- 84 Measures against finger trouble
84 20 Brief reminders
85 Appendix The Pilot Machine (Manchester Computer Mark I) -- 88 Magnetic instructions on the pilot machine -- 89 Times on the pilot machine -- Input and Output on pilot machine -- 93 Programming on the pilot machine -- Normal duties of tubes. PERM. Routine changing sequence. -- [Standard routines for the pilot machine] 94 ( INPUT -- OUT, OUTPG, OUTB -- 95 Mathematical functions LOGSLOW, SINAPP, EXAPP, RECIP, RECROOT -- 96 DBTEMP and BDTEMP -- Testing routines) -- Problems tackled -- 97 Reliability of the pilot machine
Figures -- (A) Powers of 10 -- (B) Binary-Decimal Conversion Table -- (C) Multiplication table -- (D) Addition table -- (H) Multiplication by powers of 2 -- (E) Table of function symbols -- (F) PERM and the Routine Changing Sequence -- (G) Summary
Index (Facsimile only, see below)

INDEX

This is a transcription of the Index as provided in the original manual. The numbered links are to the facsimile pages in The Turing Archive for the History of Computing as in the Table of Contents above. If a page is followed by a number in square brackets this means that the reference is not obviously visible on the given page and the bracketed number gives a more obvious alternative page

Abbreviations 18
Accumulator 7
Active 38
Action 56, 76
Actual instructions 20
Addressless instructions 22
Alternative entry 68
And 33 [18]

Beats 27
B-exceptional 20
Binary scale conventions 2
Blackout 27
B-normal 20
B sign flip-flop 21
B tube 19

Capacity of store 4
Carriage return 3, 32
Changing sign 69
Check characters 74
Checking transfers 28
Check sheets 12
Clearing Accumulators 69
Clock 26
Column 5
Completion signals (= Prepulses) 8, 40  
     Ditto single 40
     Ditto slow 40
Control 7
Conventions 48
Counting 66
Counting, omission of 63, 65 [68]
Cue 49, 73

D (= multiplicand) 16, 18
Destination sequence 77
Digit 2
Digit area 5
Digit period 27
Disadvantageous features 50
Double length accumulator 15
Dummy stops 24, 38, 71

Economic factors 61
Electronic page 5

False cues 50
Figure shift 3, 32
Fleas 60
Formal mode 25, 55
Fractional conventions 16

Hand switches (H) 25
Hooter 24

Input routine 34
Instructions 8

Job-steering tapes 78

Keyboard perforator 37
Keys 38

Left 27
Letter shift 3, 32
Line feed 3, 32
Line 5
Line-pair (long line) 5
Link 49, 51
Logarithm 48 [49]
Logical operations 18

Magnetic store 4
MAN-AUTO switch 38
Magnetic instruction 28
Manoevring space 65
Manual writing 45
Master routine 49
Meaningful sequence 34
Monitor 42
Most significant digit 25
Multiplicand 16, 18
Multiplier 15

Natural order 29 [30]
Not 18
Not equivalent 18

Or 18, 33
Obeying an instruction 8
Official account 10, 14, 73

Page 5
PERM 48 [49]
P0-P19 40
Plus (or minus) convention 16
Prepulses (completion signals) 8
Present instruction (P.I.) 7
Presumptive instructions 20
Principle lines 73

'Q' 21

Random numbers generator 25
Reading transfers 28
Reciprocal 48 [49], 72
Reduced machine 7
Replacability 58
Reversed order 29 [30]
Right 27
Routine 10
Routine changing sequence 49
Row of digits 16

Sandwiching 65, 71
Self-starter routines 48
Short lines 5
Shunting station (B tube as) 67
Sixty-fifth line 6, 7, 26, 29
Space 3, 32
Special functions 30, 33 [31]
Special working space 53
Standard form 14, 25
Starting 46
Stunts 3
Subroutines 49
Systematic working space 52
Switches 38

Tapes 76
Tape address 79
Time 27
Teleprint characters 3
Teletype 37
Titling sequence 56
Tracks 27
Transient effects 41
True cue 50
Tschebysheff polynomials 72
Tube 5

Unsystematic working space 52

Variable subroutines 74

Warning character 34
Write-erase switch 41
Writing tapes 77
Write power 42
Working space 50 [(F)], 55, 60
Writing transfers 77


Links to Individual Pages

This gives a link to each physical page in the manual in The Turing Archive for the History of Computing, in order. The pages there are linked in order, but this random access list is provided in case it sometimes proves useful. A brief description is used for unnumbered pages and the usual page number is used otherwise. "+1" indicates a further page used for a figure.

Title page Errata +1 Preface 1 2 3 4 Monitor tube photo 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Code fragment 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Punched Card photo 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 Figures : (A) (B) (C) (D) Note by Manual owner (E) +1 (F) (G) +1 (H) Index +1 +1



Programmers' Handbook (2nd Edition) for the
Manchester Electronic Computer Mark II

A.M. Turing, revised R.A. Brooker, October 1952

Table of Contents

Where authorship of a Chapter is given, this is the known main author (or person responsible) for the Chapter. Otherwise the section is most likely to have been written by Cicely Popplewell and/or Tony Brooker. The links in Chapter 1 are to the corresponding headings in the transcription of Chapter 1 provided on this site

Chapter 1    A.M. Turing, revised R.A. Brooker

The Logical Design of the Machine and the Instruction Code


1 General remarks on electronic computers
2 Scales of notation
3 The forms of storage used -- The electronic store
4 The control
5 Representation of instructions
6 The arithmetical unit -- Representation of numbers -- The multiplier -- The arithmetical instructions -- Most significant digit, Sideways adder, Random number generator, The logical instructions
7 The control transfer instructions
8 The B-tube and the associated instructions
9 Miscellaneous instructions
10 The magnetic instructions -- Input and output equipment
11 The time occupied by various operations

(See also Abbreviated instruction code (in numerical order) from the Appendix, and Summary Instruction Code (ordered logically).)

Note that the first three sections have minimal changes relative to the First Edition. The material from "The Control" onwards is a complete rewrite by Brooker, with Turing's original words reappearing occasionally, notably in "Random number generator" and "Miscellaneous instructions".

The First Edition relative to the Second only has the one chapter, which covers similar material to Chapters 1, 2 and 3 of the 2nd Edition. At the point of divergence Turing went on to describe a subset computer, with around 10 instructions, comprising two basic control instructions and a small set of arithmetic instructions, using just a single-length accumulator. This was for didactic reasons, allowing him to give some examples of simple programmes and programming methodology before going on to describe the full features of the machine and the program loading mechanisms (under what later became known as Scheme A). The manual finishes with a comprehensive description of the recommended conventions and mechanisms for running programs and a discussion of programming principles. One of the appendices gives a short description of the Manchester Mark 1 (although it is not clear why it is included).


Chapter 2

Coding Examples

Introduction -- Examples -- Coding Hints

Chapter 3    C.M. Popplewell

The Preparation of a Problem: Programming: Scheme A

Coding and programming -- Library routines -- The master routine of a problem -- Scheme A -- True and false cues --The routine changing sequence -- Check characters for single page routines -- Routines having more than two pages -- Variable sub-routines -- The official account of a routine -- The INPUT routine --Warning characters -- Rough tapes -- Setting the directory -- Writing tapes -- WRITE -- Punching writing tapes -- Compound tapes -- Steering Tapes -- Conventions.

Chapter 4    R.A.Brooker

Programming (cont): Scheme B

The size of a routine -- Organization of routines -- Sub- and ad- routines -- Levels of organization -- Open and closed routines -- Cue of a routine -- The cue directory -- The routine changing sequence/B -- Design of closed routines -- Example of programming with Scheme B -- Conventions -- Strategical considerations -- Coding the individual routines -- The input organisation for Scheme B -- The routine B.INPUT --The assembly of a program tape -- Examples illustrating the use of a WORKING PERM -- Use of 'electronic' routines -- Input of numerical (Decimal) data -- Library routine tapes.

Chapter 5

Aids to Coding

Introduction -- Translation routines -- Interpretive (master) routines -- Decoding -- To enter and leave INTERCODE -- The design of closed routines for use with INTERCODE -- Routine changing instructions -- Description of FLOATCODE.

Chapter 6    A.E. Glennie (Armament Research Establishment, Fort Halstead)

The Calculation of Functions of a Single Variable

Introduction -- Power Series -- The Taylor series -- Tchebychef polynomials -- Functions which satisfy an algebraic equation -- Iterative methods -- Repetitive methods -- Digit-by-digit methods -- Functions which satisfy an algebraic addition law -- The logarithmic function -- The inverse trigonometric functions -- The exponential function -- Interpolation -- References.

Chapter 7    N.E.Hoskin (Computing Machine Laboratory)

Numerical Solution of Ordinary Differential Equations

Equations of the first order -- Equations of higher order -- Dynamical equations -- Jury problems -- Iterative methods -- Organization of the method of solution -- Gill-Kutta routine -- References

Chapter 8

Fault Diagnosis in Programmes

Introduction -- Instruction sequence check -- Numerical check (Scheme B) -- The mechanism of NUMBERCHECK -- References

Chapter 9

Measures against Machine Breakdown

Warning -- Nature of faults -- Error detection and precautions -- The reliability of the magnetic store -- Track testing techniques -- The detection of faulty magnetic transfers -- The correction of faulty magnetic transfers

Appendix

The console -- The tape preparation equipment -- Abbreviated instruction code -- Magnetic instructions -- The teleprinter code -- Aids to calculation in the scale of 32 -- Specimen coding sheets




Comments and Corrections for Chapter 1


1. Originally "@E" instead of "@/" for address 2 of Tube 0. Note that in the First Edition of the Handbook, Turing illustrates a store with 16 pages rather than 8 (and without the error), indicating that it was written before the Ferranti Mark 1 arrived, at a time when he was not sure how many pages there would be (the order code allows for 16 pages).
2. There were only 512 20-bit lines in the CRT store, so 9 bits (rather than 10) would suffice. A larger store may have been contemplated, so the hardware may well have been designed to deal with this possibility. Also allocating two 5-bit groups to the address in an instruction was easier for the programmer using the base-32 system (see 3. below).

3. If there were no B-digits in use, then the base-32 form of a normal 20-bit instruction was easy to construct. E.g. consider ECT± (load the line-pair at address EC into the accumulator). The first two base-32 characters (bits 0-4 and 5-9) give the 10-bit store address EC (see 2. above), and the last two (bits 10-14 and 15-19) the instruction "name" . Each 6-bit instruction, e.g. 100010, was known by a two character name, being the base-32 representation of its code preceded by 4 '0's, i.e. as if it occupied the top 6 bits of a 10-bit code, e.g. 00001 00010. The first character of an instruction name is therefore always T (the character for 00001, if its least significant bit is 1) or / (00000, if the l.s. bit is 0).

It was only the third base-32 character of the four-character instruction that mixed information (i.e. the B-line in the least significant three bits and the least significant bit of the instruction code in the top bit -- see the examples in Section 8, on B instructions). This was where the 32-base system could become really irritating! For example looking at instruction ECW±, you can tell immediately that it refers to store address EC, that it has a non-zero B-line field (as the 3rd character is neither T nor /) and that the instruction is either or . To fully decode it you then need to look up (until you know your base-32 by heart) the digit corresponding to the third character, e.g. W gives 19; then if it is greater than 16 you know the instruction is not , and (subtracting 16) the B-line is 3.


4. Presumably to be read as 3 times 239, but I haven't worked out why yet!
5. The original leaves out the  f (for fractional representation) subscripts.

The value of the accumulator for 754+ is given as 01001 10101 in the Handbook, not 01001 11101. (The operation is A' = A - D S+, so its result given A = 0, D = 27 and S = 10 is A' = 0 - 27*10, i.e. -270± (or 1024 - 270 = 754+). You can see what 01001 11101 is by converting to base-32 digits using the base-32 table (or just reading the binary back-to-front!), i.e. [18][23], and then it is 18 + 32*23, i.e. 754.)


6. Given N = 00110 and / = 00000, then for /X/RYN// µ(S) = 28 gives the highest significant "1" in position r28. Of course [S] = 0 has no most significant digit, so some number outside the range 0 to 39 must be chosen as a special case -- but it is not immediately obvious why 63 is chosen. The most obvious representation is -1, and since it takes 7 bits to represent 39± this would give 127, i.e. -1±. However as it only takes 6 bits to represent 39+, then maybe 63 is chosen as the number furthest away in 6-bit positive notation.
7. The key point to notice here is that the logical instructions take [S] in the plus-minus convention. Therefore the logical operation in the top 40 bits of the accumulator is w.r.t. //// (40 zeros) if the most significant bit of [S] is 0 and ££££ (40 ones) if it is 1. In the given examples ABCD, E/// and ££// are therefore extended to ABCD////, E/////// and ££//////; and ABCB and //££ are extended to ABCB££££ and //££££££.
8. The Handbook actually gives the instructions as follows :

Code Name Function
001101/PC' = {s+}0»9         
011101/QC' = {C+ + s+ + 1}0»9
000101/HC' = {s+}0»9if [A]± >= 0; otherwise C' = C + 1
000111/MC' = {C+ + s+ + 1}0»9if [A]± >= 0; otherwise C' = C + 1
This implies that the C' = C + 1 that usually starts the execution of the next instruction (before fetching it from store) is suppressed after instructions /Q and /M, and for /H if (and only if) A < 0. I don't believe this, and it is inconsistent with the statement just made "If, as a result of one of the following operations, C' = 25 (say), then control will start selecting instructions from lines 26, 27, 28, etc., until another transfer of control is encountered."

The suffixes on s+ and C+ have been left out, since if you are taking only the bottom 10 bits it doesn't matter, and in e.g. {C + + s+ + 1}0»9 for a relative jump you might expect to see s± or even {s}0»9± instead. In fact it also doesn't matter whether the specification is simply s or {s}0»9 (as for /P and /H); so long as the resulting value of C + 1 is within range (i.e. bit 9 is 0) the result will be as desired. I don't know what happened if bit 9 was 1. Was this taken as a machine error? Did you jump to address 0 by setting C to 511 (last line in store) or 1023 (-1±), or either? Did control flow automatically from 511 to 0?

8a. The Baby order code used indirect jumps for a good reason; there was a minimal instruction set and it was realised that indirect jumping would be necessary in general programming (and also that relative jumping would be invaluable for relocatable code).

However the most frequent use of jump instructions in a program is to direct addresses, that can be placed directly in the address field of the instruction itself (if the address is not too large). Ironically, with the invention of the B-line, used in the design of the Manchester Mark 1 in October 1948, there was now an easy solution to the indirect case: load the indirect address into a B-line and jump using a zero direct address modified by the B-line. (Alternatively, for a simple multiway switch on the value of an integer, you could store the set of appropriate jump instructions in consecutive store lines, put the integer in a B-line, and then jump to the base address modified by the B-line.) So it is rather a pity that the jump instructions were not changed to using direct addresses. (In the Manchester Mark 1 the reason was probably that inter alia they did not want to change the control circuitry of the existing expanded Baby, in particular the conditional jumps, which worked by skipping just one instruction.)

The two-instruction continuous hooter loop is a good example of the unnecessarily tortuous programming that could result from overcoming the awkwardness of the jump mechanism without wasting space! Maybe one of the uses of the Dummy instruction was to place the direct address safely and clearly in the next instruction, e.g. an instruction at address FS wishing to jump conditionally to address VS + 1 could be written as :

Address  Instruction
-------  -----------
   FS       CS/H      If A >= 0, jump to instruction
                                 given by {CS}0»9 + 1
   CS       VS      Otherwise, do nothing ---
   KS       ....                    --- then carry on ....

9. TM, TX and TV are unused instructions, T" is a duplicate instruction for TG, and is a Dummy instruction, see the end of the "Abbreviated Instruction Code" from the Appendix, and the notes underneath.
10. There are already 3 corrections made by hand to this table in the duplicated Handbook, but two more remain: the last two "Effect"s being given as "[@E]' = @E//" not "[B7]' = [@E]", and "[B7]' = @E/O" not "[B7]' = [@E]. (These hand corrections derive from a set of errata buried in Chapter 2 of the copy I am using; all have been included in the text presented (without highlighting them).)
11. Example (1) of Examples 2 is as follows:
  1. Place in L the check sum, i.e., the sum modulo 240, of the line pairs, of page 4.
         | / | V E / / |  count number
    ---> | E | @ / T : |  clear accumulator
         | @ | / / Q O |  set B7 to 62
     --> | A | / ½ Q I |  partial sum
    |    | : | A : Q G |  adjust counter
     --<-| S | E / / T |  test for last cycle
    

Or, with fuller annotation:
Store
Addr.
InstructionExpanded
to (s,b,f)
Comment
//VE//62The initial value of the counter, 62, the last line pair on a page
--->E/@/T:@/, 0, T:Set A to 0. ---> indicates that this instruction is the entry point for the whole sequence. Instruction T: (A' = 0) does not use its address field (it is ignored); so the bottom 10 bits are instead used to hold the address required by the jump instruction in the last instruction (remembering that it has to be set to the instruction before the one to be jumped to). So it holds @/, the address of the instruction before the start of the loop.
@///QO//, 7, TOSet B7 to [//], i.e. 62; the loop will count down in B7 in steps of 2, till the first line pair in the page has been added in, when B7 = 0. (The B-exceptional form of the B' = S instruction TO is used; if the B-normal instruction TT is used, B7 would have to be set to 0 first.)
 -->
|
^
|
A//½QI/½, 7, TI Add [/½ + [B7]]+ to the accumulator (TI is A' = A + S+), i.e. add the contents of line-pair [B7] in tube 4 (base address /½) to the accumulator in plus convention. This is the begining of the loop.
|
^
|
|
:/A:QGA:, 7, TGSubtract 2 from B7. The constant 2 is taken from the list of powers of 2 in the PERM page, which is in 20-bit line 3 of Tube 2 (remembering to ignore the track-address line at the top and count from 0), with address A:.
 --<-S/E//TE/, 0, /TThis tests the last b-line set (or stored), i.e. B7, and if it is >= 0 it resets control to address [E/]0»9, i.e. @/. So if B7 is now -2, i.e. the first line-pair in the page has already been added in, control passes to the next instruction after the sequence shown, with the required answer in the accumulator; otherwise the next instruction obeyed is at @/ + 1, i.e. A/, the beginning of the loop.
So at the end of the loop, the accumulator will hold the sum of the 32 even line-pairs in Page 4, with L holding the bottom 40 bits, i.e. the sum modulo 240, and M holding the bits above 40.


12. Consider the sequence to program a two instruction loop to set the hooter going continuously, e.g. at the end of a program:
Address  Instruction
-------  -----------
   NS        ...
   FS       NS/V      Apply single pulse on hooter
   CS       FS/P      Unconditional jump to previous instruction
   KS        ...
Beware of reading the FS address in the second instruction as a literal reference to the instruction it wants to jump to! All control address references are indirect, and therefore have to give the address of a line holding the required address. What is more the address has to be one below the instruction to be jumped to (as 1 is always added to the control address at the start of an instruction, before fetching it from store). However the indirect address is only fetched from bits 0-9 of the given address, and some instructions do not use their address field. So it was a common device (to save store) to hold indirect addresses for jumps in redundant address fields of such instructions. One of these instructions of course is the hooter instruction /V. So we see that the indirect store address in the second instruction is that of the first, FS, and the actual address required is sitting in the address field of that, i.e. NS, the store address before FS! See also 13. below.

13. Consider the sequence to program a three instruction loop to set the hooter going continuously, e.g. at the end of a program:

Address  Instruction
-------  -----------
   Q@        ...
   O@       ///V      Apply single pulse on hooter
   B@       Q@/V      Apply single pulse on hooter
   G@       B@/P      Unconditional jump to last-but-one-instruction
   "@        ...
In the Handbook the first instruction is given as just /V, rather than the ///V. I have changed it to so as not to confuse the casual reader. In fact, see 12. above, the address in the 3rd instruction, B@, refers to (the address field of) the 2nd instruction, Q@, which gives the address one before the address of the 1st instruction -- thereby achieving the jump from 3rd instruction to 1st! It may (or may not) have been a common convention when coding to leave the address field of an instruction with redundant address field empty rather than //, to show that it was available for storing jump addresses.

Mark 1 Story : Introduction, The Baby, Manchester Mark 1, Ferranti Mark 1
Useful Links : Home Page, Picture Gallery
Context : 50th Anniversary pages (The Mark 1 story, Celebrations, Virtual Museum)
        at : the School of Computer Science, The University of Manchester
Maintainer : Brian Napper; last updated May 2000

Copyright The University of Manchester 1998, 1999, 2000, 2005