Forth Origins

Authors

Publication

Pub Details

Date

Pages

See all articles from SyncWare News v1

by Gary Smith
(C) 1983 HAWG WILD
Software
PO Box 7668
Little Rock, AR 72217

Chet Lambert, the publisher/editor/copyboy/ etc. of COMPUTER TRADER has prompted this article. At first, I resisted because of my identification with FORTH, but relented because there is a need to share information.

So there is no misunderstanding, the home computerist’s supply I head, Hawg Wild Software (TM), is heavily committed to FORTH. We have FORTH packages from several vendors for all home computers. It is, then, completely fair to believe a bias could flavor any article I might write about FORTH; you may consider that as you read this article. I will make every attempt to present the simple, unvarnished facts as I explain what FORTH is.

FORTH has been described as the only computer language NOT designed by a committee. Whether it is the only such language is debatable, but it is entirely true that FORTH is the direct result of one man’s efforts to program more efficiently. Starting in the early sixties, Charles Moore, then a physics undergraduate at Massachusetts Institute of Technology and a staff member at the Smithsonian Astrophysical Observatory, began trying to develop a better programming tool. His intent was not to create a new language, but rather make himself a more productive programmer.

He had determined he could produce about one good, meaningful program in FORTRAN per year. In frustration he began experimenting with stack structures, post-fix notation (Reverse Polish Notation, or RPN) and the like. By doing so, he believed he could increase his productivity tenfold. (Most programmers report MUCH higher increases in productivity with FORTH).

While at Mohasco Industries, in the late sixties, he dubbed his programming “tool” FORTH. The IBM 1130 he was working with was a third generation hardware machine (i.e. discreet components; diodes, transistors, resistors; on circuit boards), and he believed his “tool” was a software leap into the fourth generation. The IBM 1130 would accept only five-letter descriptors, hence “fourth” became “FORTH.”

The first real test for FORTH was when it was implemented at Kitt’s Peak National Observatory, AZ to guide the radio-telescope there. The results were so successful that calls began coming in from other astronomers anxious to duplicate the method. From there, word has spread largely by word-of-mouth, and by the efforts of the FORTH Interest Group (PO Box 1105, San Carlos, CA 94070; membership $15.00 per year, includes monthly magazine, FORTH DIMENSIONS). So FORTH has grown from one man’s conviction to what it is today, without the aid of a government or corporate push, just on the strengths of its merits and the sometimes fanatical enthusiasm of its adherents.

A word about that enthusiasm is called for here. Even FORTH’s creator, Charles Moore, has said that FORTH polarizes users into camps of those who love it, and those who definitely do not. This is in part due to the language’s uniqueness, and in part because it is something of an amplifier. That is, good FORTH programs tend to be very good, and bad ones tend to be lousy. I can say this; if you try FORTH and like it, you will very likely become a convert.

FORTH does not require or use the special registers, parameter passing, cache memory, or index addressing employed by large, mainframe computers to speed programming tasks. FORTH accomplishes much the same thing without all the attendant hardware just described. FORTH produces extremely compact programs; more compact than a non-FORTH user can usually believe. FORTH does not require special memory for error checking. Each word (function, item, operation…) may be tested as the program is developed. What all this translates to, is that FORTH is ideally suited to mini- and microcomputers, including (maybe especially) home computers.

Each computer’s own resident binary machine code is the fastest running, most efficient method of programming that particular computer. As has been said, by me, in “Computer Trader,” machine code is the only instruction set the machine truly understands. Next to true machine-code (often synonymous with) is assembler. Very close to these in terms of efficiency and execution speed is FORTH. No other high-level language consistently approaches FORTH in this department. There isn’t even a contest.

Forth Numbers

As has already been said, FORTH is unique. Some people never adjust to FORTH’s structure. That unique structure, though, is precisely what gives FORTH its efficiency and speed. If you use, or have used, a Hewlett-Packard brand of calculator, then you already know about Reverse Polish Notation. To add two numbers (5 and 3) in normal, in-fix or algebraic math (5 + 3) you place the operator between the two numbers. Not so with Reverse Polish Notation (origin country of the method’s creator, Jan Ludasiewicz). With RPN, the operator follows the numbers ( 5 3 + ). Note the spaces in between; they are an absolute must in FORTH.

The reason FORTH uses RPN is that it relies heavily on the parameter stack (called simply “the stack”). Most languages can and do use the stack, but its use is mostly user-transparent. With FORTH you MUST ALWAYS use the stack, and be aware of its contents. Likened to plates or trays in a cafeteria, the last number pushed on top of the stack is the first one popped off (ie. LIFO, Last In/First Out). In our example above 5 is pushed on, 3 is pushed on; then during execution 3 is popped, 5 is popped, they are operated on (added), and the result (8) is pushed back on the stack. Compare that with the register moves for BASIC!

The WORD

Another unique feature is the “word.” A word is the basic functional unit of FORTH. Most words manipulate the stack. “-” (minus), SWAP, EMIT (character to screen) are all words. The FORTH package comes with a dictionary of standard words (it must to call itself a standard package). You use this kernel to create your program. More importantly, you also use it to define new words to fit your application. These same new words will work on any other machine using FORTH. Furthermore, the new words are compiled in such a way that they are completely integrated into your FORTH system. These are two extremely powerful features: transportability and extensibility.

