Definitions Total control with LMI FORTH

12
Total control with LMI FORTH For Programming Professionals: an expanding family of compatible, high- performance, compilers for microcomputers For Development: Interactive Forth-83 Interpreter/Compilers for MS-DOS, 80386 32-bit protected mode, and Microsoft Windows''-' Editor and assembler includeO Uses standard operating system files 500 page manual written in plain Englisli Support for graphics, floating point, native code generation For Applications: Forth-83 Metacompiler Unique table-driven multi-pass Forth compiler Compiles compact ROMable or disk-based applications Excellent error handling Produces headerless code, compiles from intermediate states, and performs conditional compilation Cross-compiles to 0080. Z-80. 64180. 680X0 family. 80X86 family. 80X96/97 family, 8051/31 family. 6303. 6809. 68HC11 No license fee or royalty for compiled applications urn ' Laboratory Microsystems Incorporated Post Office Box 10430. /Wanna Del Rey. CA 90295 Phone Credit Card Orders to. l310l 306-7412 Fax. (3101301-0761 Definitions institute for Appiied Forth Research, inc. 70 Eimwood Ave. Rochester, NY 14611 Korsak,Andrew 504 Lakemead Way Redwood City, CA 94062 Bulk Rate U.S. Postage PAID Rochester, NY Permit No. 50 Definitions The Extensible Languages Publication i' Volume 1 No. 1 September/October 1993

Transcript of Definitions Total control with LMI FORTH

Total controlwith LMI FORTHFor Programming Professionals:an expanding family of compatible, high-performance, compilers for microcomputers

For Development:Interactive Forth-83 Interpreter/Compilersfor MS-DOS, 80386 32-bit protected mode,and Microsoft Windows''-'• Editor and assembler includeO

• Uses standard operating system files• 500 page manual written in plain Englisli• Support for graphics, floating point, native code generation

For Applications: Forth-83 Metacompiler• Unique table-driven multi-pass Forth compiler■ Compiles compact ROMable or disk-based applications■ Excellent error handling■ Produces headerless code, compiles from intermediate states,and performs conditional compilation

■ Cross-compiles to 0080. Z-80. 64180. 680X0 family. 80X86 family.80X96/97 family, 8051/31 family. 6303. 6809. 68HC11

• No license fee or royalty for compiled applications

urn' Laboratory Microsystems Incorporated

Post Office Box 10430. /Wanna Del Rey. CA 90295Phone Credit Card Orders to. l310l 306-7412

Fax. (3101301-0761

Definitions

institute for Appiied Forth Research, inc.70 Eimwood Ave.

Rochester, NY 14611

Korsak,Andrew

504 Lakemead WayRedwood City, CA94062

Bulk RateU.S. Postage

PAID

Rochester, NYPermit No. 50

DefinitionsThe Extensible Languages Publication

i'

Volume 1 No. 1

September/October 1993

SILICON COMPOSERS INC

The SC32 LIne-Up

8032*" 32-bit Forth Microprocessor■ 8 or 10 MHz operation.■ 1-cycle Instruction execution.■ Multiple Forth words per clock cycle.■ Contiguous 16 GB data and 2 GB code space.■ Stack depths limited only by available memory.

SBC32 (Single Board Computer32)■ 64 KB to 512 KB 0-wait-state static RAM.

■ 100mm X 160mm Eurocard size board.

■ SC/Forth32 Forth-83 based system Included.

PCS32 (Parallel Coprocessor System32)■ Full-len^h PC/XT/AT plug-in board.■ 64 KB to 1 MB 0-wait-state static RAM.

■ SC/Forth32 Forth-83 based system included.

DRAMI032 (DRAM, SCSI, Serial, ParalleO■ Eurocard size, piugs onto SBC32 or PCS32.■ Holds up to 16MB on-board DRAM.■ 16-bit parallel, 4 serial ports, time/date.■ Interfaces up to 7 SCSI devices.■ Software drivers in source code form.

FAD32 (A/D Converter, WatchDog Timer)■ Eurocard size, plugs onto SBC32 or PCS32.■ 16 channels, 12 msec, 12 bit plus sign A/D.■ Voltage generation, wdog timer, proto area.■ Software drivers in source code form.

655 W. Eveiyn Ave#7, Mtn View, CA 94041 (415) 961-8778

ENCODER PRODUCTS COMPANY

The Responsive People in Controls

Synergy Plus - An Intelligent Distributed Control System

+ Hardware

AlO 1218 - 8 inputs, 2 outputs, 16 digital I/O, PID routine

DIG 1248 - 48 digital I/O, +5 vdc logic

CTR 1224 - 2 high speed 24 bit counters, 16 digital I/O, 3 modes

SIO 1232-2 serial I/O, 16 digital I/O, RS-232/RS-485 options

ROM 1244 - Byte FIFO interface to IBM (Forth, Lotus, Windows)

• MCB 1290 - 2 axes of servo control, slaving, fractional ratioing* MCB 1290 plugs directly to any baseboard module via SBX

All modules Include SBX Interface, BItbus communications. Diagnostic LEDs,Watchdog, and many more standard features.

+ Software

Multitasking operating system (DCX pre-emptive)

Resident interactive programming kernel (Forth-83)

Resident development interface and editor

Disk-based library of application utilities

floating point arithmeticdynamic memory managementstate language programmingmessage passingobject oriented programmingmany more available for your unique application

Integration Services - Turn-key SystemsSystem specificationSystem designProgrammingInstallation

1601B Highway #2 • Sandpoint, ID 83864

Call 800-366-5412

E

September/October 1993

In Postscript these would be enteredas follows:

/DROP {pop} def/SWAP{exch}def/PICK (index) def/DEPTH (coant) def

This brings us naturally to the nextsubject of discussion: PostScriptderinitions. In order to cover them,

however, some interpreter details mustalso be covered.

Forth's syntax is remaricablyconsistent Everything is" a word or anumber, and these are separated byspaces. The <CR> terminates a line.Other than that, there are no escapecharacters. Individual words may have asyntax associated with them. Thecomment operator "(", for instance, parsesa comment out of the input stream^ butthe Outer Interpreter itself is pristinelyclean. It is a terrible temptation to"improve" this by adding characters withspecial meaning. Most Forth vendorshave resisted.

PostScript, however, approaches thisissue from a conventional programminglanguage stance - no syntax style issacred. Starting with the basic Forth ideaadditions are made. The nul tab <LF>

<CR> and space are considered whitespace. Unfortunately, exceptions oftenlead to more exceptions. The (.)<>[]{} / and % are special characters. Allothers are considered "regular"characters. The ( ) pair indicate a string.So does a / , but only one without anywhite space, called a "name". The {} pah-indicate a procedure. Notice white spacearound these special characters is notcritical, since they are control characters,rather than the names of routines.

Given this brief introduction to the

PostScript syntax, the definition structureshown above can be explained. Startingwith DROP, the / indicates a stringfollows, in this case the name of a routine

about to be defined. The { } brackets aprocedure which is put on the stack, inthis case the procedure calling a pop.Finally the defining word def takes theprocedure off the stack, the name nextdown on the stack, and assigns adds adefinition to the user's dictionary. Thisshould have a very familiar ring to thosewho have programmed in Forth, eventhough the details are slightly different.

Occasionally PostScript seems moreForth like than Forth itself. Forth does not

explicitly handle strings. This is left toindividual words to accomplish, such as"(" mentioned earlier. TTie colon, :,defining word in . Forth appears to work inprefix, since the colon comes firstfollowed by the name. If Forth had astring stack it could handle all suchmatters in postfix. ,PostScript, on theother hand, seems to remain true to the

postfix style. Its object orientationprovides for many kinds of things to be onthe stack, including in the example above,strings.

Another place this shows up inPostScript is conditionals. While Forthuses program control branching to handleconditionals, PostScript uses postfix stackoperations. The if operator in PostScripttakes a procedure from the stack andevaluates a Boolean below it If the

Boolean is true the procedure is executed.If not it is dropped. This is far moreconsistent than branched program flow.

Next time, sample PostScript code,and a real application.

•R. D. Dumse

Definitions 22 Vol. I No. 1

DefinitionsVolume 1 No, 1

September/October 1993Definitions is published 6 times a yearCopyright © 1993, Lawrence P. G. Forsley.Call for pomission to reproduce any material via print or electronic fcmnat

Table of ContentsArticle PageDefinitions, how to subscribe 5

Observation, Feynman on Top Down Design 61993 Rochester Forth Conference on Process Control 8

Vendor Column: New Micros, Inc 9

Forth in Space 11Vendor Column: Dash, Find & Associates 14

Consultants Spotlight: Gary Bergstrom 16Forth, C and C++ (part 1 of 3) 17

Palaeography of Extensible Languages (part 1 of 2) 19Postscript vs. Forth (part 1) 21

What is Forth technology?How do I program my laser printer in Postscript?What language really works for rapid prototyping?How do I find consultants or programmers ?Who really understands hardware and software ?How can I make Microsoft Windows work for me?What works in real time for embedded systems?

These and more questionsare answered in Definitions.

Subscribe Today!

Subscriptions are$25/year in North America, and$30/year outside North America.

Definitions is distributed bi-monthly by theInstitute for Applied Forth Research, Inc.,

70 Elmwood Avenue, Rochester, NY, 14611.

Definitions is published and edited byLawrence P. G. Forsley. Circulation andadvertising is handled by Brenda J. G. Forsley.Send inquiries to us at that address, or at our

phone: (7I6)-235-0I68

Advertising this issueAdvertiser Page

Dash, Find & Associates 14

Encoder Products, Inc inside back cover

FORTH, Inc 7

Forth Institute 4

Laboratory Microsystems, Inc back cover-

MicroProcessor Engineering, Ltd 17

Mountain View Press i.. 10

New Micros, hie 9

Offete Enterprises 12

Orion Instruments, Inc 15

Silicon Composers, Inc inside front cover

VME Inc 13

September/October 1993

Journal of Forth Applicationand Research (JFAR)

JFAR is the only refereed journal devoted to Forth-like languages. Specialtopic issues have included object orientedprograimning and real-time expert systems. Call for a complimentary copy!

JFAR Issue

Volume 2

Volume 3

Voliime 4

Volume 6

Q = $16.00 ,

#1 «2 #3 #4

□ □ □□ O □ QQ O a Qo a □ □

0 = $20.00 (ConfProc)

FoUSds:VohimelVolume 2VdumcBVolume 4VolumesVolumes 1-4Vdnmes 1-S

(3 issues)(4 issues)(4 issues)(4 issues)

Q $30.Q $40. Save%5.□ $50. Jove $15.□ $50. Save $15.□ $50. 5hve$15.□ $170.&ive$35.Q$220.5ave$50.

JFAR Snbscriptkms:

Volume 6□$ti0.00 lDdividnal.USA□$65.00 lDdividoal,No(di America□$75.00 Iridividnal, Emope/Asia□ $145.00 Coipocate, Notdi America□$160.00 Cocporale, Emope/Asia

Note: No addiliooal shqjping charges onSubscr^ons.

Order Form:

Name_j

Address:

City:.

State:. .ZfP:.

Phone Work:.Home:FAX:

Rochester Forth ConferenceProceedings

The international Rochester Forth Applications Conference has been held at theUniversity of Rochester for the past 13years and has been attended by as manyas 175 people from around the world.Most Conference Proceedings consist oflong papers by invited speakers addressing the Conference theme and as many as50 shorter papers on all topics of Forthapplication and inqilementation.

□ $25. 1981 Forth Standards□ $25. 1982 Databases & Process Control□ $25. 1984 Real Time Systems□ $20. (Wo\.3,n)m5 Software Produetivity□ $20. (Vol.4.#2) 1986 Real Time AI□ $20. (yol.5,1H)l9SlCompArchitecture□ $25. 1988 Prog Environments□ $25. IndustrialAutomadon□ $25. 1990 Embedded System□ $30. 1991 Automated Instruments□ $30. 1992 Biomedieal ̂ tlications□ $30. 1993 Process Control (faU'93)

Set of ai^ 4 or more PtooeeduigsSlave SSJProc., up to $60.!

□ $20.00 Fnth Ref BibliograiAy, 3id Ed□ $25.001988 ASYST Conference Froc□ $62.00 Stack Computers: the New Wave

By: Dr. Philip J. Koopman, Jr.□ $50.00 Scientific Forth

By: Dr. Julian Noblefwith software on disk)

Purchase Subtotal:Shipping Subtotal:($6./book,16 Max. North AmerictO

Grand Total:□ MC □ VISA □ CheckCard#E:q>iration Date:

InstitDte for Apiriled Forth Researdi, Inc.70 Ehnwood AvoiocRochester, NY 14611(716)-23S-0168 voice (716)-328-6426 fax720^.2111 @c(nnpuservcx(Hn email

Definitions 4 Vol. 1 No. 1

September/October 1993

How similar are PostScript, the pagedescription language, and Forth? Surprisingly so. Both languages fall well into thecategory of languages covered by Definitions. This column will be a brief tutorialcomparing the similarity of the two languages. A familiarity of Forth is assumed.

In the Postscript Language ReferenceManual, Second Edition, is written, "thePostScript language builds on elementsand ideas fiom several of the great programming languages. The syntax mostclosely resembles that of the programming language FORTH." In the First Edition the authors were perhaps a bit lesscomfortable with naming their heritage.In the opening preface they said.

Although the Design System language and its successors bear a superficial resemblance to the FORTH programming language, their conception anddevelopment were entirely independent ofFORTH

This disclaimer is completely missing in the Second Edition.

While I am not a Postscript expert, Ihave now designed several logos andspecial effects for my company. I found itonly took two weeks to make the transition firom someone who had heard ofPostscript, to someone who was a functional programmer.

In this issue of Definitions, I wouldlike to present some of the basic wordsthat are similar between the two languages. Later issues will cover more detail.

Both languages are postfix, havedictionaries, make named definitions, andhave an interactive outer interpreter. Tosee the similarities, a good place to startwill be looking at the stack operators.

Postscript offers eleven OperandStack Manipulation Operators: pop exchdup copy index roll clear count markcleartomark and counttomark. TheFORTH-83 Standard has nine stack manipulation words in the Required WordSet: ?DUP DEPTH DROP DUP OVERPICK ROLL ROT SWAP. While thestacks of Postscript have data typingproperties, the similarities are obvious.

Two sets of words have the samename, save capitalization: dup and DUP,and, roll and ROLL. Indeed, dup andDUP have exactly the same meaning inboth languages - the top item on the datastack is duplicated. The words roll andROLL do not have exactly the samemeanings. The PostScript roll is acounted roll, rolling up n elements jtimes. The Forth ROLL brings up the n-th element one time. Still, the underlyingidea is similar in both.

Other words have identical functions, but different names: pop andDROP, exch' and SWAP, Index andPICK, count and DEPTH.

It is easy to imagine redefining thenames of one language so the user of theother could easily cope with more familiarnames. In Forth this would be:

: pop DROP;: exch SWAP;: Index PICK;: count DEPTH;

•Definitions 21 Vol. 1 No. 1

Scpicmbcr/Octdbcr 1993 Scptcmbcr/Ociobcr 1993

1940 1950 1960 1970 1980 1990 2000

FUNCTIONAL

LANGUAGES

PROCEDURALLANGUAGES

EDSAC

Algol 68

Algol W

LISP

PrologSmalltalk

SML

APL

BASIC

FORTRAN

COBOL

PL/I

Pascal

Ada

Simula

MACROLANGUAGES . Mcllroy

^ TRAc I r- 'CP/M L — ExtensibleML,/| Languages

Figure 1. The evolution of some representative programming languages.

Extensible languages arose from thedesire of their developers to create small,efficient, and adaptable programming systems in response to the introduction of suchomnibus languages as PL/I which are meantto contain everything that any programmermight need. In other words, they can beviewed as an attempt to resolve thefjerennial controversy between proponents oflarge general-purpose and small special-purpose languages.

Extensible languages appeared in largenumbers in the late 1960s and early 1970s— Solntseff and Yezerski (op. c/7.) list over

a hundred in their review — and were aimed

at facilitating language extension throughthe addition of:

• new forms of access to data

• new forms of statements

• new control-flow constructs.

(To be Continued in next issue)

Definitions covers the unique worldof extensible computer languages. Nowhere else does such a diverse group ofcomputer technologies appear. More thandetailing the languages. Definitions isdedicated to the underlying technology.

Extensible languges at their verycore are fundamentally different thanother computer languages. Extensiblelanguages provide a good impedancematch between how we

think and how they repre-

sent knowledge. Like thevery DNA in our cells, ex- ^tensible languages employinterpreters which interpret Bthemselves. m

As such, these Ian-

guages are the key to com- -puting in the 21st Century.For several years Adobe's Postscript™has provided a device independent pagedescription language. Similarly. Sun Microsystems has developed and u,sed a device and processor independent Forthknown as Open Boot on nearly / millionworkstations. Recently. Philips announced their Interactive CD. which has a

Fonh-based authoring system available.Eastman Kodak uses the Philips discplayer technology for their new Photo CD.If you look under the hood, an increasingnumber of products are Definition based.

The survival and prosperity of programmers and engineers will increasinglydepend upon extensible languages and the

companies who provide them. Defini-tions binds together this diverse community by opening lines of communication.

searching out applications.and providing aforum for our success.

Whether polyFORTH™ in space onNASA shuttle missions, or Open Boot inSun Workstations: whether in Europe.Russia or China: we're there to report foryou providing a comprehensive overviewof Extensible languages like Keithley'sASYST™, for science and engineering:Opto 22's Cyrano™ for industrial control:FORTH Inc.'s Express, for process control: and Adobe's Postscript for page lay

out. Definitions offers you a chance tokeep up with and participate in the latestw developments in this^ field. Definitions is there

OJoin us!

Subscriptions are $25year in North America,and $30./year outsideNorth America.

Name:

Address:

Phone:

Payment: Payment:Q check□ MC □ VISA

A CCT#Expires:

Definitions is distributed bi-monthiyby the Institute for Applied Forth Research, Inc., 70 Eimwood Avenue, Rochester. NY. 14611. Definitions is published and edited by Lawrence P. G.Forsiey. Circulation and advertising ishandled by Brenda J. G. Forsiey. Sendinquiries to us at that address, or at ourphone: (716)-235-0168

Definitions Vol. I No. I Definitions Vol. 1 No. 1

September/October 1993 Sqjtember/October 1993

Ohscrvation

I- miiim oil ro|) Down

Dcsitiii

Top down neglects the need to playwith a problem, determining its dimensions and boundaries. The late Dr. Rich

ard Feynman, Physics Nobel laureate,was a member of the Rogers commissionwhich investigated the Challenger disaster. Feynman's review of the failure of atop down strategy, both technically and inmanagement, for the shuttle suggestssimilar difficulties with software. He

noted that unlike the shuttle.

Most airplanes are designed "fromthe bottom up," withparts that have alreadybeen extensively tested.The shuttle, however,

was designed "from thetop down"~to savetime. But whenever a

problem was discovered, a lot of redesigning was required in order to fix it. ̂

The fmal Presidential committee re

port to NASA identified both the 0-Ringfailure in the solid fuel booster and a

breakdown in management communicationas the* causes of the Challenger disaster.In an t^ipendix to that report Feymnanlooked at other subsystems, like the shuttle's three main engines:

The usual way that such engines aredesigned (for military or civilian air-crcft) may be called the component sys-

^ Quotations from Feynman, Richard. P.,"What do you care what other peoplethink?". Further Adventures of a CuriousCharacter.

tem, or bottom-up design. First it is necessary to thoroughly understand theproperties and limitations of the materials to be used (turbine blades, for example), and tests are begun in experimentalrigs to determine those. With this knowledge, larger component parts (such asbearings) are designed and tested individually. As deficiencies and design errors are noted they are corrected andverified with further testing. Since onetests only parts at a time, these tests andmodifications are not overly expensive.Finally one works up to the final designof the attire engine, to the necessaryspecifications. There is a good chance,by this time, that the engine will generally succeed, or that any failures are

easily isolated and analyzed because the failure modes, limitations

of materials, et cetera,are so well understood.

There is a very goodchance that the modifications to get around

^ final difficulties in theengine are not very hard to make, formost of the serious problems have already been discovered arui dealt with inthe earlier, less ejqjensive stages of theprocess.

The space shuttle main engine washandled in a different manner—top dawn,we might say. The engine was designedand put together all at once with relatively little detailed preliminary study ofthe materials and components. But now,when troubles are found in bearings,turbine blades, coolant pipes, et cetera,it is more expensive and difficult to discover the causes and make changes. ...Using the completed engine as a test bed... is extremely expensive. One does not

Palaeography ofExtensible Languages

Nicholas. Solntseff

McMaster University

INTRODUCTION

A language is a means of communication, so that the study of a language isreally a study of communication within agroup or culture that has created it.Programming languages, in common withnatural languages, are bom, evolvethroughout their lifetimes, sometimes dieand become extinct. Many languages thathave not survived to modem times appear tohave succumbed to abrapt environmentalchanges.

The aim of this note is to discuss

extensible languages and analyze Forth as anexample of an extensible system.

PROGRAMMING-LANGUAGE

EVOLUTION

The history of programming languages(PLs) can be divided into three periods:• ancient — before 1957,

• medieval — 1957-1970, and

• modem —1970 to date.

In her monumental work, Sammet^lists 130 programming languages inexistence before 1957. With few exceptions(notably COBOL and FORTRAN) thesewere various autocoders, assembler-like lan

guages, or m^ro processors. Most were theresult of research into Automatic Programming, the development of tools for computer-aided creation of programs.

The widely used programminglanguages of today — BASIC, C, COBOL,LISP, and Pascal, have their origins around

1J. Sammet, Programming Languages:History and Fundamentals, Prentice-Hall,

Inc., Englewood Cliffs, N.J. (1969)

"A group of people, a society, a culture Iwould define as 'people in communication.' They may be thought of as'sharing mles' of language, of custom,of habit; but who wrote those mles?

These have evolved out of these peoplethemselves — mles of conformity."

Colin CherryOn Human Communication,

MIT Press, 2nd. Ed. (1965).

1970. More modem languages are characterized by abstract data types, modularity, andsound theoretical foundations. One group oflanguages was first popular between 1965and 1975 — the so-called Extensible

Language^. In a real sense they served as alaboratory in which a number of modemideas were tried out and developed.

The evolution of a few representativeprogramming languages is shown in Fig. 1

EXTENSIBLE LANGUAGES

In an extensible language, both syntaxand semantics of the base language can bechanged by the end user, who can create atarget language that contains only thefeatures that he needs to solve the problemat hand. Extensions are defined by means ofa metalanguage that operates on thelanguage processor. The main features thatdistinguish extensible languages fromconventional ones are:

• symbol tables are not discardedafter the lexical phase

• the compiler can be invoked at mntime

• some or all phases of compilationcan be changed by means of themetalanguage.

^N. Solntseff and A. Yezerski, "A survey ofextensible programming languages," inAnnual Survey of Automatic Programming,

Vol. 7, (part 5,1974), pp. 267-307.

Definitions 6 Vol. 1 No. 1 'Definitions 19 Vol. I No. 1

September/October 1993

nrtoeProForth for Windows• Handle Windows with ease

• Create a window in 4 lines of code• Use Windows interactively

ProForth is a 32 bit Forth for Windows 3.1 and Windows NT ProForth

provides an interactive development and debugging environment for Windowsapplications. Simple structured definitions for GUI objects and dialog boxesmakes programming Windows easy. U«ng ProForth, turnkey applications canbe generated that can include the use of timers and multitasking as requiredfor reed time development. Hardware floating point is also supported.ProForth has a 700 page, comprehensive, step by step manual euid a largenumber of source code examples.

Forth Cross CompilersUse yoiu* PC to edit and compile Forth source code, then download and

debug it interactively on a wide range of target processors.

Microprocessor Engineering Limited133 Hill Lane, Southampton SO I 5AF England

Tel: +44 703 631441 Fhx : +44 703 339691

limited memory without an operating system, were most frequently mentioned.Another "crippled" environment is aworkstation during the boot process. TheSun Sparc station boots into a variant ofForth before launching Unix. This systemallows developers and system administrators to talk to hardware in ways whichwould be impossible once UNIX islaunched. Printers running Postscript represent another "crippled", embedded environment where threaded, interpreted languages have proven successful. A fourtharea where Forth is successful involves

systems which attempt to push hardwareto the absolute limit such as specializedimaging systems. Here Forth chips canprove competitive. Again, systems whichpush hardware to the limit in one area,such as imaging, usually do so at the ex

pense of other services. They offer onlyrudimentary operating systems and otherservices. Again this represents a"crippled" environment.

The consensus was that for large projects developed and running onworkstations or personal computers, Cand C++ represent a superior environment. This conclusion suggests that Forthhas lost the main stream to alternative

languages. Given Forth's natural advantages of interactiveness, extremely rapidincremental development and interpretiveability to examine structures, it is surprising that Forth is not better accepted as amainstream language.

Next Issue: Forth's tradeoffs vs. C andC++.

Definitions 18 Vol. 1 No. I

September/October 1993

wish to lose entire engines in order tofind out where and how failure occurs.

A further disadvantage of the top-down method is that if an understandingof a fault is obtained, a simple fix-suchas a new shape for the turbine housing-may be impossible to implement withouta redesign of the entire engine.

The current method of software de

sign is also top down design, and topdown coding. One is expected to build toa specification and the code flows.Indeed, in large software projects thereare software analysts who design, andcoders who program. The programminghierarchy goes from specifiers(managers), to designers, to coders, todocumentors to maintainers.

Consequently, there is ample roomfor miscommunication among the manylevels. Indeed, the code maintainers mayhave the clearest idea of what is beingdone, but this is rarely passed back to thedesign team: and even if it is, its far toolate into the product.

Fortunately, Forth offers an alternative software methodology. One can dotop down design and bottom up coding,adopting a methodology of iterativedesign. Iterative design is even moreimportant where specifications areincomplete or changing, which seems tomore often be the norm than the

exception. This methodology also allowsrapid prototyping.

- by L P. G. Forsley

Future articles will examine actual

software projects.

From NASA space systemsto package tracking forFederal Express...

chipFORTH...gives you maximumperformance, total controlfor embedded applications!

&

• Total control of target kernelsize and content.

• Configurable for customhardware.

• — compiles and downloads entire program inseconds.

• Includes all target source, 'extensive documentation.

• Full 32-bit host, interactivedevelopment from any DOS-based PC.

Go with the system the prosuse... Call us today!

FORTH, Inc.111 N. Sepulveda Blvd, #300Manhattan Beach, CA 90266

1-800-55-FORTH

-Definitions 7 Vol. 1 No. 1

Septcmbcr/Ociober 1993

I 1993 Rochester Forth

Conference on Process

Control

The 13th International Rochester Forth

Conference was held at the University ofRochester June 23 - 26. The Conference

was sponsored by Bradley Forthware.Inc., New Micros. Inc., Miller Microcom

puter Services. Inc., and Dash, Find &Associates. Over 30 papers were presented. Among them, author Dr. JulianNoble presented a paper on accidentreconstruction. Representatives fromJohns Hopkins University AppliedPhysics Laboratory discussed thedevelopment of Fonh architecture.NASA focused on the realities of

spaceflight and software. FORTH, Inc.demonstrated their latest polyFORTH

based-product for process control, EXPRESS.

Working groups concentrated on Forthprocessors and state machines. This

year's annual 4K run had its largest set ofrunners, strollers and bikers ever. Ven

dors Day included full hour seminars onExpress by Elizabeth Rather at Forth. Inc.and Open Boot by Mitch Bradley, ofBradley Forthware. Inc. A rousing "ForthFeud" trivia night closed the Conferencefor this year.

The Conference Proceedings will beavailable in the fall from the Forth Insti

tute. See their order form for details.

4K run, roll and stroll

Definitions 8 Vol. 1 No. 1

September/October 1993

FoHhy C and

Twelve years ago. when the Rochester Forth conferences began, typical personal computers were systems poweredby 8 bit processors. Storage consisted oftwo small floppy disk drives and memorywas typically 64 Kb at best. In such a system it was difficult to imagine developingwith a sophisticated compiled languagesuch as C or Pascal. The major competition for Forth was interpreted BASIC.

Today typical |personal computers Forthhave as much power as andmainframes of that era

possessed. Todays per- Csonal computer has a Part 1 of 332 bit processor, atleast 8 Mb of memory,a relatively fast hard disk holding on theorder of 100 MB. Today compiledlanguages work well in this morepowerful environment. Proponents ofForth must argue its merits againstpowerful competing languages. In addition, modem compiled languages nowhave debuggers which allow developers tostep through the code and browse datastructures. The capabilities of a modembrowser give C and Pascal developers access to many of the capabilities Forthprogrammers have enjoyed in interpretedmode.

Modem programs are changing aswell. Windowing, graphically based programs have become the norm. These programs are large and sophisticated. It is notunusual to see programs with 500K ormore of code requiring 2-3 MB of storage.

^ExcenXed from "Woiking Group cm C andC++", Proceedings of the 1992 Rochester Forth

Conference on Biomedical Applications, pp113-115. Chaired by Dr. Kent Brothers and

written by Menace Sunmcnis.

These applications are an order of magnitude larger than those we would buildtwelve years ago and raise new issues asto what are the typical design drivers.

Classical developers tried to getmaximum performance out of a systemwith limited resources. Classical systemswere limited in terms of memory, diskspeed and processor speed. Developersworked to use these limited resources to

maximum advantage choosing the bestsystem to maximize their own and their

system's capabilities.1 Today the limiting factor

in software development isthe developer. While thecapabilities of today'ssystems have increased by

<f3 I orders of magnitude over' earlier systems, developers

have not gotten any smarter. Today andincreasingly in the future the successfulsystems will be those that maximally aidthe developer.

%

In the near future, we can imagine

systems where incremental compilationand linking of C or C++ programs is e.s-sentially instantaneous. Already someenvironments such as Think C on the

Macintosh comes close to this goal. Inthis era, Forth's advantage of incrementallinking and immediate execution isgreatly reduced. It is time to reexaminethe assumptions underlying selection ofForth and ask how Forth will fit into a

Forth was acknowledged to be superior and where C++ was a better system.In collecting a list of Forth success stories, a common theme emerged. Fonhwas the system of choice in environmentsthat would be considered "crippled" compared to the capabilities of modem personal computers. Embedded systems,functioning on limited hardware, usually

Scplcmbcr/Oclobcr 1993

Gary Bergsirom

Gary has been known to the Forthcommunity tor almost ten years through

his ct)nsulting and the R(x;hester ForthConferences. He has an excellent back

ground in analog and digital engineeringwith over 10 years of Forth programmingexperience as well as ASYST, As-•semblers. C. and QuickBasic. He also

has engineering management experience.Gary earned an MSEE in 1977 from OhioState and a BA in Physics from Wittenberg University. He has one patent.

As a consultant he has specialized indesign consulting for analog and non-linear circuits, digital designs including mi-cnx-'omputers and digital signal proces,s-ing and in .software emphasizing data acquisition and real time systems. He hasspecific instrument, audio, and biomedi-cal applications experience with bothhardware and software. He prefers not towork on military projects.

Gary is well versed in F83. Microprocessor Engineering's Forth, and NewMicros' Max-FORTH. He is familiar

with .several micropnKessors includingthe Intel 80386 family. NEC V25, Mivtorola 6809. 68HC11 and 56(KX) DSP.

Gary notes:

/ Httr the manager of sofnwre atOrion Research hut I still did a lot of thesoftware. I like to get my hands dirty.I'd rather do the work than manage agroup of people. My business is structured the .tame way. I like systems thatare small enough for one person to understand the whole system. All one per-.son jobs are much more efficient.

His considerable experience withboth Forth and C has led him to observe:

Trying to factor things is difficult inC. You tend to write in monolithic

chunks. I try to write in as small a chunkas I can.

The president of New Micros. Inc..Randy Dumse. recommends Gary highly:

Gary developed our V25 Forth,among other things. Generally, when youhire a con.sultant, it's hit or mi.ts. Most

fall far short of the mark. Ocassionally,you'll get about what you pay. On theother hand, I always felt I got more thanmy money's worth dealing with Gary. Henever did less than a first-rate Job.

He is available for project or productdefinition, electronic design, prototypedesign and construction, manufacturingsupport and d(x:umentation. He is quietlycompetent and a pleasure to work with!

Consider Gary Bergstrom for yournext project!

You can reach him through:

Dash, Find & Associates70 Elmwood Ave

Rochester, NY 14611

{716)-235-0I68

Definitions Vol. I No. I

Scpicmbcr/Ociobcr 1993

I New Micros, Inc.

New Micros, Inc. in Dallas. Texas is

hard at work doing yet another customproject. New Micros makes approximately 40% of total sales, the largestsingle sales category, doing custom systems. Their approach of putting Forth inside single chip computers is unique inthe community. As a busine.ss strategy ithas proved .successful. New Micro's salesdouble every few years.

l*S*l ̂ ^p:: : Brc: : gJi: :: i31. ■»»- . . Bm- , . Bfii- • ^

|: aw I : m : : TOi: I:

NMIXYT-0()2I Board Layout

New Micros is forming a new partnership with the U.S. arm of CrouzetCorporation, the French founded multinational company, who recently pur-cha.sed GORDOS. Crouzet is .seeking toexpand its reach in the single board con-trt)ller and PLC markets. They are lookingfor the technology New Micros has dem

onstrated the ability to deliver to the market.

The president of New Micros. RandyDum,se. has been with the Forth community for a long time, having fi rst developed the RtKkwell R65F1I Forth microprocessor which was a 6502 core withForth in ROM, followed by New Microsown F68HC11 with Max-FORTH inROM on a Motorola 68HC11 core. Hiscompany carries a full line of single boardcomputers and I/O boards, including both8 and 16 bit microprtxessors.

New Micros is geared to customization. Recently they were working undercontract to Crouzet to automate anotherunnamed company's check printing machine. The specifications seemed simpleenough: a driver roller advanced the paper. and an independent print wheelwould start and stop to lay the signatureplate down on the checks. It had to have1/12 inch repeatability, since people likechecks to be printed accurately and theembossing plate to strike a signaturewhere the signature is expected. However. specifications have no patience forthe real world.

Randy and Ron Lovelady. ofCrouzet. went through several iterationsof optical and magnetic transducers tocount pulses from a gear and Randy wrotecode to take into account the slack in therubber drive bell. At one point he developed an adaptive system to compensatefor the ever-changing belt tension. Finally. the greate,st difficulty was identified.

Two sensors were used on the printshaft, one to indicate a home position, areliable index point, and. another to resolve a single revolution into 30 counts,12 degrees each. The print shaft had toaccelerate from a dead stop to match thedrive shaft speed in only 1/4 a revolution.

Definitions Vol. I No. J

Scplcmber/Ociober 1993

THE FORTH SOURCE

Hardware & Software

MOUNTAIN VIEW

PRESS

Glen B. Haydon, M.D.

Route 2 Box 429

U Honda, CA 94020

(415)7470760

This took fuil power. The inotor had to bespeed controlled for another 1/2 revolution while the print was laid down. It thenhad 1/4 a revolution to come to a hard

braking stop. Since the drive belt couldstretch, the sudden stop caused the wheelto vibrate when settling. If the gear toothwas under the sensor, the count was off.

The tooth was being counted multipletimes. The problem was resolved by lopping off a gear tooth.

Since there was no point in attempting speed control during the full acceleration, or during full braking, the unnecessary teeth were removed. Only thosesensed during speed control were kept.

Eventually, they had a printer whichwas repeatable, and fast! Total programdevelopment time was less than threeweeks. The development system for thistask consisted of Max-FORTH 3.3 on a

F68HC11 single board computer with textfiles downloaded via Mirror on an IBM

PC compatible laptop. Ron. chose a custom version of the NMIT-(H)21 singleboard computer which includes 8K RAM,22 parallel lines, 1 synchionous and 1asynchronous port, and an 8 channel 8 bitA/D. The A/D wasn't required for thisproject and the final board won't need theoff-chip 8K RAM. The RS-232 conversion and power supply circuitry of thelarger NM1X-(X)22 were added, and somecustom conditioning put in place on theinputs. Additionally a fully custom interface for the drive motors was hand built

for the prototype. It consisted of an "H"bridge driver for each motor and connectors to the micro and the motors.

The interactive Forth debugging cycle offered clear advantages over targetcompiled C or assembly language. Having a development system on the targetidentical to the final system also eliminated the effort of switching between development and target systems, as well asan additional step in porting to the finaltarget, and maintaining it. A service diagnostic routine was built in, and a back

door provided to allow field modifications. The expected upgrades could bemore easily tested with a complete Forthsystem on chip. An 8K Forth kernel inROM, either on-chip or off, is an engineersaver!

The NMIT-0021 is available for the

single unit price of $75. Quantity discounts are available. Custom versions are

available too.

Call (214)-339-2204 for New Micros, Inc. 1601 Chalk Hill Road. Dallas

Texas, 75212-5804

Next issue we will present new information from New Micros on their

68HC16 CPU, and later, the RS-422

Multi-Drop Drop Points.

Definitions 10 Vol. I No. 1

Septcmbcr/Ociobcr 1993

Recruiting

We handle full time and consulting

placements. We draw from files thatcover the Fonh community worldwide. Ihave met or worked with many of thepeople in our files through Conferences,publications and consulting. Since I haveexperience as a programmer/engineer,end-user and a manager, 1 have a uniqueset of both technical and human resource

skills in the placement field.

We charge agency rates for full timeand consultant positions.

Let us put these skills to work forYOU.

Associates

Each month we will highlight a different Associate. This month, we're

bringing to your attention Mr. Gaiy Berg-strom. You may contract with our Associates either through us. or with them:there is never a placement charge for anAssociate.

If you are a consulting engineer, programmer or scientist, and would like tolearn more about our Associates program,please contact us. We are always lookingfor good people for our clients.

Contact us at:

Dash, Find & Associates70 Elmwood Avenue

Rochester, NV 14611

(716)-235-0168 (voice)(716)-328-6426 (fax)

72050.2111 ©compuserve.com

Orion 8800 Emulator/Analyzer

80C196,6830268EC000,68HC11

Open 32-bit protected nnde Forthoperaiing systencs

Full-speed,zero-wait-siate enulation

64 K real-time trace without stopping the CPU

Clip-On Enulation™ forsoldercd-in processors

' Up to 2 Mbytes of enulation memory

■ Super-fast parallel interface (I28K<2 see)

' XRAY.XDB and Siena Systems support

Call today form)re Utemiureand

askforyourh'REF.copyqfour

new guide. "R&ii-Tune

— — ® l^hugging Teciinkjues".

INSTRUMENTS Fax: 415-327-9881

• Definitions 15 Vol. 1 No. 1

Scpicmbcr/Ociober 1993

Y^oclt ITSnfl Xr including: interviews withliaSn^r r inu OC- marketing, sales, and engineering staff, as

Associates I well as reviews of hardware and software,i iTiTmiTiYimi'l gjjj (jijcussions with users. We observe

production, testing and shipping. We

Technol(^ Brokers ^ summ^ presentation on the lastday. and provide a 10 page report.

Technology brokering meansbringing products and people together in T«:h Check we found that anew ways. We specialize in helping cli- developed a multi-tasking op-ents find these ways,/nsr. Because <rf crating working out trf hank

sthis, we specialize in using Forth technology for rapid prototyping, as well as Forth

witched memory in a hand held computer. Unfortunately, the most precious

derivatives like Keithley's ASYS1™ and tniswitched global bank.which was largely consumed by the overAdobe's Postscript™. We provide a range

of services from recruiting to consultingto marketing.

My associates can handle softwareand hardware, digital and analog, programming and technical writing, productspecification and projectmanagement. We'vecreated joint ventures in ^Russia. We've been w . __

called to give expert LJ^H, t^lNDwitness testimony in a associatesmultinational trial.

head of

If you wish to extend an old product,increase staff productivity, bring a newproduct to market, educate your customers, find new customers or new products:Dash, Find & Associates can help you.

I am Lawrence P. G. Forsley, and Iown Dash. Find & Associates.

We have the connections to getthings done, fast!

Tech Checks

Technology checks, or Tech Checks,give a new perspective on what you aredoing right and help you find ways towork smarter. We review your goals anddirection, and assess your people, [ro-gram and product. A tech chock takes 3

the multitasker. Consequently,code was moved from the global bank andwas duplicated in several banks. Thisused up data space, and the product beganto lose marketshare.

We identified this bot-

tlencck, and devised a

method of executing codefrom bank memory, where a

^IND bank context switch oc-A^T E"s curred with the execution of

a polyFORTH word. Thisnew code freed up 64K of bank RAM fordata, allowing the client to regainmarketshare. Because of the the Forth

return stack, programs could be nestednearly without regard for what bank theywere in: the calling bank information wasalways preserved. ̂

Subsequently, over 20,000 hand-heldunits with our bank select code have been

sold, at a value of over $60 million!

Consider using our insights in your

' For more information on this project, see "BankSwitched Code for Embedded Systems" in theProceedings of the 1990 Rochester ForthConference on Embedded Systems, which isavailable from the Forth Institute.

Definitions Vol. / No. I

September/CXitobef 1993

Forth in Space

Silicon CcMnposer's 32 bit Forthprocessor, the SC32, was launched onOctober 6, 1992 in a Swedish satellite

sent into a polar orbit to study the Earth'smagnetosphere. The SC32 was developed at the Applied Physics Laboratory atJohns Hopkins University during the pastseveral years for low eanh orbit experiments, and then licensed by Silicon Composers as a commercial processor. It wasdesigned into the Swedish satellite, Freja,which was launched by a Chinese LongMarch n rocket on October 6, 1992 from

the Gobi Desert. Rumour has it that

President Bush's signature was requiredfor the 32 bit processor export license toChina for the launch. Two of the seven

experiments in the Swedish Satellite hadForth processors: a German instrumentused a Harris RTX processor and the USmagnetometer used the SC32.

The Forth processor was a standardSC32 capable of running with a 10 Mhzclock, but reduced to 4 Mhz to allow the

use of slower memory with lower powerrequirements. It was configured with 256Kbytes of EEPROM and 256 Kbytes ofRAM, all addressed as 32 bit words.

There was one 16 bit AJD with a 50 usec

conversion, and one serial channel for

downlink telemetry. Engineers BenBallard, Bob Henshaw, John Hayes,David Lohr, Robert Williams and MaryWong designed the hardware and wrotethe software.

The magnetometer has sensors on 3axes, and measures the Earth's magneticfield. Each axis is sampled at 256 hzwith a low pass filter for a total of 3 DCsignals and 3 AC signals. A special ZFFT channel is sampled at 512 hz. Ahardware digital filter operates at 128 hz

Swedish Satellite, Freja

The magnetometer has sensors on 3axes, and measures the Earth's magneticfield. Each axis is sampled at 256 hzwith a low pass filter for a total of 3 DCsignals and 3 AC signals. A special ZFFT channel is sampled at 512 hz. Ahardware digital filter operates at 128 hzand a digital software filter operates at 64hz to remove additional aliasing whenrunning at the slow telemetry rate. A 512point FFT is performed once per second.All of this data had to be downloaded

• Definitions VoL 2 No. I

September/October 1993

over a link whose data rate was either 28

kbits/second or 14 kbits/second, which

corresponded to either 256 or 128 samples/second. A background task was written to count the number of telemetry interrupts/second to determine the data rate,and reconfigure the hardware accordingly.

The overall data collection rate was

2816 16 bit samples/second (45,000bits/second), or 24 megabytes/day. Thetelemetry downlink to a ground station inNorthern Sweden was limited at times to

a third of this value, so the Forth flightsoftware computed the FFT and could addspectra, which were sent on average every2-3 seconds.

The satellite has been continuouslytaking data since October. It waslaunched during a solar storm, and earlyscientific data indicates that it could act

as an early warning system for solarflares. This is of great interest to power

Offete EnterprisesHighlightseForth and Zen,

C. H.Ting, $15.The First Course,C.H.Ting. $25.

The Forth Course,Richard H. Haskoll, $25.

Forth Notebook Vols 1 and 2,C.H. Ting, $25. eachMore on Forth Engines

Vol. 1-17, $15. eacheFORTH disks $25.

8086/PC, 8051. PIC17C42,Trgmsputcr and others

Offete Enterprises1306 South B Street

San Mateo, CA 94402(415)-574-8250

companies in Canada and Sweden, sincetheir electrical grids can be disrupted bysolar storms. An owner of homing pi

geons asked to be notified when the satellite detected flares, since his pigeonsdepend upon the Earth's magnetic field toorient themselves.

When asked about engineering aspects of the mission. John Hayes noted:

There were more bit flips in thememory than we anticipated. It seems tobe over the South Atlantic Anomaly andover the Poles which are high radiationregions. We have this watchdog timer thesoftware tries to tickle, and otherwise thewatchdog says to reboot. There weremany occasions where a bit was flippedin the program and the software producedstrange results instead of crashing. Onetime the data showed a rectified sine wave[where the negative portion of the signalwas clipped] rather than a sine wave, andthe watchdog hadn't rebooted the software. "

John noted that one branch instruc

tion had a single bit flipped whichchanged the sense of the branch, and thisresulted in the truncated sine wave.

The current solution is to reboot the

RAM once every orbit, or every 90 minutes, to reduce accumulated programmemory errors. John's long term solutionis to compute a Hamming error detectioncode on 16K of program RAMonce/second and correct single bit memory errors. There is sufficient bandwidthin the SC32 to allow its other data collec

tion and signal processing tasks in addition to memory testing.

One key to this mission's success isthat the Forth processor can be easily re-programmed from the ground. The initialboot is from EEPROM into RAM, with

Definitions Vol. I No. 1

September/October 1993

the EEPROM organized into a simple filesystem with three copies of the flight program and three copies of an intermediateloader. A new system can be cross-compiled on the ground and a new binarycan be uplinked to the satellite. Unfortunately, John notes:

The uplink rate is much lower thanexpected. It takes 15 minutes to uplinkthe I6k by 32 bits, whereas we expectedto do this in just a couple minutes (about10 times slower).

This is one of several instances

where Forth's re-programmability has allowed space missions to succeed whereasotherwise they would have failed. In addition, the compact Forth code and its efficient, sometimes multiple instruction/cycle execution resulted in one of thehighest processing power to electricalpower consumed computers. Processingpower in orbit will become increasingly

important as data collection routinely exceeds telemetry bandwidth.

Now having proven itself in space,as well as on the ground, the SC32 ispoised for a significant role in many morespace missions.

• by L P. C. Forsley

For more information contact:

Silicon Composers655 W. Evelyn Ave. #7Mm View, CA 94041

(415) 961-8778

Next Issue: the FRISC-4 Processor

15 MIPS

HARRIS RTX 2000

SINGLE BOARD

SOLUTIONS

VMEbus Master 128kb RAM/ROM, Dual RS-232, 20MB/sec 16 bitParallel Port, 6 Mb/sec VMEbus

PC/AT Master Up to 768Kb RAM/ROM, RS-232 & RS-485, KeyboardPort, Direct access to PC/AT Peripheral Boards

Credit Card size SBC 128kb RAM/ROM, 1.25M baud Async Serial,Power Monitor, Watchdog Timer.

mnmfmk wtwtfwm

538A Valley Way Milpitas, CA 95035(408)946-3833

'Definitions 13 Vol. 1 No. 1