Channels ▼


The Forth Column

Source Code Accompanies This Article. Download It Now.


Mark November 18 - 19 on your calendar and come to the Real-Time Programming Convention at the Grand Hotel in Anaheim, California (next to Disneyland). The invited guest speakers are Jef Raskin, head of the original Macintosh development team and inventor of the Canon Cat, and Ray Duncan, well-known author and expert on IBM PC operating systems. This convention is sponsored by the Forth Interest Group (FIG) but is not limited to Forth. If you are interested in software or hardware solutions for real-time problems, this show is for you. There will be talks and demonstrations on real-time operating systems, language-oriented Risc machines, parallel processing, and languages for data acquisition, analysis and real-time device control. Application areas will cover aerospace, medical, laboratory, machine-vision, digital signal processing, robotics, automation, intelligent instrumentation, adaptive devices, working neural nets, and software peripheral controllers.

Rochester Forth Conference

The day before the 1988 Rochester Forth Conference, Harris Semiconductor engineers, attired in railroad hats, held a one-day seminar in which they described the HTX 2000 Forth chip see DDJ "Forth column" August 1988) and outlined their plans for its future. To everyone's surprise, at the conference itself, Phil Koopman (WISC Technologies) demonstrated a 32-bit hybrid of the RTX 2000 and WISC's own WCS technology. This chip is already in silicon! At a recent Silicon Valley FIG chapter, David Williams (Harris) announced that by this time next year, Harris expects to both double the speed of the RTX 2000 and come out with a 32-bit version.

Harris, makers of the RTX Forth Engine, announced that they have signed an agreement with Zoran, makers of Digital Signal Processing chips. In the agreement, Zoran will second-source the RTX chips and Harris will second-source Zoran's DSP devices. The Zoran chips will be able to be connected to the RTX ASIC bus for a very fast, high level language and digital signal processing system.

Also at the conference, Silicon Composers showed off their new SC/FOX RTX 2000 development system. The SC/FOX board slips into an IBM XT or AT (the hardware is smart) and opens up a dual-port 16K-RAM window anywhere in both the RTX 2000 and in the IBM address space. The board comes with 64K high-speed RAM, upgradeable to 1 Mbyte, and runs at 8 MHz, upgradeable to 10 MHz (approximately 15 Mips). It sells for $1,995. (Call 415-322-8763.) Both the Harris RTX 2000 development system and the SC/FOX use cross compilers, but neither--to my knowledge--has demonstrated its C compiler. The race to develop a standalone Forth for this chip is on.

The official theme of the Rochester Conference was Programming Environments, that took the form of idealized workstations and program libraries. Many Forths already support some kind of overlay mechanism. Jim Callahan (HS/FORTH), for example, talked about run-time dynamic linker to ASM and C libraries and Stephen Pelc described MicroProcessor Engineering's Modular Forth.

Guest speaker Dr. William Wickes spoke in detail on RPL (Reverse Polish Lisp) which he used to implement the symbolic math in HP's latest scientific pocket calculators. This fascinating hybrid looks more like Forth than Lisp and has the unusual property that definitions can contain embedded definitions. Dr. Norman Margolus, co-author of Cellular Automata Machines (reviewed in an earlier column), showed off the latest CAM board for high-speed modeling of physical fields. Mitch Bradley (Sun) talked about Forth's role in the Unix workstation environment--to bring Unix up in the first place and to provide for implementation-independent device drivers. There were almost 70 papers in all, and the proceedings should appear about the time you read this column.

ANS Forth Committee

The following letter was recently released by the ANS Forth committee:

"The Technical Committee working to develop an ANSI Standard for the Forth language is making substantial progress, according to Elizabeth D. Rather, Chair. The group, officially designated X3J14, has just concluded its fourth meeting in Rochester, NY (May 25 - 28).

"The most significant actions... have been passage of proposals to ensure the language won't be restricted to specific hardware architectures.... Recently passed proposals facilitate transporting programs across CPUs of differing word lengths, and can even support one's complement architecture.

