The ENGLISH ELECTRIC Co. Ltd.
Programmes to Aid Programmers
NELSON RESEARCH LABORATORIES                                 Report: NS y 77
STAFFORD                                                       Date: 19/11/57
MATHEMATICS DEPARTMENT   

DEUCE Programme News - No. 16. November, 1957. 


                         Programmes to Aid Programmers
						   
                                  R. A. Smith

SUMMARY.

     This report contains a description of various programmes which are aids 
to programmers, most of them in the ZP category of the DEUCE Library. While 
reports on (nearly) all these programmes exist (so that detailed operating 
instructions are not included here) it is felt that a brief outline of the 
advantages and disadvantages of those under the same heading and a general 
summary of the programmes available would be an advantage, particularly to 
beginners. Spaces have been left for the addition of extra notes on the 
programmes described.


INTRODUCTION.

     This report contains a description of various programmes which are aids 
to programmers, most of them in the ZP category of the DEUCE Library. While 
reports on (nearly) all these programmes exist (so that detailed operating 
instructions are not included here) it is felt that a brief outline of the 
advantages and disadvantages of those under the same heading and a general 
summary of the programmes available would be an advantage, particularly to 
beginners. Spaces have been left for the addition of extra notes on the programmes 
described. The programmes considered come under the following headings:

   1.   Read to Drum Programmes.

   2.   Clock Tracks, etc. 

   3.   Stop and Field Detector.

   4.   Punching Out the Contents of Stores.

   5.   Bricks for Punching Out Stores.

   6.   Clear Drum Programmes.

   7.   Synchronise Display.

   8.   Check Detailed Coding.

   9.   Detailed Coding Programme.

   10.  Binary-Decimal Conversion Programmes.

   11.  Miscellaneous ZP Programmes.

   12.  Assembly of Large Programmes.

1.   READ TO DRUM.

     Four programmes exist - ZP04, ZP14, ZP38 and ZP39T (Nos. 25, 36, 354 and 358)

(a)  ZP38 is the card described in the programming manual and is therefore 
the system used by most beginners. Some harsh words have been spoken against 
this routine but while it is certainly not as convenient as ZP14 there seems 
to be no very great objection to it. The track number stands out (on the cards) 
and the operating instructions are simple. Its disadvantages are 
 (i)   Subroutines have to be reproduced minus the first four rows of each triad 
 (ii)  Errors in punching the filler instructions, while not frequent, are more 
       likely than with ZP14. (These errors are however soon noticed if the 
       programmer is watching the pattern on the IS lamps while the programme is
       reading in). 
 (iii) When the pack is assembled there is no indication of the delay line from
       which the instructions are obeyed unless the cards are labelled (although
       this is not a serious objection). 
 (iv)  Triads punched on this system cannot be read to either the drum or the 
       D.L's at the whim of the programmer as is the case with ZP14.

(b)  ZP04 is known as Track Assembly and is better than ZP38 in some respects. 
D.L. fillers can be left on triads containing subroutines and indeed can be punched 
on the other triads if desired, as a means of identification. If this is done 
then the triads can be read either to the drum or the D.L's according to the 
programmers choice. A further advantage is that subroutines can be put in the 
pack without punching anything on them but the relevant parameters. (It is 
wise to reduce the punching necessary on subroutines to the bare minimum). This 
system is not quite as flexible as ZP38 since triads must be arranged in a 
particular order and there is a possibility of incorrectly punched data cards, 
particularly if the pack is modified at a future date.

(c)  ZP14 is the most convenient of the read to drum programmes since it 
requires a parameter only on the first row of each triad. Furthermore this 
parameter is of such a form that it does not interfere with the normal D.L. 
fillers so that the triad can be read either to the D.L. direct or to the drum. 
Although it is possible to read blocks of tracks without punching the parameter 
on every triad, some people consider it advisable (and very little work) to 
do this for ease of card handling during programme testing. If the D.L. fillers 
are not punched the blank X, 0 and 1 rows on the first card of each triad also 
facilitate recognition of triads during card handling. Whether or not the 
parameter and/or the D.L. fillers are punched on every triad is up to the 
programmer to decide.

