Hello Tristan,

Tristan Williams writes:

> Hello Erich,
>
> Within task-init from multitask.frt I think a task's entire tcb/user
> area is filled with zeros and then only the values from the task's
> (flash) tib are copied across to the task's tcb/user area. A value for
> BASE is not stored within the tib. Only sp0, sp0-- and rp0 are stored
> in the task's tib.   
>
> : tib>tcb  ( tib -- tcb )                  @i ;
> : tib>rp0  ( tib -- rp0 )  i-cell+         @i ;
> : tib>sp0  ( tib -- sp0 )  i-cell+ i-cell+ @i ;
> : tib>size ( tib -- size )
>   dup tib>tcb swap tib>sp0 1+ swap -
> ;
>
> : task-init ( tib -- )
>   dup tib>tcb over tib>size  0 fill \ clear RAM for tcb and stacks
>   dup tib>sp0 over tib>tcb #6 + !       \ store sp0    in tcb[6]
>   dup tib>sp0 cell- over tib>tcb #8 + ! \ store sp0--  in tcb[8], tos
>   dup tib>rp0 over tib>tcb #4 + !       \ store rp0    in tcb[4]
>       tib>tcb task-sleep                \ store 'pass' in tcb[0]
> ;

You have clearly spend more time on this, I see! Populating base
won't be difficult, but I wonder what other candidates are
there.

>
> I believe the interpreter user area is fully populated from eeprom
> at boot time, but all other tasks rely on the programmer to fill in
> what is relevant to their tasks. I did not appreciate that included a
> value for BASE, but I do now.

That's what I had in mind.
COLD avr8/words/cold.asm does jump to PFA_WARM.
WARM common/words/warm.asm does call XT_INIT_RAM
init-ram avr8/words/init-ram.asm does the copy loop
> | XT_INIT_RAM:
> |   .dw DO_COLON
> | PFA_INI_RAM:          ; ( -- )
> |     .dw XT_DOLITERAL
> |     .dw EE_INITUSER
> |     .dw XT_UP_FETCH
> |     .dw XT_DOLITERAL
> |     .dw SYSUSERSIZE
> |     .dw XT_2SLASH
> |     .dw XT_EE2RAM
> |     .dw XT_EXIT
something like "  eeinituser up@ sysusersize 2/ ee>ram "
where " : ee>ram   0 do over @e over ! cell+ swap loop 2drop ; "
no garantees. But there is ee>ram, which could be called in
task-init, too, before storing sp0 rp0 ...


>
>> Having said that I feel inclined to add another: "Wouldn't it be
>> nice, if I could run a second commandline task (quit) on an
>> existing second serial connection (thing atmega644pa or
>> similar)"? Thus effectively creating a *Two User AmForth on one
>> AtMega644pa*? Actually I do have a use case for this. And I have
>> started to implement something in small steps[2]:
>
> Would the two users have separate dictionaries?
Good question! I haven't really thought about that.
But I had in mind to prepend a new (limited) dictionary for that
second serial connection, in order to make it deal correctly
with the incoming data (well data wrapped in forth syntax).


Thank you for your input.
Cheers,
Erich


-- 
May the Forth be with you ...


_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to