Turquoise is a line-plotting virtual machine.
Turquoise is a little system with 16 operations, to plot lines from sets of rules. The program starts at the center of the screen, with all registers set to 0x00
.
VM
Runtime | position | 2 shorts | Position on the x and y axis |
---|---|---|---|
return | 2 shorts | Return position | |
scale | byte | Length of segment | |
Register | drawing | 1 bit | On/off |
color | 1 bit | A/B | |
mirror | 1 bit | Off/on | |
flipx | 1 bit | Off/on | |
flipy | 1 bit | Off/on | |
return | 1 bit | False/true |
Rules
Turtoise programs are defined as a set of rules in the follow format:
length | byte | Number of commands in the body. |
---|---|---|
cycles | byte | Number of times this rule will run. |
body | .. | Commands for the rule. |
The following example rulle uses 26 operations to draw a circle from 2 arc segments, the total program is 15 bytes, the first byte is the rule length, and the second is the number of times the rule will repeat:
1a01 4454 5551 5113 7445 4555 1511 b7
Rules are made of 16 line plotting operations:
0 | 0 | 0 | 0 | 0 | Push()/Pop() | 8 | 1 | 0 | 0 | 0 | Move(0,-1) |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 0 | 0 | 0 | 1 | Move(1,0) | 9 | 1 | 0 | 0 | 1 | Move(1,-1) |
2 | 0 | 0 | 1 | 0 | Move(-1,0) | a | 1 | 0 | 1 | 0 | Move(-1,-1) |
3 | 0 | 0 | 1 | 1 | Flip(1,0) | b | 1 | 0 | 1 | 1 | Flip(0,1) |
4 | 0 | 1 | 0 | 0 | Move(0,1) | c | 1 | 1 | 0 | 0 | Color() |
5 | 0 | 1 | 0 | 1 | Move(1,1) | d | 1 | 1 | 0 | 1 | Draw() |
6 | 0 | 1 | 1 | 0 | Move(-1,1) | e | 1 | 1 | 1 | 0 | Scale(1) |
7 | 0 | 1 | 1 | 1 | Mirror() | f | 1 | 1 | 1 | 1 | Scale(-1) |
The commands are run at each pixel.
Move | Move by a length equal to the scale register. |
---|---|
Flip | Flip movement axis vectors. |
Mirror | Swap the target axis with the move operation. |
Draw | Toggle between drawing and not drawing. |
Color | Toggle between painting and erasing. |
Scale | Modify the length of line segments. |
Movement
Moving is done between direct or diagonal pixels.
6 | 4 | 5 |
---|---|---|
2 | 0 | 1 |
a | 8 | 9 |
incoming identity