"Other major actions include adoption of a proposed extension defining an interface between Forth and standard operating systems such as MS-DOS, Unix, VMS, and OS/2. The group is also investigating the general areas of disk usage, control structures, and extensions such as floating point arithmetic.

"The Technical Committee meets four times a year. Meetings remaining in 1988 are scheduled for October 25 - 29 at NASA's Goddard Space Flight Center, Greenbelt Maryland."

"To obtain a current copy of the working standard (BASIC), send $5 (payable to the Forth Vendors Group) to Martin Tracy, FORTH Inc., 111 N. Sepulveda Blvd. #300, Manhattan Beach, CA 90266."

New Products

Computer Continuum's LAB 40-Controller connects to the serial port of any personal computer and interfaces to their off-the-shelf modules for servo motor control, stepper motor drivers, 8- and 12-bit A/D, and relay control. The conversion of signals from RS-232 to their proprietary ribbon-cable bus is handled by a Motorola 68HC11 running a ROM'd Forth system. The controller itself includes a 64K memory map, 512 bytes of EPROM, eight channels of 8-bit 64 MHz A/D, three sockets for RAM or ROM, and RS-232, RS-422, or RS-485. Forth-based communicatIon drivers are available for both the IBM and the Macintosh personal computers. The controller sells for $350 (415-755-1978).

The Dianax DSC-12 SBC is based on a 2-MHz R65F12 CPU. The board comes with D/A, A/D, signal conditioning and amplification, battery backup, and serial interface. The resident Forth nucleus has been extended with a full screen editor, assembler, and disassembler. Their introductory price of $499 includes an LCD display and 20-key keyboard. Call 514-878-2802 for more information.

FORTH Inc. (800-55-FORTH) announced the polyFORTH PC-based ACL development system. This 8086-based intelligent peripheral card provides eight RS-232 or RS-422 serial channels. Four boards can be multiplexed for a total of 32 channels of users or devices. The communication, monitoring, and control of each channel is offloaded to the ACL board, leaving the IBM PC polyFORTH system free for the application program.

More Math

In the last Forth column, there was a small bug in the floating-point support in the word ROUND. See the corrected definition in this month's Listing One, page 138.

Also, in a recent column I published Dr. Ting's recursive algorithm for line drawing. Wil Baden and Greg Bailey have both pointed out that real examples of useful recursive algorithms are hard to come by. Wil contributed the one in Listing Two, page 138.

If your Forth doesn't support RECURSE, try MYSELF. PARTITION finds the number of partitions of a number. 4 PARTITION returns 5: 4 3+1 2+2 2+1+1 1+1+1.

Forth programmers often use the operators */ or */MOD to scale an integer number by a fractional amount. in other words: 1000 2 3 */, prints 666, which is two thirds of 1000. The operator */ is preferred over the combination of * (multiplication) followed by / (division) since it supports a double-precision intermediate result.

For example, suppose you need to multiply a 16-bit integer or fixed-point fraction by pi (3.14159...). One approach is to multiply the number by 31416 and divide it by 10000, which is accurate to 4 digits. An alternate approach is to multiply by 355 and divide by 113, which is accurate to 7 digits. But how do you calculate the pair of numbers which is the best approximation to the desired constant?

Dr. Nathaniel Grossman's long Divisors and Short Fractions (Forth Dimensions VI-3) discusses the mathematical procedure in readable detail. (I have shortened and rewritten his algorithm, which appears in Listing One.) His word CF (continued fraction) requires the double-number extensions UD* and UD/MOD which are in turn based on math primitives published in the previous column. The results of example 3.141592654 1000000000. CF is shown in Figure 1, this page.

Figure 1: Sample continued from fraction result

PartQuot        Numerator    Denominator
         3            3         1
         7           22         7
        15          333       106
         1          355       113
       293       104348     33215
        11      1148183    365478
     ...         ...       ...
        2     1570796327      500000000

355 113 is the largest 16-bit pair of integers available. Dr. Grossman points out, however, that the very next ratio is almost a 16-bit integer pair. Multiplication of unsigned 16-bit single numbers by pi can be approximated to good accuracy by

52174 33215 U*/ 2*

given the unsigned operator U*/ (or the polyFORTH operator */MOD).

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.