| Source Code | Binary Code | Memory | CPU | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|
||||||||||||||||||
| 100 | Red | R |
| 010 | Green | G |
| 001 | Blue | B |
| 110 | Yellow | Y |
| 101 | Magenta | M |
| 011 | Cyan | C |
| 000 | Black | K |
| 111 | White | W |
This computer can be programmed in either binary (1's and 0's) or with a single letter for each color ("r", "g", "b", "y", "m", "c", "k", "w"). These letters are called "Source Code", and they are entered into the "Source Code" text block. Each instruction letter of the source code may be separated from other instruction letters with optional spaces or new lines. These instruction letters are much easier to remember (and to type) than the three-bit binary instruction codes for this computer.
The "Compile Program" button will convert all of the source code into binary instructions and show the binary program (along with addresses) in the "Binary Code" text block. Pushing the "Compile" button will write over any binary instructions in the "Binary Code" text block.
Once a program is compiled (or entered directly in binary) it can be loaded from the Binary Code block into the computer Memory using the Load Program button.
Once a program is loaded into memory, it can be run with the "Run/Stop" button. The CPU shows the program counter ("P") and the state of the output light ("Q"). This computer can hold up to 256 instructions. The controls are explained here:
The normal programming process goes as follows:
The process is iterative as each program is written and tested.
This very simple program flashes a yellow caution light. The time that the light stays on (and off) is controlled by the speed (instructions per second).
yk
This simple program cycles through the colors of a traffic light (green, yellow, and red). The program can be run at any speed (depending on your patience). It was designed for the default speed of 2 instructions per second.
ggggggggggyyyyrrrrrrrr
This simple program cycles through all possible colors except white. In each transition,
only one of the color bits is changed. So the transition from black to red only turns on
the red bit. Since yellow is both red and green, the transition from red to yellow only
requires turing on the green bit. Similarly, transitioning from yellow to green is done
by turning off the red bit. Green transitions to cyan by adding the blue bit, and cyan
transitions to blue by turning off the green bit. Blue transitions to magenta by adding
the red bit, and magenta returns to red by turning off the blue bit. Turing off the red
bit then returns to black and the pattern repeats (black, red, yellow, green, cyan, blue,
magenta, red, and black).
This program runs at any speed, but the slowest speed is best for observing the single
bit changing patterns.
krygcbmrk
This simple program "bounces" between red (on left) and blue (on right) while passing
through green (in the middle). The transition colors of yellow (between red and green)
and cyan (between green and blue) are shown briefly during the transitions.
This program runs at any speed, but the "bouncing" effect is more noticable
at higher speeds like 16 or 32 instructions per second.
rrrrrr
yy
gggg
cc
bbbbbb
cc
gggg
yy