CoreForth-0

avr/janus/host-stc.ft.md


Subroutine Threaded Forth, common host functions

Register usage

temp: r16, r17
TOS: X (r26, r27)
PSP: Y (r28, r29)
RSP: SP
::host::

common.ft

Jump to the value of the constant in the TOS by loading R30:R31 with the value and jumping to it:

: tset-ip      2 + $e0 over $0f and or tc, $e0 over 4 rshift $0f and or tc,
               $f0 over 8 rshift $0f and or tc, #12 rshift $0f and $e0 or tc,
               $91a5 t, $91b5 t, $01fd t, $95f6 t, $95e7 t, $9409 t, ;

Host functions used during meta compilation

:noname        dup there - 2/ 1- dup abs $800 < if $fff and $d000 or th, drop else drop $940e th, 2/ th,  then ; is t,call
:noname        s" docon" tfwdref ; is t,docon
:noname        ; is t,enter
: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, ; is t,doirq
:noname        $9508 t, ; is t,next
:noname        $9508 t, ; is t,exit
:noname        $be3f t, $91ff t, $91ef t, $91df t, $91cf t, $91bf t, $91af t, $919f t,
               $918f t, $917f t, $916f t, $915f t, $914f t, $913f t, $912f t, $911f t,
               $910f t, $903f t, $902f t, $901f t, $900f t, $9518 t, ; is t,irqexit
:noname        s" (does>)" tfwdref ; is t,dodoes
:noname        ; is t,docode
:noname        s" lit" tfwdref ; is t,lit
:noname        s" branch" tfwdref ; is t,branch
:noname        s" ?branch" tfwdref ; is t,?branch

Dictionary functions

:noname        tcell + dup tc@ + 1+ taligned ; is tlink>
:noname        tlast @ tcell + dup tc@ %01000000 or swap tc! ; is timmediate