compiletoflash

: 0-foldable $40 setflags immediate ;
: 1-foldable $41 setflags immediate ;
: 2-foldable $42 setflags immediate ;
: 3-foldable $43 setflags immediate ;

: ( [char] ) parse drop immediate 0-foldable ;  (  Forth-Style-Comment )
: { [char] } parse drop immediate 0-foldable ;  { Pascal-Style-Comment }
: \        0 parse drop immediate 0-foldable ;  \ Comment till end of line 

32 constant bl
: cr    10 emit ;
: space bl emit ;
: spaces 0 ?do space loop ;

: octal 8 base ! ;
: sqr ( n -- n^2 ) dup * 1-foldable ;
: star 42 emit ;

$20 constant P1IN
$21 constant P1OUT
$22 constant P1DIR
$23 constant P1IFG
$24 constant P1IES
$25 constant P1IE
$26 constant P1SEL
$27 constant P1REN
$41 constant P1SEL2

$28 constant P2IN
$29 constant P2OUT
$2A constant P2DIR
$2B constant P2IFG
$2C constant P2IES
$2D constant P2IE
$2E constant P2SEL
$2F constant P2REN
$42 constant P2SEL2

$4A constant ADC10AE0

: random ( -- u ) 
 ( Generiert Zufallszahlen mit dem Rauschen vom Temperatursensor am ADC )
 ( Random numbers with noise of temperature sensor on ADC )
   0
   16 0 do
     shl
    10 analog 1 and
    xor
  loop
;

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

: init Flamingo cr ." Have a nice day !" cr ;

: cornerstone ( Name ) ( -- )
  <builds begin here $1FF and while 0 , repeat
  does>   begin dup  $1FF and while 1+  repeat

  [
    $c232 ,                 \ dint
    $43c2 , $0000 ,         \ clr.b &IE1
    $40b2 , $5a80 , $0120 , \ mov #5A80h, &WDTCTL
    $443a ,                 \ mov @r4+, r10

    $4030 , ' eraseflash 16 + ,  \ br #eraseflash-interna
  ]
;

cornerstone Rewind-to-Flamingo

\ Unlike ANS-Marker, the defined "Rewind-to-Flamingo" stays in Flash and doesn't remove itself upon invocation. 
\ I think, this should be more useful for its given task to conserve some basics.
