Forth Redefined



The original title of this article was ': Forth s" Redefined "s ;' which is a valid Forth statement that defines the word Forth. We had to switch because of SEO issues as well as potential confusion with syntax errors. I thought it would be interesting to point this out because it highlights issues with the way the internet works these days. I agree with the change but I thought you might like to know that the current title had a reason for being instead of just something catchy.

I first learned Basic on a teletype with a paper tape punch, back in the early days of programming before microprocessors. One of the first major projects I worked on was a Cobol compiler and development environment written in Basic to run on a Basic-only minicomputer. The first software I sold was a variant on this, a Fortran IV environment written in Basic to run on the same system.

Along the way, I hit on almost every programming language from Algol and APL to Snobol and Smalltalk. Forth was also one of the languages I used along the way. (More on how and where later. )

What prompted this article was another article I recently read, “Forth: The Hacker’s Language” on Hackaday. It is a fun overview of Forth and worth reading. It mentions open-source tools like GNU Forth (Gforth) that are still in use and supported. Forth is still an interactive assembler, but it now has object-oriented support if you want it.

The article goes into many of the features and issues of Forth, like its reverse polish notation (RPN) and the explicit stack manipulation that is both error-prone and efficient. The one thing I think is glossed over too quickly is that Forth is an active development environment like Lisp, Smalltalk, and APL, as well as many scripting languages such as PHP and Python. Changes have effect immediately, which can be very handy on embedded platforms where blinking an LED or changing the speed of a motor in real time are advantageous. Of course, it can also be a bane as well, since something may work because of the interactive nature, but cannot be repeated without repeating the same session used to create that working situation in the first place.

It is still possible to get the original, paged version of Forth with its clumsy editor, but the latest Forth environments are much more functional. They still allow a programmer to shoot themselves in the foot faster than with C, since there is no compile/link in the development cycle, but it is easier to figure out what went wrong.

We probably need an “11 Myths about Forth” article to highlight issues about its use. There are too many more popular alternatives to make it a contender for many embedded applications but it still has its place. Forth, Inc. is only one place to get commercially supported Forth tools. There is even an app for the Arduino Uno boards using SwiftX-AVR. 

Rising Star and Valdocs

So where did I start using Forth? It goes back to a company called Rising Star that developed an integrated office suite called Valdocs well before things like Microsoft Office were even a glimmer in someone’s eye. I worked with Roger Amidon and Chris Rutkowski at Rising Star.

Valdocs ran on an Epson QX-10 that ran TPM-III on a Zilog Z80 with 256 Kbytes of banked memory. It had a bit-mapped graphics display and a pair of floppy disk drives. It had quite a few advanced features from a background mail system (I wrote much of that) to the ability to stop typing and popping out a floppy having everything saved automatically. It also had a special HASCI (Human Application Standard Computer Interface) keyboard with plain English function buttons like Mail. HASCI even had a Undo key. The editor was a true WYSIWIG text editor that was matched to the Epson printers.

For a little context, here is a YouTube video made by the CBC at the 1984 National Computer Conference (pay attention around 15:30).

About half of Valdocs was written in Forth. The other was macro assembler. C was available on minicomputers but not as ubiquitous as it is today. Macro assembler and Forth made a lot more sense at the time. Valdraw, a drawing program, was written mostly in Forth and I worked on that for a while. The 256 Kbytes of memory was four times what a Z80 normally used, but even the extra memory required us to trim as much as possible to get all the functionality in memory as possible.

Discuss this Blog Entry 14

on Feb 1, 2017

An interesting and inspiring article. thanks for information. I appreciate your blog its a interesting and it attract other peoples to read this blog.Thanks for the great share and keep up this great work!

on Feb 2, 2017

Oh, those were the times! I remember talking to Chuck Moore once. More exciting than Beetles, Doug Adams and Elvis bundled.
FORTH made impossible tasks possible. Like the Cejmatic Statistical analyzer running on an eight bit 6502 with transducer interface and all in less than 32 kB memory, the rest was needed to store the OS, the interpreter and "massive amounts" of data.
As a tribute to Chuck, we named our favorite kitten Charles.

on Feb 2, 2017

Thanks for reminding the engineering community about Forth.
I developed a distributed process control system with Fig Forth in the 1980's that is still working today in several plants.
These days, checkout FlashForth for the Atmega and PIC microcontrollers at SourceForge. Runs on Arduino, too.
Very well done!

My the Forth be with you.

on Feb 2, 2017

Aah, the good old days. I cut my first programming teeth in high school writing BASIC programs on a teletype with punched paper tape and a 300 baud phone modem connection to the local university.

I also had the opportunity to write programs using the big Hollerith punch card machines. Never had a problem with hanging chads but it seemed typing mistakes only happened after entering 70 or more characters out of 80 which meant discarding the card and starting over.

I first learned Forth on the TI 99/4A home computer. For a class project in my senior year in college, we designed and built a CPU using AMD bit-slice parts. The microcode executed the Forth language as the native instruction set for the CPU.

on Feb 2, 2017

"Ah, the good old days...." Hey, that's rose-colored-glasses nostalgia talkin'!
"There are too many more popular alternatives to make it a contender for many embedded applications but it still has its place."
I have to disagree. The only people I have met recently who want to propose using Forth are old crusty guys such as myself, who have used it in the far distant past and haven't used it recently enough to remember what a PITA it is from so many points of view! I worked on a project where we took Jonathan Sach's version, which he called STOIC (STack Oriented Interactive Compiler) for CP/M, augmented it with overlay capabilities and a true stdio-style raw and stream I/O system, and implemented a security system demo implementation for some venture capitalists.
Having done the deep, deep dive into the FORTH world, and having moved on to so, so many other alternatives to FORTH, I would have to say that anyone who seriously wants to use FORTH now, in a real project, for serious commercial development, should probably have their sanity or their inebriant levels checked. Just my opinion of course, but one shared by many other folks who should and do know better.

