I've been having a look at Gforth-EC lately, that's the embedded
cross-compiled Forth support that has been included with Gforth all the
time, but as it's well hidden and pretty undocumented, I guess most
people wouldn't have noticed it.
Now it turns out it only takes a few commands to generate a usable 8086
gforth-ec executable, running in dosbox (i.e. emulated under Linux):
From the Gforth source directory, run:
./build-ec 8086
mv kernl-8086.fi gforthec.com # need to rename for dosbox to execute it
dosbox gforthec.com
And voila, it prints the standard Gforth welcome message. Some testing:
here . 14334 ok
unused u. 47162 ok
words [..] dup lit branch >r r> c! c@ (emit) (key) lastkey and xor + rp!
rp@ sp! sp@ ! @ ?branch execute ;s ok
More Forth-code to cross-compile can be added in arch/8086/prims.fs.
Now 8086 code isn't really very interesting to most modern computer
users, but 8086 isn't the only architecture supported by gforth-ec. I
can successfully run build-ec for 8086, r8c and misc. Other targets
that seem to have been supported at some time are m68k, shboom, 6502,
c165 and 4stack, but with current Gforth-CVS compilation fails for
those.
Adding support for new target is not too difficult. Currently I'm
trying to make it work for the LatticeMico32 CPU (the Milkymist SoC).
In article <87fwen62fr....@snail.Pool>,
David Kuehling <dvdkh...@gmx.de> wrote:
>Hi,
>I've been having a look at Gforth-EC lately, that's the embedded
>cross-compiled Forth support that has been included with Gforth all the
>time, but as it's well hidden and pretty undocumented, I guess most
>people wouldn't have noticed it.
>Now it turns out it only takes a few commands to generate a usable 8086
>gforth-ec executable, running in dosbox (i.e. emulated under Linux):
>From the Gforth source directory, run:
>./build-ec 8086
>mv kernl-8086.fi gforthec.com # need to rename for dosbox to execute it
>dosbox gforthec.com
Slightly surprising. I expect a Forth only to run on a dosbox if
it does INT 21 io. I expect an embedded Forth to work independant
from MSDOS INT 21 stuff.
>And voila, it prints the standard Gforth welcome message. Some testing:
>here . 14334 ok
>unused u. 47162 ok
>words
>[..]
<SNIP>
>David
Groetjes Albert
--
-- Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
On Feb 7, 11:07 am, Albert van der Horst <alb...@spenarnc.xs4all.nl>
wrote:
> Slightly surprising. I expect a Forth only to run on a dosbox if
> it does INT 21 io. I expect an embedded Forth to work independant
> from MSDOS INT 21 stuff.
But there is no single standard way for an embedded '86 system to do
IO. Embedded msdos compatible boards are certainly not unknown, and a
dosbox is convenient as a sandbox for testing on a Linux system, so
its not surprising that an embedded '86 Forth would have msdos IO as
the shipping system. Certainly whoever is using it on a board other
than an embedded msdos board would replace that with IO appropriate to
their board.
>>>>> "Albert" == Albert van der Horst <alb...@spenarnc.xs4all.nl> writes:
> In article <87fwen62fr....@snail.Pool>,
> David Kuehling <dvdkh...@gmx.de> wrote:
>> Hi,
>> I've been having a look at Gforth-EC lately, that's the embedded
>> cross-compiled Forth support that has been included with Gforth all
>> the time, but as it's well hidden and pretty undocumented, I guess
>> most people wouldn't have noticed it.
>> Now it turns out it only takes a few commands to generate a usable
>> 8086 gforth-ec executable, running in dosbox (i.e. emulated under
>> Linux):
>> From the Gforth source directory, run:
>> ./build-ec 8086 mv kernl-8086.fi gforthec.com # need to rename for
>> dosbox to execute it dosbox gforthec.com
> Slightly surprising. I expect a Forth only to run on a dosbox if it
> does INT 21 io. I expect an embedded Forth to work independant from
> MSDOS INT 21 stuff.
It does use int 21 io, see definition of (emit) &friends in [1]. The
nice thing is that this is really completely compiled&assembled from
forth. No binutils, GCC etc. involved.
> I've been having a look at Gforth-EC lately, that's the embedded
> cross-compiled Forth support that has been included with Gforth all the
> time, but as it's well hidden and pretty undocumented, I guess most
> people wouldn't have noticed it.
> Now it turns out it only takes a few commands to generate a usable 8086
> gforth-ec executable, running in dosbox (i.e. emulated under Linux):
> From the Gforth source directory, run:
> ./build-ec 8086
> mv kernl-8086.fi gforthec.com # need to rename for dosbox to execute it
> dosbox gforthec.com
> And voila, it prints the standard Gforth welcome message. Some testing:
in file included from *OS command line*:-1
in file included from kernel/main.fs:43
cross.fs:1156: No such file or directory
[IF] >>>included<<< hex
Backtrace:
$9C5D6C throw cp: kan status van ˇkernl-8086.fi-˘ niet opvragen: Bestand of map bestaat niet
>>>>> "Coos" == Coos Haak <chfo...@hccnet.nl> writes:
> Op Mon, 06 Feb 2012 23:07:36 +0100 schreef David Kuehling:
>> Hi,
>> I've been having a look at Gforth-EC lately, that's the embedded
>> cross-compiled Forth support that has been included with Gforth all
>> the time, but as it's well hidden and pretty undocumented, I guess
>> most people wouldn't have noticed it.
>> Now it turns out it only takes a few commands to generate a usable
>> 8086 gforth-ec executable, running in dosbox (i.e. emulated under
>> Linux):
>> From the Gforth source directory, run:
>> ./build-ec 8086 mv kernl-8086.fi gforthec.com # need to rename for
>> dosbox to execute it dosbox gforthec.com
>> And voila, it prints the standard Gforth welcome message. Some
>> testing:
> What version of Gforth are you using, I get:
> coos@donald:~/work/forth/gforth-0.7.0$ ./build-ec 8086
> in file included from *OS command line*:-1 in file included from
> kernel/main.fs:43 cross.fs:1156: No such file or directory [IF]
> >>>included<<< hex Backtrace: $9C5D6C throw cp: kan status van
> ‘kernl-8086.fi-’ niet opvragen: Bestand of map bestaat niet
Ah, this could be caused by missing installation step. Try 'sudo make
install' first.
BTW I'm using the latest GForth from CVS. Try
cvs -d :pserver:anonym...@c1.complang.tuwien.ac.at:/nfs/unsafe/cvs-repository/src-master co gforth
cd gforth
./BUILD-FROM-SCRATCH
sudo make install
./build-ec 8086
>>>>> "Coos" == Coos Haak <chfo...@hccnet.nl> writes:
> Op Mon, 06 Feb 2012 23:07:36 +0100 schreef David Kuehling:
[..]
>> From the Gforth source directory, run:
>> ./build-ec 8086 mv kernl-8086.fi gforthec.com # need to rename for
>> dosbox to execute it dosbox gforthec.com
>> And voila, it prints the standard Gforth welcome message. Some
>> testing:
> What version of Gforth are you using, I get:
> coos@donald:~/work/forth/gforth-0.7.0$ ./build-ec 8086
> in file included from *OS command line*:-1 in file included from
> kernel/main.fs:43 cross.fs:1156: No such file or directory [IF]
> >>>included<<< hex Backtrace: $9C5D6C throw cp: kan status van
> ‘kernl-8086.fi-’ niet opvragen: Bestand of map bestaat niet
Right, the arch/8086 directory is not included in Gforth's distribution
tarballs. Here's a current snapshot tarball that has it: