gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cross compiling


From: Anton Ertl
Subject: Re: Cross compiling
Date: Mon, 1 Mar 2021 23:36:57 +0100
User-agent: NeoMutt/20170113 (1.7.2)

On Mon, Mar 01, 2021 at 08:54:21PM +0000, Ethan Gardener wrote:
> I was responding to Anton Ertl's comment, "Assembly language is not a 
> particularly nice way of writing Forth
> code, though (and most of a Forth system is written in Forth);" particularly 
> with a view to what proportion of Jonesforth is assembly language.

What I mean is stuff like (from
<https://github.com/nornagon/jonesforth/blob/master/jonesforth.S>):

defword ":",1,,COLON
        .int WORD               // Get the name of the new word
        .int CREATE             // CREATE the dictionary entry / header
        .int LIT, DOCOL, COMMA  // Append DOCOL  (the codeword).
        .int LATEST, FETCH, HIDDEN // Make the word hidden (see below for 
definition).
        .int RBRAC              // Go into compile mode.
        .int EXIT               // Return from the function.

In Forth you would write this as

: : WORD CREATE docol , latest @ hidden ] ;


> > >I imagine JonesForth's double-indirect threading would be good for 8-bit 
> > >systems.
> > 
> > Did he ever get his terminology straight? That was always my main beef 
> > with JonesForth: he didn't understand what direct/indirect threading 
> > actually referred to.

He codes NEXT as follows:

   lodsl
   jmp *(%eax)

That's indirect-threaded code.  The comments talk about
direct-threaded and indirect-threaded code.  This may be a little
confusing, but Kogge takes a similar approach in "An architectural
trail to threaded-code systems"; and I followed him on this trail on
<https://www.complang.tuwien.ac.at/forth/threaded-code.html>.

- anton



reply via email to

[Prev in Thread] Current Thread [Next in Thread]