anchor.diff:      begin
         eint? if \ Only enter sleep mode if interrupts have been enabled
           dint up-alone? if ( ."  Sleep " ) sleep then eint
  +        pause
         then
  -      pause
       again
  +;
  +
  +\ --------------------------------------------------
  +\  Convenience fonctions
  +\ --------------------------------------------------
  +
  +: ms ( ms_delay -- ) \ `ms` which allows other tasks to run
  +  millis swap   ( start ms_delay )
  +  begin
  +    wfi pause running \ switch to `wfi` to let lowpower-task go to sleep
  +    2dup millis rot
  +  - < until
  +  2drop
   ;
   
   \ --------------------------------------------------
  
positive.code: 
  \ Internal stucture of task memory:
  \  0: Pointer to next task
  \  4: Task currently active ?
  \  8: Saved stack pointer
  \ 12: Handler for Catch/Throw
  \  Parameter stack space
  
negative.code: \  Lowpower mode
  \ --------------------------------------------------
  
  : up-alone? ( -- ? ) \ Checks if all other tasks are currently in idle state (only counts state==1)
    next-task @ \ Current task is in UP. Start with the next one.
    begin
      dup up @ <> \ Scan the whole round-robin list until back to current task.
    while
      dup 1 cells + @ -1 = if drop false exit then
      \ Check state of this task and exit if it is active
      @ \ Next task in list
    repeat
  