MEM
16^2 shorts shared program and heap memory
16^2 shorts stack
16^2 shorts return stack
input data is a single short at 0xbffe
screen data is r5g6b5 from 0xbfff to 0xffff
OPS
NOP ( -- ) sit back and do nothing
LIT x ( -- x ) push x to top of the stack
POP ( a -- ) remove top of the stack
NIP ( a b -- b ) remove second value from top of the stack
SWP ( a b -- b a ) swap top two values of the stack
ROT ( a b c -- b c a ) rotates top three values of the stack to the left
DUP ( a -- a a ) duplicates top of the stack
OVR ( a b -- a b a ) duplicates second value at the top of the stack
EQU ( a b -- bool ) push 0001 if a == b, 0000 otherwise
NEQ ( a b -- bool ) push 0001 if a != b, 0000 otherwise
GTH ( a b -- bool ) push 0001 if a > b, 0000 otherwise
LTH ( a b -- bool ) push 0001 if a < b, 0000 otherwise
JEZ x ( cond -- ) conditional jump to x if cond != 0
JNZ x ( cond -- ) conditional jump to x if cond == 0
JMP x ( -- ) jump to x
JRT x ( -- ) store PC+2 to return stack and then jump to x
RET ( -- ) return from call, or quit if not in call
LDA ( addr -- value ) push value at absolute address to top of the stack
STA ( val addr -- ) write a value to an absolute address
RED ( -- value ) read byte from stdin
WRT ( value -- ) write byte to stdout
ADD ( a b -- a+b )
SUB ( a b -- a-b )
MUL ( a b -- a*b )
DIV ( a b -- a/b )
AND ( a b -- a&b )
ORA ( a b -- a|b )
XOR ( a b -- a^b )
LSF ( a shift -- c ) left shift
RSF ( a shift -- c ) right shift
SLP ( -- ) give control back to the interpreter
INC ( a -- a+1 )
DEC ( a -- a-1 )
DBG ( -- ) output debug informations, can be omitted in release builds