14
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 included Uses standard operating system files 500 page manual written in plain English 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 8080, Z-80, 64180, 680X0 family, 80X86 family, 80X96/97 family, 8051/31 family, 6303,6809, 68HC11 No license fee or royalty for complied application m/ ' Laboratory Microsystems Incorporated Post Office Box 10430, Marina Del Rey, CA 90295 Phone Credit Card Orders to (310) 306-7412 Fax (310) 301-0761 Definitions | Institute for Ap; 70 Elmwood Rochester, NY t •';< >; >j\' j - DIGI i" 940 ANDF\EW MJK'bfiK 304 LAMf'LirL l-.iAY REDWOOD CITY CA 94062-391? The Extensible Languages Publication JY 30 i

Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

  • Upload
    dinhthu

  • View
    217

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

Total controlwith LMI FORTH

For 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 included

• Uses standard operating system files

• 500 page manual written in plain English

• 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 8080, Z-80, 64180, 680X0 family, 80X86 family,

80X96/97 family, 8051/31 family, 6303, 6809, 68HC11• No license fee or royalty for complied application

m/' Laboratory Microsystems Incorporated

Post Office Box 10430, Marina Del Rey, CA 90295Phone Credit Card Orders to (310) 306-7412

Fax (310) 301-0761

Definitions |Institute for Ap;70 Elmwood

Rochester, NY

t •';< >; >j\' j - DIGI i" 940ANDF\EW MJK'bfiK304 LAMf'LirL l-.iAYREDWOOD CITY CA 94062-391?

The Extensible Languages Publication

JY

30

i

Page 2: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

SILICON COMPOSERS INC

The SC32 Line-Up

SC32^ 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-length PC/XT/AT plug-in board.■ 64 KB to 1 MB 0-wait-state static RAM.

■ SG/Forth32 Forth-83 based system included.

DRAMI032 (DRAM, SCSI, Serial, Parallel)■ Eurocard size, plugs into 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. Evelyn Ave #7, Mtn View, CA 94041 (415) 961-8778

——— Definitions 2 VoL 1 No. 2

November/December 1993

ENCODER PRODUCTS COMPANY

Synergy Plus - An Intelligent Distributed Control System

+ HardwareAl01218-8 inputs, 2 outputs, 16 digital I/O, PID routine

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

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

SI01232-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, Diagonostic LEOs,Watchdog, and many more standard features

+ SoftwareMultlasking operating system (DCX pre-emptive)

Resident interactive programming kernel (Forth-83)

Resident development interface and editor

Disc-based library of application utilities

Floating point arithmetic

dynamic memory management

state language programming

message passing

object oriented programming

many more available for your unique application

Integration Services - Turn-Key SystemsSystem specification

System design

Programming

Installation

1601B Highway #2 • Sandpoint, ID 83864

Call 800-366-5412

SI

Definitions 27 VoL 1 No. 2

Page 3: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

VENDOR'S COLUMN

New 68HC11

Interactive Cross

CompilerFORTH, Inc.

FORTH, Inc. announced a new releaseof its chipFORTH interactive cross-compilerfor the Motorola 68HC11 family ofprocessors. Hie new release incudes extensiveoptimizations and improvements, includinga 32-bit "big model" host to support largetarget programs. chipFORTH is widely usedfor instrumentation, process control,industrial sensors and other applications.

Elzabeth Rather, President of FORTH,Inc. notes:

Perhaps the best-known is FederalExpress' Supertracker, a hand-held deviceused by over50,000FedEx agents world wideas the primary ir^ut device for their award-winning package tracking system.

chipFORTH allows an engineer tointeractively develop and test high-performance embedded applications for the68HC11 using an IBM PC as a host.chipFORTH connects to the target 68HC11through the chip's serial port to provideinteractive, incremental programmingwithout an in-circtiit emulator or other extra

hardware and software. The package includesthe pF/x multitasking executive andpolyFORTH development environmentrunning under MS-DOS on a PC host, plusall the tools necessary to develop and testapplications for the target. These tools includea high-level FORTH cross-compiler, cross-assembler and a complete target nucleus withhundred of primitives. All of these, plus thepF/x executive are also supplied in sourceform.

The runtime library includes integer andfixed-point fraction math, which offersfloating point-like capability without the

speed penalty; string handling; clock andcalendar; and input and output numberconversion. chipFORTH utilities andprogramming aids include a string and fullscreen editors and PROM programmingsupport

The product includes a developmentboard that provides 8K each ROM and RAMand dual RS232 ports. chipFORTH isconfigured to download and run a testapplication on this board; a simple procedureis provided to let the user reconfigurechipFORTH for custom hardware and targetad^ess space. The 68HC11 chipFORTHpackage is offered at $1,995. for software,hardware, documentation and telephone hotline support Versions of chipFORTH are alsoavailable for the 8031/51,80x96, and 68xxxfamilies of microcontrollers.

For more information, please contact:

FORTH, Inc.Ill N. Sepulveda Blvd.Manhattan Beach, CA 90266(800) 55-FORTH or 310 372-8493.

Dash, Find & Associates

Decniiting,Consulting,Tech Checks

r>\SH,FlNDASSOCIATES

Cbntad. us ab

Dash, Find & Associates

70 Elmwood Avenue

Dochester, NY 14611

