XXIIVV

WDR Instruction Set

The WDR paper computer, or Know-how Computer, is an educational model of a computer consisting only of a pen, a sheet of paper, and individual matches in the most simple case. The instruction set of five commands is small but Turing complete and therefore enough to represent all mathematical functions: incrementing ("inc") or decrementing ("dec") a register, unconditional jump ("jmp"), conditional jump ("skp", skips next instruction if a register is zero), and stopping program execution ("end").

OpcodeDescription
ENDAborts the execution of your program, so that you can examine the contents of your data registers.
SKP(r)Checks if the data register r is zero. If it is zero, the program counter is increased by 2, otherwise the program counter is increased only by 1.
JMP(z)Sets the program counter to line number z.
INC(r)Increments the contents of the data register r and increases the program counter by 1.
DEC(r)Decrements the contents of the data register r and increases the program counter by 1.

To encode a WDR program into a 8-bits punched card, we could use 3 bits of space to encode the operation, which leaves 5 bits for the value. This computer's programs uses only 5 operations out of a possible 8, leaving 3 unused.

BinaryOpcode
000END
001SKP
010JMP
011ADD
100SUB

The following program subtracts from R1 and adds to R0 until the value of R1 is zero. The result of the addition of R0 and R1 will be stored in R0.

LineOpcodeValueOpcodeHex
0001000011JMP 03$43
0101100000ADD R0$60
0210000001SUB R1$82
0300100001SKP R1$22
0401000001JMP 01$41
0500000000END$00

The binary expression of the operation and value of the previous program can be encoded horizontally as the following punched card:

	v   v   v   v   v   v    
			•                
	•   •           •        
		•       •            
							 
							 
							 
	•                        
	•       •   •   •        

Ref. 5-bits Table

The following table show the binary table for 32 addressable lines of a program.

00000000801000101000001811000
01000010901001111000011911001
02000100A01010121000101A11010
03000110B01011131000111B11011
04000000C01100141000001C11100
05000010D01101151000011D11101
06000100E01110161000101E11110
07000110F01111171000111F11111