The EDSAC Valve Computer

I attended an interesting talk from Andrew Herbert, hosted by The National Museum of Computing, about coding on the EDSAC or Electronic Delay Storage Automatic Calculator. This was a valve computer built by a team from the Cambridge University Mathematical Laboratory, led by Maurice Wilkes with construction overseen by Bill Renwick. Whilst somewhat overshadowed by the more famous Alan Turing, Wilkes and Renwick made no less of a leading contribution to computer science.
Designed in 1947 and completed in 1949, EDSAC was amongst the worlds earliest fully electronic computers to see practical service, with the Manchester Mark I also entering use at around the same time. It had been preceded by the Manchester "Baby", completed in 1948, but this had very limited functionality and was used only as an experimental machine. Another well-known predecessor was ENIAC, which was completed in 1945 and used for military calculations but this was not a stored program computer. ENIAC was programmed by setting the positions of switches on a panel. EDSAC improved on this, following the now ubiquitous Von Neumann Architecture, and operated like a modern computer by loading programs from a storage device into memory.
Before it was even completed, EDSAC would be developed into what may be the worlds first business computer by the forward thinking Lyons company which ran a popular chain of tea and coffee shops. Operating on thin margins and high volumes, the business necessitated the peak of efficiency. Following hearing about the concept of computer technology, Lyons was directed to Wilkes and the EDSAC.
Lyons loaned the somewhat understaffed Wilkes an engineer in 1949 and immediately began construction of the Lyons Electronic Office (LEO) computer under the direction of John Pinkerton, who had been hired by Lyons for the task. This was a similar machine to EDSAC with some modifications. The first business application to which the machine was applied, in fact before all the parts of the system were complete, was calculating the total value of goods being produced by the Lyons bakeries. This was chosen as a simple program but with useful output to demonstrate the reliability of computer operations and was running routinely by 1951. Complex payroll applications, stock control and ordering systems would follow shortly afterwards and would prove the efficiency savings delivered by computers to business.
Transistors were only beginning to be invented when EDSAC was being designed and would not see widespread availability until the 1950s. Instead valves, also known as vacuum tubes, were the principle component used to implement the logic. A heater causes electrons to be produced in a process known as thermionic emission. In a vacuum the electrons are able to flow towards an anode (the plate). The flow of electrons between the heater and the plate effectively completes a circuit. However, the circuit can be turned off by applying a negative voltage to a wire mesh (the grid) that is located between the heater and the anode, which interrupts the electron flow. The ability to turn the electron flow on and off creates an electronic switch very similar to that of a transistor. From this action, all logic circuits can be constructed.

The EDSAC had 1024 18-bit words of memory implemented as mercury delay lines. Only 17-bits are of each word are usable, hence a little over 2K of RAM in modern parlance. So in the 1940s it still had more RAM than a ZX81! The delay lines were tubes filled with liquid metal and a sound wave sent though the metal would take some period of time to propagate from one end of the tube to the other. Data was stored in the wave as it travelled along the tube. When the data reached the end it would be fed back in again to refresh the state.
Apparently, half the RAM was usually broken at any one time so it was best to keep your programs under 512 words.
The machine has 14 CPU instructions (or maybe 19 depending how you count them) and can run at a blazing 650 instructions per second. That may not seem very fast, but it is when you compare it to the incumbent computing technology. It's apparently at least 1500 times faster than a postgrad student with a mechanical calculator. Even though the machine is extremely slow and limited by any modern standard, when you express it in the context of the available contemporary alternatives, that it could perform work equivalent to 1500 people without error and operate 24 hours a day, the value of the machine becomes apparent.
Mass storage is delivered via a 50 character per second paper tape reader and program output is to teletype. Two of the instructions are used for input and output respectively. It also has a specific instruction to ring a bell to let the operator know the program has finished.
Amazingly it is possible to do graphical video display. The system was equipped with three CRT oscilloscopes, the centre of which shows the state of the memory delays lines. The RAM is implemented as two banks of 32 delay lines (each storing 16 x 18-bit words) and the oscilloscope can show the state of any one of the delay lines in full. The exact line being displayed is selected by a rotary switch. Each dot on the oscilloscope represents one bit. Hence by setting relevant bits in the memory the machine can display an image on the screen; in effect it is a bitmap graphics display.

Coding for the EDSAC is performed in a form of assembly language and is a surprisingly familiar experience. There is an emulator available which is shown here running on Linux. I got as far as "Hello World" in EDSAC assembly. The teletype output is represented in the top right window. The code is in the left hand window, which would have been input encoded onto paper tape in the real system. The pattern of green dots in the middle is a simulation of the oscilloscope display showing the memory state of one delay line. The "long tank" selector chooses which delay line is shown.

The "O" assembler instruction outputs a character to the teletype. The characters are picked up from the referenced memory addresses. I did not figure out how to do a space character! There's also some directives (not machine instructions) at the start and end of the code that indicate to the bootstrap loader to load the paper tape and what to do with the program.
The EDSAC has a form of combined BIOS and assembler that manages your program called "Initial Orders". Here we're loading the code into memory location 64 onwards (indicated by T64K). The next "GK" directive sets a program counter offset to the load point. The code is relocatable, just like on a modern computer, and can be loaded anywhere in RAM. Memory locations are relative to the load position. The next instruction actually causes the CPU to halt which was apparently best practice so that you can verify on the display that the program has actually loaded into memory properly before running it.
Things EDSAC assembler makes hard are: it didn't originally have an index register because the concept hadn't been invented at the time of machine's design, although the machine did acquire one some years later when this was figured out. To deal with a vector you ended up doing tricks with self modifying code. It did not have a subroutine jump instruction because that concept hadn't been invented yet either, although there was a trick called a "Wheeler jump", named for the inventor David Wheeler, that achieved the same effect.
I fired up the games library, like this classic from 1952 called "OXO". This may have been the first ever computer game, although as with any "first", it's always hard to tell and depends how you define it.

To make your selection of square, you need an interactive input device and this computer does not have a keyboard. Input is handled by a mechanical rotary telephone dial, which is represented on the emulator in the bottom right of the screen. In this game, dialling a digit enables you to choose one of the nine positions on the noughts and crosses board.
Image Credits: EDSAC Computer Photo, by University of Cambridge, Creative Commons Attribution 2.0 Generic; EDSAC Display Tubes, by University of Cambridge, Creative Commons Attribution 2.0 Generic; Valves, by Mister rf, Creative Commons Attribution-Share Alike 4.0 International