logoalt Hacker News

DonHopkins • today at 11:35 AM • 0 replies • view on HN

Mitch Bradley retired and didn't want to ever write a Forth implementation ever again (after a long line of them like CForth and OpenFirmware) but I talked him into using Claude to write one for the PDP-7, which he went to bed skeptical of, woke up at 7am with some ideas, and finished implementing by noon. Including a turtle graphics library for the Type 340 vector graphics display -- itself an assembler for 340 intructions, written in Forth running on PDP-7 instructions!

He really enjoyed doing it, I enjoyed building on top of what he did, and it's one of the most elegant implementions of Forth I've seen, as if for decades the PDP-7 has always had a fast lean mean Forth screaming to get out, thanks to its ideal instruction set.

Now thanks to JavaScript's efficient VMs inspired by Self, and Dave Ungar's subsequent ideas about Korz, it runs ridiculously fast on a Korz PDP-7 emulator implemented in TypeScript with a PDP-7 instruction to JavaScript JIT. So does the Korz Apple ][ emulator. Now I'm working on reincarnating my Apple ][ ProDOS 6502 Forth 83 system.

https://github.com/SimHacker/moollm/tree/main/designs/korz

Forth Day Talks: Mitch Bradley, PDP-7 Forth, Don Hopkins, PDP-7 and Apple ][ Emulator

https://www.youtube.com/watch?v=k2pwJ294r8o

https://en.wikipedia.org/wiki/Open_Firmware

https://en.wikipedia.org/wiki/OpenBIOS

https://github.com/mitchbradley

"Thinking Forth" discussion:

https://news.ycombinator.com/item?id=33681531

>I've frequently written about Mitch Bradley's Forthmacs / Sun Forth / CForth / OpenBoot / OpenFirmware on HN. I was his summer intern at Sun in 1987, and used his Forth systems in many projects! [...]

"EFI? Intel has been trying to shove that down our throats for years." discussion:

https://news.ycombinator.com/item?id=12240478

Mitch Bradley originally developed a Forth system at Sun for use diagnosing and developing hardware, by burning it into ROM and running it via a serial port. It was based on Langston and Perry's Forth-83, and had a meta compiler that could target different word sizes and architectures. He made it even more architecture and word size independent, implemented interactive top level loops and conditionals, emacs-like line editing, all kinds of low level device drivers and testers that ran in stand-alone mode, and many other features, including full 16 and 32 bit support with a vocabulary for writing word size and endian independent code.

He ported Sun Forth to 68K and SPARC Sun workstations, as well as the Amiga and other systems. It ran in both stand-alone mode (from disk, tftp or ROM), or under Unix. Under Unix, it could dynamically relocate and link in Unix libraries, and you could call back and forth between Forth and C.

Sun Forth eventually evolved and standardized into the Open Firmware [1], whose purpose was to support machine independent byte code [2], so plug-in hardware cards could include ROMs with Forth byte code drivers that ran on 68K, SPARC, x86 and other systems.

Sun shipped it with the SPARC workstations, Apple adopted it and shipped it on their PowerPC Macs, IBM shipped with their POWER servers, and Mitch worked directly with the OLPC project extending OpenFirmware to support the OLPC XO-1 Children's Computer secure and power efficient hardware. [3]

>OLPC Wiki: 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.

[1] http://www.openfirmware.info

[2] http://www.openfirmware.info/FCODE_suite

[3] http://wiki.laptop.org/go/Open_Firmware