(716>235-0168 (vdoe)

(716>3286426 (fax)720502111 @compuserve.coin

Definitions 26 Vol. 1 No. 2

Definitions November/December 1993Definitions is published 6 times a yearCopyright ©1993, Lawrence P.G. ForsleyCall for permission to reproduce any material via pint or electronic format.

Table of ContentsArticle Page

Call for Papers 4

What's Up 5

Observation: Factoring & Complexity 7

New Micros, Inc.: new 68HC16 board 10

33+ MHz Forth Processor 13

Postscript vs. Forth 15

Interview with Dr. Glen Haydon 19

Palaeography of Extensible Languages 21

Forth, C and C++ 24

New 68HC11 Interactive Cross Compiler 26

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$35/year outside North America

Definitions is distributed bimonthly 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 inquires to us at that address,or at our phone: (716) 235-0168.

Advertising in this issue

Advertiser Page

Dash, Find & Associates 26

Encoder Products, Inc inside back cover

FORTH, Inc. 18,26

Forth Institute 4,6

Laboratory Microsystems, Inc back cover

Microprocessor Engineering, Ltd 22

Mountain View Press 9,19

New Micros, Inc. 10

Offete Enterprises 12

Orion Instruments 23

Silicon Conposers, Inc inside front cover

VME,Inc 17

Page 4: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

1994

Rochester Forth Conference

on

Rapid PrototypingJune 22nd - 25th, 1994

at the

University of Rochester

Call for Papers

There is a call for papers on all aspects of Forth technology, Its application andImplementation, but especially as relates to rapid prototyping. Rapid prototyping allowsfast tumaround from product conception through design Into manufacturing and throughmaintenance; the complete product cycle. It has become Increasingly Important withever shortening product life cycles and design times. Interactive, extensible languagesoffer the most potent, and cost effective, rapid prototyping tools available.

Other sessions will cover standards, related languages, applications and newprocessors. Standards Include the ANS X3/J14 as well as up and coming standards likeOpen Boot. Related languages Include Kelthley's ASYST and Adobe's PostScript.

Submit a 100 word abstract by April 15th and a final 5 page paper by June 1st. Typeshould be no smaller than 8 point. Author's kits will be sent Indicating preferred fonnat.Longer papers will be considered for submission to the refereed Journal of ForthApplication and Research.

The Conference

Vendor Exhibits

Training seminars, beginner through advancedPoster sessions

Programming in PostScriptX3/J14 ANS Forth Standard

Forth vs. C vs. C++

Forth under Windows

Object oriented technologiesThe fourteenth annual Rochester Forth Conference will be held at the University of

Rochester In Rochester, New York. Registration, training seminars and vendors lx)othswill begin the afternoon of Wednesday, June 22nd. On campus housing Is available.Attendance will be limited. Register eariy.

For More Information, contact:. Lawrence P. G. ForsleyConference Chairman

Forth Institute

70 Elmwood Avenue

Rochester, NY 14611 USA(716)-235-0168 • (716)-328-6426 faxEMail: Genie L.Forsley

Internet [email protected]

Definitions 4 Vol. 1 No. 2

November/December 1993

with the same stack diagram. It wassuggested thatiypedPorth could be a higherlevel subset of Forth allowing developers todrop into low level Forth and use wordsreturning variable numbers of argiunents aslong as the end result was type safe.

Other safety issues were raised as well.It was generally conceded that denyingprogrammers access to the internals made Cand C++ safer languages than Forth. In anera where the developer is increasingly thelimiting factor, safety is more of an issue. Itwas suggested that use of the retum stackfor DO LOOPs and intermediate storagewere inherently unsafe. A safer, higher levelForth which denied access to the return stack

would help to discourage conunon errors. Aseparate DO LOOP and local storage stackswould allow the retum stack to be used bysource level debuggers. A case can be madefor a higher level Forth in which all variablesare named local variables and no stack

manipulation is allowed. As above, words inthis language can be written in low levelForth with full access to the stack.

Memory management is another issue.While the standard provides for the standardC memory management words: malloc andb'ee, these are in the optional word set.Current Forth memory management usingALLOT and FORGET is extremely limitedsince the only way to free memory is to freeall memory allocated after a particular pointin the dictionary. In programs using dynamiccreation and destmction of objects, thiscripples any effective memory management.In general it is unclear when or if memoryallocated fiom a system will be released. Thestandard Forth scheme of allocating spacein the dictionary is useless in a system wherefrequent memory allocation random releaseare used.

There are ways that C and Forth couldco-exist in the same program. A hybridprogram might take advantage of the speed,safety and close ties with the operating

system available with C while using theinteractive and extensible nature of Forth to

accomplish tasks that neither language couldachieve on their own. Currently there areseveral versions of Forth implemented in Cwhere the Forth systems executes Forthwithin a C shell which manages interactionwith the operating system. It as alsosuggested that a Forth which understood themechanisms of dynamic linking could actas an integrator for C routines available indynamic libraries.

Cooperative hybrid programs raiseseveral issues. Most important is who is incharge? Does the C program use Forth forwell defined tasks while retaining control ordoes Forth retain control but execute some

or most of its words as C routines?

Development of good hybrid systems requireprogranuners familiar with the details ofimplementing both C and Forth applications.It will be a major challenge. It is clear thatthe C community will not be interested inexploring such solutions until the Forthconununity demonstrates the utility of theapproach.

Several issues are raised in this

discussion relative to some of the basic tenets

of Forth. How important is it that words beallowed to retum a variable number of

arguments? Could a Forth be built where allarguments were accessed through localvariables? What would the effect of makingthe dictionary dynamic so that words mightbe randomly undeHned? This would bepossible in a tokenized Forth. What wouldbe the effect of making redefinition of a wordglobal rather than incremental?

In the third and concluding part of thisarticle we will look at systems where thishas been done, including hybrid Forth andC systems.

' Excerpted from "Working Group on C and C++",Proceedings of the 1992 Rochester ForthConference on Biomedical Applications, pp 113-1 IS. Chaired by Dr. Kent Brothers and written byHorace Simmons.

Definitions 25 VoL 1 No. 2

Page 5: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

Forth, C and C++^This is part 2 of a 3 part article

examining Forth, C and C++

While C compilers can produce codethat is faster than Forth this was not seen as

a critical advantage. Very little of the codein a large program is executed often enoughto make significant differences in speed.Both C and Forth allow the developer tooptimize critical sections of their code. Forthe vast majority oflarge programs today'sprocessors provide Foiadequate speed. In thefuture, speed willbecome even less of an

Forth

and

CPart 2 of 3C has a well Parti

established and veryuniform collection of

libraries for many functions developersmight wish to perform. Because C and Unixdeveloped together, almost all C compilersoffer emulation of library functions availableunder Unix. These functions include routines

for managing files, manipulating strings andmanaging memory along with hundreds ofother functions. Individually, many of theselibrary routines would be simple for adeveloper to code. Together they form a vastarray of working, tested functionality onwhich the developer can rely. The C librariesillustrate the down side of the common

characterization of Forth: 'The good news isyou can write anything you want; the badnews is you have to". The new ANSIstandard proposes many of the C libraryfunctions as optional routines. This is a stepin the right direction, but C programmers cancount on these libraries to be available on

any system. Development and publicationof code implementing a number of standardlibrary functions would be a majorcontribution.

Another advantage of C++ and modemC is the use of prototypes and local variables.The most common errors in Forth involve

mismanagement of the stack. Such errorscome in two forms. First, programmersmisuse the stack by failure to adequatelytrack the location of items on the stack. A

Forth word might start out with A B C onthe stack. At some point later, the developerbelieves that the stack holds: BAA whereas

in fact it holds B C A. or B A. A second,

more subtle error involves misunderstandingnot the location of items on the stack but

their type. Imagine the■m effects on a program.fl running on a 32 bit system, if the programmer believesI that a variable on the stack

is an address when it is anumber or the programmer

-y believes the stack holds anumber when it holds a 32bit float. Errors of this type

were seen to represent a significant majorityof errors found in Forth code. In modem Cand Pascal programs such errors cannotoccur. Developers access the stack onlythrough named local variables and thuscannot make errors in stack access. Functionprototypes causes the compiler to test thetype of variables passed to each function.As a result, the compiler will catch errors inargument type. These features mean that aC compiler will catch most errors that a Forthprogrammer will have to test at run time.

In a strongly typed Forth system, stackcomments would be active and typed. Itwould require all words to supply thecompiler with a description of the numberand type of stack arguments. The compilerwould check to make sure that type andnumber of arguments were preserved. Thissystem would require eliminating all wordswhich retum a variable number of argumentssuch as ?DUP, substituting ?IF. It would alsorequire that all branched IF statements retum

Definitions 24 Vol. 1 No. 2

November/December 1993

What's Up?Definitions is well on its way with its

second issue. Observation: Factoring andComplexity looks at a different way ofprogramming, and thinking: even beyondthe bounds of object oriented programming.We have three Vendor's Columns this issue:one following Randy Dumse's latest68HC16 based-board 2ANew Micros, Inc.,an Interview with Dr. Glen Haydon,Mountain View Press, and a thirdregarding FORTH, Inc.'schipFORTH for the 68HC11. WThe continuing work at the WJohn's Hopkins AppliedPhysics Laboratory by Marty MFraeman, John Hayes andothers is documented in a ii+

MHz Forth Processor. Randy ^Dumse ponders PostScript ^Programming with an actual PostScriptprogram in Postscript vs. Forth. Dr. NickSolnsteff completes his series on the historyand background of extensible languageswith Palaeography of ExtensibleLanguages. Finally, Horace Simmons andDr. Kent Brothers continue their discussionfrom last issue with Forth, C and C++.

The 1994 Rochester Forth Conferenceis coming up in June at the University ofRochester. This year's theme is RapidPrototyping. Anyone trying to bring aproduct to market in the rapidly changing,global market knows how importantshortened product life cycles have become.Extensible languages, with resident,interactive operating systems on embeddedproducts as well as interactive languagesunder host operating systems provide a r^idway to market.

For many of you this will be your last

issue, unless you subscribe now! In the nextissue we will look at Open Boot, interviewChuck Moore and discuss his latestmicroprocessor developed in conjunctionwith Dr. Ting, continue PostScriptprogramming, observe Forth on Trial, watchForth in near space and more. If you havecomments, please write. If you are interestedin our Vendor's Column or Consultant'sSpotlight, call us. We're here to support you!

As editor of this publication I havefound that although we are primarily for theextensible language community, we run right

along side hardware. This is unique andimportant. There is a gradual

blending of the interface betweenhardware and software, and no

V languages better support thatcrucial inleiface than the exten-

^ sible languages. Defmitions isproud to be in the forefront of a

powing technological wave. Onewhich will impact not only the realm

of electronics, but may effect every areaof human endeavor. Perhaps, with the rightpush, we'll see software and hardwarereplaced by smartware!

Join us!

Subscriptions are $25/year in NorthAmerica and $35./year outside NorthAmerica.

Address:

Payment: □ check

ACCT#

□ VISA

Expires

Page 6: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/Dctsmber 1993

Journal of Forth Applicationand Research (JFAR)

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

JFAR Issue #1 #2 #3 #4

Volume 2

Volume 3

Volume 4

Volume 5

Q Q □□ O □ □□ o □ □O □ Q □

□ = $15.00 , 0= $20.00 (ConfProc)

Full Sets:Volume 1 □ S30.Volume 2 (3 issues) □ $40. S'flveSS.Volumes (4issues) □ $50, 5fjve$15.Volume 4 (4 issues) □ $50. Save $15.Volumes (4issues) □ $50. S'nveSlS.Volumes 1-4 □ $170. Save $35.Volumes 1-5 □ $220. Save $50.

JFAR Subscriptions:

Volume 6□ $60.00 Individual, USA□ S65.00 Individual, North America□ $75.00 Individual, Europe/Asia□ $145.00 Corporate, North America□ $160.00 Corporate, Europe/Asia

Note: No additional shipping charges enSubscriptiCHis.

Order Form:

Address:.

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 implementation.

□ $25. \9^\Forth Standards□ $25. \9^2 Databases & Process Control□ S25. \9M Real Time Systems□ S20. {Vo\.'iM2)\9%5 Software Productivity□ $20. (Vol.4,#2)I986Rffl/rimcA/□ $20. {\o\.SM)\9^1 CompArchitecture□ $25. \9^% Prog Environments□ $25. \9i9 Industrial Automation□ $25. \99^ Embedded System□ S30. \99\ Automated Instruments□ $30. 1992 Biomedical Applications□ S30. \993 Process Control (fall'93)

Set of any 4 or more ProceedingsSave SSJProc.. up to $60.!

□ $20.00 Forth Ref Bibliography, 3rd Ed□ $25.00 1988 ASYST Conference Proc□ 562.00 Slack Computers: the New Wave

By: Dr. Philip J. Koopman, Jr.□ iso.QO Scientific Forth

By: Dr. Julian Noble(with software on disk)

Purchase Subtotal:Shipping Subtotal:($5./book,15 Max. North America)

Grand Total:□ MC □ VISA □ CheckCard#Expiration Date:

Institute for Applied Forth Research, Inc.70 Elmwood AvenueRochester, NY 14611(716)-235-0168 voice (716)-328-6426 [email protected] email

Definitions 6 Vol. 1 No. 2

November/December 1993

the interpreter is distributed throughout theobject space! Data objects are instantiated bymeans of defining words which are theanalogues of type identifiers in conventionallanguages such as C or Pascal.

In common with other extensiblelanguages, there is no rigid distinctionbetween compile-time and run-lime phases.As can be seen from Fig. 2, processing ofForth statements can move arbitrarily fromone to the other and back again. Thesymmetry of the diagram is very striking.

DEFINITION OFNEW DEFINING WORDS

New data structures can be easilydefined in Forth with the help of the create... doe$> mechanism. As there is no syntax toconsider and the semantics (the individualizednew part of the interpreter) can be specifiedin terms of Forth itself, the data abstractionmechanism is both very elegant and simple.

Forth programming thus entails thecreation of a language for the application

(building of objects to represent the problemenvironment and the means to make themperform as required) and this languagebecomes the application.

The creation of new control structures

which proved to be a major stumbling blockin the case of extensible languages, can beeasily done in Forth using the standard word-definition mechanism. It is only necessary tomake the new word immediate, i.e.,executable even during the compilation phase.

CONCLUSION

Forth is an extensible language parexcellence and has found a niche in theevolutionary schema of programminglanguages. Like the coelacanth. it willprobably outlive a lot of its contemporaries!

— Nicholas Solntseff

McMaster University

(THE END)

' W.l. van der Poel and I. Maarsen (eds.). MachineOriented Higher Level Languages, North HollandPublishing Co., (1974), 535 pp.

Orion 8800 Emulator/Analyzer

m

♦ open 32-hit protected mode Forthoperating systems

♦ Full-speed, zero-wait-slate enulaibn

♦ 64K rcal-lint trace without slopping the CPU

♦Clip-On Emilation^"^ forsoldcred-in processors

♦ Up to 2 Mbytes of enulalion memory

♦ Super-fast parallel interface (128K <2 sec)

♦ XRAY.XDB and Siemi Systems support

Call lodiiyfornvre litenmire and

adiforyourFRHEcopyofour t>uw guide, "Real-Time

S, — ® Techniques".=*= Tel: 1-800-729-7700

INSTRUMENTS Fax: 415-327-9881

Definitions 23 Vol. I No. 2

Page 7: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

Jword » aclioiiL

INTERPRET

COMPILINGWORD

IMMEDIATE

WORD

Figure 2. Forth's Compile/InterpretCycle.

nrbe

FORTH

Forth as a programming language hasall the features of an extensible system. Inthis, it is aided by the complete lack of syntax- a Forth program is a sequence of wordswhich are compiled into a (threaded)sequence of procedure addresses (or codeaddresses). The Forth symbol table or thedictionary is available to the user at all timeswhich is one of the distinguishing featuresof extensible languages.

The Forth code-address or "inner"

interpreter is very small and efficient asthreading leads to "direct" execution ofprocedure code. In the case of somearchitectures, the inner interpreter can becoded into a single machine instruction!

What makes extensibility almost trivialin Forth is that every data object carries itsown interpreter with it as every word containsa field which contains the address of the code

that provides the semantics. In other words,

ProForth for WiTidows• 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 interactivedevelopment and debugging environment for Windows applications Simple structureddefinitions for GUI objects and dialog boxes makes programming Windows easy. UsingIh-oForth, turnkey applications can be generated that can include the use of timers andmultitasking as required for real time development. Hardware floating point is also supported.ProForth has a 700 page, comprehensive, step by step manual and a large number of sourcecode examples.

Forth Cross CompilersUse your PC to edit and compile Forth source code, then download and debug it interactivelyon a wide range of target processors.

Microprocessor Engineering Limited133 Hill Lane. Southampton SOl 5AF England

Tel: +44 703 631441 Fax: +44 710 339691

Definitions 22 VoL I No. 2

November/December 1993

Factoring andComplexity'

Imagine, if you will, a brick: a singlebrick. Hold it in your mind's eye. Add asecond brick. What is its relationship to thefirst? Add a third brick. Keep them allequally in your mind's eye. How do youarrange them? Add a fourth brick. Don't letthe edges become fuzzy. Keep your focuson all four bricks equally. Has theirorientation changed as you've added thefourth? Add a fifth brick. Are they becomingharder to keep equally infocus? Add a sixth brick.

orientation? Is your focusshifting from one to ^another? Are you losing --i;-- • j-'the individuality of each ||brick? Add a seventh if L'ij.'.'.j'vj ^ A'tbrick. ' ?

Most people find this *' 'exercise difficult by five or six bricks,regardless of how they arrange them. Apsychologist. Dr. Miller^, conjectured thatpeople can keep seven, plus or minus two,independent objects in mind at the samelime before they need to be categorized, orchunked. At seven or so bricks, most of us

fall back on a brick wall, or a pile of bricks,where any number of bricks can berepresented or queried individually, but wecan't have the bricks and their individualitysimultaneously.

This is how people naturally categorizethe world around them. This isn't how

programming languages are intended to beused. nor. how code is organized. Programswritten in languages, like C and FORTRAN,are thought of in tenns of lines or pages ofcode. There is no correspondence betweenhow we organize items and the organizationmost programming languages force upon us.

Forth is an exception. Most good Forth

code fits on a single line. Curiously, a lineholds five to nine words between the onset

of a colon definition and its endingsemicolon. There is a good impedance matchbetween human thinking and Forth'sorganizational strategy.

Forth's interactiveness allows, even

demands, play. One can play with Forthwords. Our aliendon spans are limited, andalthough the human mind is no longerstretched by hours or days awaiting aFORTRAN mainframe edit, compile, linkand test, even 30 seconds is loo long. Forth'simmediate responsiveness matches our

limited attention span.

Given the ability toorganize our thoughts in acomputer similar to how

we think, we can interactwith, and edit, our

, }i ' ' programs as if they were• " thoughts.

