\ Print a High Level Trace                            08JAN84MAPBUG ALSO DEFINITIONS                                            : L.ID   (S nfa len -- )                                           SWAP DUP .ID  DUP NAME> 1-   - + SPACES  ;                   VARIABLE SLOW                                                   VARIABLE RES                                                    : (DEBUG)       (S low-adr hi-adr -- )                             1 CNT !   IP> !   <IP !   PNEXT   ;                          : 'UNNEST   (S Pfa -- Pfa' )                                       BEGIN   1+ DUP @ ['] UNNEST = UNTIL   ;                                                                                                                                                                                                                                                                                                                                                                                                                      \ Enter and Leave the Debugger                        06Oct83map: TRACE   (S Ip - )                                                >R .S R>  CR @ >NAME 10 L.ID   SLOW @ NOT KEY? OR               IF   SLOW OFF  RES OFF   ."   --> "   KEY UPC                    ASCII C OVER = IF  SLOW @ NOT SLOW ! THEN                       ASCII F OVER = IF DROP BEGIN QUERY RUN RES @ UNTIL THEN         ASCII Q OVER = ABORT" Unbug"                                    DROP THEN   PNEXT   ;                                       ' TRACE  'DEBUG !                                               FORTH DEFINITIONS                                               : DEBUG   (S -- )                                                  ' 2-   DUP [ BUG ] 'UNNEST (DEBUG)   ;                       : RESUME   (S -- )                                                 [ BUG ]  RES ON  0  PNEXT   ;                                ONLY FORTH ALSO DEFINITIONS                                                                                                     \ Load Screen for the MultiTasker                     07Feb84mapONLY FORTH ALSO DEFINITIONS                                        1 2 +THRU   CR .( MultiTasker Hi Level Loaded )              ONLY FORTH ALSO DEFINITIONS   \S                                The MultiTasker is loaded as an application on top of the       regular Forth System.  There is support for it in the nucleus   in the form of USER variables and PAUSEs inserted inside of     KEY EMIT and BLOCK.  The Forth multitasking scheme is           co-operative instead of interruptive.  All IO operations cause  a PAUSE to occur, and the multitasking loop looks around at     all of the current tasks for something to do.                                                                                                                                                                                                                                                                                                                                                   \ Activate a Task                                     17Oct83map: TASK:   (S size -- )                                             CREATE   TOS HERE #USER @ CMOVE   ( Copy the USER Area )        @LINK  UP @ -ROT  HERE UP !  !LINK ( I point where he did)      DUP HERE +   DUP RP0 !   100 - SP0 !  SWAP UP !                 HERE ENTRY LOCAL !LINK    ( He points to me)                    HERE #USER @ +  HERE DP LOCAL !                                 HERE SLEEP   ALLOT   ;                                       : SET-TASK   (S ip task -- )                                       DUP SP0 LOCAL @   ( Top of Stack )                              2- ROT OVER ! ( Initial IP )                                    2- OVER RP0 LOCAL @ OVER !   ( Initial RP )                     SWAP TOS LOCAL !  ;                                          : ACTIVATE   (S task -- )                                          R> OVER SET-TASK   WAKE  ;                                                                                                   \ Create a Background Task                            10Mar84map: BACKGROUND:   (S -- )                                            400 TASK:   HERE @LINK 2- ( get address of new task )           SET-TASK  !CSP  ]  ;                                         \S                                                               background: spooler     1 capacity show  stop ;                                                                                 : spool-this   spooler activate  3 15 [ shadow ] show stop  ;                                                                   variable counts                                                 background: counter   begin pause 1 counts +! again  ;                                                                                                                                                                                                                                                                                                                                         