anchor.diff:  \ Store the adjusted return stack pointer into the parameter stack
       !
   \ Store the desired entry address at top of the tasks return stack
  -  r> insert ;
  +  r> insert-task ;
   
   : activate ( task --   R: continue -- )
     true over 1 cells + ! \ Currently running
  
positive.code:     sp@ >r handler @ >r rp@ handler !  execute
      r> handler !  rdrop  0 unloop ;
  
  : throw ( throwcode -- )  dup if
    handler @ 0= if false task-state ! then \ unhandled error: stop task
      handler @ rp! r> handler ! r> swap >r sp! drop r>
      unloop  exit
      else  drop  then ;
  
  \ --------------------------------------------------
  \  Lowpower mode
  
negative.code:   until
    2drop false ;
  
  : previous-task ( task -- addr-of-task-before )
    \ Find the task that has the desired one in its next field
    >r next-task begin dup @ r@ <> while @ repeat rdrop ;
  
  : insert-task ( task -- ) \ Insert a task into the round-robin list
    dup task-in-list?  \ Is the desired task currently linked into ?
    if drop else next-task @ over ! next-task ! then ;
  
  : remove-task ( task -- ) \ Remove a task from the round-robin list
    dup task-in-list?  \ Is the desired task currently linked into ?
    if dup @ ( task next )
       swap previous-task ( next previous ) !
    else drop then ;
  
  \ -----------------------------------------
  