CoreForth-0

avr/janus/host-itc.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::

common.ft

Set the instruction pointer (IP) to the value on top of the stack by loading R24:R25 with the immediate value:

: tset-ip      $80 over $0f and or tc, $e0 over 4 rshift $0f and or tc,
               $90 over 8 rshift $0f and or tc, #12 rshift $0f and $e0 or tc, ;

Host functions used during meta compilation

:noname        s" docon" tfwdref ; is t,docon
:noname        s" docol" tfwdref ; is t,enter
:noname        s" dovar" tfwdref ; is t,dovar
:noname        s" exit" tfwdref ; is t,exit
:noname        $940c t, s" next" tfind 2/ t, ; is t,next
:noname        s" lit" tfwdref ; is t,lit
:noname        s" branch" tfwdref ; is t,branch
:noname        s" ?branch" tfwdref ; is t,?branch
:noname        s" (does>)" tfwdref ; is t,dodoes
:noname        there 2 + t, ; is t,docode
:noname        $920f t, $921f t, $922f t, $923f t, $930f t, $931f t, $932f t, $933f t,
               $934f t, $935f t, $936f t, $937f t, $938f t, $939f t, $93af t, $93bf t,
               $93cf t, $93df t, $93ef t, $93ff t, $b63f t,
               there 8 + tset-ip
               $940c t, s" next" tfind 2/ t, ; is t,doirq
:noname        s" reti" tfind t, ; is t,irqexit

Dictionary functions

:noname        tcell + dup tc@ + 1+ taligned ; is tlink>
:noname        tlast @ tcell + dup tc@ %01000000 or swap tc! ; is timmediate
:noname        talign
               there tlast @ t, tlast !
               there >target pack$ c@ 1+ tallot talign ; is thead