requires cload.f create clink.f ," 1.4 85/08/21" decimal create link-string 256 allot : n->str ( n -- hex-str) base @ hex swap n->l <# #s #> pad place base ! pad ; : %s ( str -- ) link-string "cat ; : %x ( n -- ) n->str %s ; : %" ( -- ) ( Input Stream: string ) compile (" ," compile %s ; immediate : link ( str addr -- ) 0 link-string c! %" /bin/ld -T " %x %" -x -N -o f.out " %s link-string system [""] f.out cload ; : linkhere ( str -- ) here lalign link ; \ It would be nice if we could automatically determine which \ binary file was used to start forth, but it's not easy for a Unix \ program to determine which binary file is actually being executed. variable first-clink first-clink on : base-syms ( -- str ) first-clink @ if \t16 th 2.0000 cload-base l! \ [""] /usr/local/forth \ [""] /tumtum/forth/forth [""] forth first-clink off else ["] /bin/mv f.out f.base" system [""] f.base then \t32 here lalign cload-base l! ; : clink ( object-file-name -- ) base-syms ( object-file base-file ) 0 link-string c! %" /bin/ld -A " %s \ Incremental loading on base-file %" -T " cload-base @ %x \ Start loading at cload-base %" -x -N -o f.out " %s %" -lm -lc " link-string system [""] f.out cload ;