Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

meta: A handful of simple words.

So close! Just gotta implement interpret, and then we can start the debugging
process.
  • Loading branch information...
commit 19ceb3019cc244d088483d304d97bdbea632e612 1 parent 6c9edd4
@MostAwesomeDude authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 cauliflower/meta.py
View
21 cauliflower/meta.py
@@ -291,6 +291,16 @@ def thread(self, name, words, flags=None):
ucode += assemble(ADD, J, 0x1)
ma.asm("0branch", ucode)
+# Goddammit DCPU!
+ucode = assemble(SUB, J, [J])
+ma.asm("nbranch", ucode)
+
+ucode = assemble(IFN, Z, 0x0)
+ucode += assemble(SUB, J, [J])
+ucode += assemble(IFE, Z, 0x0)
+ucode += assemble(ADD, J, 0x1)
+ma.asm("0nbranch", ucode)
+
# Main stack manipulation.
ucode = assemble(SET, PUSH, Z)
@@ -298,6 +308,15 @@ def thread(self, name, words, flags=None):
# Return stack manipulation.
+ucode = _push(0xd000)
+ma.asm("r0", ucode)
+
+ucode = _push(Y)
+ma.asm("rsp@", ucode)
+
+ucode = _pop(Y)
+ma.asm("rsp!", ucode)
+
ucode = _push([Y])
ucode += assemble(ADD, Y, 0x1)
ma.asm("r>", ucode)
@@ -444,4 +463,6 @@ def thread(self, name, words, flags=None):
"[",
], flags=IMMEDIATE)
+# ma.thread("quit", ["r0", "rsp!", "interpret", "nbranch", 0x8])
+
ma.finalize()
Please sign in to comment.
Something went wrong with that request. Please try again.