li -r.: 1! I The French math

ematician, Descartes,

wrote a long letter to a friend, at the end ofwhich be apologized for having not had thetime to write a shorter letter. We rarely havetime to write a proper program, let alone theluxury of rewriting one, save to fix bugs. Yet,what is a program in Forth? A collection ofwords: a collection we constantly name,rename and rewrite. We give old words newmeaning.

Forth encourages the discipline of

rewriting, and gives us the tune to do so.

Dr. C.H. Ting pointed out that talk showhost Johnny Carson often had a pencil in hishand. A pencil with an eraser on cither end.As Ting noted, "the important part of a pencilis the eraser".' What you take away is moreimportant than what you leave. Similarly, Dr.Alan Furman stated the aphorism'':

To gain knowledge, add somethingevery day. To gain wisdom, remove

Definitions 7 Vol. 1 No. 2

Page 8: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

something every day.

^ith each rewriting our understandingof our words grows before us as we honethem further, like tools. With each honingthe tool becomes more precise, sharper, andthe code often smaller. Our knowledge ofour application gained by working with thatapplication becomes wisdom.

Dr. Kent Brothers, one of the authors

of VP-Planner, a successful, until legallychallenged, clone of Lotus 1-2-3, describedat the 1990 Rochester Forth Conference^how they developed VP-Planner. He pointedout that each time Lotus came out with a