NOTE. It is rather easy to forget to punch the P31 on the first row of the 
last triad read to the drum, although this is less easy if the last track is 
always say 15/15 containing a clock track and/or a control routine.

Hand written note here appears to say:
Y row track ... P12 + P15 (not necessary)
Does not look at X,0,1
Last triad has Y P31

(d)  ZP39T is for reading triads punched for 64 column read and will be 
published shortly. It has been designed to avoid the disadvantages of earlier 
single field programmes.

2.   CLOCK TRACKS, etc.

(a)  Clock Tracks.

     A clock track may be defined as a track containing a pattern of digits 
which by means of a synchronising programme makes it possible to regain control 
of the m.c. numbering when this has been lost (e.g. after falling out or when 
using the Initial Input).

     It is very useful during programme testing to restart a programme using 
the instructions and data already on the drum i.e. without the need for reading 
the cards in again or during a production run to restore control, or to punch
out stores in phase, using one of the programmes listed below.

     There are two main types in existence:

     (I) That which uses a whole track of instructions such that whichever 
         is obeyed first, exit is always at the same point e.g. programmes 
         ZP15, ZP16, ZP15/1, ZP16/1, ZP36, ZP37 (Nos. 37, 38, 79, 80, 346, 347)

     (II) The P31 clock track which requires a P31 in just one m.c., the 
         track being available for instructions or data (subject to the 
         restriction on the P31 digits). There is only one programme of this 
         type, ZP34 (No. 314) which uses a P31 in 15/1516.

     Of the two systems (II) is preferable. It does not require a complete 
track of instructions and it is easily formed and remembered. It is complete 
in itself but can be included in type (I) if desired. It is useful with 
POST MORTEM - see below. A slight disadvantage from the point of view of 
using type (II) with existing programmes is that track 15/15 may not be available 
(and in the interests of standardisation it is better not to use a different 
track). Another slight disadvantage is that synchronising by this system at 
present requires 3 cards.

     There are one or two small differences between the programmes under 
type I.

(i)  The "Set" routines ZP15, ZP15/1 and ZP36. ZP15 and ZP36 use 15/15 
with the latter also having a P31 in m.c. 16. ZP15/1 uses track A/B, to be 
chosen by the programmer.

(ii) The "Sync" routines, ZP16, ZP16/1 and ZP37. ZP16 and ZP37 use 15/15, 
the former allowing the programmer to choose the point of entry into the main 
programme. ZP16/1 uses the variable track set by ZP15/1.

(b)  Re-Synchronising the Drum.

     On occasions the drum drops out of Sync. during a programme, which usually 
means starting again because when the drum comes back into Sync. the tracks 
will in effect have been shifted round an indeterminate number of m.c's and 
digits. However ZP44 (No. 372) when run in with the Initial Input shifts 
them back to their original positions on the drum thus making it possible to 
continue. For this programme to work however, Clock Track Programme ZP15 
must of necessity have been included in the main programme.

NOTE. The function of clock track programmes and the function of ZP44 should
      not be confused. Synchronising by means of a clock track is simply
      a question of synchronising the m.c's of the high speed store with the
      m.c's of the drum, whereas ZP44 is a programme to overcome the effects
      of one particular machine fault (namely, the drum dropping out of Sync).

3.   STOP AND FIELD DETECTOR.

     ZP41 (No. 363) is a one card programme which should be the first card 
of a programme. It will stop the machine either if the Stop Key is at STOP or 
if the selector switch on 32/64 column readers is switched to 64 column. 
After taking appropriate action the operator can continue. It will probably find 
increasing use as more programmes are made for 64 column working.

