Merge pull request #5 from dglaude/patch-1

Fix for "; comment only lines"
This commit is contained in:
Scott Shawcroft 2021-02-03 19:18:48 -08:00 committed by GitHub
commit cf81c94093
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,13 +53,14 @@ def assemble(text_program):
sideset_count = int(line.split()[1])
elif line.endswith(":"):
labels[line[:-1]] = len(instructions)
else:
elif line:
# Only add as an instruction if the line isn't empty
instructions.append(line)
max_delay = 2 ** (5 - sideset_count) - 1
assembled = []
for instruction in instructions:
print(instruction)
# print(instruction)
instruction = instruction.split()
delay = 0
if instruction[-1].endswith("]"): # Delay
@ -162,6 +163,6 @@ def assemble(text_program):
else:
raise RuntimeError("Unknown instruction:" + instruction)
assembled[-1] |= delay << 8
print(hex(assembled[-1]))
# print(hex(assembled[-1]))
return array.array("H", assembled)