diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..9559004 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# MEM +16^2 sized shared program and heap memory +16^2 sized stack +16^2 sized return stack + +input data is a single short at __0xbffe__ + +screen data is 8-bit indexed on two layers +(one short is two pixels, one for each layer), and located +__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 ( -- ) jump to x and store PC+2 to return stack +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 |