This idea will explain how a typical cooperative Forth multi tasker works.
For now here is a glossary of the noForth multi tasker (in development):
2023-09-04
( xt task -- )task and an execution token xt, make the task execute that token and wake up the task. If an error is cought within the task, the throw code is stored in the task’s ´error#´ user variable and the task is stopped.( task addr -- addr' )task. Used in the form <task> <user-variable> his to translate from the current task’s user variable address to that of task.( addr -- )multi ( -- ))ms, emit, key?, and key) to their multitasking counterparts (multi-ms, multi-emit, multi-key?, and multi-key).( -- task )( x1 ... xn task n -- )n values, a task task, and the number n, it pushes these n values onto the task’s stack.( -- )task-state set to true.( -- ))( task -- )task, it sets the task’s state to sleeping, i.e. the user variable task-state to false.( -- )( stacksize rstacksize -- task )task.( -- )ready or sleeping), link, error number, stack pointer (sp), and return stack pointer (rp).( addr -- )addr by setting its value to 0.( x -- )x relative to the user pointer (up@).( task -- )task, it sets the task’s state to ready (i.e., not sleeping, user variable task-state to true).( x -- )x on the stack.( -- x )x on the stack.( x -- )x on the stack.( -- x )x on the stack.( x -- )x on the stack.( -- x )x on the stack.error# is used to store the last error number/trow code that was raised during the task’s execution. If a task encounters an error, this value will be updated to represent the specific error code and the task will halt.true for ready, false for sleeping).