Merge pull request #5 from dglaude/patch-1
Fix for "; comment only lines"
This commit is contained in:
commit
cf81c94093
1 changed files with 4 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue