
4os – An operating system written completely in Forth - zeveb
http://web.archive.org/web/19991022233047/www.itvc.com/Technology/4os.htm
======
grkvlt
I was always fond of the Jupiter Ace [1] which was a Sinclair ZX-81 clone made
in the UK in the early 80s. It had FORTH in ROM as the system language and
operating system/interface, rather than BASIC.

> ACE's Forth was based mostly on Forth-79, with some relevant differences.
> Runtime error checking could be turned off to further raise speed by 25% to
> 50%. [...] The ACE's dialect of FORTH introduced several innovations. [I]t
> added syntax checking to control structures and definer constructions [...]
> as well as decompiling capabilities.

I think they only sold about three of them; I certainly never saw one in the
shops. It was overtaken by machines like the BBC B, Commodore 64 and ZX
Spectrum 48k, which were better specced (more than 1Kib RAM, colour output
etc.) and had more software. Even the ZX-81, which I owned at one point and
programmed in its idiosyncratic BASIC (including features like using the
screen buffer as a few extra bytes of scratch memory!) was more popular. But,
a nice idea, and I keep scanning eBay to try and find one to buy second-hand,
just to see what they were like...

[1]
[https://en.wikipedia.org/wiki/Jupiter_Ace](https://en.wikipedia.org/wiki/Jupiter_Ace)

~~~
jpalomaki
I wonder how to IT world would have turned out if we who played with the home
computers in 80's as kids would have been exposed to Forth or Lisp instead of
Basic.

~~~
zeveb
That right there is an excellent question. I was one of those whose first
language was Basic, and I really wonder of Dijkstra was right: was I
permanently damaged by learning it?

------
throwawayqnx
For comparison, the QNX Neutrino operating system fits (no, used to fit: I
last played with it ~15 years ago) on a 1.44mb floppy disk, which is a bit
bigger, but also contained a decent browser for the time as well as a media
player and other goodies.

[http://www.operating-
system.org/betriebssystem/_english/bs-q...](http://www.operating-
system.org/betriebssystem/_english/bs-qnx.htm)
[https://en.wikipedia.org/wiki/QNX](https://en.wikipedia.org/wiki/QNX)

~~~
fouc
I've always wondered why they haven't open-sourced any of it, even a super old
version. The photon gui stuff was exciting.

~~~
david-given
They released some of it under a look-but-don't-touch license for a while, in
an attempt to build a community, and you could get a free license for the
desktop version of QNX (with all the developer tools in it). I think I still
have a CD somewhere. It worked pretty well.

It may even be still available, but after digging up my old Foundry27 username
and password (which, surprisingly, still works), their download site is an
impossible trainwreck and I was unable to find it any more.

The demo floppy, by the way, is here:

[http://toastytech.com/guis/qnxdemo.html](http://toastytech.com/guis/qnxdemo.html)

Requires a 386 and 8MB of RAM.

------
agumonkey
Was just reading Thinking Forth [http://thinking-
forth.sourceforge.net/](http://thinking-forth.sourceforge.net/), this couldn't
be more timely.

~~~
threepipeproblm
I read that recently, and then found out about "function level" languages,
which are sort of the modern extension of stack-based languages.

Function level != functional. Check out Factor, for a prominent example.. the
combinator library is beautiful.

~~~
smaddox
I'm really impressed with Factor. This is the first time I've heard about it.
Thank you for mentioning it.

------
cjbprime
Open Firmware (as shipped on Sun machines and PPC Macs for years) is an
operating system written in Forth, too.

~~~
lukego
OpenFirmware was also the firmware (~BIOS) for the One Laptop Per Child XO.
The software was open sourced for OLPC and is online here:
[https://www.openfirmware.info/Open_Firmware](https://www.openfirmware.info/Open_Firmware).
This is the same code that was developed at Sun and evolved for Mitch
Bradley's projects ever since. (I _think_ that Apple wrote their own
interface-compatible implementation mostly in C.)

For OpenFirmware is one of the best programs in existence. See also the OLPC
Forth Lessons wiki:
[http://wiki.laptop.org/go/Forth_Lessons](http://wiki.laptop.org/go/Forth_Lessons)

~~~
davidw
There's even an OpenFirmware song!

------
hellofunk
We moved our production server cluster (approximately 50 machines) over to 4os
recently and the results have been great. Customers love it, the product is
faster, easier to maintain, and new developers onboard quickly. We were able
to get our existing team of 200 developers up to speed on Forth in about 30
days, and everything we do now is written in Forth for an OS built in Forth.
For us it was a no brainer.

~~~
keithnz
Do you deploy in forth containers, focker containers? and how do you manage a
lot of fockers at once?

~~~
arethuza
"how do you manage a lot of fockers at once?"

In a stack?

~~~
lmitchell
Probably more of a heap I would think.

------
xorl
There is also the kestrel with an Forth operating system.
[http://kestrelcomputer.github.io/kestrel/](http://kestrelcomputer.github.io/kestrel/)

------
i4k
Interesting, but found this:

[https://groups.google.com/forum/#!msg/comp.lang.forth/XCtQPZ...](https://groups.google.com/forum/#!msg/comp.lang.forth/XCtQPZYEVH8/Mp0mIhQ0HPoJ)

~~~
nickpsecurity
" _the source code is pre-alpha at best, is of fairly poor quality, implements
less than web 1.0 early browser compatibility._ "

The marketing material on the web site gave me a different impression than the
above quote. Perhaps they should put the quote on the site. ;)

------
rebootthesystem
I truly believe every programmer needs to learn and use Forth for a while.
Same with assembler. And bring up a machine using both not aided by anything
else. In other words, if you need a text editor to edit Forth screens you need
to write it yourself, in Forth.

This does not mean I think Forth has a future in or is suitable for larger
scale work these days. I do think it, and assembler, and the process of
accomplishing the above can provide a massive learning experience that will
only enhance what work a programmer might do in the future with modern
languages and platforms.

~~~
luckydude
So I've done what you suggest, both of them. The assembler was useful, got
close to the metal. The forth, for me, was a waste of time. I remember writing
something like less(1) in forth just so I could scroll forwards/backwards
through code, search, you know, basic stuff.

I don't feel like learning forth did much for me. Learning assembler, hell
yes, reused that knowledge over and over (I rewrote assembly versions of Unix
stuff like ls, cp, rm, etc in Z80 for a CPM machine I had at University).

Maybe I just don't get forth.

~~~
rebootthesystem
It's been a while so I might not recall all the details. This is what I did on
a 6502 in the 80's (the order might not be exactly right):

    
    
        - Write drivers (in assembler) for external UARTs and parallel port chips
        - Write (in assembler) enough code to get the very basics of Forth going
        - Now in Forth, write the standard set of Forth words
        - Write a rudimentary text editor
        - Write a floppy disk driver and file system management code
        - Now I have a Forth computer
     

At that point I started to use Forth for robotics. Quadrature encoder inputs.
A/D, D/A and digital I/O. Eventually doing real-time PID loop. Control a
single motor. Build a robot arm. Control five or six motors. Build an external
LED hexadecimal display. Talk to it in Forth. Build a buttons and knobs
control panel for the robot. Talk to it in Forth. Have loads of fun and learn
a ton.

In other words, I had a very specific project in mind and saw it through from
a bunch of chips on the workbench to a finished robot arm with user interface.

There are a million lessons to be learned in such a project.

I've actually thought about dusting off my old files and designs and putting
together some kind of an educational kit to launch on Kickstarter. It could be
a lot of fun.

------
protomyth
I was a big fan of Postscript and Forth. I loved Forth for the way it made you
think about dividing up a program. It felt so natural to build a dictionary of
words in pursuit of defining a higher level solution. I don't get the people
who think its a write-only language. I came upon one of my old programs a
decade after I first wrote it. Its was really easy to understand even now.
Stack notation for comments with a bit of explanation are some fine
documentation.

Postscript was a better Forth IMHO. I loved creating Postscript files for
reports. My Turbo C, foxbase, and a Postscript printer were my main tools at
my first job.

------
GregBuchholz
Anyone have info on the Chuck Moore and
[http://colorforth.com](http://colorforth.com) ? The colorforth website has
been out of commission for a couple of months.

~~~
ljosa
Looks like he recently (August, 2016) moved his company, GreenArrays, to
Cheyenne, Wyoming.

------
rpcope1
So this is pretty interesting (especially as a Forth programmer), however was
this ever open sourced, or even still available?

~~~
freehunter
Question: I've looked at Forth a number of times and I think it's a
fascinating looking language but I've never bothered picking it up. I've also
never had a chance to talk to a Forth programmer. Can you tell me what type of
application you're working on, if it's legacy or new development, and your
thoughts on when to choose Forth over something else?

From what I understand, Forth is mostly used as an embedded "OS" when a
traditional OS wouldn't cut it. Is that accurate?

Sorry, it's just not a terribly common language, but it certainly is
interesting.

~~~
pmoriarty
I tried to learn it, and found Forth to be an obfuscated, write-only language.

Forth programmers give a lot of lip service to writing short, well documented,
elegant words (functions) but in real-world programs I've seen the opposite:
the tendency has been to long, poorly documented, and convoluted words. (At
least that's been my experience with open-source Forth programs. I've heard
the libraries for commercial Forths are of much higher quality, but I have not
verified this myself)

Forth has been compared favorably to Lisp, but I found them to be like night
and day, and Lisp (and especially Scheme) to be far more elegant and easy to
both read and write.

Forth might arguably be better than assembly, but unless you have a pressing
need to write the tiniest programs possible (like on some resource-starved
microcontroller), I'd be hard pressed to find a reason why you'd want to use
Forth instead of some higher level language that is far less painful to work
with.

In fact, I've even heard some Forth fans themselves say that the point of
using Forth is to write yourself something as quickly as possible that lets
you program in a higher level language.

Don't get me wrong, I really, really wanted to like Forth and spent a lot of
time trying to learn it, but in the end it felt like it just wasn't worth it.
I might give it another go if I get heavily in to programming microcontrollers
where Lisp or Scheme is not an option.

~~~
Someone
_" Forth has been compared favorably to Lisp"_

In some contexts, that's true. Lisp needs insane amounts of RAM to get a
decent REPL running (I can't find figures for the original 704 implementation
(did it even have a REPL or was it compiled?), but I guess easily 20kB or
more), while forth runs its REPL happily in a tenth of that space.

If you are bootstrapping the firmware for a device, where _bootstrapping_
means that you have to write the code interfacing with any of the hardware
before you can use it, and you can find enough I/O pins to use for a serial
port, a forth REPL is both easier to implement and way more useful than a lisp
one. And if your device doesn't have much memory, it may be your only
realistic option.

------
totalforge
I recall the Forth entry from 'how to shoot yourself in the foot in
programming languages': self foot shoot dup.

~~~
Zuider
It should be: foot dup shoot shoot

------
avodonosov
Why wayback machine? Is it dead by now?

~~~
valarauca1
Been dead for sometime. There is a lot of references to 4os on Google Groups
where people were discussing if the company would open source the OS before
they went under.

Judging by the fact there aren't many other references to 4os I don't believe
they did.

Discussion for those interested
[https://groups.google.com/forum/#!topic/comp.lang.forth/I3Bg...](https://groups.google.com/forum/#!topic/comp.lang.forth/I3BglDBLnDQ)

