Kibler Electronics
Industrial Support Since 1975

  • HOME
  • Consulting Services
  • Computer Corner II
  • TCJ Support
  • Software Projects
  • Other Topics and Links
  • BOBZ Products
  • MyForth
  • Forth

    Forth is a computer language invented by Chuck Moore and is best described by his comments to the introduction of "Starting Forth" by Leo Brodie. Chuck had this to say:

    • I developed FORTH over a period of some years as an interface between me and the computers I programmed. The traditional languages were not providing the power, ease, or flexibitlity that I wanted. I disreguarded much conventional wisdom in order to include exactly the capabilities needed by a productive programmer. The most important of these is the ability to add whatever capabilities later become necessary.
    Chuck goes on to explain one of the guiding concepts that keeps FORTH programmers choosing to use FORTH over more current languages:

    • One principle that guided the evolution of FORTH, and continues to guide its applications, is bluntly: Keep It Simple. A simple solution has elegance. It is the result of exacting effort to understand the real problem and is reconized by its compelling sense of rightness. I stress this point because it contradicts the conventional view that power increases with complexity. Simplicity provides confidence, reliability, compactness, and speed.
    In the many years of doing programming, that last paragraph is the most important. The simple clean programs ran without issue, while the more complex and supposedly state-of-the-art with the latest concepts in use, were the buggiest and most difficult to update. Forth in its simplicity makes programming fun, easy, and produces nearly bug free results. I have heard that since its release, FIG Forth 83 users have never found a bug in that release. Something unheard of today, when some programs have patches weekly.

    Forth examples

    Many years back when I was doing my masters in Computers and Education, I needed to produce a computer based training program as my master project. I created a tutorial on forth using F83 forth. While other students used the current and more typical programs of the time. The results was rather predicable, I had mine done 100%, while the others had only 30 to 60% completed. The problem was the complexity of the current batch of tools. The tools were so difficult to work with, the other students were lucky to get more than a page of data entered a day. While using forth I was able to get my basic outline running in a few hours, and was proofing the final results by the end of the week. You can find the program, f83tutor.zip here.

    The are plenty of Forth examples available on the web and any search engine will turn up plenty of links. The official site to start with is the "Forth Interest Group" or FIG. You can find it at http://www.forth.org . A very popular version of forth for use on both Linux and Windows is the GNU version called gforth. You can get gforth here .

    Forth and embedded processors

    One area of forth usage that has not dimished over the years, is embedded applications. There are many features of forth that make it ideal for embedding. The compactness and often a direct relationship between assembled instructions and forth words, make it the ideal programming language.

    I am currently working with a special version of forth, called MyForth. Developed by Charley Shattuck, with lots of help from Bob Nash. This version is intended for embedding in small 8051 based projects. They currently feel the product is not commercial worthy as it has too many personal enhancements, and is more an exploration of concepts than a real product. Don't get them wrong about how it works, as they have developed some real working products using this code.

    The main features of this forth, is the use of macros and macro like instructions to generate 8051 assembler instruction. Using SEE, a forth word or instruciton, it will dissasemble the current code into assembler instructions so you can see if your doing what you wanted to do. Like other embedded forths, you use gforth running on a PC to talk to the project cpu as if you were running a full development platform on your project board. This tethering of the forth to the product is what makes development extrememly fast and efficient.

    MyForth for SiLabs 8051s

    Although not a commerical product, it is ready for use and you can get a zip of MyForth as of 09/2009 here. Give it a try and see what you can do - it works on both windows and linux, after you load gforth on your system. You will find a manual with plenty of explanations in the DOC section. The latest version of the manual is here as a pdf.

    Hope you enjoy FORTH, I sure have.

    Kibler Electronics, PO Box 535, Lincoln, CA 95648-0535, USA.
    mail: billkibler3@gmail.com

    This is a "Java Free Site" and for the reasons why Read This Article.

    Copyright © 2020, Bill Kibler/Kibler Electronics.