To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.pbforthOpen lugnet.robotics.rcx.pbforth in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / pbFORTH / 189
188  |  190
Subject: 
Multitasker and MARKER word
Newsgroups: 
lugnet.robotics.rcx.pbforth
Date: 
Sun, 14 Nov 1999 18:06:43 GMT
Viewed: 
1178 times
  
Hi Ralph,

Here are my results regarding MARKER and multitasker problem: small additional
code in MARKER word could do the trick. It was even easier then I though: you
don’t need to put tasks in the “sleep” mode. Just remove them from the task
chain and they will never get the chance to continue...

Read your “opening remarks” recently, great speech, Ralph!
(So bad, I wasn’t there…).

Sergey


-- assembler code -------------------------------------------------------------

;------------------------------------------------------------------------------
; MARKER ( "<spaces>name" -- ) \ CORE EXT
;
; Create a definition with name. The new definition will
; restore on execution all dictionary allocations and search
; order pointers to the state they had just prior to the
; definition of name.
;
;  : MARKER
;      HERE
;      CREATE
;     SystemTask @   \ SystemTask's follower
;     BEGIN
;   DUP @ ,   \ save follower
;   @ CELL+         \ next follower
;   DUP SystemTask @ =
;     UNTIL DROP 0 ,   \ terminator
;
;      , GET-CURRENT ,
;      FORTH-WORDLIST   \ start of wordlist link
;      BEGIN CELL+ DUP @ WHILE @ REPEAT   \ find end of wordlist link
;      , GET-ORDER DUP , 0 DO , LOOP
;      DOES>
;     SystemTask @   \ SystemTask's follower
;     BEGIN OVER @ ?DUP WHILE
;   OVER !   \ restore follower
;   @ CELL+   \ next task's follower
;   SWAP CELL+ SWAP   \ next element
;     REPEAT DROP CELL+   \ terminator
;
;   DUP @ TO HERE
;     CELL+ DUP @ SET-CURRENT
;     CELL+ DUP @ 0 SWAP !   \ restore end of wordlist
link
;     CELL+ DUP @ DUP >R CELLS + R@ 0 DO DUP @ SWAP cell- LOOP
;        DROP R> SET-ORDER   \ restore search order
;     FORTH-WORDLIST   \ start of wordlist link
;     BEGIN DUP @   \ last word name field of
wordlist
;   BEGIN  DUP HERE U>
;   WHILE  cell- @
;   REPEAT OVER !   \ restore search order
pointer
;   CELL+ @ ?DUP 0=   \ repeat to next wordlist
;     UNTIL ;

M_COLON(6,``"MARKER"'',Marker,_SLINK)
        .word HERE,CREATE

        .word SystemTask,Fetch
MARK0:  .word DUPP,Fetch,Comma
        .word Fetch,CELLPlus
        .word DUPP,SystemTask,Fetch,Equals
        .word ZBranch,MARK0,DROP,Zero,Comma

        .word Comma,GET_CURRENT,Comma
        .word FORTH_WORDLIST
MARK1:  .word CELLPlus,DUPP,Fetch,ZBranch,MARK2
        .word Fetch,Branch,MARK1
MARK2:  .word Comma,GET_ORDER,DUPP,Comma,Zero,DoDO
MARK3:  .word Comma,DoLOOP,MARK3
;        .word DOESGreater,DUPP,Fetch,TO,HERE
        .word Pipe,CALLL,DoLIST

        .word SystemTask,Fetch
MARK4:  .word OVER,Fetch,QuestionDUP,ZBranch,MARK5
        .word OVER,Store
        .word Fetch,CELLPlus
        .word SWAP,CELLPlus,SWAP
        .word Branch,MARK4
MARK5:  .word DROP,CELLPlus

        .word DUPP,Fetch,DoTO,AddrHERE
        .word CELLPlus,DUPP,Fetch,SET_CURRENT
        .word CELLPlus,DUPP,Fetch,Zero,SWAP,Store
        .word CELLPlus,DUPP,Fetch,DUPP,ToR
        .word CELLS,Plus,RFetch,Zero,DoDO
MARK6:  .word DUPP,Fetch,SWAP,CellMinus,DoLOOP,MARK6
        .word DROP,RFrom,SET_ORDER,FORTH_WORDLIST
MARK7:  .word DUPP,Fetch
MARK8:  .word DUPP,HERE,UGreater,ZBranch,MARK9
        .word CellMinus,Fetch,Branch,MARK8
MARK9:  .word OVER,Store,CELLPlus,Fetch,QuestionDUP,ZeroEquals
        .word ZBranch,MARK7
        .word EXIT

-- end of assembler code ------------------------------------------------------



Message has 2 Replies:
  RE: Multitasker and MARKER word
 
(...) WOW! This is great Sergey! I haven't had a close look, but are you actually taking ALL of the tasks out of the list, or just the ones defined AFTER the point in the dictionary that is being restored by MARKER ? (...) Thanks for the kind words. (...) (25 years ago, 14-Nov-99, to lugnet.robotics.rcx.pbforth)
  RE: Multitasker and MARKER word
 
Sergey, (...) Never mind my last message. I can see you store the actual task chain in the definition of MARKER and then restore the task chain correctly. WOW! I think pbForth is on the cusp of respectability now! Cheers, Ralph Hempel - P.Eng (...) (25 years ago, 14-Nov-99, to lugnet.robotics.rcx.pbforth)

4 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR