WDR & CARDIAC Paper Computers
Paper computers have the purpose to teach the basic concepts of computing. The WDR paper computer from the 1980s is said to be the most popular of its kind. The instructions, the commands the paper computer can execute are very limited in number, but Turing complete. What does this mean? I principle the five instructions of the WDR paper computer are enough to solve any computational problem. The WDR uses five instructions and a number of storage registers holding counts. The user “you” requires pen, paper and something to represent data. Anything countable, originally the inventor proposed to use matches (or dices, rice corns).
Let us take a look to the instructions…
J xx
- …sets the program counter to line number xx
- …“jumps” to line xx in your program
0 xx
- …checks if the data register xx is zero (contains no matches)
- …if it is true, the program counter is increased by 2
- …or in other words, jump over the next line of the program
+ xx
- …add one match to the contents of the data register xx
- …increases the program counter by 1 (go to the next line of the program)
- xx
- …remove one match from the contents of the data register xx
- …increases the program counter by 1
S
- …end the execution of the program
- …results should be in the registers
Instructions are written in short codes. The +
, -
and 0
instructions reference a register by its integer address. Suppose we have two registers, then they are referenced as 1
and 2
. The program runs from top to bottom, one line at a time, starting from line 1. Line numbers alongside the program are used to jump forward and backward in the program with the J
instruction. Following is a very simple example which adds content in register 2 to register 1, a simple addition.
LN PROGRAM
1 J 4
2 + 1
3 - 2
4 0 2
5 J 2 6 S
The left column represents the line numbers (LN) and the right column contains the program to execute. The following pictures illustrates the layout on a paper, here using dice to represent counts. Follow the program flow with your pen while manipulating the register content. Start with a count of 3 in register 1
and count of 7 in register 2
. After the program stops the result should be a count of 10 register 1
.
In case you wonder, is that it? Yes, computers are basically fancy machines to manipulate numbers, lots of numbers, 100% percent accurately, and extraordinary fast. Let us consider another program which subtracts numbers.
1 0 1
2 J 4
3 S
4 0 2
5 J 7
6 S
7 - 1
8 - 2 9 J 0
When you think about this: What happens if the number you subtract is bigger? You’ll end up with a negative result. I’ll leave it to you to adjust the little program above to use a third register to represent a negative number. There have been improvements to the original instruction codes. First to make it more readable and second to better differentiate register access from jumps between lines. The multiplication program below is written in both notations:
1 0 2 isz b
2 J 4 jmp 4
3 J 8 jmp 8
4 - 2 dec b
5 + 4 inc d
6 + 1 inc a
7 J 1 jmp 1
8 0 4 isz d
9 J 11 jmp 11
10 J 14 jmp 14
11 - 4 dec d
12 + 2 inc b
13 J 8 jmp 8
14 - 3 dec c
15 0 3 isz c
16 J 1 jmp 1
17 0 2 isz b
18 J 20 jmp 20
19 S stp
20 - 2 dec b 21 J 17 jmp 17
As you can see, the right instruction set above uses three character mnemonics and letters a,b,c,d
to address registers. This is more in line with real assembly language, where lines are referred to as addresses in the storage (memory holding the program). Now the instruction codes use integers for addresses [adr]
and character for registers [reg]
:
jmp [adr]
…jump to addressisz [reg]
…is zero registerinc [reg]
…increment registerdec [reg]
…decrement registerstp
…stop
Lets compare this to another paper computer which supports more instructions. The CARDIAC (CARDboard Illustrative Aid to Computation) predates the WDR by more then a decade. It requires more then just a blank sheet of paper and a pen. Increments and decrements are computed in the head of the operator. Everything else uses a more elaborate paper setup with sliders to represent registers and memory cells.
Printouts to build our own CARDIAC [^1] are freely available as well as the original CARDIAC Instruction Manual [^2], which I can highly recommend to take a look at. CARDIAC is a 10 instruction computer working on opcodes like real computers. It helps to understand the difference between machine code and assembly language (based on mnemonic). The manual introduces a lot of important terminology like program counter, control unit, accumulator and many more. A very educational and interesting journey.
This is by no means the end of paper computers. The vast ocean of information on the internet holds more, much more (for or example the Instructo or the Tiny Man Computer). If the topic of non-electronic computers interests you in general, I recommend to start with an article by Devine Lu Linvega about paper computing [^3]. There we are, on the tip of the iceberg, it’s up to you to climb down.
References
[^1] CARDIAC Printout, Johan Von Konow, CC-BY-NC-SA
[^2] CARDIAC Instruction Manual, Internet Archive, CC-0
[^3] Paper Computing, Devine Lu Linvega, CC-BY-NC-SA