BOX-256
BOX-256 is a game played by writing assembly code to pass graphics tests.
History
BOX-256 was released for Windows and as an in-browser game by Juha Kiili in April 2016. The first release includes 4 puzzles. v1.1 adds another 8 puzzles and two new opcodes.
Programming
The BOX-256 virtual CPU supports 13 instructions:
Instruction | Description |
---|---|
MOV A B C | copy C cells from A to B |
PIX A B | display a pixel of colour B in location A |
FLP A B C | exchange C cells at A and B |
ADD A B C | Set C = A + B |
SUB A B C | Set C = A - B |
MUL A B C | Set C = A * B |
DIV A B C | Set C = A / B |
MOD A B C | Set C = A % B (added in v1.1) |
JMP A | jump to the instruction at A |
JEQ A B C | jump to the instruction at C if A = B |
JNE A B C | jump to the instruction at C if A != B (added in v1.1) |
JGR A B C | jump to the instruction at C if A > B |
THR A | start a new thread at A |
There are three different addressing modes:
Mode | Description |
---|---|
0 | constant |
@ | address |
* | pointer |
The instruction pointer is stored in address @FF. The instruction pointer for any additional threads is stored at @FE, @FD, etc.
Example
The following example displays a checkerboard pattern:
FLP @16 @17 001 PIX 000 @17 000 ADD 010 @05 @05 JGR @05 00F @00 ADD 001 @05 @05 JMP @04 002 003