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