In the ’80s, Beginner’s All-purpose Symbolic Instruction Code (BASIC) was the predominant programming language for home computers. Of course, it was not the BASIC that Kemeny and Kurtz wanted – although Kurtz seemed to be less anal about it than Kemeny –, it was the entry point into computer science for many bedroom programmers. In other words, 99% of the computers you could buy was talking a dialect of BASIC as soon as they were switched on. The other option you always had was the much less palatable machine language. Now, you may ask yourself about that missing 1%, right? Well, with some obscure machines, you could do FORTH natively! For example, with the British Jupiter ACE by Cantab or the much more capable French Hector HRX by Hector. For those of you who don’t know FORTH, it was invented by Charles Moore in the late ’60s to drive a radio telescope. By itself, this fact is not very interesting, except that it gives us some clues on his design choices for this really nice language: FORTH is small, frugal in memory, almost as fast as machine language in its worst implementations, interactive, and … cool. To be fair, FORTH’s detractors call it a write once read never (WORN) language.
At the end of the day, it is a question of taste I presume. I do love FORTH, as well as the concept of stack machine it is built upon. The same way I like to describe the C language as a universal assembler, FORTH is the definitive interactive assembler to me. If you have not heard of FORTH, it is likely because you are not working/interested in the fields where FORTH is well established: aerospace, machine control, firmware development, etc. Interested? If so, I will show you how you can evaluate this language with a low-cost micro-controller and an In-System Programmer (ISP). In particular, I am using an Arduino Uno and a WaveShare USB AVRISP XPII ISP (but you can pick any Atmel AVR compatible ISP). You will then need to download a free evaluation version of the SwitX Cross Compilers for Micro-controllers from https://www.forth.com/download/. FYI, the license cost for the AVR Lite version is $295. But for an evaluation, it will cost you nothing! Note that the evaluation time is not limited, but the target object code size is. SwiftX is sold by FORTH Inc., the company co-founded by Chuck Moore and Elizabeth Rather in the early ’70s, almost 50 years ago. Once the package installed on your PC, you have all you need to build, upload and run the SOS demo application. The operations can be described as follows: connect the ISP to the Uno’s ICSP connector and connect both (the Uno and the ISP) to your computer. Both should show-up in your devices manager if all the drivers are correctly installed. Open the SwiftX IDE – this is done by opening a project (the SOS one for example) and not the executable. You then have to build a FORTH kernel (an IDE menu option). This generates a target.hex file (~90KB). Push the kernel to the Uno by typing RELOAD!. Behind the scene, the AVRDUDE EEPROM/flash programmer, that is included in the package, is used by the IDE. At this point, the SOS sample is running (see attached video). While the code is running in the background, you can connect to the Uno in debug mode from the IDE, and execute any FORTH code/command! Indeed, SwiftX is multitasking (yes, in less than 100KB). The commands are sent via the ISP to the Uno, executed by the FORTH kernel, and the stack (or result) is sent back to the IDE. Et voila! If you are a retro-computing aficionado, you can take a pause, and contemplate the fact that you have just setup a system that is almost 5000 times faster and has 30 times more memory than the Jupiter Ace! To start exploring FORTH, you can read the Forth Programmer’s Handbook copy shipped with SwiftX. As a next step, one can refer to the ANSI X3.215-1994 language reference (also provided). When you will start interacting with FORTH, you can display the stack in a non-destructive way using .S command as usual, but the IDE also displays the stack in the window’s status bar! Last but not least: type WORDS to have the content of the dictionary (equivalent to the list of all the FORTH instructions, plus the ones you have defined). Now it is up to you, and may the FORTH be with you!