Combines the drawbacks of a hosted Forth with those of a native Forth!
Anton Ertl
Apache/2.4.62 (Debian) OpenSSL/3.0.15 Server at www.complang.tuwien.ac.at Port 443
What is it?
It's a bootable system that uses the Linux kernel to talk to the hardware and runs Gforth (and only Gforth) on top of it (as init process). Also, for a sense of purity, no other executables are provided. And because of lazyness (to make a selection) no Forth source code is provided, either.The floppy version
The present instance is based on tomsrtbt-2.0.103 and Gforth-0.6.2 and runs in 8MB. The basis is still visible in various places, e.g., the greeting message (it is not really a full tomsrtbt version, but my feeble attempt to change the message did not succeed).
After booting the root file system contains the /dev tree from the original tomsrtbt plus the following files:
-rwxr-xr-x 1 root root 471781 Apr 6 2001 /lib/ld-linux.so.2 -rwxr-xr-x 1 root root 1236396 Apr 6 2001 /lib/libc.so.6 -rwxr-xr-x 1 root root 79024 Apr 6 2001 /lib/libdl.so.2 -rwxr-xr-x 1 root root 143712 Apr 6 2001 /lib/libm.so.6 -rwxr-xr-x 1 root root 92352 Dec 23 16:15 /sbin/gforth lrwxrwxrwx 1 root root 6 Dec 23 16:16 /sbin/init -> gforth -rwxr-xr-x 1 root root 190796 Dec 23 14:52 /usr/local/lib/gforth/0.6.2/gforth.fi
The CD version
The CD version is based on RIP-11.4 and Gforth-0.6.2 and boots in 16MB. The basis is still visible in various places, e.g., the grub menu (just select the line below the one you start in to start Gforth).After booting the root file system contains the /dev tree from the original RIP, a similar /lib tree as shown above, a normal installation of Gforth-0.6.2 in /usr/local/, and a link from /sbin/init to /usr/local/bin/gforth.
What can you do with it?
- You should be able to access various Linux devices in the /dev directory (with open-file etc.).
- You should be able to do create Forth bindings for Linux system calls, and perform system calls through these bindings (see lib.fs in any Gforth distribution (not included in the floppy distribution))
- You may be able to access input and output ports in assembly language, and do memory-mapped I/O by mmaping (mmap has to be bound first) /dev/core or /proc/core (/proc has to be mounted first). If you are really into native Forth, this is probably the way that you will prefer.
What is it good for?
It's just a demonstration of the principle. I would not recommend it for any serious use, but some people have been asking for native Forths on PCs, and they might be interested (although there's probably still too much hosting going on for them).Disadvantages of the current version
- It's RAM-disk based, and therefore uses more memory than otherwise necessary; it should be possible to do a CD (maybe even a floppy, but probably not with glibc) with a Linux kernel and Gforth that runs in 4MB and has 2MB unused.
- The floppy version uses Linux-2.2, so you get error messages like "Invalid memory address" when a more appropriate one would be "Stack underflow". Using Linux-2.4 or later will fix this (the CD version uses Linux-2.6 and reports a stack underflow as such).
- No special support for any of the things you can do with it. You have to type it in all yourself, and with the next boot, they are gone again. It would be preferable to have at least a source file that provides the most important system calls as Forth words (or put them in the image file).
- No boot from USB stick. Currently boot floppies can be created only under Linux.
- PC-based only.
How to create a boot floppy
Under Linux:wget http://www.complang.tuwien.ac.at/forth/gforth/almost-native/angf-0.1.tar.gz tar xvfz angf-0.1.tar.gz cd angf-0.1 #put a good floppy disk with no or expendable contents in drive ./install.sThere is no support for making boot floppies with other OSs at the moment.
How to create a boot CD
Download the ISO image, and burn it to the CD as an image (not as a file). On Linux, you can do it somewhat like this:wget http://www.complang.tuwien.ac.at/forth/gforth/almost-native/angf-0.1-rip.iso #Use "cdrecord -scanbus dev=ATAPI" to find out which dev to use #Insert "blank=fast" if you use a CDRW cdrecord dev=ATAPI:0,0,0 angf-0.1-rip.iso
Anton Ertl
| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| angf-0.1-rip.iso | 2004-12-27 16:50 | 7.0M | CD version | |
| angf-0.1.tar.gz | 2004-12-23 18:42 | 1.7M | Floppy version, install from Linux | |