CoreForth-0

avr/janus/host-itc-avr.ft.md


Indirect Threaded Forth, host functions

Register usage

IP:     r25:r24
W:      r23:r22
SP: Y   r29:r28
RP: SP
TOS: X  r27:r26

DOCOL / Enter

IP points to next word in the caller W points to CFA

Host

::host::

host-itc.ft

Calls are mapped to $8000 upwards to use the LD instruction. Add this as an offset to branch and call targets.

:noname        $8000 or t, ; is t,call
:noname        swap $8000 or swap t! ; is t!target
:noname        $8000 or t, ; is t,target

Store calls to to action words as-is, as they need to be made to actual flash locations.

:noname        s" docol" tfind t, ; is t,enter
:noname        s" docon" tfind t, ; is t,docon
:noname        s" dovar" tfind t, ; is t,dovar

Create a dictionary entry, link addresses are mapped to $8000 upwards to allow using LD instructions to traverse the dictionary.

:noname        talign
               there tlast @ $8000 or t, tlast !
               there >target pack$ c@ 1+ tallot talign ; is thead