
.program my_program

; optional side-set
.side_set 1 opt

// definitions
.define dec 1
.define hex 0xFF
.define bin 0b01010101
.define exp ( 1 + 2 - 3 * 4 / 5 )

<beginfold id='1'>/*</beginfold id='1'>
pio test program
NOTE: this program don't do anything useful
<endfold id='1'>*/</endfold id='1'>
.wrap_target ; resume here at the end of the program
public start: ; start of the program
    set x, 7

loop: // iterate x times
    set y, 1 ; set y to 1
    set y, dec
    set y, (1 << 0)
    set y, (dec << 0)
    set y, 1 side 1 ; keep setting y to 1
    set y, 1 side dec
    set y, 1 side (1 << 0)
    set y, 1 side (dec << 0)
    set y, 1 side 1 [1] ; still setting y to 1
    set y, 1 side 1 [dec]
    set y, 1 side 1 [1 << 0]
    set y, 1 side 1 [dec << 0]
    set y, 1 side 1 [(1 * 1) << 0]
    set y, 1 side 1 [(dec * 1) << 0]
    <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> set <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> y <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> , <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> 1 <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> side <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> ( <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> 1 <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> << <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> 0 <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> ) <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> [ <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> 1 <beginfold id='1'>/*</beginfold id='1'><endfold id='1'>*/</endfold id='1'> ]
    jmp x-- loop

busywait: jmp pin busywait // wait for input pin to go low
.wrap

<beginfold id='2'>%</beginfold id='2'> c-sdk {
<beginfold id='3'>/*</beginfold id='3'>
this function does nothing useful
<endfold id='3'>*/</endfold id='3'>
uint8_t do_nothing(uint8_t num) <beginfold id='4'>{</beginfold id='4'>
    return num;
<endfold id='4'>}</endfold id='4'>
<endfold id='2'>%}</endfold id='2'>

<beginfold id='2'>%</beginfold id='2'> python {
# this function also does nothing useful
def do_nothing<beginfold id='5'>(</beginfold id='5'>num<endfold id='5'>)</endfold id='5'>:
    return num
<endfold id='2'>%}</endfold id='2'>

<beginfold id='2'>%</beginfold id='2'> unknown {
    unknown language pass through
<endfold id='2'>%}</endfold id='2'>
