Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesForth Powers the Mac


March 1995 / News & Views / Forth Powers the Mac
Rick Grehan

First, let me confess that I have a soft spot in my heart for Forth. It's a language that has largely been misunderstood. I've seen it best described as an amplifier: Good programmers can do wonders with Forth, bad programmers produce hideous results.

Now from Creative Solutions (Rockville, MD, (301) 984-0262; fax (301) 770-1675) comes Power MacForth , descendant of the first Forth development system for the Mac. Power MacForth's ancestor was a 680x0-based, high-quality Forth programming system with lots of accompanying source code tools and libraries. As its name implies, Power MacForth runs on the PowerPC line of Macs.

As development packages go, Power MacForth is surprisingly complete. It implements the core and extended core words of the relatively new ANSI Forth specification. The sys tem provides its own form of cooperative multitasking. If you don't mind the postfix notation (and you can't, if you're going to work with Forth), it has a PowerPC 601-compatible assembler and disassembler. There's even a built-in source-level debugger; though, granted, it's really a BASIC-style ``trace'' capability.

Power MacForth is ``direct-threaded,'' as opposed to the earlier 680x0 version, which was ``token-threaded.'' With token-threaded code, execution of a single routine requires that the Forth inner-interpreter fetch a 16-bit token, resolve that token to the address of the code, and then transfer execution to that code. Token threading is memory thrifty, which makes it workable even on 512-KB Macs, but relatively slow. Meanwhile, direct-threaded code discards an inner interpreter. Tokens are replaced by CALL (or, in the case of the PowerPC, branch and link) instructions that call the routine directly. This change represents more a maturing of the Mac than a maturing of MacForth.

A bene ficial byproduct of Power MacForth's direct-threaded structure is that it allows the compiler to use ``in-lining'' optimizations. A short Forth word of two or three instructions is copied wholesale into your code rather than being compiled as a branch.

The piles of source code tools and examples provide complete access to the Mac toolbox. In fact, there are two interfaces to the toolbox. The one that I found most interesting was a collection of files known as ``MacIncludes,'' which are Forth-like counterparts to the universal C header files for the Mac.

The package is inexpensive: You get a complete PowerMac development system for $199. Of course, what a Forth programmer considers complete might seem skeletal to a C++ programmer. Still, you get the compiler, hordes of source code examples, an assembler and disassembler, and a debugger. Owners of 680x0 versions of MacForth can upgrade for $129. And the whole thing fits on one floppy disk.


Power MacForth

screen_link (31 Kbytes)

With Power MacForth and four words, you can create a basic drawing package.


Up to the News & Views section contentsGo to previous article: 3-D Hardware Vendors Anticipate Microsoft's 3-D DDIGo to next article: Multimedia Goes NativeSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network