Skip to content

pioasm: document predefined constants zero and one #1951

Open
@magy00

Description

@magy00

Resubmission of #1862:

Error messages are not obvious. Maybe allow zero and one to be assigned the values 0 and 1, resp., repeatedly.

test.pio:

.program test
.origin 0
_0:
zero:
        jmp skip
_1:
one:
        mov pins, ~pins
skip:

        nop [1]

        out pc, 1       // effectively jmp _0 or jmp _1
$ ~/.pico-sdk/tools/2.0.0/pioasm/pioasm test.pio
test.pio:4.1-4: syntax error, unexpected integer
    4 | zero:
      | ^~~~
test.pio:7.1-3: syntax error, unexpected integer
    7 | one:
      | ^~~

Similar for (obvious?) labels like clear, wait, status, etc., are mistaken as keywords:

test.pio:

.program test
clear:
wait:
status:
block:
$ ~/.pico-sdk/tools/2.0.0/pioasm/pioasm test.pio
test.pio:2.1-5: syntax error, unexpected clear
    2 | clear:
      | ^~~~~

Note that all (except for a generated #define) is case-insensitive (cannot use kludges like all-caps in CPP).

Apparently reserved words:

.clock_div .define .fifo .in .lang_opt .mov_status .origin .out .pio_version .program .set .side_set .word .wrap .wrap_target
auto block clear exec gpio ifempty iffull in irq isr jmp jmppin left manual mov next noblock nop nowait null one opt optional osr osre out pc pin pindirs pins prev public pull push putget rel right rp2040 rp2350 rx rxfifo set side side_set sideset status tx txfifo txget txput txrx wait x y zero

Metadata

Metadata

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions