KDF9 Programming Languages
We have surviving copies of two KDF9 Algol compilers,
viz: Whetstone Algol and Kidsgrove Algol,
and two assemblers
viz: KDF9 Usercode and KAL4.
KDF9 Algol is of course Algol 60.
The two surviving implementations were produced at English Electric’s
eponymous establishments at Whetstone and Kidsgrove.
The Whetstone system processed Algol programs held on paper tape
in a load-and-go manner.
The Kidsgrove system was embedded in the POST filing system which operated
entirely on magnetic tape, and stored program text in Algol Basic Symbols.
The compiler produced a binary program in a file, for future execution.
There is a facility for running Paper Tape Whetstone Algol
There is a β-version of a facility for running the Kidsgrove compiler
Note: The only I/O routines that work are open(20), close(20), open(30), close(30), writetext(30, ...), output(30, ...) and read(20).
You can type your own Algol 60 program into the text area provided, or create a file and upload it.
Please do not try any lengthy computation.
It is only a very tiny computer that runs this
as was KDF9 by today’s standards.
Usercode is the language in which most KDF9 software was written,
including both the above Algol 60 implementations.
It is basically an assembly language in that each machine code instruction
in a program is represented by a Usercode mnemonic.
The original manufacturer’s manual is
The manual was extensively revised and republished in 1969 and is available
This almost certainly post dates our version of the code.
There is a β-version of a facility for running Usercode programs
The web page still needs improvement, but the Usercode Compiler works.
The two Algol systems survived as lineprinter listings of KDF9 Usercode.
As a prerequisite to rescuing them, it was necessary to produce
a Usercode assembler.
This gives a rather more detailed listing than the original software, and
it is available as an option in the above facility.
The original software (KAA01PT) survived as a listiing in the Science Museum archive,
and is clearly not the final version as it has a bug which the released system
definitely did not have.
We have original manufacturer’s manual pages.
This software is the paper tape version, and has size limitations.
There was another Usercode assembler (KAB84) which ran in the magnetic tape filing system
Although it formed part of the Kidsgrove Algol system it has not survived (see below).
KAL4 − KDF9 Assembly Language number 4
This assembly language was developed by John Thomason as an MSc project at Leeds University.
It became a staple part of the Eldon2 system at Leeds.
The Leeds FORTRAN compiler was written in KAL4 and generated code into KAL4.
We have the definitive version from the author.
It reads the source code from an Eldon2 file, and is written in KAL4.
The user manual is here.
There is an α-version of a facility for running KAL4 programs
It is planned to modify the way in which this works to
make it more tolerant of various ways of representing Algol Basic Symbols,
which are loaded into an emulated Eldon2 file.
As a prerequisite to rescuing KAL4, it was necessary to produce
a new KAL4 assembler.
This is also available as an option in the above system, and produces a more
detailed listing than the orignal, although it is not capable
of processing some of KAL4’s for creating constants.
Structure of Whetstone Algol
The structure of the Whetstone Algol system has a pair of overlays.
Firstly, a translator which reads the Algol 60 source code and generates
an intermediate code in much the same way as Java does, or Pascal's P-code.
The program is then run by calling in the other overlay (called controller)
which then executes the user's program by interpreting the intermediate code.
There are links to listings of the two overlays below.
There is good reason to believe that this is a released version of the system
that went into general use.
The system that we have here operated from paper tape.
There was another system that operated within the POST
system, and unlike the paper tape system, included the facility
for procedure bodies written in Usercode.
In 1966±1 this facility was added to the paper tape system at Oxford University,
but unfortunately this version of the system has not survived.
Structure of Kidsgrove Algol
The surviving listing of Kidsgrove Algol (Kalgol) is incomplete,
and almost certainly not a final version.
This listing was printed in Australia and somehow
made its way to Bill Waite in Colorado,
where it was scanned and PDF files transferred over the net to a laptop in the Yorkshire Dales.
The structure of the system has a series of overlays called bricks, and a memory resident I/O module called PANACEA (KAB00).
Compilation proceeds from brick 01 (KAB01)
through to brick 60 (KAB60) which outputs
Usercode to be read by brick 84.
The main compiler listing only lacked brick 20, of which a hand-written version was discovered in the Science Museum.
David Huxtable has turned this into an approximation to the original.
In fact the whole thing is an approximation, as it has become abundantly clear that what we have cannot
possibly be the final released version, because we have found several bugs that we know to have been absent
from the production version.
However, we can compile lots of Algol programs, especially if we avoid using the optimiser.
Although the memory resident KAB00 was among the survivors, its initialisation required
a KAB80 which did not survive, and without which it seems impossible to understand KAB00.
Consequently a new PANACEA (KAB00) has
Another absentee from the surviving listings is the Usercode compiler (brick 84 − KAB84).
This is unfortunate as the output from the compiler is in Usercode.
However, a listing of the Paper Tape Usercode Compiter
was found in the science Museum.
A new brick 84
converts the Algol Basic Symbols output by the compiler into
paper tape code and feeds it to KAA01.
Brick 01 (KAB01) takes its input in
Algol Basic Symbol code on a POST format magnetic tape.
The user's Algol 60 program in an ASCII file is converted to an octal dump of
the POST format tape.
This is then read as emulated paper tape by a new brick 81
which then passes control to the true brick 01.
The new bricks
KAB81, KAB84 and KAB00 are written in the
Leeds University assembly language KAL4.
On the real system the memory resident KAB00 fetched the overlays and other material
from a system tape.
Our newly written KAB00 reproduces this behaviour so the compiler consists of
only 2 files, KAB00.bin and the system tape.
You can download a demo of Kidsgrove Algol
which you can run on your own computer.
All you need is a C compiler, and it has run on a whole varity of machines.
There is a readme.htm file within the ZIP file.
Source code listings
There are listings of the original source files produced by modern assemblers.
The left-hand side shows the machine code, and the source code is shown as it would have appeared
on a KDF9 Flexowriter, and with hot links to subroutines.
There are also hot links to the images of the pages of the original listing,
except for the listings of the Kidsgrove compiler which were delivered as PDF files,
as is explained here.
KAA01 Paper Tape Usercode Compiler
EDNKAL4 The KAL4 assembler
KMW02 The Whetstone Algol translator
KMW03 The Whetstone Algol run time system
KAB01 Brick 01 Kalgol Set Up Declaration List etc.
KAB02 Brick 02 Kalgol Update Codes
KAB20 Brick 20 Kalgol Procedure Classification
KAB22 Brick 22 Kalgol Storage Allocation
KAB24 Brick 24 Kalgol Print Level Parameters
KAB40 Brick 40 Kalgol Brick 40 Interim
KAB41 Brick 41 Kalgol For Statement + subscript optimization
KAB42 Brick 42 Kalgol Tidy Up after optimizer
KAB45 Brick 45 Kalgol For Statement Conversion
KAB46 Brick 46 Kalgol optimizing For stmt converter
KAB60 Brick 60 Kalgol Translator -- i.e. code generator
KAB95 Brick 95 Kalgol Terminating + Post Mortem Brick
KAB99 Brick 99 Kalgol Terminating Brick
All the above Kalgol bricks are from the Australian listing, except KAB20 which was missing from the original
Also missing was KAB84, the brick that translated the usercode generated by brick 60
into a binary program.
We have been able to make a near equivalent from the Paper Tape Usercode Compiler (KAA01)
which also survived in the Science Museum archives.
KAB84 Brick 84 − new code converting the Compiler output to paper tape code,
and calling the Usercode Papaer Tape Compiler.
KAB81 Brick 81 − new code copying the output from mkchan.c to a POST-format mag tape
KAB00 PANACEA − new code implementing the functionality of the original memory resident module.
The listings were processed by a mixture of OCR and human eyes.