It must be pointed out that FORTH essentially has two versions, both highly transportable and for the most part compatible. In 1978 the FORTH Interest Group, convinced that FORTH would become popular if it were standard and available, released their figFORTH version. FORTH-79 is largely a subset of figFORTH intended to allow for greater transportability between systems. FORTH-79 is more applications oriented, The differences are generally minimal.

FORTH is structured. Not top-down, but bottom-up. FORTH is threaded, in that each new word has, not complete definitions, but pointers to its defining words. The programmer begins with simple conceptual words (at the bottom), and defines more and more complicated words (procedures) from them. The final, threaded word is the program. Any other new words created to fit the application are also part of “your” FORTH environment. In this manner FORTH continues to grow to fit the needs of the system, the application and the programmer.

This brings us to our closing point; the needs of the programmer, FORTH has been described as the software hacker’s language. It has also been said that you can program FORTH to do anything, but you will probably have to program it yourself. You do have to do more with FORTH. You do have to keep track of the stack. You do have to guide FORTH to your application. FORTH, in turn, will do so much more for you. The key is that YOU ARE IN CONTROL. Each FORTH program is almost a new language; your language. (To that end, other languages have been written entirely in FORTH. It is used as an in-house development tool at several large corporations.) If you want a FORTH program to do more, YOU can extend it then and there.

CONTROL, STRUCTURE, EXTENSIBILITY, SPEED, EFFICIENCY, COMPACTNESS, TRANSPORTABILITY….FORTH

Best Regards,
Gary
HAWG WILD Software (TM)

Questions & Answers

After receiving a sample of XFORTH from Hawg Wild Software, and looking it over for the first time, some questions came up which I put to Gary Smith. Since these are questions other first-time FORTH users are likely to ask, I’m including them here for all of you so that Gary doesn’t have to repeat them,

Q: XFORTH comes with a complete list of standard words and tape loading instructions, but does not provide much tutorial information. What would you recommend for first-time users?

A: Our documentation is minimal; on purpose. You CAN NOT learn FORTH from abridged texts. We recommend “Starting FORTH” by Leo Brodie for tutorial purposes, We also supply a FORTH manual ($14.95), written for Jupiter Ace 4000, but can be used as a general tutorial. “Starting FORTH” still best.

Q: (“Loaded question” department) How does XFORTH compare with the other FORTH packages available for ZX81?

A: Our FORTH is REAL, threaded FORTH and not arrayed (indirect thread). You get full FORTH restarts, etc. Read the ads. Ours is listed by FORTH Interest Group!

Q: What kind of after-sale support do you provide?

A: We publish XFORTH XCHANGE, on an “as needed” basis for XFORTH customers, We allow re-printing of any part of XFORTH XCHANGE by interested publications. This is good stuff for XFORTH users. No one else offers the support we do, at any price. (Gary’s willingness to answer my dumb questions is proof enough for me! — ed.)

Q: The XFORTH package is about 6K long. Does all this get saved to tape each time, or can the object (result) code be SAVED independently?

A: You SAVE both the Loader and Object. FORTH is threaded. Don’t worry. Threading makes things VERY compact and fast. You can create very busy programs with 4K or less, let alone the 10K we leave!

Q: What is the Jupiter Ace 4000? How can it De obtained?

A: The Jupiter is currently the only micro with FORTH as its operating system. We (Hawg Wild) are authorized dealers for the Jupiter Ace 4000. Available now: (No longer being made. ed.) Jupiter Ace 4000 – $150.00, 16K RAM pack ~ $50.00, 48K RAM pack – $125.00.

Hawg Wild Software sells XFORTH on cassette for $25 + $1 S&H.

Resources

MULTI-FORTH is available from Tree Systems, Suite 233, 3645 28th St., Grand Rapids, MI 49506. It is also EPROM based (it is the same as above and only available from Soft Magic. ed.), and comes with a card that the BASIC ROM plugs into, allowing switching between FORTH and BASIC. This is a multitasking version. Price $49.95 ppd.

Another FORTH is called ZX-FORTH and comes from The Forth Dimension, 1451 Union St., Middletown, PA 17057. For $42.95 you get the tape, “comprehensive user’s manual,” two sample programs (game and a simple WP), and a quick-reference card. Manual alone is $10.00.

Soft Magic Corp., 1210 W. High St., Bryan, OH 43506. Their TREE-FORTH comes on a 64K EPROM, so you don’t have to LOAD it from tape. Soft Magic is offering a special package deal (good only until final versions of docs and packaging complete); EPROM (reg. price $69.95) plus “Starting FORTH (retail value $17.95) and “Understanding FORTH” by J Reymann (retail value 2.95) all for $49.95, But hurry as this won’t last for long.

Meanwhile, if this looks interesting to you, I would recommend that you purchase XFORTH and “Starting Forth” to get your feet wet. After gaining expertise you’ll be in a better position to evaluate the merits of the other FORTHs for your applications, You should also contact FORTH Interest Group for additional “scoop.”

SyncWare News is not affiliated with FIG, Hawg Wild Software, or any other FORTH supplier mentioned, nor are we receiving payment for any mention. The preceding information has been presented for your info only, and we cannot be liable for inaccuracies, We ARE interested in your response and impressions (good or bad) re: FORTH in any of its versions.

Products

 

Downloadable Media

 
Scroll to Top