Bernd Paysan wrote:
On Donnerstag 19 Juni 2008, Sergey Plis wrote:
Now as I understand wake should be different for my task. It seems
linkTask needs to be different.

No, linkTask can stay as it is - it's just the task list it links to must be
different. A task list is a double linked list, so the easiest think is the
following:

: isolate ( task -- ) dup linkTask ;

This will "isolate" the task in so far that it only links to itself.

Thanks! I can't get it to works though. The code below is placed in a separate file and run by bigforth. If in the clock code I use activate, then it works but eats 100 of CPU (unrelated problem though). If I run it with (activate) then nothing happens. What I expect is bigforth executing only clock task and nothing else. This is just testing if the general approach works before going into callbacks. BTW can I define a word like clock and then make it a callback and then pass it to C routine instead of using start-routine code. If I must use start-routine, then where do I place it?

Thanks!
--
Sergey

Label tboot :R DI pop SI pop lods BX BX xor ret end-code
Code ^     AX push OP AX mov Next end-code hmacro :ax 0 T&P

\ places n1 through nm in memory starting at address pointed to by addr
\ returns the address of the next cell in memory
: >Task ( n1 .. nm cells addr -- addr2 )
    @ over - under >r bounds ?DO  I ! cell +LOOP  r> ;
: isolate ( task -- ) dup linkTask ;

: (mpass   ( n0 ... nm-1 m Taskaddr -- ) rdrop
>r cells r@ user' s0 + >Task
    r> r> -rot >r ^ tboot  \ --> ip sp op tboot  r: task
    4  cells r@ user' r0 + >Task
    r@ user' TsaveRP + ! r> isolate ;

: (activate) ( Taddr -- ) 0 swap (mpass ;

Code start-routine :R  4 SP D) UP mov ' pause rel) jmp  end-code

\ showtime clock start wait                       32b  06mar94py
also DOS
: showtime   ( time -- )  singletask
    at? 0 cols 8 - at rot >time type at  multitask ;
0 Value clocktask
: clock   ( -- )
    $100 dup NewTask  (activate)  decimal  dattime
    \                 ^^^^^^^^^^
    up@ to clocktask !name
    BEGIN  BEGIN  pause  dattime under  = 0=  UNTIL
&990 after over showtime  till
    AGAIN ;
toss
: startc    clocktask wake ;
: waitc     clocktask sleep ;
: noclock   clocktask ?dup IF  kill 0 to clocktask  THEN ;
clock


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to