JFAR was a refereed journal and long served an important role in the early years of Forth programming. Its diverse content is a resource we help to preserve by making it available here, without charge. All code examples may not run unmodified on modern, standards-based Forth systems but the knowledge it nevertheless conveys may be invaluable.
On This Page
- JFAR volume 1, issue 1
- Expert System for Diesel Electric Locomotive Repair
- A State Space Approach to Robotics
- Control of a Cartesian Robot
- A Robotic Application for Contamination Free Assembly
- Improvement of a Human/Robot Interface Through the Use of Forth
- Forth and Automation Research at The National Bureau of Standards
- Dynamic Processing of Analog Data Using an Apple Computer
- Vectored Versions of Forth Compiling Words
- JFAR volume 1, issue 2
- JFAR volume 2, issue 1
- JFAR volume 2, issue 2
- JFAR volume 2, issue 3
- JFAR volume 3, issue 1
- Forth-Based Software for Real-Time Control of a Mechanically Scanned Ultrasonic Imaging System
- Fast and Flexible Forth Programming in a Femtosecond Laser Lab
- Stack Frames and Local Variables
- Should VARIABLE be an Immediate State-sensitive Word?
- Readable and Efficient Parameter Access Via Argument Records
- Run-Time Error Handling in Forth Using SETJMP and LNGJMP for Execution Control
- JFAR volume 3, issue 2
- The MAGIC/L Programming Language
- Expanding the Forth Dictionary Beyond the 64k Limit by Using Bodiless Code
- Improving the Understandability of Forth Code
- A Window System
- An Alternate Forth Dictionary Structure
- Conversion of a Token-Threaded Language to an Address-Threaded Language
- A Direct-Threaded Code TTL Control Unit
- A Forth-Based Object File Format and Relocating Loader used to Bootstrap Portable Standard LISP
- A Multiprocessing Computer System Composed of Loosely Coupled Forth Micro-chip Modules
- A Microcoded Machine Simulator and Microcode Assembler in a Forth Environment
- A Micro-Based ASW Trainer in Forth
- Forth as the Basis for an Integrated Operations Environment for a Space Shuttle Scientific Experiment
- A Machine to Implement a Generalized Forth Environment
- Forth Implementation of the Heap Data Structure
- Real-Time State Machine Implementation Programming Techniques
- A Forth-Based Iconic Interface
- Interactive Videodisc Control and Computer-Based Training on the Apple Macintosh
- The Design of a Low-Cost CAD/CAM System
- Microcomputer Control of a Machine Tool
- DEBUGGER: The Design of a Test Aid to Support the Development of an Embedded Computer System
- Local Variables
- Forth Automates Intrinsic Viscosity Determinations
- HFORTH: A High-Level Business Language in Forth
- System Development Via Prototyping in the Analytical Laboratory
- What’s Wrong With Forth?
- Meta-Compilation System
- Some Problems in Implementations of tbe Forth Standards
- A Tokenized Rule Processing System
- Concrete Suggestions for a Forth Floating-Point Standard
- Plotter Drivers as an Exercise in Forth Wordset Design
- Forth in the Computer Numerical Control Environment
- Under the Hood of a Superchip: The NOVIX Forth Engine
- Forth for a Multimicroprocessor Control System
- Fifteen Programmers, 400 Computers, 36,000 sensors, and Forth
- A Versatile Software Control System For A Triple Quadrupole Mass Spectrometer
- BASIC on Forth
- Implementing Forth for the Multics Operating System
- A Process Monitor
- Object Oriented Extensions to Forth
- State Sequence Handlers
- From Bubble to Quick: A Forth Comparison of Sorting Algorithms
- Combining Forth and the Rest of the Computer World; Dynamic Loading of Subroutines Written in Other Languages and Their Use as Forth Words
- The Reed for a Standard Test Suite
- Forth in a Muon Channel with CAMAC Control
- Pragmatic VLSI Design Environment (PRIDE)
- NAPLPS Decoding in Forth
- Controlling an Integrated Automatic Parameter Characterization System with Forth
- REvised REcursive AND? ‘REPTIL :IS
- Forth-79 Profiled
- Production Testing of Domestic Clothes Dryers Using LMS Forth
- Top-down Design in Forth
- Forth Implementation in a High-level Language
- Measurement of Interrupt Response Time of PDP-11/44 and PDP-11/23 Computers with a CAMAC Interface
- An Implementation of MC68000 fig Forth under UNIX
- JFAR volume 3, issue 3
- JFAR volume 3, issue 4
JFAR volume 1, issue 1
Expert System for Diesel Electric Locomotive Repair
In recent years, expert systems have become the most visible and the fastest growing branch of Artificial Intelligence. General Electric Company’s Corporate Research and Development has applied expert system technology to the problem of troubleshooting and the repair of diesel electric locomotives in railroad “running repair shops.” The expert system uses production rules and an inference engine that can diagnose multiple problems with the locomotive and can suggest repair procedures to maintenance personnel. A prototype system has been implemented in Forth, running on a Digital Equipment PDP-11/23 under RSX-11M. This sytsem contains approximately 530 rules (roughly 330 rules for the Troubleshooting System and 200 rules for the Help System), partially representing the knowledge of a Senior Field Service Engineer. The inference engine uses a mixed-mode configuration, capable of running in either the forward or backward mode. The Help System can provide the operator with assistance by displaying textual information, CAD diagrams or repair sequences from a video disk. The rules are written in a representation language consisting of nine predicate functions, eight verbs, and five utility functions. The first field-prototype expert system, designated CATS-I (Computer-Aided Troubleshooting System – Version I), was delivered in July 1983 and is currently under field evaluation.
A State Space Approach to Robotics
Two robotic systems for the filming of motion picture special effects and the measurement of spacecraft antenna performance are described. Both systems are programmed in the Forth language and use a common approach of state space methods to produce a highly modularized and reliable control program. As the robot revolution continues, robots are taking on new and unusual applications. Two new applications discussed in this paper are in the area of motion picture effects filming and spacecraft antenna pattern measurements.
Control of a Cartesian Robot
The work in control applications at the Laboratory for Perceptual Robotics has been directed toward a prototype CartesIan Assembler donated to the laboratory by General Electric of Schenectady, New York. The machine and some of the hardware interfaces are described along with low level controlling schemes for point-to-point position velocity control. An emulation of single axis controllers is shown to be an effective control method. Encoder positional information is the basis of this low-leve control structure, which will later be tailored for use with processors devoted to each axis. High level control issues, such as adaptive learning techniques, are addressed.
A Robotic Application for Contamination Free Assembly
Rockwell’s Electro Static Gyro Navigation (ESGN) System is built around a one gram beryllium ball that functions as a gyro rotor. It is round within four millionths of an inch and is electrostatically suspended in a cavity with only two thousandths of an inch clearance between the ball and the walls. The presence of a detectable impurity during assembly could cause an electrostatic discharge that would destroy the gyro. Cleaning by conventional methods typically took 25 hours. This paper discusses the mechanical construction and Forth programming of a robot arm that reduced the process to a 17 minute cycle.
Improvement of a Human/Robot Interface Through the Use of Forth
International Robomation Intelligence (IRI) manufactures a computer-controlled 5-axis robot arm for industrial uses such as machine loading unloading and parts transfer. IRI updated its computer operating system from the present assembly code version to Forth. This paper describes the usage of Forth for man-machine interfaces. User programming is accomplished via IRI’s simple and straight forward on- line Robot Command Language (RCL). Special emphasis will be placed on how Forth has been adapted to the production environment where the end user may have little or no programming experience. The approach taken emphasizes at all times the relationship between human and robot rather than the physical control of the robot itself.
Forth and Automation Research at The National Bureau of Standards
The National Bureau of Standards (NBS) is conducting a large research project in industrial automation. Automated control of manufacturing processes will be achieved through extensive use of computers. Some of the individual projects implemented in Forth will be described. Some Forth techniques used on each project will be highlighted.
Dynamic Processing of Analog Data Using an Apple Computer
GASCHROMATOGRAPH is a program that supports data acquisition from laboratory instruments using an Apple-ADALAB system with dynamic calculations of areas under the peaks for quantitative analysis. Requirements of the system are: an Apple II computer with 48k RAM, monitor, disk drive, printer, and game controller. Analog to digital conversion of the instrument signal with 13 bits of resolution is accomplished with an ADALAB interface board. The areas calculated by GASCHROMATOGRAPH are shown to be essentially identical to those determined by direct digitization of the area under a peak produced by the tracing on a strip chart recorder. The integration algorithms of GASCHROMATOGRAPH were designed for and are applicable to analysis of samples that are resolved completely by the chromatography system.
JFAR volume 1, issue 2
Implementing Data Structures in FORTH
This paper focuses on the application of Forth’s extensibility to implementing powerfuL versatile data structures. Use of CREATE … DOES> is briefly explored. Tools are introduced to change the residency of a structure to disk, map memory, vector generic structures, and control multitasking.
Message Passing with Queues
General message passing software for intertask communication has been written in Forth using first-in, first-out queues. These queues can be of any length, and either memory or disk resident. The disk-resident queues may be several blocks long. The width of a queue entry is also arbitrary and can range from a single byte to the queue length. This software was successfully used for intertask communication among the seventeen tasks of the Omega Laser Alignment System.
Vectoring Arrays of Structures
Writing a program module requires the specification of the interface between this and other program modules (or the operating environment). Since modularity implies that you can replace one module by another, a mechanism is needed to switch the definitions (data structures) that make up the program module interface. In this paper, a general way of switching the action of a set of Forth data structures (which can be thought of as a program module interface) is presented.
Multiple Code Field Data Types and Prefix Operators
This paper presents compilers for creating “intelligent” data types that have more than just one code field, as words in classical Forth do. These compilers introduce a prefix syntax into Forth to create a whole class of data structures, the first of which became known in the Forth community as the ‘TO’ concept in 1979.
A Portable Forth Random Number Generator
A portable high-level Forth random number generator is described. It is based upon Knuth’s FORTRAN function IRN55 and uses the tabular method of Mitchell and Moore. The Forth word and the FORTRAN subroutine yield identical long sequences of random double numbers.
The QUAN Concept Expanded
The QUAN (multiple CFA words) was presented by Evan Rosen at the fourth FORML Conference. This concept is very close to the TO concept but moves the selection of an EXECUTE routine from the execution to the compilation phase. The QUAN concept has been implemented in MMSForth V2.2 and extensions have been studied. The use of this type word for data hiding and implementation-independent applications will be investigated. Examples of the use of these concepts in practical situations will be presented. Using QUAN instead of VARIABLE leads to both time and memory savings. The resulting code is also easier to read with the removal of redundant @ and !. Experience with this concept in several projects proves the advisability of including it in the next Forth standard.
A Note on Bitmaps
Bit maps are an invaluable tool for handling 2-valued data such as disk free block lists and compressed database indices. They reduce index storage space by a factor of 8 over bytes, and can reduce the iterations for searching the indexes by a factor of the word length of the computer.
A Forth Finite State Machine
Finite state machines arise naturally in many applications and are a versatile, easy to understand structure to organize a control application around.
It is easy to write defining words to provide one (or even two) dimension arrays in Forth via CREATE … DOES>. Nonetheless. this leaves one in the position of having to write a new defining word for each size array as well as each data type. The attached code provides a defining word for generalized arrays of any size or type.
JFAR volume 2, issue 1
The R65Fl1 and F68K Single-Chip Forth Computers
The R65Fll, introduced mid year 1983, was the first commercially available single-chip Forth “engine.” It has remained relatively unchallenged in its market position for over one year. Other single-chip systems are under development. In all probability, near the end of 1984, the F68K will become the second single-chip engine for the Forth language, with an anticipated 20 times execution speed improvement in performance over its predecessor. This paper focuses on the design methodologies used in the development of the R65F11 and the new F68K.
A Forth Machine for the S-100 System
A three-board processor that contains a Forth interpreter executing on AMD-2900 bit-slice components, high-speed memory, and hardware stacks, has been designed and built for use in the S-100 bus environment. The Forth system operates independently of the S-100 system processor and memory, and can only be accessed from the bus by ports. The S-100 system processor is free to do I/O and the existing system uses the CP/M operating system to support the operation of the Forth system.
Forth Direct Execution Processors in the Hopkins Ultraviolet Telescope
Engineers at the Johns Hopkins University Applied Physics Laboratory have designed and built two computers that will control and monitor the Hopkins Ultraviolet Telescope, a 1986 Space Shuttle experiment. These computers implement a microcoded Forth nucleus in a word-addressed AMD 2900 series bit-slice architecture. All programs for them are written in Forth, which takes the place of assembly language in this architecture.
The Design of a Forth Computer
A relatively fast but simple computer architecture is outlined in which the machine language is very closely related to the high-level language Forth. Speed is obtained by the direct implementation of Forth primitives and the parallel operation of a sequencer, arithmetic logical unit, data memory, and stacks. Suggestions are made for certain improvements including the possibility of reducing the computer to VLSI.
QFORTH: A Multitasking Forth Language Processor
This paper presents the architecture of a computer designed to execute Forth language programs efficiently in a multitasking, single-user, real-time environment. Issues addressed in the design include a stack mechanism allowing high-speed primitive operations as well as dynamic stack creation and deletion, memory configurations tailored to the different requirements for code and data memories, and processor-controlled rapid context switching in response to interrupts and program events.
polyFORTH on the NCR/32
A very high performance polyFORTH II system implemented on the NCR/32 chip set was presented at the 1984 Rochester Forth Applications Conference. This article will clarify some aspects of the implementation.
Interactive Headerless Code
For certain Forth applications, a few words constitute the user interface, but the underlying supporting words are useful during development. There should be a simple method of creating headerless words or structures, while still maintaining an interactive environment, and without having to resort to complicated metacompilers.
JFAR volume 2, issue 2
Laser Beveling in polyFORTH
High-power thyristors capable of carrying 1000 amperes and of blocking up to 6500 volts, used for high voltage DC transmission applications, must have their edges beveled to have the lowest possible electric fields at their surfaces to prevent premature surface breakdown in reverse bias. A computer-controlled system has been developed for the General Electric High Voltage DC Transmission Operation in Collingdale, PA, to produce bevels on the edges of their high-power thyristors. The system uses an IBM PC connected to three micromanipulators and a Q-switched laser. Various laser-cutting algorithms coded in polyFORTH have been developed for beveling. Each algorithm requires different processing times and produces different quality bevels in terms of thyristor surface breakdown resistance.
The Use of Forth in the Instruction of Introductory Robotics
At the Digital Control and Robotics Laboratory at Wright State University, students use an implementation of Fig-Forth to design a teach mode control program for modified toy robot arms. This program allows the arm to be taught multiple trajectories of up to 100 points (unique arm positions) and then permits repeated execution of these trajectories. The program successfully realizes real-time position monitoring, motion-execution algorithms, management of the trajectory database and features a menu-driven, user-friendly operation. The hardware environment consists of the host PDP-11/34 minicomputer operating under RSX-11, and four LSI-11 microprocessor workstations. TASK4TH, a standalone derivative of Fig-Forth, is down-line loaded from the host into the workstation and is capable of supporting peripheral equipment which includes serial and parallel I/O and also analog-to-digital and digital-to-analog conversion. Toy robot arms with five degrees of freedom are connected to the workstations and have been modified to operate under computer control. Position detection is accomplished through analog-to-digital conversions on the outputs of Hall-effect sensors (mounted on the axes of rotation) and arm motion is accomplished by actuating solenoids via the parallel port.
An Intelligent Forth-Based Robotic Vehicle
A Forth-based robotic parts delivery system was developed at Stanford University as a joint masters project. An electric personnel carrier was modified to follow a tape track from workstation to workstation, where it would stop for a preprogrammed period of time. Closed loop feedback systems were implemented to control vehicle guidance and speed, and an ultrasonic sensor was used for obstacle avoidance. The vehicle recognized thin metal plates on the floor, enabling it to be taught to wait at a workstation or change the obstacle detection range.
Kitt Peak Multi-Tasking Forth-11
An overview of the Kitt Peak National Observatory (KPNO) real-time environment is presented. The eleven optical telescopes at Kitt Peak employ a variety of experimental instruments, including Fourier Transform Spectrometers and large array digital cameras, that impose a diverse set of real-time requirements. Presented next will be a historical perspective of Forth and KPNO over the last decade outlining the evolution of the embryonic version of Forth on an 8k mainframe (CDC), mini (Digital VAX-11 and PDP-11), and micro (Digital LSI-11) machines. The real-time attributes of Forth in general and KPNO multi-tasking Forth-11 in particular are discussed. Some details of the implementation of Forth-11 are presented to reveal the power of this real-time programming environment. Finally, the KPNO CCD camera system will be used to illustrate a complex real-time application of multi-tasking Forth-11.
In classical Forth, code is generated linearly in memory, and consists of appropriate, interwoven header and object code structures. To improve the memory usage characteristics of this classical dictionary structure, we have separated the headers from their associated object code to implement new header structures, supporting the removal of headers from memory when they are no longer required.
JFAR volume 2, issue 3
Forth Meets Smalltalk
Forth has certain inadequacies that limit its use as a general-purpose production language, particularly for building large applications. The object-oriented approach of Smalltalk-80 is used as a model for extending the Forth compiler to create a hybrid language. The resulting system permits definition of classes and objects in the manner of Smalltalk-80, and can be fully intermixed with standard Forth.
Stack Usage and Parameter Passing
Routines can use the arithmetic stack for parameter passing and for temporary storage. This paper describes a mechanism that formalizes stack usage by providing each routine with an “activation record”-like data structure, cf. Pascal. This data structure, consisting of a storage space and an arithmetic stack, provides an interface between routines and the arithmetic stack. The interface allows the flow of all possible data to and from routines, and offers extreme clarity of source code. The described implementation increases the execution time and the amount of generated object code by 10-30%.
Number Crunching with 8087 FQUANs: The Mie Equations
By long-standing tradition, Forth uses scaled-integer arithmetic in preference to floating-point operations, both because of its origin in the integer-rich world of process control and because of the inefficiencies of floating-point operations. However, scaling requires advance information on magnitudes, which is not always easily available in scientific calculations. In addition, the appearance of the 8087 numerical coprocessor has removed the stigma of inefficiency, and we have reached the point anticipated by Charles Moore, at which it becomes preferable to use floating-point operations. Taking the IBM PC BIOS software single-precision routines as baseline for the heavily numerical Mie equations, the 8087 is 115 times faster. Precision increased from one significant figure with BIOS (round-off error dominates in the recursive claculations) to agreement with published 6-figure values with the 8087. Because stack operations are fast on the 8087, while 8-byte stores and fetches are relatively slow, it pays to keep operands on the 80-bit-wide, 8-word- deep 8087 stack. It is, for instance, possible to replace two complex numbers with their sum and difference, without leaving the stack. The net result is a Mie-equation algorithm that produces a result in 15 minutes, compared to the 24-hour turnaround for a one-second CRAY-1 background run.
A Forth Profile Management System
A Profile Management (PM) system for source code control has been developed, which partitions source blocks. Profiles refer to sections of code which can be loaded by name, and whose status can be accessed through PM. Profiles can be subdivided, and a query language allows the user to create conventional load blocks from them. All profile information is embedded as commenting structures. The package occupies approximately 3k of memory with 35 source blocks, and has been effectively used to manage an application with over 4 megabytes of source code.
Patching the ONLY Structure on Top of Fig-Forth
The ONLY structure is by far the most powerful enhancement made to the Forth-83 standard. It expands the power of the vocabulary structure to become a truly useful software development tool. Dictionary searches can be limited to search only a group of five words if you so desire. This allows for much more modular programming, vocabularies becoming akin to procedures in Pascal. Scoping can be limited very easily as well, so local and global variables can have the same names.
A Group Construct for Field Words
Glen Haydon’s very useful field definition words are made more useful with the addition of a GROUP construct that allows the aggregation of several fields into a repeating group. This accommodates situations in which a record definition contains an array or more complex indexed structure that should be accessed symbolically.
JFAR volume 3, issue 1
Forth-Based Software for Real-Time Control of a Mechanically Scanned Ultrasonic Imaging System
CenterForth was used as the control software for an ultrasonic imaging system developed at GE/CRD. The system is an “Ultrasonic Macroscope” and is used in industrial “Nondestructive Evaluation” applications. It forms an image by mechanically moving an ultra-sound beam over the surface of the material under test. The beam is tightly focused at a constant depth below the surface to reveal flaw locations within the sub-surface slice. Image acquisition and display functions are performed by two Direct-Memory-Access controllers, using extended memory. Data input, output, and computation all take place concurrently. The system is fully interrupt-driven to free the 11/23 bus for DMA transfers (word transfer rates on the order of tens of KHz).
The application software (which runs on an enhanced fig-Forth-derived kernel) models the imaging system as a cyclic, sequential finite state machine. A state variable is derived from the image line-counter and governs the operations that the CPU must perform. Through the use of interrupts and flags, the output process (which synchronizes the entire operation) functions as if it were driven by an independent processor.
Routines were written to permit high-level access to extended memory and high-level interrupt handlers. Software debugging was facilitated by a “snapshot” routine which captured the “state” of the system. It provided a post-mortem display/dump of the sequence of events, state of flags, variables, etc., at the time each snapshot was taken.
This application was particularly well suited to Forth. Because of the heavy bus usage anticipated at high scan speeds, stand-alone operation is mandatory, regardless of the software environment.
Fast and Flexible Forth Programming in a Femtosecond Laser Lab
A software system has been developed in Forth to manipulate, control, acquire, and display experiments which are performed in a femtosecond dye laser laboratory. Requirements placed on the system are that it be user friendly while maintaining both flexibility and speed. The use of vectored execution allows one to satisfy these two requirements while keeping the number of user addressable words to a minimum. This system is currently in use measuring both optical and electrical transients in the terahertz frequency regime. Techniques that are used to control and display the experiments will be explained along with some typical results that this system gives the experimenter.
Stack Frames and Local Variables
The stack frame technique for dynamic local variable storage in Algol and descendant languages may be adopted in Forth to expand the number of elements easily handJed directly on the stack, reducing the need for variables. The required extensions to Forth can preserve the interactive quality of Forth by using the parameter stack exclusively and by using a built-in set of local variable names rather than an argument list compiler. Special techniques such as wildcard names, code pointer arrays, and modifications of TO can reduce the overhead involved.
Should VARIABLE be an Immediate State-sensitive Word?
We present an alternative to the word VARIABLE. In the absence of special modifiers, the word returns the contents. Previous use of modifiers allow the word to store or otherwise modify its contents. Unlike previous implementations the word is immediate and modifiers act at compile time allowing run time performance equivalent or superior to that seen with @ and !. The extension of this concept to arrays is also presented.
Readable and Efficient Parameter Access Via Argument Records
An Argument Record allows the input parameters and local variables of a high level Forth definition to be accessed by name. Method selection prefixes such as T then become widely applicable, allowing closer action object binding and reducing the proliferation of dictionary words as new data types such as floating point numbers and matrices are introduced. Such enhancements are of particular interest because they can be freely intermixed with classical Forth. Standard Forth techniques for describing compiler extensions prove to be an ideal tool for implementing these enhancements. A package that requires just 1200 bytes of dictionary space is sufficient to provide a wide range of facilities, and produces efficient re-entrant code.
Run-Time Error Handling in Forth Using SETJMP and LNGJMP for Execution Control
This paper discusses and provides two Forth implementations of the SETJMP/LNGJMP concept for error handling in applications which have words nested many layers deep. SETJMP and LNGJMP may be familiar to programmers who have worked with UNIX/C environments. A SETJMP is paired with a LNGJMP, which when executed later, will return control to the code following the SETJMP. passing an appropriate value on the stack. In essence, this creates the equivalent of the GOTO statement in Forth. In most Forth applications a word at each level returns an error or success code which is processed before continuing. The use of SET JMP!LNGJMP eliminates the nesting of IF … ELSE … THEN or BEGIN … UNTIL statements by transferring control to a level where all error conditions may be handled. SETJMP and LNGJMP may be nested to handle local as well as global situations. These constructs reduce code overhead and produce code which is easier to follow. SETJMP and LNGJMP are ideal programming constructs for error handling since they allow control flow to be optimized.
JFAR volume 3, issue 2
The MAGIC/L Programming Language
When Forth was created in the early 1970s, it represented a major change in the way programmers could think about their machines and the programming process. It allowed fully interactive coding and provided for almost unlimited extension of the environment. This has undoubtedly been an important breakthrough. However, there are a number of characteristics of Forth which can be problematic, especially where group productivity is concerned. Among these are its reverse polish notation and the tendency towards highly dialectical programming. MAGICIL, developed by Loki Engineering, Inc., combines the fundamental advantages of Forth with a stable syntactical structure and a full set of programming constructs, increasing efficiency in programming and project management.
Expanding the Forth Dictionary Beyond the 64k Limit by Using Bodiless Code
At the Kodak Research Labs (KRL), experimental test beds are controlled from Forth. The most complex test beds require a Forth system with a dictionary larger than 64 kilobytes of memory will allow. An existing Forth system, modified to produce bodiless code, now supports a dictionary of several megabytes. These modifications, which generate the bodiless code, provide a method to increase the dictionary space of a Forth system running on a computer with memory management capabilities.
Improving the Understandability of Forth Code
One of the most often vocalized complaints about Forth is that it is unreadable, and therefore unmanagable because no one but the original author understands it. An example of this is metacompiling, one of the least understood and most complex functions in Forth.
A Window System
This simple window system can be used with most ASCII terminals. Arbitrary rectangular regions of the screen may be defined as windows. Output directed to a window will be confined to that region of the screen. By assigning a different window to each task, tasks may conveniently share the screen without worrying about each other. The system also manages access to the keyboard so that multiple tasks may simultaneously request input without confusion.
An Alternate Forth Dictionary Structure
The data structures used for definitions and the word search of Forth can facilitate various utilizations of the same. My goal is completeness and efficiency. Constants or literals are stored separately so they can be hashed. The concept of a constant is enlarged so that the code string is a constant in the same sense as a text string. A constant is something that is self identifying and unchanging at the textual level. A colon definition is then a palrlng of a code string with a name. Only pointers to the two “constants” are kept in the definition entry (a pointer to the name string and a pointer to the code string). The various constant and definition records are implemented with tagged fields. This allows inspection of the entire record by any routine possessing a pointer into any field of the record. Additional optional fields are: Reference count, Comment pointer, Input type list pointer, Result type list pointer.
Conversion of a Token-Threaded Language to an Address-Threaded Language
After becoming spoiled by almost four years of experience with a token-threaded language, I find it difficult to imagine ever going back to an address-threaded language. Token threading gives me the flexibility of a metacompiler without the complexity. All code is relocatable. I can modify or delete words at the beginning of the dictionary without recompiling. I can eliminate the words not needed for an application before burning the application in ROM, and because garbage collection becomes a trivial problem, I can even eliminate the need for screens by decompiling object code and doing all my editing from RAM. Many of the tools I have come to depend on would be difficult or impossible to adapt to an address-threaded language. However, address-threaded languages do have a speed advantage over token-threaded languages for most applications. A compromise has been achieved that allows me to do all my development work in a token-threaded language and then use self-modifying code to convert the language into an address-threaded language for increased speed when the project is completed.
A Direct-Threaded Code TTL Control Unit
A hardware design for a control unit is presented, which utilizes TTL logic and fast CMOS Static RAM to implement a very fast version of DTC. The control unit is capable of sequencing the operations required for NEXT in one memory cycle and for DOCOL and SEMI in two memory cycles. A prototype of the control unit is currently being tested for performance evaluation.
A Forth-Based Object File Format and Relocating Loader used to Bootstrap Portable Standard LISP
For a quarter of a century, much Artificial Intelligence research has been accomplished using Lisp as the implementation language. Portable Standard Lisp (PSL) was created to support research activities on a wide variety of processors and operating systems. To aid in porting PSL, we developed an ASCII object file format whose relocation directives are essentially Forth language statements. A Portable Linker is then used to directly link compiled Lisp code normally dependent on the Lisp runtime system. Finally, since the object file contains Forth statements to handle final relocation of segments, we wrote a relocating loader in Forth to load and execute these “exported” Lisp programs. The PSL runtime system is ported by processing it with this system as just another exported program. This paper discusses the Forth-based object file format (which is general enough to handle other languages besides Lisp) and the Forth-based relocating loader.
A Multiprocessing Computer System Composed of Loosely Coupled Forth Micro-chip Modules
A Multiprocessing Computer System consisting of loosely-coupled Forth micro-chip modules is currently being developed at the School of Engineering and Computer Science at Oakland University. A network of 16 modules has been designed. The modules do not share any common memory and communicate with each other over a global bus — an 8-bit parallel bus with seven control lines. The system uses a layered protocol structured on the OSI Reference Model. The network is designed to support different types of micro chips operating at different speeds. The software support at the physical and data-link layers will have to be modified for the different types of micro-chip modules. In such a system, it would be desirable for one module to execute a word that has been defined in another module in the system. This is referred to as a Remote Procedure Call (RPC). In the system being developed, calls of this type are handled by the RPC layer which sits above the Data-link layer of the OSI model. The Forth words defined at this level are independent of the type of micro-chip being used.
A Microcoded Machine Simulator and Microcode Assembler in a Forth Environment
A Forth program that provides a design tool for systems containing a microcoded component was implemented and used in a computer architecture laboratory. The declaration of standard components such as registers, ALUs, busses, memories, and the connections is required. A sequencer and timing signals are implicit in the implementation. The microcode is written in a Forth-like language which can be executed directly as a simulation or interpreted to produce a fixed horizontal microcode bit pattern for generating ROMs.
A Micro-Based ASW Trainer in Forth
The author’s group at the Naval Surface Weapon Center is engaged in the development of a low cost desktop trainer for NAVY ASW Acoustic Sensor Station Operators. Each device is based on a Zenith 150 microcomputer, with the software being developed using ROHDA-Forth, the author’s personal implementation of the Forth language. Brief descriptions of the system being simulated and the Forth-based simulation are given. The paper then focuses on the productivity aspects of using Forth in the development effort. Particular areas discussed are the value of very high level coding (using the ROHDA-Forth Data Structures and Symbolic Function compilers) to expedite development of all coding for an initial pass, and use of trace facilities to achieve extremely rapid code development. Selected examples of coding from the project will be used to illustrate the use of the high level programming constructs and the trace facilities used in the software development.
Over a period of three years, a Forth-based system was developed by JPL for the operations of a major scientific instrument onboard the Space Shuttle. The software had to meet a very demanding operations environment where the the interactiveness of the software was not merely desirable but essential to the success of the mission. Forth was chosen for its capability of integrating divergent software needs into an interactive package. The mission flown in October 1984 was beset with numerous hardware failures and challanged the capability of the system to its fullest.
A Machine to Implement a Generalized Forth Environment
A microcoded design of a machine to implement a 32-bit Forth has been simulated. The addressing is segmented so that storage allocation and deallocation is quite general. Garbage collection and compacting of memory are supported. The design of the instruction set is in the spirit of the RISC (Reduced Instruction Set) machines, allowing stack operations and indexed access directly into the stack to produce a frame or register-like environment.
Forth Implementation of the Heap Data Structure
The use of the heap for memory management provides the Forth programmer with a versatile tool. Its use speeds program development at the conceptual level by allowing the program designer a means to consider dynamic arrays, garbage collection, and overlays; and at the implementation stage by providing a framework for easy manipulation of data structures.
Real-Time State Machine Implementation Programming Techniques
Experienced system designers readily admit that state diagrams are more useful in describing real-time automina than flowcharts. This is particularly true during the system definitions, when the actions of the machine are described in terms of the inputs and outputs and time conditioned responses. These same designers would be hard pressed to name even one source describing any method for generate programs from state diagrams. State diagrams have historically been the tools of the hardware designer, which may explain why published materials on conversion methods from state diagrams to computer programs (flow chart, pseudo-eode or high level language routine) are not widely available. This paper will attempt to identify why high level language programmers have lined up behind the flow chart (or pseudo-eode equivalent) and left state diagrams to hardware engineers and a few stubborn assembly language programmers. h will also explain at least one version of the rules used to design using state diagrams, and how to program from these drawings.
A Forth-Based Iconic Interface
This paper highlights the power of MacForth as a high-performance interactive programming environment for the Macintoch Computer, in developing an interactive interface for integrated databases. We present the main specfications and some implemented commands of a command language based on icons. Objects to be manipulated are represented by icons. Properties are attached to each object and are also represented by icons.
Interactive Videodisc Control and Computer-Based Training on the Apple Macintosh
This paper presents the use of a microcomputer to control the action of the videodisc player. This has the great advantage of allowing an instructional designer to create a complete course for the student, with remediation and branching, that can either be run by the instructor in a classroom setting, or by the individual student at his or her own pace.
The Design of a Low-Cost CAD/CAM System
There are a number of CAD/CAM systems available to Industry today, ranging in cost from approximately $25,000 to $300,000. These systems vary greatly in the hardware and software facilities which they offer to the potential user. The small companies that make up the majority of the manufacturing industry cannot, in general, afford the highly sophisticated systems. In many of these companies, the need to carry out complex analyses is not necessary. However unless the small company has access to this new technology at a reasonable cost, it will be unable to manufacture its products on a competitive basis.
Microcomputer Control of a Machine Tool
The requirement of a low cost Controller for Machine Tools, which could perform similar functions to more expensive systems, is necessary if small companies are to be able to use sophisticated techniques for manufacture. At the University of Waterloo, in the Department Engineering, a number of systems have been designed. varied both in the hardware, and software used.
DEBUGGER: The Design of a Test Aid to Support the Development of an Embedded Computer System
This paper describes the design of a Forth-based debugging aid that has proven useful in the development of a sophisticated real-time microprocessor based controller. The controller provides an interface between a militarized intelligent terminal, an auxiliary bubble memory, and a local area network. The computer programs supporting the controller operate in an interrupt-driven multi-tasking environment. The test support facility was implemented to assist in identifying and correcting programming errors in the controller software. We will discuss our experiences in the design of this tool and how it provides a programmer with a means of gaining visibility into the product under development.
There are some cases where the number of variables inside a procedure exceed the maximum that can be easily accessed with simple stack operators. Local variables are proposed to free programs from stack thrashing and spaghetti-like manipulation that can occur in programs with a large number of stack variables.
Forth Automates Intrinsic Viscosity Determinations
An automated system for determination of the intrinsic viscosity of polymer samples has been implemented in the Analytical Laboratory at SOHIO (Standard Oil of Ohio).
HFORTH: A High-Level Business Language in Forth
This paper presents some features of HFORTH, a high-level business language written in Forth, some recent applications, and the extension to THE ROBOT, a menu-driven program generator.
System Development Via Prototyping in the Analytical Laboratory
In the appropriate situation, the prototyping approach to system development offers lower risks to the software development manager than the traditional structured approach because it is more likely to produce a system meeting clients’ needs. l The iterative process of prototyping will be examined using the system for determination of intrinsic viscosity of ploymers, implemented in the Analytical Laboratory at SOHIO (Standard Oil of Ohio), as an example.
What’s Wrong With Forth?
Forth offers unusual control over the entire hardware and software environment, allowing design efficiencies far more important than its speed and memory performance. But some traditional coding practices have used this flexibility in ways which impede the development and maintenance of large software projects. And easy access to system facilities has too often allowed vendors to get away without providing complete application support for any particular purpose. The keys to improvement are modular software design, information hiding, and closure. We will have succeeded when programmers can join a project, then quickly come up to speed and contribute within a single section of a complex system.
An overview is given of concerns and techniques leading to the creation of a generalized meta-Forth system. Analysis shows that the meta process can best be controlled by a number of states in distinct environments. An integrated administration tool adds to the flexibility of the system.
Some Problems in Implementations of tbe Forth Standards
There have been many complaints about the Forth standards. These have been both from users and from those responsible for implementing the standards in commercial Forths. Complaints have even appeared in letters in major magazines, and have included such adjectives as “unuseable”. But the reasons for the complaints have been, in large part, unfocused. Many users’ complaints seem to stem from a wish that standard Forth “did more”, which reveals a misunderstanding of the purpose of the standards: to provide a minimal word set so as to allow writing of portable code (although one may argue what “minimal” means — for example standard floating-point words were called for even before Forth-79 was formulated). Perhaps a more basic user’s complaint is that small changes in Forth-83 (e.g. redefinition of ‘ and the termination of LOOP ) make it difficult to translate code and can lead to subtle bugs (e.g. with floored division) if the differences are not understood. The failure of the Forth-83 standard document to explicitly spell out differences aggravates this problem.
A Tokenized Rule Processing System
In examining rule processing in LISP we were struck with the crudeness with which text was treated. We have developed a rule processor in Forth in which the rules are strings of Forth words. Undefined words are automatically entered into a text vocabulary. As unknown words are entered into the vocabulary they are tested for the presence of special characters and English constructs such as ending with s. Words with appropriate construction are designated as one of 255 special classes. Clauses are compared on a word by word basis, each word being tested not only for equality but for synonyms. The processor will automatically equate regular plural and singular words and expand regular possessive forms. Special words allow rules to remember indeterminate antecedents and retain them during the testing of a rule. Articles and similar words are included in the clauses but not tested in matching clauses. Incorporating the syntactic processor into an available inference machine (Park, Mountain View Press) gives a flexible powerful knowledge system.
Concrete Suggestions for a Forth Floating-Point Standard
Many serious programmers dismiss Forth as unsuitable for professional work because it lacks standard floating-point (FP) Capability. Proposed here is a word set based upon two years of intensive use of the MMSForth words (including FQUANs and “long-addressed” variants) with the 8087 numerical coprocessor, with input from several other approaches. Most operations are the familiar Forth words preceded by an F, or a C for complex arithmetic. Short words are strongly preferred because of the natural length of FP definitions.
Plotter Drivers as an Exercise in Forth Wordset Design
Three levels of driver design are discussed for a typical X-Y plotter. A minimum driver merely permits Forth to mimic the plotter’s internal BASIC command set. A more elegant one transforms the same commands into a more Forth-like and more English-like word set. Finally, the command set is modified and vectored into the existing MMSForth TGRAPH (Turtle Graphics) utility. This transforms the plotter into an optional video screen to which one can output TGRAPH graphics routines without any modification. Demonstra tions will be given using the inexpensive Radio Shack FP-215 Flatbed Plotter. Source code for a simple Forth implementation is included, and can be adapted to many similar plotters
Forth in the Computer Numerical Control Environment
In order to help students grasp the concepts of computer-aided manufacture, a small Computer Numerical Control (CNC) workstation was built. It consists of a microcomputer, a vertical mill, a plotter, a printer and necessary interface electronics. The workstation may be controlled by means of either a Forth-based control language or a CNC language closely following the standards of EIA RS-358-B. Although the capacity of the mill is small and the resolution of the system is not consistent with industry standards, the workstation provides students with the desired experiences and also serves as a physical demonstration of the potential of Forth.
Under the Hood of a Superchip: The NOVIX Forth Engine
The NC4000P is a single-chip Forth Engine based upon minimum hardware concepts developed by Charles H. Moore. This highly parallel machine architecture directly executes Forth primitives in a single clock cycle. The initial implementation of this device is based upon a 4000 gate CMOS semicustom integrated circuit operating at an 8 MHz clock rate.
Forth for a Multimicroprocessor Control System
In our laboratory, a triple quadrupole mass spectrometer (TQMS) has been placed under complete computer control. A distributed processing system of several microcomputers were required to control the more than 30 instrumental parameters, acquire data and perform peak finding in real time. The software for this system was based on a standard Forth operating system.
Fifteen Programmers, 400 Computers, 36,000 sensors, and Forth
A large, recently completed Middle East Airport featured in its design a powerful, integrated computer system incorporating security and access control, fire and life safety monitoring, environmental monitoring and control, power distribution, fuel farm monitoring, water distribution, control of runway lights, and numerous related applications. The system is being supplied by Avco Corp., and is programmed in Forth by a team of programmers from FORTH, Inc. and Avco. This paper discusses some technical and management highlights from this experience.
A Versatile Software Control System For A Triple Quadrupole Mass Spectrometer
The complete computerization of a triple quadrupole mass spectrometer (TQMS) in our laboratory has been accomplished by a software control system that allows the operator to conveniently and flexibly control the instrument’s 30 parameters and 5 different scan modes. Forth has allowed us to create such a system by allowing the system programmers to tailor-make a command syntax specific to our application, while still allowing access to the Forth kernel and application primitives.
BASIC on Forth
Design is discussed of an implementation of the BASIC language on Forth. The program is changed to one long Forth executable statement. The data is separate from the program.
Implementing Forth for the Multics Operating System
Like many tools and subsystems on Multics, Forth resulted from a wish of one of its users (in this instance one of its developers) to add to Multics’s range of computation. After a period of development and some local exposure, such spontaneously generated software enters a stage of peer review and wider exposure that enables it to be considered for product review. Currently, a version of Forth that follows the design as described in the “fig-FORTH INSTALLATION MANUAL” by the FORTH INTEREST GROUP is in the local exposure state at MDC/CISL and is not yet scheduled for peer or product review.
A Process Monitor
This paper discusses a Forth implementation for monitoring, control and optimization of a medium-sized chemical process. The 68000 based program routinely collects on-line field data, performs absolute and deviation limit checks and stores data on a hard disk for future retrieval in graphic or tabular form. Routines for lab analysis and product quality management via CUSUM technique are provided. Both field and lab data are used to optimize conversions and yields. To quickly isolate and respond to plant upsets, field variables are organized and displayed as trend charts in groups containing up to eight variables. A top-down tree structure is used so that each variable in a group above is casually related to another group below. Forth screens are utilized as fill-in shells for customer reports and help files.
Object Oriented Extensions to Forth
The paper describes two iterations in the evolution of a set of object oriented extensions to Forth-79, based loosely on the syntax and semantics of Smalltalk-80. The initial inspiration for the project was a desire to create a structured data facility in Forth, equivalent to records in Pascal (as an illustration for a book chapter on Data Structures in Forth).
State Sequence Handlers
We describe a new type of sequence control structure which allows an ordinary: word to behave as a small state machine. The control structures may be freely mixed with BEGIN, UNTIL, etc., and with IF, ELSE, and THEN, with conventional nesting restrictions. The new structures include analogs of BEGIN, UNTIL, etc., as well as several other words which support terse, readable, state machine code.
From Bubble to Quick: A Forth Comparison of Sorting Algorithms
This paper compares generalized implementations of half a dozen sort algorithms in Forth. Examples of sorting integers and strings are used to illustrate the different methods. Even the faster sorts are coded compactly in Forth. The sorting algorithms take ite m numbers as arguments, allowing users to define their own EXCHANGE and COMPARE words. Informal guidelines are given for choosing an appropriate algorithm for your application.
Dynamic subroutine loading has been added to the local VAX implementation of Forth-79 that runs under the Berkeley dialect of Unix (so called “Princeton Forth”). This paper is about the semantics of how this might be specified and a sketch of how it was implemented here. Also mentioned are some of the problems that must be faced.
The Reed for a Standard Test Suite
A test suite is a set of programs used to assure that a compiler or programming language meets explicit specifications. A standard Forth test suite would bring many advantages to the Forth community. Ambiguities in the language of the standard would be resolved through example. Both users and system-authors would have a convenient way to confirm that their dialects meet standard requirements. And most importantly, dialects that could run the standard test suite successfully would be virtually assured of being code-compatible. In short, we feel that a standard test suite is a necessary step in the evolution of an effective Forth standard.
Forth in a Muon Channel with CAMAC Control
Control and diagnostic software was developed for M15, a recently commissioned surface muon channel at TriumF. Logistics gave rise to several efforts in several programming languages. This paper describes the Forth diagnostic package, and the choices of languages is briefly discussed. Several extensions to the Forth language, and the way they were put to use, are shown in the framework of a detailed account of the software implementation. The emphasis is on the production of readable code and on the design of constructs that most closely model the structure of the application.
Pragmatic VLSI Design Environment (PRIDE)
This report consists of the overview of the VLSI design environment created in Forth. The PRIDE program has been run on computers ranging in size from a TRS-80 Model I to a VAX-ll/780 and has been used for the design of over 10 ICs.
NAPLPS Decoding in Forth
The North American Presentation Level Protocol Syntax (NAPLPS) is a standard for encoding both textual and graphic information for videotex. Given a personal computer with hardware (either built in or added on) that can produce a display conforming to the standard, the actual decoding of NAPLPS-encoded data can be done in software. Such software decoder. have been written both experimentally and as commercial product. (primarily in Canada, where consumer videotex is more prevalent than in the U.S.). NAPLPS decoding is similar to recursive descent par.ing, but NAPLPS code does not always have the clean structure of a context-free language. There are awkward jumps and unexpected escapes possible. Forth lends itself readily to the task of NAPLPS decoding, gracefully handling both the straightforward parsing and the sudden shifts. An experimental NAPLPS decoder in Forth has been developed at the CBS Technology Center. We briefly describe the NAPLPS coding techniques, then explain the design and implementation of the decoder. The suitability of Forth for this task is illustrated and emphasized.
Controlling an Integrated Automatic Parameter Characterization System with Forth
An integrated automatic parametric characterization system for semiconductors has been developed in GTE COMMUNICATION SYSTEMS. The system consists of an automatic testing and measuring system, a database, and extraction algorithms for device parameter. This paper describes an automated system that fulfills these modeling tasks for existant and future technologies. The architecture of this system, the operation of the software, and a brief description of design methodology based upon Forth and the tradeoffs between Forth and BASIC for this application are discussed.
REvised REcursive AND? ‘REPTIL :IS
REPTIL represents an attempt to present a Forth-like language as a viable, pedagogically sound, alternative language for student programming at all levels. Since its initial presentation in 1984, it has been totally revised and is currently being rewritten. This paper is a review of the infrastructure and some of the structured features of REPTIL.
The technique of profiling an application program, that is obtaining statistical data on the length of time that the program spends in each of its component sections, is well known and allows time critical parts to be identified and thus optimized. Less obvious is the possibility that an entire operating system might be profiled. This is hardly practical with the majority of operating systems (even less, compiler), but the simplicity and virtual machine concept of a Forth system does lend itself to the in-depth analysis that profiling will allow. This paper describes such an analysis for a Forth-79 system.
Production Testing of Domestic Clothes Dryers Using LMS Forth
This paper describes the implementation of a semi-automated testing facility for domestic clothes dryers, with particular emphasis on the system functionality, and the approach taken for controlling asynchronous concurrent tasks.
Top-down Design in Forth
Top-down design and coding practices are central to effective software engineering. Forth provides a programming environment that can be readily modified and expanded to suit particular needs. This paper examines the relationship between Forth as a programming environment and the use of top-down design and coding.
Forth Implementation in a High-level Language
A prototype Forth interpreter has been implemented in Ada as a research project. The Forth interpreter is written to take advantage of Ada features, such as range checking, exception handling, and utility packages for string handling and numerical operations.
Measurement of Interrupt Response Time of PDP-11/44 and PDP-11/23 Computers with a CAMAC Interface
Comparison of interrupt response times for PDP-11/44 and PDP-11/23+ machines, using the Forth programming language, is presented. The interrupt response of the machines with Forth implemented as a stand-alone operating system is compared with an implementation of Forth running under the RSX11M operating system. The comparisons have been made on systems operating CAMAC parallel interface busses, both as single bus controllers (IEEE 583) and as parallel highways (IEEE 596), which require a branch driver interface.
An Implementation of MC68000 fig Forth under UNIX
The Department of Mathematical Sciences (the previous home of Computer Science at McMaster University) acquired three Pixel-80 computers in January 1984 for graduate and senior undergraduate teaching. The computers incorporate a MC68000 microprocessor and operate under the Unix operating system. The present paper summarizes the work done to implement Forth on the Pixel-80s.
JFAR volume 3, issue 3
A Microcoded Machine Simulator and Microcode Assembler in a Forth Environment
A Forth program that provides a design tool for systems which contain a microcoded component was implemented and used in a computer architecture laboratory. The declaration of standard components such as registers, ALUs, busses, memories, and the connections is required. A sequencer and timing signals are implicit in the implementation. The microcode is written in a Forth-like language which can be executed directly as a simulation or interpreted to produce a fixed horizontal microcode bit pattern for generating ROMs. The direct execution of the microcode commands (rather than producing bit patterns and interpreting those instructions) gives a simpler, faster implementation. Further, the designer may concentrate on developing the design at a block level without considering some of the implementation details (such as microcode fields) which might change several times during the design cycle. However, the design is close enough to the hardware to be readily translated. Finally, the fact that the same code used for the simulation may be used for assembly of the microcode instructions (after the field patterns have been specified) saves time and reduces errors.
A Forth Implementation of the Heap Data Structure for Memory Management
The use of the heap for memory management provides the Forth programmer with a versatile tool. Its use speeds program development at the conceptual level by allowing the program designer to consider dynamic arrays, garbage collection, and overlays; and at the implementation stage by providing a framework for easy manipulation o(such data structures. An examination of the highlevel code leads naturally to examples of these and other techniques of dynamic data management. The implementation presented here has been used for some time in our Forth-based version of the expert systems language, OPS5. This has resulted in faster execution times for OPS5 programs and has overcome problems in extending the language to the real-time domain.
Object-Oriented Extensions to Forth
This paper describes an extension to a standard Forth-79 or -83 system that enables programming with objects organised into classes (with subclass inheritance). Objects are activated by sending messages to them, following the model of Smalltalk-80.
Discrete Event Simulation in Forth
A Forth-based discrete event simulation system is presented, with words for scheduling events, executing the simulation, or optionally stepping through it. An example problem, the barbershop simulation, is presented and discussed. Forth is shown to have considerable advantage over implementation in conventional procedural languages.
Plotter Drivers as an Exercise in Forth Wordset Design
Three levels of driver design are discussed for a typical X-Y plotter. A minimum\ndriver merely permits Forth to mimic the plotter’s internal BASIC command set. A more elegant\none transforms the same commands into a more Forth-like and more English-like wordset. Finally,\nthe command set is modified and vectored into the existing MMSFORTH TGRAPH (Turtle Graphics)\nutility. This transforms the plotter into an optional video screen to which one can output\nTGRAPH graphics routines without any modification. Source code for a simple Forth implementation\nfor the Radio Shack FP-215 Flat-bed plotter is included, and can be adapted to many similar\nplotters.
JFAR volume 3, issue 4
Extending Forth in a Camac Controlled Muon Channel
Control and diagnostic software was developed for a recently commissioned muon channel at TRIUMF. Logistics gave rise to separate efforts in several programming languages. This paper describes the Forth diagnostic package. The choice of programming language is discussed briefly. Several extensions to Forth, and their usage, are shown in the framework of a detailed account of the software implementation. Emphasis is placed on the production of readable code and on the design of constructs that closely model the structure of the application.
Forth in the Computer Numerical Control Environment
In order to help students grasp the concepts of computer-aided manufacture, a small Computer Numerical Control (CNC) workstation was built. It consists of a microcomputer, a vertical mill, a plotter, a printer, and necessary interface electronics. The workstation may be controlled by means of either a Forth-based control language or a CNC language closely following the standards of EIA RS-358-B. The development of this workstation has been greatly facilitated by the use of Forth, which was used to test electronic driver and interface circuits, to control the plotter and mill, to form a basis for the Forth-like control language, and to implement the EIA standard CNC language. In addition, since the CNC languages are embedded in Forth, the support features of the Forth system are available to the user. The inherent transportability of Forth combined with a hierarchial modular design results in an implementation that is almost totally hardware-independent and very flexible. This project serves as an extensive demonstration of the utility of the integrated Forth environment in CNC applications
Exception Handling in Forth
Forth relies on the discipline of the progranuner to provide the benefits of structured languages: readability, predictability and modularity. A difficult class of problem for structured software is the handling of exceptions to the control flow, including errors. Even in properly designed software, a low level module may detect a condition whose proper resolution resides on a higher level. We describe a general implementation for exception handling in Forth that hides the inherent structure violation within a readable control structure which allows return from any nesting depth of Forth words and control structures. Further, this structure is itself nestable to any arbitrary depth.
State Sequence Handlers
We describe a new type of sequence control structure that allows an ordinary : word to behave as a small state machine. The control structures may be freely mixed with BEGIN, UNTIL, etc., and with IF, ELSE, and THEN, with conventional nesting restrictions. The new structures include analogs of BEGIN, UNTIL, etc., as well as several other words that support terse, readable state machine code. The normal state variable is replaced by an execution pointer, whose handling is mostly hidden in the source code. Application code never need supply a pointer value. DefInitions may be understood as standard Forth procedures, with the understanding that execution may “hang up” in one of the internal loops or called procedures until it is proper to proceed. Repeated calls to the main procedure result in repeated execution of the loop code or the called procedure until continuation is appropriate. The sequence control structures encourage structured code, make state entry and exit natural, and produce fast, compact, object code. They eliminate the need to assign and manage state numbers. The structures and several applications are described.
User-Oriented Suggestions for Floating-Point and Conlplex-Arithmetic Forth Standard Extensions
Governmental, industrial, and editorial acceptance of Forth requires that it conform to some recognized, formal standard, (preferably sanctioned by ANSI). Proposed here are standard extension wordsets for floating-point (FP) and complex (CP) arithmetic, based upon three years of extensive use (and rewriting) of the MMSFORTH words with the 8087 numerical coprocessor. The models for the proposed extensions are IEEE 754 for constraints and the HP-15C pocket calculator for scope.
A Wordset for Error Propagation Arithmetic
Experimental and observational errors propagate as data are transfonned or mathematically manipulated to produce quantities of interest. The mathematics of this propagation are simple, well known, but tedious to apply. Forth proves to be an ideal language for error analysis. Presented here is a short wordset that reduces the mathematical portion of the process (in contrast to its philosophical aspects) to routine coding, supplying the minimum propagated error of any data reduction nearly automatically. Additional words can be built upon the models supplied. Floating point capability is assumed.