ZP39T (No. 358) mentioned in para.1(d) contains a stop and field detector, 
which only allows the programme to run in if the machine is on normal operation, 
and the switch IS set for 64 column working.

4.   PUNCHING OUT THE CONTENTS OF STORES.

(a) ZP29 (No. 261) POST MORTEM. This is easily the best programme for
punching out the contents of parts of the machine (whether short stores, D.L' s 
or tracks are required) especially if there is a P31 clock track in 15/15, 
since then the m.c's appear on the cards in their correct positions. The 
operating instructions are simple and selection of the required information is 
easy. In addition to punching out required information the result of using this 
programme is often useful in discovering where a mistake has actually occurred 
in a programme, from the contents of the various stores punched out.

     It is advisable to remember that track 15/14 is overwritten by this programme 
and is therefore not punched out. Also one m.c. of D.L.1 is lost.

     This programme has a wider use. It can be used to produce the entire 
contents of the machine in a form which can be used to restart a programme from 
the point at which it was broken off. This scheme is described in detail in 
DEUCE News 13.

(b)  ZP27/1 (No. 276) Punches D.L's and/or Tracks. If there is no P31 clock track 
in a programme and it is particularly important to punch D.L's or tracks with 
the correct phase then this programme ZP27/1 should be used. Unfortunately 
the operating instructions are rather complicated and it is quite easy to make 
a mistake.

     The remaining programmes under this heading are more or less obsolete but 
are included here for completeness.

(c) ZP09 (No. 28). Punches D.L's. This requires the main programme to call 
it in, so that it can only be used at predetermined points, which is not what 
is usually required during programme testing. Cards are punched in phase.

(d) ZP17 (No. 39). Punches all non-zero tracks. Cards are not punched in 
phase.

(e) ZP18 and ZP26 (Nos. 40 and 155). Punch Short Tracks and/or D.L's and/or 
Non-Zero Tracks. ZP26 is similar to ZP18 but uses fewer cards. It uses a 
clock track in 15/15 and ZP15 must therefore have been included in the main 
programme. A disadvantage is that it is not possible to select any particular 
track(s), all non-zero tracks being punched. Cards are punched in phase.

(f)  ZP20 (No. 61). Punches track A/B. Cards are not punched in phase.

(g)  ZP21 (No. 62). Punches a D.L. This requires a pattern of digits in D.L.12 
and cards are punched in phase.

(h)  ZP25 (No. 103). Punches n tracks from M/N. Cards will be punched in phase 
if ZP15/1 was included in the main programme or if ZP25 is run in from a blank 
m.c. 0, (using programme surgery).

5.   BRICKS FOR PUNCHING OUT STORES.

     ZP31 and ZP32 (Nos. 263 and 264) are bricks which can be used in Scheme B 
to punch out the short stores and D.L's respectively. These programmes can be 
used direct from the reader to punch out the contents of the respective stores 
in programmes other than Scheme B, but this is best done using one of the 
programmes mentioned above.

     ZP30 (No. 262) and ZP33B (Formerly LZ02B No. 78) punch out non-zero 
tracks, the latter being a Scheme B brick requiring parameters in the normal 
way. ZP30 is mentioned in DEUCE News 10, but punching out tracks is best done 
by some other method.

6.   CLEAR DRUM.  ZP13, ZP13/1 and ZP24 (Nos. 25, 315 and 102).

     It is sometimes difficult to convince beginners of the need for a clear 
drum programme in any programme which uses the drum. The point is that if the 
wrong track is brought into the high speed store and this contains instructions 
from another programme it may be some time before the error is discovered (since 
the programme may enter this track and continue for a while before finally giving 
a failure) whereas if this track were blank the mistake would be discovered 
immediately. Also if non-zero tracks of the drum are being punched out (during 
programme testing) one does not want other people's programmes punched out as well. 
Finally if the machine develops a fault, the engineers like to know exactly what 
is or what should be in the machine. A clear drum programme merely avoids one 
possible source of confusion. It should be used only as a safeguard and not to 
clear tracks which the main programme expects to find empty. This should be 
done in the main programme if necessary.

     ZP13/1 is an improved version of ZP13 which does not assume D.L.11 is 
