[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cross compiling
From: |
Ethan Gardener |
Subject: |
Re: Cross compiling |
Date: |
Mon, 01 Mar 2021 19:32:03 +0000 |
User-agent: |
Cyrus-JMAP/3.5.0-alpha0-206-g078a48fda5-fm-20210226.001-g078a48fd |
On Sun, Feb 28, 2021, at 6:31 PM, Anton Ertl wrote:
>
> Assembly language is not a particularly nice way of writing Forth
> code, though (and most of a Forth system is written in Forth); OTOH,
> it saves you from having to work out Forth cross-compiling if you want
> to bootstrap yourself from Forth. There are three well-known
> implementations distributed in assembly language: fig-Forth, Ting's
> version of eForth, and JonesForth. eForth was first developed in
> Forth using a cross-compiler and only translated to assembly by Ting.
> AFAIK the story for fig-Forth is similar; I don't know about
> JonesForth.
JonesForth author credited another Forth as helping him understand how to do
it, but didn't say it was a direct translation. jonesforth.f is shorter than
jonesforth.S, but so much of both files are comments, it's hard to compare the
code sizes. (87% of jonesforth.S is comments, but my regexps fail me on
jonesforth.f. I should write some Forth to parse it, but old habbits die hard.)
Some of its assembly language is more complex than it needs to be, supposedly
for the purpose of making it a good tutorial. (I don't know how that works.) In
any case, I imagine JonesForth's double-indirect threading would be good for
8-bit systems. The original uses GNU As assembly syntax which is not everyone's
favourite, but there are Nasm translations out there.
If you're brave enough, there's also a Nasm-based colorForth. (The original of
this was machine code! colorForth was just a scripting language for an OS
written directly in hexadecimal.) I have no idea if its Shannon coding scheme
would work well with less than 32 bits.
https://www.inventio.co.uk/colorforth/
- Re: Cross compiling,
Ethan Gardener <=