The machine in the game is a very simple stack machine with very few opcodes:
Opcode | Short | Description |
---|---|---|
11111111 | HALT | Stops the machines execution. All programs must end with this |
01010101 | Prints the top value on the stack | |
00000000 | EMPTY | Will push 0 to the top of the stack if the stack is empty or 1 otherwise |
100SNNNN | LOADVAL x | Will load the immediate value SNNNN where S is the sign of the value |
00010000 | LOADIN | Load value from input to the top of the stack |
00110000 | POP | Discard the top-most value on the stack |
00010001 | JUMP | Skip the top-most value on the stack steps |
00010101 | JUMPIF | Skip the top-most value on the stack steps only if the second top-most value on the stack is not zero |
00110011 | COMPARE | Will put 0 if the two top-most values on the stack are equals and 1 otherwise |
01001000 | ADD | Will put the sum of the two top-most values on the stack at the top of the stack |
11001100 | DUP | Will put the top-most value on the stack at the top of the stack again |
This game was made in 72 hours during LD34 with PureScript. View the source here.