Skip to content

Commit bb7c571

Browse files
committed
Add case of op and then space
1 parent f3d4b2f commit bb7c571

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

adafruit_pioasm.py

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
WAIT_SOURCES = ["gpio", "pin", "irq", None]
2727
MOV_DESTINATIONS = ["pins", "x", "y", None, "exec", "pc", "isr", "osr"]
2828
MOV_SOURCES = ["pins", "x", "y", "null", None, "status", "isr", "osr"]
29+
MOV_OPS = [None, "~", "::", None]
2930
SET_DESTINATIONS = ["pins", "x", "y", None, "pindirs", None, None, None]
3031

3132

@@ -156,6 +157,8 @@ def assemble(text_program):
156157
assembled[-1] |= 0x10
157158
else:
158159
raise RuntimeError("Invalid mov operator:", source[:1])
160+
if len(instruction) > 3:
161+
assembled[-1] |= MOV_OPS.index(instruction[-2]) << 3
159162
elif instruction[0] == "irq":
160163
# instr delay z c w index
161164
assembled.append(0b110_00000_0_0_0_00000)

0 commit comments

Comments
 (0)