
\ Blink a LED on P1.8

$40044014 constant IOCON_PIO1_8
$50013FFC constant GPIO1_DATA
$50018000 constant GPIO1_DIR

: blinky ( -- )
  $C0 IOCON_PIO1_8 ! \ Set P1.8 as GPIO without Pullup/Pulldown. $C0 are reserved bits that must be set.
  256 GPIO1_DIR    ! \ Set P1.8 as Output

  begin
    256 GPIO1_DATA !
    1000000 0 do loop
      0 GPIO1_DATA !
    1000000 0 do loop
  key? until
;