new release, so would they. With eachrelease Lotus became larger. With eachrelease the code for VP-Planner got smaller.

The parameter stack is the primarymethod of parameter passing in Forth. Dr.Glen Haydon, author of All About Forth,observed that the use of the stack for

unnamed parameters is akin to usingpronouns in English. An item's position onthe stack is but a place holder: its meaningis determined by the context of the word,much as the referent for a pronoun is foundin the context of a sentence. Similarly,multiple pronouns and their indirection arecontusing in a sentence, just as stack depthsgreater than three are unwieldy in Forth.

Few speak of reading computerprograms. We speak of writing, debugging,documenting or maintaining code: but rarelyreading. We don't think of computer codeas for people: its for computers: butcomputers don't think, people think.Ultimately code is for people.

I have read a great deal of Forth codeduring the past nineteen years, some of itmine, but the majority written by others. Ihave been often struck by the prograimner'ssignature: not the one left by his or herinitials, but by the way in which theirthoughts are expressed: particularly inForth. Some write code which is verymonolithic. It consists of a few, large

definitions which do everything. Otherswrite code made up of small well-factoredpieces.

Charles Moore, the first discoverer of

Forth^ writes spare, well-honed code. Hisdefinitions are rarely more than one linelong. His programs are rarely laiger than afew pages^. Moore wrote a BASIC compiler"in 1981, which was elaborated on by MichaelPerry.' Although it imposes a fewrestrictions, such as separating keywordswith spaces and requiring integer arithmetic,

the BASIC compiler source is lessthan 100 lines long and compiles to 1550bytes.

This style is reminiscent of Haikupoetry, where the constraints of form are asartificial as Haiku itself, but as real as the

real time constraints the program must livewithin.

Poetry isn't easy to read. It requireswork. Good poetry has subtlety, depth andshades of meaning. Good Forth code hassubtlety and depth, although plays on wordsmay be lost on the in silico interpreter.

When I read Forth code I look at

structure/or structure. The first is form, thesecond content. Form shows as tight orrambling code, lengths of words, and namingof expressions. Content appears as what thecode does, and how it does it. In Forth, Formand Content are curiously intertwined. Is acompiler directive or a defining word strictlyeither? They are an example of Contentdirecting Form directing Content.

As with all good writing, good Forthcode shows clarity of thought throughlucidity of expression.

Einstein once observed, "Thingsshould be made as simple as possible, butno simpler", which is to say just complexenough. Several metrics for measuringsoftware complexity have been developed,including Tom McCabe's cyclomatic metricindex, known as McCabe's Metric, which

Definitions 8 VoL 1 No. 2

November/December 1993

Palaeography ofExtensible Languages(Part 2)WHY DID EXTENSIBLE

LANGUAGES BECOME EXTINCT?

The development of extensiblelanguages was motivated by the desire oftheir creators to avoid the large andcumbersome programming languages suchas PL/1 which tried to provide in one packageall of the features of

Algol, Fortran, and

COBOL. The proponentsof extensible languagespointed out thatgenerality easily slipsinto inefficiency. Toovercome this ten

dency, they advocatedthat expensive featuresshould be made avail

able only to those thatneed them.

It is good to remember that aprogramming-language designer cannotforesee all of the potential users' needs.

Why did extensible languages die out?

There were many reasons for this, themost important of which are:

• Language extension via atheoretically sound metalanguage is a non-trivial operation;

• Portability could not be achievedbecause of the lack of a common platform;

• Well-designed programminglanguages, such as Pascal, provided gooddata-definition facilities;

• Machine-oriented languages' forsystems prograrruning provided access tomachine features.

"When I u

Lewis C

