Whiteboardiac is a silly little emulator for a very simple computer.  It has 100 decibytes of memory, where a decibyte is a decimal byte, two decimal digits from 0 to 99.  It also has 100 lines of program memory, each one from one to three decibytes.  Its output is a single seven-segment LCD display, and it has no input, though you can edit the memory.

You write programs in machine code.  For example:

62 5

… is a program to display the number “9” on the LCD.  Opcode 37 is “switch on all segments”.  Opcode 62 is “switch off segment X”, where X is the number following on the line.  Opcode 0 is “stop”.  The above was the first program I wrote with my son, the Boy Wonder, who is nine.

Here’s a longer example, which the Boy and I wrote during his second lesson. It creates a cycling display of LCD segments, reading its input from memory:

I’ve written the emulator in Delphi. It’s rather primitive. The current opcodes are as follows:

OpcodeArg #1Arg #2Effect
0End program; reset program counter to 0
14MPut a zero at memory cell M
15MAdd one to memory cell M
16MSubtract one from memory cell M
17XMAdd X to memory cell M
18XMSubtract X from memory cell M
19MNCopy memory cell M to memory cell N
20MAIf memory cell M is zero, set program counter to A
21MAIf memory cell M is not zero, set program counter to A
22ASet program counter to A
23MJump to memory cell M
25ASave the program counter then set it to A
26MSave the program counter then set it to memory cell M
27Set the program counter back to the last saved value
37Switch on all LCD segments
38Switch off all LCD segments
61SSwitch on segment S (from 1 to 7)
62SSwitch off segment S
63Toggle segment S
71MSwitch on segment at memory cell M
72MSwitch off segment at memory cell M
73MToggle segment at memory cell M