empty at entry and leaves the read and write heads in position 0. Both of these 
are one card programmes.

     ZP24 clears the drum and then reads each track to check that it has in 
fact been cleared. This programme is not often used since it is a 3 card programme 
and is slower than ZP13/1.

     A programme which uses the drum normally starts as follows:
          Stop and Field Detector (Optional).
          Initial Card
          Clear Drum
          Clock Track
          Read to Drum
          Triads.

7.   SYNCHRONISE DISPLAY.  ZP05 and ZP05/1 (Nos. 18 and 49).

     These two programmes are similar but ZP05/1 uses only one card. It is 
convenient for the beginner to include this programme in a pack, rather than to 
try and line up the scope while the programme is running in or when the 
programme is in the machine. Once the beginner gets used to the machine, however, 
it is quite easy to line up the scope while the programme is running in.

NOTE. Synchronising the display monitor should not be confused with 
synchronising the drum with the high speed store which was dealt with in 
para. 2; the display monitor will in general require synchronising independently.

8.   CHECK DETAILED CODING.	 ZP06 and ZP06/1 (Nos. 16 and 213).

     ZP06/1 takes account of the P1, P22-25, P31 positions which was not done
by ZP06.

     Some people swear by this system while others have nothing to do with it. 
It does in fact form a slightly more positive check than independent checking 
of coding and punching, if it is used to reconstruct the flow diagram. However 
it takes rather longer and requires machine time (which may or may not be a 
disadvantage). An advantage is that the check does not lose effectiveness by 
being carried out by the programmer himself.

9.   DETAILED CODING PROGRAMME.  ZP43 (N0. 370)

     This programme does the detailed coding of a programme once the allocation 
of storage space has been completed. Instructions are punched in decimal 
one per card from the flow diagram and read in using ZP43. The triads of 
instructions are then punched out in the usual form i.e. with D.L. filler 
instructions on the first four rows and binary instructions on the following 
32 rows. Facilities are available for including library subroutines, decimal 
and binary constants and there are also some checks on consistency.

     Very little experience of this programme has been had as yet but it is 
claimed to be simple to use, rapid in action and to cater for whims of the 
programmer.

10.  BINARY-DECIMAL CONVERSION PROGRAMMES.

(a)  ZP42 (No. 369) converts cards each with 12 binary numbers of p b.p. 
(-2 ≤ p ≤ 37) to decimal, 3 per card. In the past the matrix conversion routines 
have been used for this purpose, mainly because they incorporate a sum check. 
However this check is sometimes a nuisance as is the fact that the number of 
values to be converted has to be known in advance. Such a set of circumstances 
occurs during programme testing, after using POST MORTEM. The results from 
POST MORTEM can be converted using this programme, without the need for a sum 
check or a punched parameter card.

(b)  ZP10 and ZP10/1 (Nos. 29 and 30). ZP10 reads cards each with 6 standard 
floating binary numbers, multiplies them by 2P and converts them to standard 
floating decimal. It requires a pseudo sum at the end of the numbers to be 
converted (≤ 68). ZP10/1 does the same as ZP10 except that the pseudo-sum 
is not required.

(c)  ZP19 (No. 44) is a programme which was made for a special purpose and would 
not normally be used. It converts s.f.b. numbers to single length decimal.

(d)  ZP22 (No. 63) This programme converts s.f.b. numbers as in ZP10 but the 
numbers are punched block floating i.e. the numbers are punched with the same 
decimal exponent and the mantissa is shifted accordingly. There is no 
restriction on the size of numbers, although if the numbers cover a large range 
some significant figures will be lost. On the other hand results tabulated 
from these cards are easier to read and the exponent may not be required on 
the tabulation.

