File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 15
15
import re
16
16
17
17
splitter = re .compile (r",\s*|\s+(?:,\s*)?" ).split
18
+ mov_splitter = re .compile ("!|~|::" ).split
18
19
19
20
__version__ = "0.0.0-auto.0"
20
21
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PIOASM.git"
@@ -142,7 +143,20 @@ def assemble(text_program):
142
143
# instr delay dst op src
143
144
assembled .append (0b101_00000_000_00_000 )
144
145
assembled [- 1 ] |= MOV_DESTINATIONS .index (instruction [1 ]) << 5
145
- assembled [- 1 ] |= MOV_SOURCES .index (instruction [- 1 ])
146
+ source = instruction [- 1 ]
147
+ source_split = mov_splitter (source )
148
+ if len (source_split ) == 1 :
149
+ assembled [- 1 ] |= MOV_SOURCES .index (source )
150
+ else :
151
+ assembled [- 1 ] |= MOV_SOURCES .index (source_split [1 ])
152
+ if source [:1 ] == "!" :
153
+ assembled [- 1 ] |= 0x08
154
+ elif source [:1 ] == "~" :
155
+ assembled [- 1 ] |= 0x08
156
+ elif source [:2 ] == "::" :
157
+ assembled [- 1 ] |= 0x10
158
+ else :
159
+ raise RuntimeError ("Invalid mov operator:" , source [:1 ])
146
160
if len (instruction ) > 3 :
147
161
assembled [- 1 ] |= MOV_OPS .index (instruction [- 2 ]) << 3
148
162
elif instruction [0 ] == "irq" :
You can’t perform that action at this time.
0 commit comments