Skip to content

Commit

Permalink
meta: A handful of simple words.
Browse files Browse the repository at this point in the history
So close! Just gotta implement interpret, and then we can start the debugging
process.
  • Loading branch information
MostAwesomeDude committed Apr 12, 2012
1 parent 6c9edd4 commit 19ceb30
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cauliflower/meta.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -291,13 +291,32 @@ def thread(self, name, words, flags=None):
ucode += assemble(ADD, J, 0x1) ucode += assemble(ADD, J, 0x1)
ma.asm("0branch", ucode) 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. # Main stack manipulation.


ucode = assemble(SET, PUSH, Z) ucode = assemble(SET, PUSH, Z)
ma.asm("dup", ucode) ma.asm("dup", ucode)


# Return stack manipulation. # 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 = _push([Y])
ucode += assemble(ADD, Y, 0x1) ucode += assemble(ADD, Y, 0x1)
ma.asm("r>", ucode) ma.asm("r>", ucode)
Expand Down Expand Up @@ -444,4 +463,6 @@ def thread(self, name, words, flags=None):
"[", "[",
], flags=IMMEDIATE) ], flags=IMMEDIATE)


# ma.thread("quit", ["r0", "rsp!", "interpret", "nbranch", 0x8])

ma.finalize() ma.finalize()

0 comments on commit 19ceb30

Please sign in to comment.