Usage

Enter a program by clicking on the dots in the 8x8 memory grid.
Use the buttons at the bottom to step or run the program.
Reset will cause the PC and the register to go to zero.

How it works

The C88 has a RAM which has eight locations, each location contains an eight bit word.
This RAM is for both program and data.
There is also an eight bit register, known simply as "the register".
To explain; here is an example program that adds two numbers together.

0 - Load 4
1 - Add 5
2 - Store 6
3 - Stop
4 - 23
5 - 15
6 - (output location)
7 - (unused)

The first instruction loads the number 23 in to the register from memory location 4.
The second instruction adds 15 to the register and stores the result in the register. (15 is the value of memory location 5.)
Then the result is stored in memory location 6.
The program then stops.

Try it here.

It's that simple.
The IO stuff is only really useful if you have a physical implementation of the machine.

Some more interesting programs

Die roll. Run fast and then stop to generate a random number in address 7.
GPIO Die roll. Same as above but outputs to GPIO register and is not biased towards six.
Cylon. Run slow to see a cylon flash cycle in the main register.
Slider animation. Like the cylon but the edge between lit and unlit moves instead of a single lit bit moving.
Integrator. Takes the GPIO input, integrates it, puts the result on the GPIO output.
Differentiator. Like the Integrator, but does a differentiation instead. More useful with a physical machine that has some IO stuff attached.

Instruction encoding

Each C88 instruction is eight bits wide. The five most significant bits (the leftmost five bits) are the opcode. The three least significant bits are the address or operand.

Most instructions take an address. The shift and rotate functions take one operand (between 0 and 7).
The Inc, Dec, Double, Half, Stop and IO instructions require no address or operand.

Copyright and licence

© Lex Bailey 2015 (Machine spec, Simulator GUI and instructions, Die roll program, GPIO Die roll, integrator, differentiator, slider)
© Lissa Moriarty 2015 (Simulator back end, Cylon program)

You are permitted to redistribute this page and associated code, with or without modification, provided you give proper attribution to the original authors.