aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-04-14 00:48:27 +0200
committerkdx <kikoodx@paranoici.org>2023-04-14 00:48:27 +0200
commite59d3b714c620dffe4cb799b703e853741055917 (patch)
tree0a0642852b5805e11d99ce73f6a9c2cb3874e7d3 /README.md
parent774b224bcabe0f80c01f3ef45713860a39b78d6a (diff)
downloadorga-e59d3b714c620dffe4cb799b703e853741055917.tar.gz
spec.md -> README.md
Diffstat (limited to 'README.md')
-rw-r--r--README.md46
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