adafruit / Adafruit_CircuitPython_PIOASM

Simple assembler to convert pioasm to bytes
MIT License
27 stars 17 forks source link

Better diagnose the incorrect lines like "side 1" or "[5]" #65

Closed jepler closed 3 months ago

jepler commented 3 months ago

Before this, the exception would be 'IndexError: list index out of range'. Now it is 'Unknown instruction: side' or similar.

Based on a report on discord from @AcThPaU that I have interpreted as actually being due to poor reporting of this error condition:

the pioasm sideset instruction check pops the instruction empty, causes the next nop check to out of index

side-set and delay need an instruction, even if it's nop. E.g., nop side 1 instead of side 1. Such as this example from pico-examples:

    out pins, 1   side 0   ; Stall here when no data (still asserts clock low)
    nop           side 1

Please feel free to expand on what you meant @AcThPaU if this doesn't address your concern.