[TUHS} Running V8 ...

Don Hopkins don at DonHopkins.com
Wed Oct 18 00:50:47 AEST 2017


The OLPC XO-1 also used OpenFirmware! 

Mitch Bradley ported and extended Forthmacs to support secure auto-boot, power management, and used it for debugging the OLPC’s unique hardware and operating system. 

http://wiki.laptop.org/go/Open_Firmware <http://wiki.laptop.org/go/Open_Firmware>

>Open Firmware is the hardware-independent firmware (computer software which loads the operating system) that the XO runs.

>It was developed by Mitch Bradley at Sun Microsystems, and used in post-NuBus PowerPC-based Apple Macintosh computers (though it has been dropped with Apple's transition to Intel processors), Sun Microsystems SPARC based workstations and servers, IBM POWER systems, and PegasosPPC systems, among others. On those computers, Open Firmware fulfills the same tasks as BIOS does on PC computers.

>For example Fedora and Debian use the YaBoot BootLoader for Open Firmware.

>The Open Firmware user interface includes a FORTH-based shell interface. FORTH is a powerful high level language that is remarkably compact. A complete Forth development environment including compiler, decompiler, assembler, disassembler, source level debugger, and assembly language debugger is present in the XO boot ROM (SPI FLASH). With the Open Firmware Forth system, you can directly access all of the hardware devices on the XO, use built-in functions like selftest diagnostics and games, and even write complete applications, without needing any external tools. The bulk of Open Firmware is written in Forth, so the source level debugger can be used to debug Open Firmware itself.

http://wiki.laptop.org/go/OFW_FAQ <http://wiki.laptop.org/go/OFW_FAQ>

OpenFirmware also has its own song to the tune of the Jetson’s theme, and Mitch’s rendition is much more mellifluous than RMS singing his Free Software song:

https://web.archive.org/web/20060213143046/http://bananajr6000.apple.com/1275/misc/ofwsong.au <https://web.archive.org/web/20060213143046/http://bananajr6000.apple.com/1275/misc/ofwsong.au>  

I used the 68K and SPARC versions of Mitch’s “Forthmacs” system under SunOS. 

It had a re-targetable meta-compiler, portably supported targets targets with 16 bits, 32 bits, different byte orders, could dynamically link and call C libraries, also ran in stand-alone mode, could be burnt into ROM and run in framebuffer memory, and and which he later developed into OpenFirmware). 

I worked with Mitch as a summer intern at Sun in ’87, integrating his other pure C “CForth" system into a circuit editor called “CADrioid”. At the University of Maryland, I used Forthmacs to develop a dynamic memory allocator (which I would run diagnostics on in mmap'ed framebuffer memory as a screen saver), a FORTH extensible X10 window manager with pie menus called “piewm” (kind of like NeWS for X10 with FORTH instead of PostScript), a hypermedia brower for NeWS called “HyperTIES”, and a cellular automata machine simulator compatible with Toffoli and Margolus’s CAM6 hardware and Forth rule definitions published in their book (which I’ve since rewritten in JavaScript).

Forthmacs:
http://donhopkins.com/home/archive/forth/forthmacs-doc/ <http://donhopkins.com/home/archive/forth/forthmacs-doc/>
http://www.donhopkins.com/home/code/allocate.f.txt <http://www.donhopkins.com/home/code/allocate.f.txt>
http://www.art.net/~hopkins/Don/lang/forth.html <http://www.art.net/~hopkins/Don/lang/forth.html>

piewm:
http://www.donhopkins.com/home/code/Xlib.forth.txt <http://www.donhopkins.com/home/code/Xlib.forth.txt>
http://www.donhopkins.com/home/code/fuwm-main.forth.txt <http://www.donhopkins.com/home/code/fuwm-main.forth.txt>
http://www.donhopkins.com/home/code/hacks.forth.txt <http://www.donhopkins.com/home/code/hacks.forth.txt>

HyperTIES:
http://www.donhopkins.com/home/ties/fmt.f <http://www.donhopkins.com/home/ties/fmt.f>

