programmerthinkst.jpg

Forth Redefined

Jan. 31, 2017
Ever played with Forth? It’s still out there, although it’s not for everyone.

Image courtesy of Thinkstock

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.

About the Author

William Wong Blog | Senior Content Director

Bill's latest articles are listed on this author page, William G. 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. Bill is a Georgia Tech alumni with a B.S in Electrical Engineering and a master's degree in computer science for Rutgers, The State University of New Jersey.

He has written a dozen books and was the first Director of PC Labs at PC Magazine. He has worked in the computer and publication industry for almost 40 years and has been with Electronic Design since 2000. He helps run the Mercer Science and Engineering Fair in Mercer County, NJ.

Sponsored Recommendations

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!