
compiletoflash

\ -----------------------------------------------------------------------------

\  Special Atomic Register Access
\   See section 2.1.3 "Atomic Register Access" on RP2350 datasheet

: toggle ( x addr -- ) $1000 or ! inline ;  \ atomic XOR on write
: set    ( x addr -- ) $2000 or ! inline ;  \ atomic bitmask set on write
: clear  ( x addr -- ) $3000 or ! inline ;  \ atomic bitmask clear on write

\ -----------------------------------------------------------------------------

: delay-ticks ( ticks -- )
  cycles ( ticks start )
  begin
    pause
    2dup ( ticks start ticks start )
    cycles ( ticks start ticks start current )
    swap - ( ticks start ticks elapsed )
    u<=
  until
  2drop
;

: ms ( u -- ) 12000 * delay-ticks ;
: us ( u -- )    12 * delay-ticks ;

\ -----------------------------------------------------------------------------

: Flamingo cr
."      _" cr
."     ^-)" cr
."      (.._          .._" cr
."       \`\\        (\`\\        (" cr
."        |>         ) |>        |)" cr
." ______/|________ (7 |` ______\|/_______a:f" cr
;

: welcome ( -- )
  cr
  Flamingo
  cr
  ." Have a nice day !" cr
;

[ifdef] init
  : init ( -- ) init welcome ;
[else]
  : init ( -- )      welcome ;
[then]