CAM6:
http://www.donhopkins.com/home/code/cam.f.txt <http://www.donhopkins.com/home/code/cam.f.txt>
http://www.donhopkins.com/home/code/compile.f.txt <http://www.donhopkins.com/home/code/compile.f.txt>
http://www.donhopkins.com/home/code/rules.f.txt <http://www.donhopkins.com/home/code/rules.f.txt>
https://github.com/SimHacker/CAM6/blob/master/javascript/CAM6.js#L41 <https://github.com/SimHacker/CAM6/blob/master/javascript/CAM6.js#L41>

Here’s an old post extolling the virtues of CForth and Forthmacs, that I posted in response to a question on comp.lang.forth back in ’89.

-Don

https://groups.google.com/forum/#!msg/comp.lang.forth/cAFn_jDDu50/t8wEQeCe4pYJ <https://groups.google.com/forum/#!msg/comp.lang.forth/cAFn_jDDu50/t8wEQeCe4pYJ>

From: don at brillig.umd.edu (Don Hopkins)
Newsgroups: comp.lang.forth
Subject: Re: Forth for VAX, Sun
Summary: Bradley Forthware: 4444 is the number of the best!
Keywords: sun, unix, cforth
Date: 10 May 89 11:06:40 GMT
Organization: U of Maryland, Dept. of Computer Science, Human Computer Interaction Lab

In article <24... at agate.BERKELEY.EDU> w... at garnet.berkeley.edu (William Baxter) writes:

>To my inquiry about Forth systems for the VAX and Sun, I received two
>responses, both mentioning the same programs.  
>
>C Forth 83: 
>
>Runs on both VAX (VMS or Unix) and Sun, and in fact on just about every
>computer with a half decent C compiler.  The price is $50, which gets
>you C kernel source, Forth utilities source, on-line documentation, and
>a printed glossary.  It's a Forth-83 dialect with 32-bit stacks, real
>files, and several utilities.

I used a version of CForth when I was working for Mitch, summer before
last at Sun. It's a very nice Forth system, and quite portable. You
can define your own Forth primatives in C, by adding them to this big
switch statement! We linked CForth together with a schematics CAD
system (CADroid), so you could call the CADroid commands from Forth,
and then we wrote a user-friendly extension language in Forth. It
accepted postfix commands, and prompted for arguments in English. You
could interactivly define macros for laying out circuit bodies and
wiring them up, by typing commands, pointing with the mouse, selecting
from menus, pressing function keys, putting in your own prompts for
arguments, bindings macros to keys, etc. It also supported interactive
loops and conditionals. Mitch came up with a really neat unified
syntax for them:

condition? [ <stuff to do if true> ]

condition? [ <stuff to do if true> ][ <stuff to do if false> ]

count [ <stuff to do in a loop> ]

count [ <stuff to do in a loop> ][ <stuff to do if count is 0> ]

The last one (the loop-with-an-else-clause) was particularly useful
because it could be used instead of the otherwise common construct:
        