on Feb 2, 2017

Thanks for reminding us how dumb we are!

But, at a time when bytes and nibbles were what you had, memory space was limited to 64 k (non bank-switched) processor were eightbitters and clocks counted in tens of MHz - at most, which forced you to use assembler for real-time processing, FORTH made many projects possible that would otherwise not have been possible.

At least for us human beings. The situation was perhaps different in your world. I now use graphical input. Writing code line by line, as you seem to do, is something that merits a thorough mental check-out.

on Feb 3, 2017

Forth, like most older languages including things like Cobol and Lisp, have not stood still. There are a lot of improvements from IDEs to documentation tools to debuggers that have changed of the years and these are typically incorporated into other platforms like Forth. Programmer productivity needs to be taken into account and Forth was pretty good in that respect so adding improvements like smart editors in IDEs only helps.

on Feb 2, 2017

I cannot understand any silly comments about Forth - it is a language , like any other; it has users and it is alive. Has not taken over the world as planned - so what. There is a community, users, products, customers .... It is fun and if anybody wants to read about it, google amazon for our eBooks or if you want to try it out go to the Forth-ev website or search for A Start With Forth; no software installation needed - just download and run the exe. And Forth is running on ISS NOW. Normally used for special requirements. And MPE's Sockpuppet can even make C and other languages Interactive - Mixed Language Programming - as we know the future.

on Feb 2, 2017

I learned Forth many years ago. It's wonderful for interactive design, and one can easily write programs that take up less memory than assembly/machine language (which is not as much of an advantage for embedded applications as it used to be).

Its principal problem is that it's a "write only" language. Unscrambling what someone else has written can be confusing.

HP made a huge mistake in not including Forth in its 28-series calculators.

on Feb 3, 2017

I would agree that many programming languages like Forth and APL tend to run into the "write only" category with extensive use of "one liners" where cramming computation into a one line function was designed for efficiency and compact presentation often with little or no documentation. On the other hand, this approach is more akin to the programming norms of these languages rather than best practices. There is really no substitute for good comments and inline documentation that help reduce the write only syndrome.

on Feb 6, 2017

Good word and variable names and comments are essential to any programming environment. WOL:s do not exist per se. It is more about planning and "Analyze, find a solution, think, build structure, code modules, test modules, integrate, validate" than using a certain language.
Sloppy programming, which leads to WO programs, can be seen in any programming environment. Also in graphic ones.

on Feb 7, 2017

And with some graphical languages you get get real spaghetti code.

on Feb 16, 2017

I wanted to share a email not I received about the article.

"I enjoyed your forth column and wanted to add some comments about Forth which we still use today for running complex hardware and also doing field theory calculations. In 1981 we hit the wall in trying to maintain our large Fortran programs doing electromagnetic eddy current calculations for induced current flows in metal parts. We switched to a 32 bit Forth ( designed for the VAX out of Huntsville AL) for the new IBM PC in 1982 to do both field calculation and run the analysis equipment which was a home brew multi-channel Vector Network Analyzer. The switch was made because we could rewrite the IBM scientific subroutine package in a more general form that handled complex numbers transparently in a couple of day. We still use that code today and it has been embedded in hundreds of industrial materials testings systems. In the 1990s another Forth user, friend, physicist, and author of Scientific Forth Julian Noble started talking about the weakness in the Standard Model of physics in particular the lack of understanding about what mass actually was. That after 5 years of conversation about the problems coupled with a great deal of unexplained experimental data in materials areas where EM theory was not complete got us looking at the physics of fields in detail. In two more decades we used Forth to do field theory to explain the data our Forth based industrial instruments were putting out during the testing of hot and hot rolled steels. Having a single software computing platform that could be almost instantly debugged for 34 years that could be run on almost any hardware reduced our software creation costs to the point we could afford to attack some basic problems with physics that had plagued our work since we started in 1971."

on Mar 11, 2017

Bill , thank you again for your nudge to get my CoSy up on GitHub . It's like taking off the kimono and climbing onto and laying down spread eagle on the alter .

It is transformative to have tutorial support via YouTube and the plane of equality of user=programmers I infer on git ( as a total noob . too complex tho ) . is my lifetime with APL at my fingertips simplified in an open-to-the-x86 Forth . See the 3 YouTubes covering aspects of CoSy down to a challenge to see the same Morse code translation worked thru in CoSy worked thru in Python .

Thanks again ,

Git CoSy . Go Forth & Branch & Merge
Add value .

Bob A

Please or Register to post comments.

What's alt.embedded?

Blogs focusing on embedded, software and systems


William Wong

Bill Wong covers Digital, Embedded, Systems and Software topics at Electronic Design. He writes a number of columns, including Lab Bench and alt.embedded, plus Bill's Workbench hands-on column....
Commentaries and Blogs
Guest Blogs
Jan 26, 2017

An Amateur’s View on the P2 (Part 2): Slew Rate and the Oscillator 3

Justin Mamaradlo takes a further look into the P2 op amp and how it functions, analyzing the oscillation and slew-rate characteristics of the venerable component....More
Jul 15, 2016

Simple Yet Effective ESD Testing Methods for Higher Reliability 11

There are multiple ways to test for electrostatic discharge, ranging from implementing a human-body or machine model to....using a balloon and a comb?...More
Apr 8, 2016

Confabbing on the Fabless Fad 5

High capital and maintenance costs, and EDA advances along with abstractions to deal with chip complexity, have been leading contributors to the fabless migration....More

Sponsored Introduction Continue on to (or wait seconds) ×