Add case of op and then space

This commit is contained in:
gamblor21 2021-03-23 14:12:46 -05:00
parent f3d4b2ff4c
commit bb7c5717ab

View file

@ -26,6 +26,7 @@ OUT_DESTINATIONS = ["pins", "x", "y", "null", "pindirs", "pc", "isr", "exec"]
WAIT_SOURCES = ["gpio", "pin", "irq", None] WAIT_SOURCES = ["gpio", "pin", "irq", None]
MOV_DESTINATIONS = ["pins", "x", "y", None, "exec", "pc", "isr", "osr"] MOV_DESTINATIONS = ["pins", "x", "y", None, "exec", "pc", "isr", "osr"]
MOV_SOURCES = ["pins", "x", "y", "null", None, "status", "isr", "osr"] MOV_SOURCES = ["pins", "x", "y", "null", None, "status", "isr", "osr"]
MOV_OPS = [None, "~", "::", None]
SET_DESTINATIONS = ["pins", "x", "y", None, "pindirs", None, None, None] SET_DESTINATIONS = ["pins", "x", "y", None, "pindirs", None, None, None]
@ -156,6 +157,8 @@ def assemble(text_program):
assembled[-1] |= 0x10 assembled[-1] |= 0x10
else: else:
raise RuntimeError("Invalid mov operator:", source[:1]) raise RuntimeError("Invalid mov operator:", source[:1])
if len(instruction) > 3:
assembled[-1] |= MOV_OPS.index(instruction[-2]) << 3
elif instruction[0] == "irq": elif instruction[0] == "irq":
# instr delay z c w index # instr delay z c w index
assembled.append(0b110_00000_0_0_0_00000) assembled.append(0b110_00000_0_0_0_00000)