(e)  ZP23 (No. 50) Converts double length standard floating binary numbers 
to double length decimal. The range of values is somewhat restricted and the 
input cards are in a rather special form.

11.  MISCELLANEOUS ZP PROGRAMMES.

(a) ZP01, 2, 2/1, 3 and 8 (Nos. 1, 2, 3, 4 & 27) are used in the preparation of 
subroutines and programmes for the library and the programmer does not normally 
require them.

(b)  ZP07 (No. 17) is for checking that cards punched for R01 are in fact 
decimally punched (since R01 does not contain this check). It should not be 
necessary to use this programme since if there are enough cards to make the 
use of it worth while the values should be punched more than one per card.

(c)  ZP11 and ZP12 (Nos. 33 and 34) are redundant and are being removed from 
the library.

(d)  ZP28 (No. 242) reproduces cards with specified rows missing. It is far 
less expensive and just as convenient to use the reproducer for this purpose, 
unless this has no row eliminator.

(e)  ZP35 (No. 328) is part of a system for restarting a programme after using 
POST MORTEM. This system is described fully in DEUCE News No. 13.

(f)  ZP40 (No. 361) reproduces cards with their rows in any specified order. It 
can be used to move the rows of a pack of cards forward or backward n places 
(n ≤ 11).

12.  ASSEMBLY OF LARGE PROGRAMMES.

     Most programmes divide fairly clearly into several sections and such a 
division is in any case forced on the programmer by the limited size of the 
mercury store.	It usually corresponds closely with blocks of the overall 
logical flow diagram. There is usually great advantage to be gained in writing 
distinct sections and specifying with absolute precision what each section does.

     The advantages are:

(a)  All the transfer of programme between drum and mercury can be done 
with programmes already written.

(b)  Existing programmes (e.g. for input and output of matrices) can 
often be used in computations to which they are not obviously relevant.

(c)  It is easier to localise mistakes and make alterations that are only local 
in effect.

(d)  By storing the whole programme on the drum it can be made re-entrant and 
also can be restarted at easily specified points during testing, without 
reading the whole programme again.

     There are in existence several schemes for assembling a large programme 
from its various sections. These are (in order of publication)

     (i)   ZC01, ZC01/1, 2 & 3 (Nos. 208-210 & 323). The General Interpretive
           Programmes (as used for instance with Scheme A, B, or Z Bricks.)

     (ii)  ZC11 (No. 311).
     
     (iii) ZC13 (No. 345) which includes Subroutine B08 (No. 204).
     
     (iv)  ZC14 (No. 360)
     
     (v)   Subroutine B08/1 (No. 224).

(i)  GIP was designed to be quite general, though its main use has been in 
     linear algebra operations. Full details of this scheme are given in 
     DEUCE News 10 and the Supplement to DEUCE News 10.

(ii) ZC11 can be used to control either sections of an ordinary programme or 
     Scheme B type bricks. (The programmes or bricks under control have to obey 
     some simple rules, over and above those required in the definition of a 
     standard brick). However it is better to use ZC13 in the former case (since 
     it is easier to use) and ZC14 in the latter case (since it is more flexible).

(iii)ZC13 is a system for writing a programme onto the drum and reading each 
     section into the high speed store as it is required. It is quite simple 
     to operate but the subroutine Programme Fetch (B08) which reads each 
     section from the drum, can be used on its own if desired.

(iv) ZC14 is a scheme for linking together standard bricks. GIP is easy to operate
     and very little programming time is required. It is almost invariably
     used for "one off" jobs. However if the matrices are small a disproportionately
     large amount of machine time is spent in the interpretive routine. This
     system (ZC14) spends comparatively little time interpreting but some
     programming is necessary (mainly to plant parameters). It is specially
     suitable for work on small matrices, particularly where the programme will
     be used frequently.

(v)  B08/1 is a subroutine for bringing blocks of tracks from the drum into the 
     high speed store. It is less refined but faster than B08.