From f70126c0596882730c17410f61ed676347f5f431 Mon Sep 17 00:00:00 2001 From: David Glaude Date: Mon, 1 Feb 2021 00:28:05 +0100 Subject: [PATCH 1/5] My fix for "; comment only lines" This should fix #4 but there might be a better way. --- adafruit_pioasm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adafruit_pioasm.py b/adafruit_pioasm.py index dc7591f..d3c9e78 100644 --- a/adafruit_pioasm.py +++ b/adafruit_pioasm.py @@ -60,6 +60,8 @@ def assemble(text_program): assembled = [] for instruction in instructions: print(instruction) + if len(instruction) == 0: + continue instruction = instruction.split() delay = 0 if instruction[-1].endswith("]"): # Delay From 61c8964705d7a079997faff3d02c8ead5c49d7a2 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 2 Feb 2021 10:36:18 -0800 Subject: [PATCH 2/5] Update adafruit_pioasm.py --- adafruit_pioasm.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/adafruit_pioasm.py b/adafruit_pioasm.py index d3c9e78..1fc8653 100644 --- a/adafruit_pioasm.py +++ b/adafruit_pioasm.py @@ -53,15 +53,13 @@ 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) - if len(instruction) == 0: - continue instruction = instruction.split() delay = 0 if instruction[-1].endswith("]"): # Delay From ef66ca90102cfdc3d9a73dc4e5db057177a5f4f6 Mon Sep 17 00:00:00 2001 From: David Glaude Date: Tue, 2 Feb 2021 21:48:54 +0100 Subject: [PATCH 3/5] Remove print in library. library should not print --- adafruit_pioasm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_pioasm.py b/adafruit_pioasm.py index 1fc8653..b326886 100644 --- a/adafruit_pioasm.py +++ b/adafruit_pioasm.py @@ -59,7 +59,7 @@ def assemble(text_program): 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 +162,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) From 897358415d886c84cce6a58048e51180719880de Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 3 Feb 2021 13:32:10 -0800 Subject: [PATCH 4/5] Update adafruit_pioasm.py --- adafruit_pioasm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adafruit_pioasm.py b/adafruit_pioasm.py index b326886..89662c4 100644 --- a/adafruit_pioasm.py +++ b/adafruit_pioasm.py @@ -53,7 +53,8 @@ def assemble(text_program): sideset_count = int(line.split()[1]) elif line.endswith(":"): labels[line[:-1]] = len(instructions) - elif line: # Only add as an instruction if the line isn't empty + elif line: + # Only add as an instruction if the line isn't empty instructions.append(line) max_delay = 2 ** (5 - sideset_count) - 1 From 4ceb54bdeff7c2df3fe9aff3c047920088ba2269 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 3 Feb 2021 18:56:17 -0800 Subject: [PATCH 5/5] Black --- adafruit_pioasm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_pioasm.py b/adafruit_pioasm.py index 89662c4..f91134b 100644 --- a/adafruit_pioasm.py +++ b/adafruit_pioasm.py @@ -60,7 +60,7 @@ def assemble(text_program): 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 @@ -163,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)