count 0= [ 
  <stuff to do if count is 0> 
][ 
  count [ <stuff to do in a loop if count isn't 0> ] 
]

The way these constructs worked interactivly (and during macro
definition) was that you started a loop by typing a count and a [, and
it would execute commands as you typed them in, the first time through
the loop, and once you typed the matching ] (they nested!), it would
re-execute the now-compiled loop count-1 more times, real fast.  The
conditional form had just the same behavior: It would either execute
what you typed as you typed it, or ignore your commands, according to
the condition (|-1| or 0).

So when we carefully consider all of these facts, we are forced
to ask ourselves the following question:  What was today's topic
again? Wait, I remember:  Bradley Forthware.

>
>Sun Forth:
>
>Runs on any Sun 2, Sun 3, or Sun 4, and also on most non-Sun 680x0 Unix
>machines.  The price is $200, which gets you the binary, source code,
>metacompiler, 200+ page printed manual, and a ton of utilities (for
>instance, it can load C object files into the Forth dictionary and
>execute the C subroutines as Forth words.  It also has a disassembler
>and both high level and assembly language debugging tools.)
>
>

Sun Forth is an excellent, rich, fast, fantastic Forth system! I've
used it for all kinds of things, on the Sun-2, the Sun-3 (68K), and
the Sun-4 (SPARC). It also runs on the Atari ST, and the Mac, I think.
(I haven't used those versions) On the Sun-2, I had a good time using
Sun Forth to figure out how to frob the CG1 color graphics card, by
printing out the cg1reg.h file, mmap'ing in the device registers, and
frobbing around with them. (I finally discovered that you could only
write to the color table during vertical retrace, when I got mad and
frustrated that my unsucessful attempts at loading the color table
were taunting me by kinda sorta working occasionaly, and I decided to
punish it by running it in an infinite loop. My color table slowly
faded into view!)

It's got a kick-ass decompiler, that pretty prints forth code and
disassembles primatives! Who needs manuals or source code? (But you
get them anyway! ;-) There are a lot of other nice features, like an
emacs-like command line editor, with history, and command completion
over your Forth vocabularies. It's very well interfaced with Unix. It
also runs stand-alone without Unix. Mitch uses it in the hardware lab
at Sun to debug decadent wayward hardware, by dropping in a Forth ROM,
talking to it through a serial port, and running it in the framebuffer
memory! [It looks real neat munching away on the screen, and it can
work even when the main memory is fried!] The list of features goes on
and on...

The ability to dynamicly load in C object files makes Sun Forth useful
for a whole lot of things you'd normally never think of (or at least
admit to thinking of) using Forth for! On the Sun-3, I linked in a
version of the X10 "uwm" window manager I had modified to do pie
menus. I could call all the window manager functions from Forth,
passing them arguments on the stack, and I could bind mouse actions
and menu selections to Forth functions. I moved the main control loop
that dispatched events into Forth, so I had a crack at the events
before passing them on to uwm. Forth could could respond to window
system events, track the mouse, pop up menus, change the cursor, move
windows around, etc... It had complete access to all the window
manager function and data structures. One thing I used this system for
was to implement an experiment that Jack Callahan designed, comparing
pie menus with linear menus. (A paper describing the experiment is in
the CHI'88 conference proceedings.) The Forthified window manager
administered the experiment by randomizing the order in which the
menus were presented, prompting the test subject to select a certain
item from each menu, and recording the menu selections made and the
time each took, etc...  The Forth system was very useful for
prototyping different mouse tracking techniques for pie menus -- it
would have been very painful to have to go through the old
edit-compile-link cycle every time I wanted to tweak something! NeWS
is an example of how useful it is to have a window manager with an
interactive extension language! (But I didn't have NeWS yet.) X window
managers are big messy programs (even in the X10 days!), but I was
able to plug X10 uwm right into Sun Forth, and start hacking away --
instant extension language! (Though uwm wasn't exactly /designed/ for
that kind of abuse!)

I've also used Sun Forth for other projects, like prototyping a
hypertext markup language interpreter (NeWS HyperTIES), and as a
Cellular Automata Machine rule compiler. I cloned Tom Tofoli's CAM
rule language in Sun Forth, and wrote a tool for computing and
displaying them in NeWS. Not anything like as fast as the real CAM
hardware [256x256 cells @ 60 frames/sec], but if you feed it the right
rules and initial conditions, and wait a while, it will make lots of
pretty patterns that take up lots of disk space.

>Both are available from:
>
>Mitch Bradley
>Bradley Forthware
>P.O. Box 4444
>Mountain View, CA 94040
>

Mitch swears the PO box number was totally coincidental!

>----
>Disclaimer:  Endorsement?  I haven't even used them.
>
>William Baxter
>
>ARPA: web@{garnet,brahms,math}.Berkeley.EDU   
>UUCP: {sun,dual,decwrl,decvax,hplabs,...}!ucbvax!garnet!web

Disclamer: Of course I'm quite biased, since I worked with Mitch for a
summer, and I just love his Forth system. But so does Mitch, or it
wouldn't have so many great features!

        -Don



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20171017/7334a939/attachment-0001.html>


More information about the TUHS mailing list