se a word/*Humpty Dumpty said, in a

rather scornful tone,"it means just what I choseit to mean - neither more

nor less,**

SUCCESSES OF EXTENSIBLE

LANGUAGES

Although extensible languages died outas a group, their significant influence onsubsequent programming-language designcannot be overlooked. They provided theprograiruning-language community with abetter understanding of

• macro processor mechanisms

• machine dependencies

• problemsassociated with portability.

• abstract data

structures.

FAILURES OF

EXTENSIBLE

LANGUAGES

arrol (1896)

Through the Looking Glass and What AliceFound There.

Attempts to

create a widely usableextensible languageended in failure for a

number of both experimental and theoreticalreasons. The three most important of theseare:

• Inability to provide user-levelextensibility;

• Inability to describe control-structure extensibility;

• Total absence of compiler andprog-ram exchange.

Programming-language theory was stillin its early stages of development in the latesixties and this led to the first two failures.

At the same time, computing was totallydependent on the main frame and theprogramming language community wasdivided into a number of camps that couldnot exchange programs or systems. Hence,the signal lack of portability.

Definitions 21 VoL I No. 2

Page 9: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

D: Ten us a little mwe about the WISCyi6.

Q: The WJSC/16 is about as simple as it canbe and still have the necessary functionsavailable. Everything is connected to a single16-bit bus. The source and destination codes

are chosen before enabling the particularfunctions. A 32-bit microcode is stored inRAM. Two stacks of 512 words each areincluded. The machine is 16-bit word

addressed. Software utilities allow a byteswap within a 16-bit word. We have foundthat wasting one bytefor ASCII characters isa small price to pay for the added total space

This maybe yourlast issueif

you

haven't

alreadysubscribed!

Subscribe Now!Next issue includes articles on:

More PostscriptCharles Moore and C.H.Ting's

P21 microprocessorForth under Microsoft Windows

Forth in Near SpaceWhat's up with the Harris RTX

miaoprocessor

Practical FactoringASYST: A Scientific Software

System

FORTH on Trial

and more

available. The clock speed is derived fromthe host. The limiting speed is the ALU chip,the 74181. Everything is common TIL. Thetotal chip count is 84 dips of the 7400seriesand no MSI. The WISC/16provides an idealtool to learn how to connect your processorand application with Forth software as theglue. Half or more of the WISC/16 sales areoverseas.

D: What else do you have to offer yourcustomers?

G: MVP is one of the few places where aknowledgeable Forth user answers the phone.I am the author of the latest edition of AllAbout Forth, which includes a functionaldefinition for 7 public domainimplementations arul the actual source codefor four implementations. The appendices inAll About Forth include the Installation

Manual, 79-Standard and 83-Standarddocuments. The combiruition makes the book

an ideal general reference for all Forth users.

Soon after the ANS Forth Standard isadopted, common fitnctions will be added toAll About Forth along with animplementation. It will be a 32-bit modelusing DPMI (DOS Protected ModeInterface). This implementation has been usedto address as much as a 28 megabytes oflinear address space on a standard Intelbased system. The 64K and segmentconsiderations are no longer a problem.There is minimal perceptible time penalty forthis implementatioru Mf/» the DPMI on theIntel maclune one does not have to go to aMotorola 68K or other processor to get a 32-bit linear address space.

I am also aware of many fineproprietary Forth implementations and canput many of them into perspectivefor use withyour applications We welcome ir^uires. Wealso offer technical typesetting arul other helpin preparing manuscripts, articles and books.

Glen can be readied: 1-(415) 747-0760 voice (if

he can get it in 4 rings) or voice mail, fax, andBBS.

Definitions 20 VoL 1 No. 2

November/December 1993

measures control structures. Dr. Ibm Hand,while a professor at Florida Institute ofTechnology, took John Cassidy's assemblerwritten in Forth for the Intel 8080'®microprocessor and applied McCabe'smetric. Hand noted that an 8080 assemblerwritten in Pascal or C typically has a valuefar larger than 50, wha*eas:

Cassady's assembler has a rrtetric of0: there were no control structures.

Hand found if he applied otherconventional measures of complexiQr, suchas the number of vaiietles, Cassady'sassembler still had a metric of 0.

An assembler written in Forth has nocomplexity!

Forth allows us to write programs withno complexity: yet they still get the job done.

When I was teaching at the Universityof Rochester I told my students the best codewas no code. If there was no code, there was

nothing to write, nothing to debug, nothingto document, nothing to maintain. Thoughthey complained, I maintained that if theysolved the problem before them withoutcode they woujd get an A; but for themeantime they could approach itasymptotically.

How is this possible in Forth? The keyis proper problem factoring and usingForth's inherent properties: the text or outerinterpreter for parsing and organizing itemsin a dictionary; the stack for parameterpassing; and, most importantly, defining andcompiling words to create structures whichmake structures.

The best code, is no code!

—^L. P. G. Forsley

' This article is based upon a presentation byLawrence P. G. Forsley, "Rhyme, Reason and theTao of F(*th", Proc. of the 1992 Rochester IbrthConference on Biotnedical Applications, pp. 34-40.

^ Miller, G. Psychology of Communication: SevenEssays, Basic Books, New York: 1967.

^ G.H. ling in the question period following thetalk on "Rhyme, Reason and the Tao of FiHth".

* Alan Furman in the same question period.

' K. M. Brothers, "The F(^ System Behind VP-Planner: Designing fw Efficiency in the Face ofComplexity", Proc. of the 1990 Rodtester ForthConference on Embedded Systems, pp 5-12.

* Moore, €., "FORTH: A New Way to Program aMinicomputer" Journal of Astronomy andAstrophysics, Supplement 15:1974. pp. 497-511.

^ Personal conversation with Charles Moore on

December 2,1993. He noted that one exceptionwas a was a laige database package he wrote whileat FORTH, Inc.

' Moore, C., "ft-ogramming a BASIC Compilerin FORTH", 1981 FORMLPROC, Vol 2, ForthInterest Group, San Jose, CA.: 1981. pp 513-519.

' Perry, M., "Charles Moore's BASIC CompilerRevisited", FbrthDimensians,V(A III No. 6, ForthInterest Group, San Jose, CA.: 1982. pp 175-178.

'®Hand, T, "Software Metrics for Falh", Proc. ofthe 1988 Rochester Forth Conference onProgramming Environments, pp. 67-68.

THE FORTH SOURCE

Hardware & Software

MOUNTAIN VIEW

PRESS

Glen B. Haydon, M.D.Route 2 Box 429

La Honda, CA 94020

(415)747-0760

Definitions 9 VoL 1 No. 2

Page 10: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/DocL'mber iyy3

New Micros, Inc.New Micros has released ils first

revision 68HCI6 board, the NMIX-0()26.

The NMlX-()()26 is a highly featured CPUboard in the NMI Eurocard board series.

The NMIX-()026 has hardware feature of the

68()()() single-chip computers whilemaintaining some software compatibilitywith earlier 68HC1 1 designs. The 68HC16CPU is (largely) source compatible with the•HCI I. The -HClb is a 16-bit CPU while

the'HCl l is an 8-bit design.

Software throughput is enhanced, notonly by the wider data-path, but also by thehigher clock speeds, up to 16.78 MHzoperation from 32 KHz osc. Address anddata space arc also larger in the "HCI 6. Eachcan be as large as I Megabyte.

The "HCIb chip also providesProgrammable Chip Selects, which were notavailable on the 'HCI I (at least the original68HC11A8 and Ey variants). The WatchdogTimer and Cl(x:k Monitor features have been

supplemented with a Bus Monitor as well.

Like the 'HCI I. the 'HCI6 has 8 A/D

channels. However, the 'HCI6 offers 8 or

10 bit accuracy. The 'HCI6 has the samecompliment of serial channels as the 'HCI 1:one Asynchronous Serial channel and oneSynchronous Serial Channel. Twice as manyfree running 16-bit timers are in the newerchip. The Input Captures. Output Compareand Pulse Accumulators arc provided in thesame quantity on both chips. Two PulseWidth Modulated outputs are provided onthe 'HClb. These make possible a "towcost" D/A-like output. Many applicationswith slow response limes will see this signalas an analog level. A simple filler can beused to "round off the edges" for systemswith faster responses. A host of parallel linesare also available on the new part. Since the'HCI 6 is packaged in a 132-pin PQFP. manymore connection points are available whichcould not be accommodated on the original•HCI I 52-pin PLCC.

The NMIX-0()26 has a small I"x3.5''

prototype area on the end of the

100x160mm Eurocard format. Connectors

and interface circuitry can be added there.This is about half the prototyping area whichwas available on the NM!X-0()21. 'HCI I

based boards. The larger processor socketand additional memory requirementsrequired enlarging the active componentarea of the board.

The NMlX-0026 still maintains a gooddeal of compatibility with the New MicrosNMITand NMIS series computers. The 32-pin JEDEC memory sockets have the samepinouts on all versions, and the jumpers forthe sockets are the same as found on other

boards with 32-pin sockets.

Definitions 10 Vol. / No. 2

November/December 199.1

Interview with Dr.

Glen Haydon

Mountain View Press

I caught Glen Haydon. owner ofMountain View Press on a late October

moming. I interviewed him at his Shangri-La West, overlooking the Pacific oceanwhile he was resting in his hot tub. Overthe years Glen has built a glass and redwoodhome at the end of a long dirtroad in the hills behind p—Stanford University. All j

Jon Ross, the first ppmanaging editor of the Joumal ^of Forth Applications and AnAnnoiResearch, lived with Glen for oiti

several years while workingon his MBA. During this timehe used his considerable

construction skills on Glen's Thi

home. BEvisfi

All A

REVISED

uml uppliciiiions. Wefi'nturc rhc MVP Forthiinplcinciilaiioii ik'si^ncdfor bci-iiiiu'r.s. TheMVP Forth kernel has hecii stable since

I9S.I. Some more recent applications havebeen added in the current distribution. We

also handle books from otherpublishers anda number of other implementations: FPC.Jifi-Forth. eForth from Tin}'. Py^my fromSarf>ent. Yerkes {which is a public domainversion of Neonfor the Macintosh) and RickvanNorman's 32-hit F32. These

implementations and others are available onour bulletin hoard. We use the simpleProcomm bulletin hoard software. Contact

us for more information.

bout

FORTHAn Annotated Glossary

bout

AND UPDATE

Glen's formal trainingwas in physics, biology andmedicine. He has experiencein programming and hardware design. Heis also an amateur astronomer with a 12 inch

reflector telescope under a converted grainsilo dome. He usually answers the phonehimself and can handle inquiries in bothEnglish and German.

Mountain View Press, known simplyas MVP. has been around for over 12 years.

Glen took it over from Roy Martens about3 years ago and made it a division of hiscotnpany. Epsilon Lyra. WISCTechnologiesand Haydon Enterprises are also divisionof Epsilon Lyra.

D: What does MVP do'?

G: We publish and sell hardcopydocumentation for Forth implementations

D: What about hardware?

ITH 0: We di'itrihute the WISCTechnolo\>v products. The

idGiossary wiSC/16 'is available in

several forms including

printed circuit boards. TheWISC/32 is available with

the Harris chip on a singleboard for evaluation. We

^UPOATK) y,„yJ paieuts de.signs.

The WISCII6 is a goodleaching tool.

D: WhoisusingtheWISC?

G: Several .schools are using the WISC/16in their undergraduate and graduate

engineering clas.ses. Some have bought thebar circuit boards and populated them whileother have bought the a.s.sembled and tested

boards. A few people have found wirewrapping their own boards rewarding. Itusually lakes 20 to 30 hours to wire wrap.By adding hardwarefunctions one at a time,eachfunction can be tested as you progre.ss.The basic Forth concept of factoring andtesting each function is done in hardware.

We use a PC as a host for the developmenthardware and use a little bit of glue to allowthe ho.si to acce.ss a single central bus. Allfunctions arc accessed from the central bus.

Definitions

Page 11: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

From NASA space systemsto package tracking forFederal Express...

chipFORTH...gives you maximumperformance, total control forembedded s^plications!

' Total control of size

and content.

> Configurable for custom hardware.

> Fast— compiles and downloadsentire jprogram in seconds.

• Includes all target source, extensivedocumentation.

> Full 32-bit host, interactivedevelopment from anyDOS-based PC.

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

FORTH, Inc111 N. Sepuiveda Blvd. #300

Manhattan Beach, OA 90266

1-800-55-FORTH

there was a good chance the path might betoo complicated for some PostScriptversions. In the end I settled for moving itoutside the repeat. I simply stroked thewhole path at once. (Once for horizontallines, once for vertical.) I saw no quickmeans of changing the structure whichwould leave such an easily understandableexample intact

The first printed page (which was notsolid white) was almost solid black. At thattime I had not added the setllnewidth

command. I initially set it to .01, which wasa very 6ne line. Later I decided .1 was moreaesthetically pleasing. When the line widthwas handled, I focused on the problem ofthe page being only 2/3's drawn. I hadreversed the order on the X and Y inputs tothe rlineto and rmoveto commands.

Finally, I had used .1 setgray and hadvery dark lines. I changed the command toS setgray and achieved the desired results.

For someone regularly usingPostScript, with an interactive environment,the whole procedure should have only taken10 minutes. Such is the nature of

pmgramming, it is not for the faint heartedor those without the necessary tools at hand.

In the next issue, I will discuss a fewbetter development tools operations, andwhere these tools can be obtained.

—^R. Dumse

Definitions 18 VoL 1 No. 2

November/Decendwr 1993

Since the memory map of the 'HC16is 16-bit, the minimum conHguration ofsockets would require four, two for RAMand two for ROM. Four 32-pin JEDECmemory sockets are provided on the board.Any 28-32-pin JEDEC device can be usedin any sockets. In fact, 1 Megabytes ofPseudo Static RAMs (PSRAM) can beinstalled in the two RAM sockets, each with512 Kbytes.

The previous 8-bit boards had threememory sockets by design. Hiis allowed oneRAM for variable storage, etc.; one ROMfor language monitor or operating system;and one open socket intended for the targetcode. This could be RAM duringdevelopment and then EPROMed forproduction. The three sockets Et neatly onthe chosen Eurocard format.

This is not possible with the 'HC16 andits 16-bit memory access. The power supplysection of our previous designs was deletedto make room for four sockets. This allows

two 8-bit RAMs and two 8-bit ROMs to be

present in memory at one time. Theincreased size of the usable memories,

however, may relieve some of this lack ofsockets, as a large, battery-backed RAM cansimulate both program space and data space.The programmable chip selects makemoving memory devices possible withoutactually moving them from their sockets.

A new scheme was needed for the bus

expansion cards. The old 34-pin VerticalStacking Connectors (VSC-34) so familiaron the 8-bit cards was expanded to a 60-pinJEDSTACK Vertical Stacking Connector(VSC-60). It was done in such a way 8-bitperipherals will still work in the lower 34pins of the VSC-60, yet new memory cardscan be added which will take advantage ofthe entire 16-bit data-bus and address bus.

Previously, the best sellers in the NewMicros series of single board computes have

been boards based on the 8-bit F68HC11.

As mentioned, the 68HC16 is a faster, 16-bit version of the popular 68HC11. Thetransition from 8-bit to 16-bit was not a

smooth one. This was not an easy board forNMI to make. Uiey had plarmed to comeout with it much earlier, but the greatest partof the delay turned out to be somethingbeyond their control.

Randy Dumse, president of NewMicros, Inc. found:

Die prototype house who made our fastturn protoboards made several defectivePCB's in a row. We spent valuable resourcestrying to figure out why the design didn'twork. Die software never seemed "to boot".However, it turned out the PCB was full ofshorts.

Shorts on the data-bus caused the chipto go into odd operating modes on power-up. It was a ticklish problem to isolate, sincethe board is seldom questioned Erst Finally,the software development continued withoutthe prototype hardware using a MotorolaEVM boaM. A close implementation of theF68HC11 MAX-FORTH was ported to the•HC16.

The lead spacing on the 132-pin PQFPis .05" and is made for surface mount

attachment. NMI found a socket made byAMP which allows several-time replacementof the IC despite the delicate leads.Successful insertion and removal should be

possible about 20 times. Although this is farless than other devices, it is better thanhaving a Single Board Computer in whichthe CPU could never be removed.

The biggest problem with the designwas accorrunodating the chip selects. On-chip progranunable chip-selects shouldmake the ultiihate in flexibility. For the mostpart this is true. Unfortunately, thearchitecture, had one drawback: mixed 8-bitand 16-bit selects. There are no provisions

Definitions 11 VoL 1 No. 2

Page 12: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

for priority with the internal chip selects. An8-bit access occurring at the same memorylocation as a 16-bit access, causes a full 16bit transfer. Since the board can cany the iiilladdressable space of 2M RAM, if the chipselects are set for full access to memory, thereis no space in the memory map.not coveredby a 16-bit access chip select. Therefore,addressing S-bit peripherals is also difficult

As Randy points out

The design assumption made by NMIwas that anyone willing to pay the costdifferential to step up from the 'HCll to the'HC16 needed additional processing speed

Processing speed was preserved byadopting a 16-bit bus despite die problem ofoverwriting "paired" bytes on 8-bitoperations. This was fixed in software forNMI's 'HC16 FORTH and will be in

hardware on a second generation of the boardwhich will use 8-bit chip-selects. All memorywill be accessed as 8-bit wMch will remove

boundary access and single byte write

Offete EnterprisesHighlightseForth and Zen

C.H.Tmg, $15

The First Course

C.H.Ting, $25

The Forth Course,

Richard H. Haskell, $25

Forth Notebook Vols 1 & 2,

C.H.rmg, $25More on Forth EnginesVoL 1-17, $15. each

ePORTH discs $25

8086/PC, 8051, PIC17C42,

Transputer and others

Offete Enterprises1306 South B Street

San Mateo, CA 94402(415) 574-8250

problems. The 16-bit bus speed will bemaintained for on-boundary accesses, byhaving two 8-bit memory accesses in parallel.Although this will use two more of theprocessor chip select pins otherwise availablefor the user, it preserves performance.

In addition, the programmable chipselects don't easily allow fiill access to the2M space. Since the 'HC16 does not have 24address lines, but its 68000oriented hardwaredoes, the upper address lines were "faked"by copying the top address line the •HC16does have. Unfortunately, this means thelargest possible chip select is half-a-Meg.FORTH tests which half of 1 Meg memoryspace is being accessed and automaticallyadjusts the chip select

Randy notes:

There is still more to be learned by chipmanufacturers about combining hardwarewith software. These chip selects prove that.While well thought out, not every possible useis obvious.

Versions of the board are also planned,which will accommodate the new 68HC16

parts, such as the MC68HC16Y1 with theTime Processing Unit (TPU). TheMC68HC16Y1 comes in a 160-pin PQFP.Hie TPU is a small "co-processor" whichmanages additional timers. The RAM in theMC68HC16Y1 can be used as emulation

control stores to develop new "micro-code"for the TPU. Developing a FORTH interfaceto maximize this unique feature of this part isa challenge, yet to be realized. Still, thedevelopment of this new line of processorscontinues at NMI, having far reachingconsequences for future 16 and 32-bit boardsfrom the company.

Next issue we will talk to NMI about

their newly proposed Easy-A MultidropProtocol standard.

For More Information:

New Micros, Inc.

1601 Chalk HUl Road

Dallas, TX 75212-3804(214) 339-2204

Definitions 12 VoL 1 No. 2

November/December 1993

output. I wrote the text in an editor anddownloaded it to the printer. I was "blind"to any en-or messages. I tried to change fromthe parallel port to the serial port, so I couldsee the error messages. The last time I didthat was on an NEC890 printer, but now Iuse an NEC95 printer. The setup wasdifferent, and I decided it would take halfan hour to figure out the "secret" differencewhich alluded me on the first try. In the endI settled for the tried and true, trial and errormethod of debugging. This method willalways produce results - slowly - butfaithfully

My first indication of a problem waswhen the download ended with a

"WAITING" message on the printer fiuntpanel, followed by a several minute delayedreturn to "READY PS". There was no

output. A rereading of all the commands useddid not reveal any anomalies. Byconunenting out essentially all the program(using % ) except the showpage at the end.

I was able to spit out a blank page. Good.That proved the transfer method through theparallel port was working. Next, individuallines were uncommented and clean pageswere occasionally received. This producedabout 6 pages of blank paper. To my surprise,the code I most suspected was giving noproblem. The simplest code was theproblem. The procedure being passed to therepeat command would not interpretwithout error. Originally, I had a strokecommand in the repeat loop between therlineto and the rmoveto. Only one path wasto be generated at a time. It turns out, sincestroke uses up the path, it essentiallyeradicates the current point, so the rmovetodid not know where the starting point was.This error prevented output

It is not a good idea to let the pathsbecome too complicated in PostScript I usedthe stroke in the procedure to be sure thepath was only one segment long. Byremoving it outside the repeat phrase, I felt

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.

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

Definitions 17 Vol 1 No. 2

Page 13: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

after the scaling. Making the line width 1/10"of the quadrille cell size was an arbitrarychoice. For a sharper line on the page, asmaller line width can be chosen, accordingto the minimum resolution of the printerbeing used.

With these preliminaries out of the way,the actual lines can be drawn. PostScript hassome of the feel of the old turtle graphics.To establish a first position and origin. 0 0moveto can be used.

From this known position, lines can betraced out in relative position. The movetocommand uses absolute coordinates. There

are also a whole set of relative commands.

The rlineto command uses the current

position and the supplied x and y values tocalculate a new position, relative to the first.In turde graphics terms, the pen is downduring this move. There is a noticeablerelationship between the turtle graphicsapproach and the operation of PostScript.The rlineto describes a path, but does notactually draw any "dark bits" in the bufferbeing readied for the paper. This will be doneby the stroke command after the path isdescribed. The PostScript "turtle" onlydraws potential for color, not the actual coloritself.

After the rlineto command, a return to

the next line's position is used. It is importantnot to create a path with this move, whichwould be darkened with the stroke. The

command to do this is rmoveto. It is the

relative counterpart to the absolute movetocommand. In this case, the rmoveto both

reposidons the "turtle" back to the left ofthe screen and moves one-unit-step up thepage. In turde graphics tenns, the pen is upin this move.

The repeat command takes twoparameters, a count and a procedure. The 45horizontal lines on the page can be added tothe path using repeat.

Finally, the stroke turns the path into

drawn lines in the memory image which willbe the dark traces on the paper. Asmentioned, this is a different step from theturde graphics concepts. The path createdwith rlineto (or a host of other drawingcommands available in PostScript) needeither to be stroked or filled before the bits

in the output buffer are set dark (accordingto the setgray level). Stroking traces the pathwith a line whose width is controlled bysetlinewidth. In this case, the paths aremeant to be stroked with the stroke

command.

The same procedure is used to set thevertical rules. Finally, after the drawing isdone, the original graphic state is restored,with the grestore command, and the outputbuffer transferred to the paper in the printingprocess with the showpage command.

Tbe complete program follows:

^ve

.9 setgray18 18 scale

.1 setlinewidth

0 0 moveto

45 { 36 0 rlineto -36 1 rmoveto } repeatstroke

0 0 moveto

37 { 0 44 rlineto 1 -44 rmoveto } repeatstroke

grestore

showpage

Well, was it worth the effort? Thisprogram took about an hour to write and anhour and a half to debug. It's reallyquestionable if it wouldn't have been betterto get the straightedge out and do the workby hand. Why did it take two and a halfhours? First, since I don't program inPostScript very often, 1 had to look up almostevery command. For instance, I couldn'tremember which end of the gray scale .1setgrey produced. I thought it would be verylight and it was actually very dark.

The second reason is that I didn't have

an on screen viewer for the PostScript

Definitions 16 VoL 1 No. 2

November/December 1993

33+ MHz Forth

ProcessorNative Forth instruction set processors

provide a high level language with efficientinstruction execution, For example, complexinstruction set computers, CISC, like theMotorola 680(X), take tens of clock cycles/instruction. Even reduced instruction set

computers, RISC, like the SUN SPARC,average one or two clock cycles/instruction.By comparison, multiple Forth instructionscan be executed per clock cycle, somereporting an average of 1.5 instructions/clockcycle!

The Johns Hopkins FRISC3 waslicensed by Silicon Composers and iscommercially available as the SC32. FRISC3was produced in 1987, and first silicon wasavailable in 1988. It is a 32 bit

Forth processor, with singlecycle subroutine calls and theability to embed thesubroutine return in some

operations giving a freesubroutine return. It has two

on chip stack buffers, each ofwhich is 16 elements deepwith overflow into memory.Considerable simulation of Forth Programsshow that a register bank of 16 is optimal.Dynamic studies of stack nesting depth byKoopman' and Hayes* indicate that theexecution, or return stack, rarely exceeds adepth of 16.

Marty Fraeman and John Hayes of theJohn Hopkins Applied Physics Laboratoryhave been using the Chipcrafter siliconcompiler (now known as EPOCH) fromCascade Design Automation of Seattle,Washington to develop a new version of theSC32, referred to here as the FRISC4. It willbe like the SC32, with similar instruction setbut a higher level of integration. SiliconComposers will fabricate the part for theircustomers and the Applied PhysicsLaboratory.

The FRISC 4 instruction set includes a

DOES> instruction, which is a datasubroutine call which pushes the returnaddress on the parameter stack in one cycle.There are four branch instructions includingDOES> and subroutine call. This is a byteaddressed machine, with load and store byteinstructions.

There is better math support includinga barrel shifter and a leading zero counter forfloating point normalization and imagecompression. For example, one lossyalgorithm does log compression and saves theexponent. There is better hardware formultiply and divide. Since a multiply can bedone 2 bits/clock, a 32 x 32 multiply with a64 bit product will take 16 clock cycles. Thedivide step is 1 bit/clock, or 32 clock cyclesfor a full register divide of 64 bits by 32.

In modifying the originalarchitecture, John Hayesnoted:

BiiiSSP To first order, the 16 deepstacks capture most dataaccesses.The stackbuffers gotus down to 1 cycle/instruction.But, you now have a memoryaccess problem, where you

access memory every processor cycle. OurForth program measurements show 10%of the memory accesses are data and noprograms had greater than 20% dataaccesses. Writes are rarer (a few percent)This is old information but we 're exploitingit now.

Forth programs run in simulationshowed combined instruction/data caches

were better than instruction only caches.Currently there is an instruction data cacheof 4 kbytes. For all of the benchmaiks therewas a hit rate of over 90%, although weprefer to use an effective cycle limemeasurement which takes into account the

miss penalty and hit ratio.

Cache could be a big win in spacebecause there are very few space-rated

Definitions 13 VoL 1 No. 2

Page 14: Total control with LMI FORTH ·  · 2017-06-12• Editor and assembler included ... (Single Board Computer32) ... 68HC11 using an IBM PC as a host

November/December 1993

memory parts. For example, UnitedTechnologies Microelectronics Corporation(UTMC) seUs 55 nsec 32K x 8, radiationhard memoriesi However, the FRISC4 on-

chip cache is at least twice as fast as theexternal memory part, and may use lesspower.

Processor cost is partly a function ofdie size. The larger the die size, the lowerthe yield, and the higher the cost. TheFRISC4 die will be smaUer than the SC32

die which is about 10 mm on a side. There

may be a cache-less version for bothradiation hard and commercial versions of

the processor.

John also wanted an interface which

required less "glue" logic and could takeadvantage of many memory families. A realsimple system could he built withoutadditional chips. Ihis is especially importantin space, and other applications, which puta premium on power consumption. Hedesigned a programmable bus interfacewhere:

I divided the 4 gigabyte address spaceinto 16 regions. Each region has aprogrammable number of wait states, witha 6 bit register per region. There is a veryshallow, write bi^er32 bits wide and 1 worddeep.

The new processor has the ability toboot from an external byte wide inteiface(the SC32 needs a 32 bit wide EPROM).There is a programmable on-chip inteiruptcontroller, responding to edge, or levelinputs, with at least 6 external and 2 internalinterrupts. It includes an on chip UART witha progranunable baud rate, 1 start, 8 data and1 stop bit. This additional functionalityrequires extra pins. Whereas the SC32 isavailable in an 84 pin package, the FRISC4will require at least 144 pins in a squarepackage

The processor core was finished inSeptember 1992 and was executing

programs on a simulator. The interruptcontroller, byte wide boot, bus interface, 4kbyte direct map cache and a UART havebeen designed and implemented. Errorcorrecting code (ECC) hardware has beenadded on chip which can detect double bitand detect and correct single bit errors. Thisfeature is enabled or disabled in software.

When used, 7 additional memory bits arerequired. Marty Fraeman points out'

There will be minimal impact onperformance since we 're usually running outofcache.

The ECC was inspired by radiationproblems encountered with the Freja satellite,(see Forth in Space, Volume 1, No. I). Johnnotes that there is a potential conflict in:

simultaneously designing a fastcommercial processor while building a lowpower space processor. However, both likerich features, except ECC, which is lessimportant on the ground.

Also under consideration is a dual

counter timer and a parallel port

It is expected that FRISC4 will seesilicon by the middle of 1994. The p-ocessorwill be implemented in .7 micron silicon.Simulation shows that a 33 MHz clock rate

is possible. As John notes:

somewhere on the curve we ought toget 40 MHz parts.

For more information contact

Dr. George NicolSilicon Composers655 W. Evelyn Ave#7MtnView,CA 94041

(415)-961-8778

* Knx^man, P., Steuk Computers: the new wave,John Wiley and Sons: 1989. pp 139-144.

^ Hayes, J. and Lee, S., "The Architecture of theSC32 Forth Engine", Journal of Forth Applicationand Research, Vol 5 No 4:1989. p 504.

Definitions 14 VoL 1 No. 2

November/December 1993

PostScript vs. ForthImagine you are working late one night

and go to your drawer for some quadrillepaper and there is none. There's none in thesupply cabinet, either. You are faced with thedileiruna, give up on the deadline, or, get outthe straightedge and eversharp and carefullyhand make your own ruled paper. Now theformer is not career enhancing, and the laterrequires several hours of tedium. But wait!There's that PostScript printer on thenetwork. Why not program it to make whatyou need. Will that be faster? Well, it's wortha shot

wait there's another way. Why not make 1/4" the new unit-of-measure. TTie PostScriptoperator scale can set the coordinate systemto any desired size. So the command 1818scale would cause a unity graphic step to berepresented as a 1/4" step. Hence, an 8.5 x11" sheet becomes a matrix of integer tracksranging from 0,0 in the lower left to 36,44in the uppo* right comer.

Last time we

compared PostScript toForth and found there

were many similarities,both superficial andfundamental in the two

stack-oriented, extensiblelanguages. BothPostScript and Forthdefining words wereshown in action. In this

issue a real code examplewill he given. In a columnthis short, it is not practicalto teach the whole

language, so words will be used andexplained as necessary, but not in thesequential and thoroughly complete mannerthat might appear in a text book.

Before using the scale operator, thegraphics condition of the machine should besaved in its pristine condition. This is toensure the following pages come out inregular size, without concern for the contextof the previous use of the printer. The

command to save the

graphic state is gsave.

The line to he used to

draw the rules should not

be at 100% intensity. Thesetgray command canselect the appropriateintensity so the lines willnot ovapower the writingyet to come (the lines youwant to draw on the

paper). Intensity of thedrawing can range from 0to 1. The lower the value

the blacker the drawing.The default setting is 0, for black. In theexample it is set to a light level of .9 by the

Icommand, .9 se^ray.

Referring to the PostScript Referencemanual, you discover the default unit ofmeasure in PostScript is the "point". A"point"? What's that? Well, in typographyit's the unit of choice for describing text sizedthings. Oh, like point sizes in fonts? Yes,that's it exactly. How many points to theinch? A point is (close enough for almost allpurposes) 1/72 of an inch.

The scaling is accomplished next by thepreviously described 18 18 scale.

If the quadrille is to be 1/4" spacings,there would be 18 points between lines. But

Left on its own, the width of the line

drawn is determined by the default line widthsetting of 1. Before the scale, this was 1point. After the scale, it is 1/4". This settingof the line width is not acceptable. The entirepaper would be blackened. There would heno white space between the thick, 1/4" linesplaced every 1/4". The setlinewidthconunand is used to narrow down the line

Definitions 15 Vol 1 No. 2