the Echothe Echo 1 but he advent of IBM/PC facilities and the use of Motorola 68000 orotessors xx...
Transcript of the Echothe Echo 1 but he advent of IBM/PC facilities and the use of Motorola 68000 orotessors xx...
t
I
‘I
Bcn’ioi IVI Z
3r
B C to 6
onGpsis:
TCs per thscnsos th areas of application and e reasons for the choice of the
or I angu e in th raining fComp ter Syste ns Engi ieering students t the
in y hno
I±itrnductiorn
I) n the as bur s there has been a significant growth in the use of the
t’o t language in tin’ training of students within the School of Electrical and
Computer Enneering at Curtin University of Technologr and in particular
within the Computer Systems Engineering degree. The variety of applications,
and the reasons for the introduction of Forth are presented to show the potential
a f tin. guag thin neen ig cducat
Th rigina lssignm nV
Th€ irs introduction of Forth at Curtin was as a student assIgnment. A major
a,signment was initiated in 1984 to investigate the language, its uses and to
‘ g t app tions oropria to coirputer syst’ms enneering courses The
ci I rerta i r avalabl a I ttimewasfortheZ8OinaCPlMstyl
dc mont °nvironn ent(CDOS)
Phe results of this investigation showed that the most likely applications for Forth
were:
1) in eiectronicJcomputer systems projects in the
hardware area and in relation to industrial control,
2) ir the teaching of assembly language programming
3 in the teaching of certain operating system concepts.
F1rst Austraian Forth Syrnposum
if -
t’ chine- ii ;naii cn/nuu
it
-
i r di. ‘0mw s i nplc. tat am orth I eon us Com
g. ue.PO SEC at urh c mdcix the cix son between IBM/PC
SON arm cIt it ix at-d Mao ntosh users vith an appronmate 50 50 split between
off user and als-- in hie studs t’ Iab,rstorr facibties
LW Forth C UR’F’( F ) for th FM/PC
LI o n
ito Is ip
in cmproces or
4, MaJi N for the. Ma mixosh
Projects
e use f F orth ii ix ergraoua tude t ects which last through the final
to i hs I i ir u & o vitis staff familiarity The
st thr plemor ons m ed ha ocen ar ar being used for project
dvelopments witb varyong deeec of success
Forth is now also being used at the. postgraduate study and research levels.
IMJFor forthelBLWC.
Jif FM/P cl bee for roe to
of en is Of a steida d notM
a&Cini Ic. improv e apphoa i of UP! OR I H fo udent introduction to the
assembly language fcr the 8086 Whilst the Forth puristt may not support this
4eveiopn eat it providos sigruficant adt antages in teaching. This project
complements the facilities in Mach II which are discussed later in this paper
der tie to ching of assembly ar guage
e latns a he p stgraduate 1ev is the development of improved industrial
c ntrol software for he vy md etnal apphcation.
2 First Australian Forth Symposium
F
c1 3 J! tuCt1tS
c Y’ w II he yr rt nu o
ti io a itt oro m 0
P aan ohr; s cn ch:ch could bt proulded vatu commana stnng a
2 2 ras d k if crc tior of indopendent omzr nd vat
r ted th ci n id g er’ a rdiobuor og or
1i’bIe text inscrtrore This project proessed to the level where a command
anp’cme flOd noveasent on three axes of the robot for each command string
n 0 s 1 s i xneuc r ru n ‘0 asp o
tee proer and in the rehaoility of hte demonstration robot arm.
b ftc. S ugle ‘hip 6811011 ‘lipmcessor
inrbe of project. at Curtin have been involved with the development of ROVs
Remote Operated Vehicles) for underwater application. The newer ROVs are
it s railer han their predecessors to cut down power requirements and to be
tao c manouverable The first AUSSIE submersible produced used an STD bus
7-80 bated system both at the surface and below for communication and control
pu ose To help reduce the volume of electronics the use of single chip
a pr css cot oilers ha beer advocated but not implemented until the
am dcx ciopmont facilities could be made available. Late last year the
s’ o’ n was mad’ that a sir gb chip microprocessor with a built in Forth could
rr ti- ac. adf ctsrcvn 1 um’m de Icp’ettrne aM fa al’tte
‘0 recuitant ase of the MaxForth implementation on tire 68HC11 is proceeding
ry sarlbfactoniy and being configu ted to implement the communications and
I c attic fa ardwtfr h ROVtef
Teaching Assembly Language:
F r ur be f y r the Z-80 assembly anguage was’ u ed e tensively withir
the Echo 1 but he advent of IBM/PC facilities and the use of Motorola 68000
orotessors xx VME bus systems for robotics, and real time system applications
h s cc o a sig rificant reduction in the use of the Z80.
ml- aced was to introduce assembly language as efficiently as possible. Once a
student has become familiar with the concepts then conversion to the specifics of
an lternative processor seems to be less of a problem Forth was considered as
C Au aha’ co Sy”posumn
--1
-K — —
o ho tact
a gu v a ab ‘nil acinto
El- ha’ teen sA 4Lpas r ts attito ergraduate o
cm at dimna himj to teo-ih ‘en Ty language programming for the 68000
rocecsor results ham been sec one imaging In effbct the students are
tea H-g two1anguages at onec hi’ - thm does not appear to cause any problems.
I e debugging and tiace facilitu allow the students to quickly relate Forth to
er and ‘stand t of ntacr i itions t £ ate inline code
feq xl he and e e concept of
ME d p he I mph. to o provides
ents wi obviou derstand hi xamplcs of ‘tack frames,
bonmquently it has been found that the students can easily relate to the procedure
linking requirements -of other high level languages such as Pascal, Modula-2 and
o with which they are familiar i beneve the development of a “conventional”
assembier for Forth implementations on the IBMiPC could open up wider
educ tional markets for these prod cts This ha resulted in the current
c duate r j to impi is feat
ri eking (Mncepts
I g multit sk anu tea tents f neers I ge xally beer a
onerous task. T school rot s ow eats used a “—al time exccut1u for the 180
from Kadak m Canada nhich was med both for teaching and project application
Other fac’htes used mcluue Versadus and OS—9 for the 68000. a stmpler iearmng
mvmnment ‘va deOreanre whoa aitag “ito the operating system principles
ar I en allowing r ‘mIle imple atic us to b ed in real ti ne applications
pts o l. vitching hi nmux to needed to be presented in
£ rmngenvi oxiner Vi hs rae vi gva gsbeoause fitsroundrobinr e emptive task swmtchirg £ nhg atior a I Ii was used as the
ni ut asking learning tool and with emphasis n its limitations an important
part of the study process. The students using Mach II for this process had
already become familiar with it through the assembler studies.
A combmnation of lecture and assignment were used to get students to face up to
First Australian Forth Symposium
rp I
Ire acL:t S’ft, 1Qict’a a
lit tiw tardard sh:d4ier ifl Mach 1 with o priorti
C o e r s t ts r i
N It pen
‘:1 chol lia just purchased a UMI robot from the LK which xs programmed a
a on c Forth 1mw an mM/Pc-me Rfl” teach eackage ror the robot is en
p ic io lay r nit n p o an b3star at Forth sP a, h novem nt of
tho robot axes may be directly controlled by single keystrokes on the keyboard
a g r o e ar e aunerickeypad area.
Forth words have been defined to set and read the control parameters of the robot
to th r v th ords which ‘ontrol a learning mode give considerable fleñbility to
sw em connguration.
Thts ;s adding considerably to the appreciation of Forth as a practical language
fo use n the adus nal control field.
Coc io
The application of Forth to the traimng of engmeenng students (specifically
Co ipu er m Fag ne dn studer ts) I as grow a quite dramatically during the
las (ncr yca”s simly P ecause t cuts ±e desigu panc pie and systems
rquirnments ‘ithn the n urse. It is ant.cipated that Forth will continue to prove
to e ig fic t acto ir h ra urgpr gr an bocaus of tseasylea air
Cit n’actenstlcs and its simple access to the hardware through assembly
Toe avaiiabtiity of small industriai robots configured and controlled by Forth
u on tar ds v ‘11 farther enhance ts r pplication to a broader spectrum of
engineering studer ts,
rs Ms iT’ n F ft Syapostum S
CK IND
o Fca
0PE HiLLN.SJJA’!STPSjLIA
928 6.
I 3OLLEGE‘2 FORTHAPPROACH TO TEACHING
SESSON2 SESSIIENT ,* D
3 P SYLLABUS1 FEEL FOR LANGUAGE AND MOTIVATION
3 2 VARIABLES AND CONSTANTS33 LOOPS AND TABLES324 EDITOR AND FILES
5 DECISIONS - 8
3 6 MOVING DATA7 DEBUGGING S
328 PORTS MUSE AND 0803 2 2 2 8
39 PECT AND QUIT 528228*85
3. O COMPILATION 5 2 5 2555252
3il N/C LANGUAGE 1 2 2 8 2
12 N/C LANGUAGE 2 8
3 FRD(RE I14 RDUARE2 2 5
3 15 ‘RD(RE 5 8 5 2
3I6 MULTITASKING S
3.17 METACOMPILATION 2 2 2 2 2
4 GENERN COMMENTS 2 *
GG LNSITOR
0s2 FORTH53 COURSE
5 EVALUATION 2
6,tA S
7 KM DGMENT
S I5 3
3344
5 48 58 5
5566
5 66677
2 9555 25*5 9
95 85*888 10
8 101111
I
*7
I
5 788
First Australian Forth Sympos!um
a ‘a ate ‘
t r f fa e’ a1 Nr t nay C’ I e I C
nt e t cc c q; ice -ng
o a çjouerment tertiary adu at çr ‘at ti t
+ r c’ies I over’ he ‘at te Its ‘at de ‘a ar ‘a ‘at y bgh
a cr They g duate after 1/2 aears of full time
i are awe ded a crt ic te a t e ak 4 e is r
ge S’me o the graduates are accepted and proceed to
ati’utes of higher education or univers ties
At th moment undergraduates in the digi tel strand are
fced among other subjects M/C language programing for 2 CPU ‘a
h 65B2 for beginrers ir stage three followed by an advanced
(,2 ‘ado- POF Lor the final stage 4 In the advanced 6502
nre students are encouraged to build theL ow hardware and
a t i te rupt driven software to control I/O peripheral chips
r e oftae is buried in Eprom Until h ‘a yea BA°IC was the
up’, available high level 1anguage
Participants to the FORTH course come from he electron c
:noustry and have as a minimum prerequisite a certificate in
Electrical and Electronic engineering or equivalent
qu&ification Some are Institute graduates Participants’ ages
vary from 22 to 55 they come from the private sector
government and government authorities eg WATERBRD CSIRO
AF3C DEFENCE SCCetc Most are experienced in testing and
building electronic equipment and are hardware oriented but
Keyboard experience among them varies Most of them have it
s’orr programing in BASIC many from programming the 6502 or the
78P and others the PDP11
The Forth course is free but the cost of books software
aid hardware i born by the part cipant Attendance is 3 hours
per week for 17 weeks Of the eight groups who have attended the
c urce so far 3 groups were released by their respective
employers to attend day time sessions the remaininci 5 groups
a tended evening sessions starting at 630 Pt1
Motiv ton cried from the need to assess and catch up wtb
e softwar t chnology to the premise of effcient hardware
nrtrol‘Th ‘a he participants within and between groups are a
+ xtu uf widely di ergent i erestc a d experences
Ther is an ongoing discussion among staff at NSCT as
to th p rpose of teaching software subjects in the School of
El ctrica Eng neering Though staff agree that it is a mixture
of data acquisition , processing and display modeling, problem
so yin9 and the control of hardware they disagree on the amount
of emphasis to be placed on each component but a trend has
emerged emphasizing in our School the control of hardware
1 0 g h I ij FF ac Je dee ger na d 0
4 L LOU 05 tut ne avaiabiea t cou o 7a out bø an+rar
T °DP 4/c as ce 1e niy n r puc and ona e m S h k v we
a 1 e ore er ny af em are th ie ha or
o unknown quantItY and no° n the main st-earn of tings
The breakthrough occurred n md 1985 when 3 events occurred
muaneousi? and renforced each other. NSCT acquired 15
-i con ute a r irg und MS dos The 6502 Rockwell Forth
p ha up cc cc I ava able nd Sdney
p vioc the puu’ c i er on Le. en Per y L&P1
F83 With scarce funds available for the purchase of software the
L&P version of Forth was deal in many respects. NSCT did not
ave to worry about distrbu’ion problems and copyright
ri em n s an d nt I si of &P a ava lable for 280
s owned y rraiy o ou tude ts the source code of the
anguage is available and fully documented echrically it is
robust and above all blessed with a metacompiler.NSCT distributes the software at cost price and in the
a irit of FIG,tn Febr”ar” 1986 NSOT e Ilad the Crst Forth group . In
u y 1986 12 staff members att nded an 8 week 3 hr/week Forth
course In February 1988 this year the 8th. Forth group was
enrol led,Though students experimented with RSCForth on the Rockwell
c ip and Br te Forth on t e Ir ci 8051 ontroller there was never
orma p act al ab wo k tudeits to ght hardware kits late
the course and experrre te it thee according to their own
fkeld of interest.Earlier this year NSCT bought Inner access Forth for the
Zlog SuperB chip. It is now NSCT’s adopted hardware chip. It
ns a 20 ‘lHZ ard t s ftwa e is den cal to L&P . Its price
w b n the a f de h aid of the
tacorpiler app ication e ne n e oe ‘lSCT has acqu red
Maestc boards with the NiX chip to demonstrate and experiment
with the latest in Forth techno!ogy, Twice hand robots borrowed
froa the School of Mechancai Enginee ing schoo1 were programmed
se a ort e as u d e x o ks ‘laster ng
th y A derso ar Tra , he eco d ed ior of StartingForth by Leo Brode and Forth A Text and reference by Kelly and
Spies. All excellent textbooks for beginners though the latter
goes into more depth Stude9ts are advised to read chapter one of
Bode aT nkingFo h
F’ AusI aNan Eorth Sympos urn
ci r e b K a b
Each tudent has hs own Air icot cowputer he ma. imu
njjer + etudents is 15 per class. As Forth theory is developed
e tudent s imeedi tely requested to test his understanding
t a e f e a. e e eyboa de 055l C
aa.les are chosen ta have a v sual ard audible impact
Theoretical exp1anaton never exceeds 15 minutes Thus a student
cutt1e between his desk and keyboard around iø times in a
5 sc n he beg nning of the course b spert more t e
a tSe keyboard as the course progresses.
In every session a set of notes is given to the student to
omp ement the textbook material or to emphasis some point. At
e eg n g he ourse the studen purchase at ost pr c
be L&P Forth ersion modified with a screen editor. The cost +
the floppy is $5 . A similar version is available for those who
ave IBM’s or compatibles.
2 Z ASSESSMENT AND AkiARD,
Assessment is based on an end of course test weighing 20X of
be ourse marks, 88X is devoted for yearwork assignments and ab
tasks. Students must attend at least BOX of the 1? weeks.
Successful students are issued with a letter confirming
t da e an u e . ctatemert of attainment, Uni c are
)t wa ded
s P s a tor Sy p siur 3
F
t S.
i th s f t week we stress the ‘act that Forfl is
ike a spoken cr yr tte Iaguage Spacec o gaps must exist
betw en ods Tn larguage is a d ctonary of words grouped into
‘ffeent vocabularies, he ci io ay s e s cc’ ased by
$nvetig or creating nw words
Wh feth s cal’ed a threaded ‘angage he . treads nf
L&P and the hashng of it
The cortrol of VDU and cursor AT, DARK dEEP , HELLO
Inventing rew words us rg Id on The reamig and
FORGETnng of definitions
Strings Positioning of strings
The data and return stack,
Dot and EMITDelays using MS
Changing Radix numb r system
Tynical examples
0, WORDS, VOCS,I HELLO CR HELLO BEEP
2 : MY—NAME—IS John Simpson * CR CR BEEP ;
3, DARK 30 20 AT MY-NAME-IS 200 MS BEEP 5 TIMES (LOOPS)
4, MON-NOtI MYtW*—IS ; (Frerch)
5, FORGET MY-NAME IS
6, 12 HOC CR 12 DECIL CR
2 VARIABLES -N YS PFT
C ONSTAMT SChoosing rarnes fcr crnstants,
VARIABLES, A ot of ime is spent mar ipulating variab es
c a fu damentl oncept to Fo th
ar ab e a 2 byte storage area
-t is ar addrcss of n r yg
t is a system variable,
etcr aid store data,
fetch ard store a byte,
System Var ables, BASE ot the Forth System
PRINTINO ON,
bk’JING OFF,
i First AstraIian ForM Symousium
cc set K ed n ‘he fst week a ng IMEC
e op c n cc ntere t p shet tn loop ndex I is
cL nej 14 h U R UcP 1D , UD ASCI1 and EMIT
Pr r of Jet1iial/hex , decnal bi ry and AS II ab es
Neted loops and LEAVING loops
lnt’oruction to the screen editcr
Hog Supe S hardware kit
Orgar iz Uor o hcrdware proiect
4 EoI3P AND FILEc
Screen cdi toreEditor commands Help menu Shadow screens
torth filesCreating and Opening filesg
Copy and Convey of screensa
Loading sc’eens Emptying dictionary
I ne skip and screen skip
DEC SIONS
P rt flags CPU flagc
KEY and KEYIF THEN and IF ELSE , THEN
Nesting of control constructs The use of KEY and KX?
e th r control conctructs.
it for a coon definizion
Stri gs: C
‘ sitioal case statenent (best cace statement)
n K3VI C DATA
T is s ne of the most visraV sessions most effective
and most in erestirg
Ar rays are created , blanked erased and 4 i lied then
twpedData is moved between arrays
Data s fetched and stored fran within arrays
Data from 1024 size arrays is updated and flushed to disk
Blocks fran CON and HEX files are fetched from disk into
RAM, manipulated, then stored back nto R#*h
Memory is DlJ1Ped
F’ A sV”Iiar Fo1b Syrnoos;urn11
EU’ 3D Fds ar
deade f r da a [ aderK7DE and PEJ$L,<ECURSE RECUR F
Cl Fl exam os
r
°crt v/s memcryCetcb;ng and s’orng data tron and to portsProgranwn g r 4 channel zround chip ( TI ) ia a serial port
Tr at kin) d do bI umbe sP air a ib bt i cc port tenavalabe
W de n est Boa Speed NOVIX IBM
30 EXPECT A-ND (iflT
EXPECT3 PAN r I vOuter i a pr e 00Coand ne i terpreter IN ard D0NE?Keyboard and d;sK intenpretationtWIT TWES as examplesVec’oning the nput wod sourceEVA ( nV ron on)
3 rflp
cwrra C orraa and untrralThrpiiat’on al d:tferent constructsE r in n c i on ack pt har e
Jr3 r6E
808 and’ tectuneI uc ns
s orth agsSimp e M/C language routi es CODE NEXT ENDCODE
MSDOS interrupt cai’s
First Australian Forth Symposum
3 UJ C
i a. ii rctrtct4reC :nrd!t ore. S
C rC:C yn ue ow hei todcies 2The Laxon In ck
r r e‘Exit R )RCP
‘J 1nt
liloq ¶,upere C p ar hitecture
n r t n seZHog interrupts
tiardware proJect
2 HARDUciPE 2
ov x chip ( chitectu’eInstruction setHardware proJect
2fl5 HRDURE 3
Nov x op imiseHardware proJect
a3 MLkJ iT3SKiNO
o d o n u t ta krg o p Pause
User variable and syten variables anea
Task creation Task wake and sieep Background taskS
ingie and Mul i
mul - ask e amp e de o st ated
Hardware projects
* METACJMPILATION
iemeaiCngofmetacnpilation.
-e mechanics of metacompUation
Metacompiling a headless appiication
Firalizing harckuare project.
NOVIX metacompilation
FtC Astra’iar Forth Syrnpo&un 13
- ndvt
S --- €. ‘ -aeriL sta’ U€L t
I t a h€ t t ‘ of cx r n te’ a
0 3 C 1 C 0 0 t P
ar o - at urunpntaton n
u o- a cua e t t g r
otr p a &Jcr0 a boy fi rton wch can sidetrack the
-at ur But ulta’-’ ‘ n or the sr-ous student a gold
+ -f t r r ttp )xrnmr tchiqes, opc
at 1€ a ‘ ic a 3 e cros wt ct t on us beg inc’s
and oracttoner alike until understood that is are meta
c-rper worth s at e’ a itun the her el86b1k But after L&P
o [ 1 s r th c ag i
No dft:o1ty ‘as been experened ‘n handling arthmetc
an logic operators :r poatfix mcde beyond the normal
r a o a g + 4 € c a en y st p ol t ns
c simpia prob era are de beate1, undetaker to demonst’ate how
a word representing the ‘na1 solution is made of simpler words
Th r cessi y + do umnt ng th t rf cc between words thru a
co d’ a ac d agrar i s e ce t derts are advised to consul
Leos Brodie Thinking ForthBeg nrers tace 4 types + difficuities Clerical
eGa ca c cia adge i rh
lerical d+ficulties are due to the novelty of Forth
insertng a space between words is usually forgottena specially
• or d fter o cn a c o a d ot quote Forgetting to
terminate a de irit on w h s mi olon Not pa ring IF THEN
IF ELSE THEN DO LOOP etc and incorrectly nesting
tb n A so fo gett ng to tic t’ieir orly in ide colon definitions
cc ar ca f c a a te se o the edito and th
handing of fles The firs4 time I introduced the traditional
i1e dio I reaized that c’jdents were hang dfficuities.
t ou d o a re i € t e a o t • •d tor and Forth A
clear demarcation between ed t node aid For th was necessa y, A
ecreen editor was impiemented It is a must for beginners But
n he t • cree edit r a a Ic rn ng cu tie
‘ic ia d nj o + € i r t ot ho th ea ing a d
operngot ties. Moving bockswih>r and between files
Ircidena difficulties a-c due fi the flecessity of learnng the
88 t n € ad osn a e orde towite low
lee1 rorth words This is repeated 4or the Zilog SuperB CPW
Genuine Forth difficnltes n ascending order were
BEGIN 491 E REP!A The flag + WHILE ?
nterp e at on an comp lati i
3 Imedate words4 4ORD How come WORD usage c infix ? its input is
from nput a ear tack ‘
5 Deferred compilat on6 CREATE DOES>
1 4 First Australian Forth Symposum
t r ie EbTT3R a :oftwa c w &c h n en
t a e it a c g h
er d fa ‘I t> o a scr en be we st g i t d k ir
aee of error an appropr ate message i displayen The:;stuctor wLl save hmseIf quite some effort in the first few
e t t t d t a e oF h
cdi ts
The cdi tor s to cPeck that the fol ii ng words are:
d V e b a
F
I e by an and
3 Paired: DO LOOPIF nnn ELSE nnmTHENBEGIN AGAINBEGIN 1NTILBEGIN WHILE REPEAT
Sof wa e ci h to fH er out the Liput of
cotr c aracte s v a keyboa d2 Disable unused keyboard keys eg Up arrows
3, Provide Video and Sound words egt[ C n ) generates d o4 f eqen v r,
do Re EXPEC to accept on y numbers as nput
5, Read and write ASCII and hex fles at other than
on 1 Kilobyte boundary,He f ci t like VIEW bu mo e n he attire f
i t a ardtowt
‘ O RE
-he topics of th,s tourse a outl ned should be sp cad over
2 semesters with more time spent on harare and on problem
lv ng te nique A specif c set of abs ard a pr ject should
de a ei e art c pan s
S2 0 S r ur
td t f. çf. - y t tuoent e
t of c e c s No erorgt ef r was
nCraw ro cc rue: di o lac o e b t
e a o :o:su o s BRODIF Thinno
hRut orsoer the folow og a Th oe semester students
a r d a ev Ia g ae ard as etled fortt omputer Kit using
i e c tte many roces or av able tey g n r t d a u nRc
picaton They metacnpaied ther own Eorth program They
o e s a h n a g o o t i s h n e 8886 nd h
ZogSuper8m’xing twizh hgh eveI Forth. hey executed
M—DOS nterrup4 calls and ga ned an insight r the working of an
ore a rg syst m a d a mode n I njuage
The conf dence and knowledge gained by such activity is
rr ieable tsl o vts hatth hasbee chieved’nl
semester in an E’ectrcai and not a Computing achool without the
traditional backup of prerequste and corequisite subjects
a a I ble a the udergraduat leve reflects on the intrinsi
mer t of the Forth Language itself Forth is an effcient and
pot n education tools Reirfo-cement s ever present and
instantaneous wteher in the form 0+ reward (oR) zr punishment (
or crash) The final software/hardware product is quickly and
eas ly ea ze cay nj o tine for boredom to set in or cause
for d sheartening There is no constraint imposed by form
Crc tvty is not histracted or stifled it is liberated
Bone students have exp ess d the r desi e t attend an
advanced follow up course It was gratifying to find out that an
o g n zat r hay ng f h i pe s n e attend the ourse last
semester followed it up by sendng 4 more during daytime this
yea Our School has offcially adopted the subJec4 which can now
b offered awwherc n t[e Stat T e opt tor is he o
,ntroduce it at a ater time as an undergraduate subject Plans
t r a i e r t n i e 2 d o r e or b NOV X chip hay een
discussed at NSCflAt the moment PASCAL s otfereo in stage 1 Following the
I a se y o t o h 9 9 n be off - d or em n
sta t nq rext semester BASIC is beirg phased out Aware of the
p t r I of For h a n ° uc t o ol ard as a h rdware tool I
expec t to make fu tier ir n Ilabus a early
urdergraciuate stages
6 irct Austral ar Forth SymposlLrrl
kJJJEr. MEhI
It is no easy task to introduce to an inst!tution
onerva i e b a u e th a es abi shed c r i u uii and set o
subjects tte notion of experimenting with new ,untried and
u conuntirn I ideas That I was encouraged to do so 2 years aon
is a credit to staff who backed me up at NSCT That decision is
today fully jusUfied by the advent of the NOVIX chip and the
news of accord sou c ng by Harris scm conductors on the high end
of the market and the availability of Forth for the Zilog Super8,
t e Ii e 88’I ard Motorola 68HCI1 on the ow end, by everts ike
this Symposium and class attendance.
I uld I ke to thankJ0Haines,J Goulding and 8.Webster t
NSCT for their unqualified support during the last 2 years
T Rofe and P Tregeagle of SYDNEY FIG for their help and NSCT
Forth students for their help and enthusiasm which made the
effort worthwhle, L&P for allowing us to share a masterpiece and
CMoore for creating Forth in software and hardware0
St 4. sLVa a Furt “y pu&un I
4-
- 1’ .1
t
- t ± •:.b.Cacotrt. trs ::‘
;sn..... izy- fl t r.. -. a. rpzctr: Cw3’Zt..r..ty t%.- a•t-c. -. rti’ac tr :‘ sses..Ieate4 ‘6ChLj.es
)4 4t-, tjjr er agetavaic 1%_ -o-p-’- i— be useS inra y w-y, C•.”3, ..4t ra’ys sd :ssistjng thcst d rt C hersy nf L,s’’e t- ?e successful
- ot tese ‘i •perrenç re;2.r.. a teavies o_ t...e at.atoy, c :tj lErotance in f.ct effort
z. ade ret tc, oroduc- a c iiplete:y aut,jat_c experjinnt
34st becats— t’ere :s a eec or Ste Carpfler bascj practjcaj•
ar t!:s pape’- e Ciruss Jie zeats or a prograre corjtenced ...
fl5 It-ar Pas rr to aOWirj object_yeg
xpana the e3c0e_I,icrts 3nto trw sernp5 ard t’lard year
lcabozata )a.
Lfls:e rcducr.vry effjcicy.cy ñata appropriaterto:ce o lane a’ze
%O’C ‘rid Aecj.ri annrpri&te
* )es-gy eac,,ez rts gi’ os. be a:-4 ‘49i c’-’er t’tiarj
t:t ±...
IesI’.. .rac pa r t s’c d nec;cr. -c: -m ‘ e’ign ai
,, r ‘r
Lp irp gi delays frr his .rojc,t were ae aferw.J4 stft CCSonslj5 for teac laboratory
eveaopwer.t 4t S.A IT and the flo.z] f Phys:caj Sciences,
ilanders Ur”ersa’y Many points ae ‘a raised and it was clear
that, a.thougsz many stt4erts were computer literate the
disciplires of problem solving were inadequate The lace of
formal processee ,u3d rest.t ma’z 0 the ai”is
‘rst Austraflan Forth Symposium
aC
a cC
sac ‘up in a
U 2. ‘4
e r ço kS
rp s ou d bE u.c.d to ulsustrate tue van - acquisitior
b U OJ.!JO’ tints f signal analysis This was
mpartan to the S.A.I I effort due o recent
ax sms of H. P’i s ca degrce where it wqas felt there was
-7
8
p ag c r u
C
0 ta’ ; d g
• r n i’ de dc rta
cc.
Mac 1. a publis’irg row dlt.d by Kc.iY.a.
r i a FORTI based language wth four nit modules
TEV I LYoI$, ACQUISITION and GPIB The extersive glossary
er iearly every mathematical and acquisitior task.
ie o the excellent documentataO and tutorials rake 1
uder’ o ga r expertise
sa’ I- rp IUr
1
IDI.
4I
CC
CS
.
‘‘l
a
p4
44 ‘I.
S3
%.D’
fr
1‘S
tC
-u‘%
13C
s)
‘0t
3 ID
IDI,
I.1
.4I
3
U1
‘Dl
..(
..%
Cq
5•
41
1-tid
0’(a
’.,
•0
1rt
a3
•,W
I.
S4)
1J
F.3
I.)
t’
‘o
h3
aID
37
0’
10I
I
J.
Cs
pID
0D
ID
ID
0tt
43
I,‘3
7 C. • .. Ca.. .c •....‘:t7 t... .:
- a • 0 .43 5 r : c°n e1cc” :
3.. t. • I ‘U..tT 8 - 2 C C.
C.tt C na:at..’n in efl.t.ture of - j:ri cysflr -r
c a La .‘ U o-rrt’y n
.e C. f.s ‘a..i.,.z... .tcrees .,_ azr1nig 1.. .. f.z
... ..- - f ‘r r. t a .ncat’d — “e f±ra jcct ILDC’rata y -
.q r - - c...’.sc”eea _are ta c :.j t.a... et...r.,.
—q - a iiso’c cit 0 th- pcr a’i’ .owcr rora.r;
si 8...: ‘v ,.rb:r ...te o ...ta 1 o
t’Ctc 4 e tr.a :ow nd hifl rrequnces vere te pei
t ‘ c Te $ n 1 a to t er .d t’e a ed in r4er
• 1 .-rn- .flt .-1SS - c’t?l.U P
cbt e e s o n f
! N IL v ay rent.
‘ oa. rte..gtlt4 bet arto i- r4 9.nd
:r cormon. sample echanacs exper:ments. Data a.S obtained
‘garParraptinq 1 g’it beam — sensor zrays positioned down t%
-n i rd aista cc vcr .t ar i e a a € ;r ph e
troduced. However. thc accaracy can be poor unless good tiing
2 r ‘ r t’ i s -‘ cnarw fl ‘;e atorare
i_Isccp’ o daspy a the en’o ou pis t w a 6 c. .e o
-c flYE! te anaLyse these outt4ts arid produce tizte ersus
c a c Ii e ‘ stu n prxacyh1ti4ay
.C Ii C4C mces:rtent’ as a ttnctacr. o4. the a.wae an:Lne .0 be
..say Gchaeved. Scvera tarue ‘teasurewts and anal)ses ar
cat a n a. ire
S yle. ottpat or •‘n r w dra ara cn firal graphs are s’nan £.t
Sn
Firs’ Australian Forth Symposium 21
1 co C co T C,
(0 C
-
120. 200.
-
‘
iiUi L.
000tOG
First Australian Forth Symposium
1
UtI
rA
L
IOL
UU&1t
Lr — — —
20G 6L0 IOL 140
urei
4L0 12L 202
4t2+
20 360yE 3
60! 0 14L I80!xE 0
flQ“A
—..;.........; . i...... ...;.........; •.......;...... .
........;.........;. ..... ..
.:.;.........;.......:.:
8—.
.4Win.4fl
-.800
a .........t.••I• * •..••ss.l .
........s ., • •....... e .. • , .:
T •..‘•I.i.......41t4j........s .
.
I— —-——--i
48.0 128. 209, 299. 360.XE 8
a
14.1:
6.01 a
2 • 08-
. .irri—r——r’... .
• •: •l . • •• . • ±J?2! ±.““ • •• ••
.•. ... ..; •. . •.. •• .;... • . . . . . ;. . .... ... . •. . .. . .. . . ..; • . . . . .
fr *
28.0 6L8 188. t90$ 8148.
24 First Australian Forth Symposium
4
at
4Caa
=1
La-i
La-i
-Lal
a-2a
CoI4,4
La’
rL
a’,O
Z
__
‘9;:
‘p‘-
aC
A)
‘UO
S-bO
__
LSUa
CC
3CE‘—
U
-flFF
YI
IIH
-f4K
’t’S
Si
a’
(it
asu
aC,
30 2
Fr
Iair
tOsaah*s -
4t
PC
NE. UMBE
t
38
F PECR P
1P
L
aM 4w
8
I
4
ar Fw4k ThOS uT
‘L ]ot ofof Fre
piftude ar iase a, a F t ion
r rst Australian Foh Syrposium
I
27
21 oa
a-.
•c•
as
t
•“
L__J.
r...a.n
..sins...
•n.e.
•,
F•
011
•31
——
-—
C
aC
CV
.
41•
•w
’seq
a.
—
•a
___
C—
.—
——
.-
w•
4.
I
tab
••
U•
—
o•
m—.
•7
4•
••
•tC
SaflC
sI—
CW
S-
21a
—_,
—..
—
ci•
I•
I•
.0
Cs_
Ce
...e.
-C
1¶1
—.
a•
a•
a 0. •
-
-7 I
3; I a) TC)
C
)i—
4—
Cl)
B V 0 ciCD a) rt
0
CD CD-
I‘.1 0
lad’emanc a g o Sompiter In da s us bcf vog iav’lat at
wim sting and athleticBsicard scdb M
A ai ssicl’ e
g r
ovcgap seq c ad rcase n ry ques r roti r r ucalist c looking not aocedurcs o dray aid undraw i pA Dpackag°fro ‘ a
ow r viruall cv ama d’
n I i ixtcer years teachingo thai a passing interest ii
ad cd caret to program the SharpI a gra c results at
i t proj for LI kpple II omputerp t 0 il
is ale aobunw vastolearnalli ti LI ug pocesc A’Ihavesaid,Ihad
pa edu Ago Forirar Cobol andug n roUter wto wanted
i dg ac stash’ was to know stya V of odu tIe
vu Ma and a copy ofs igopograrri
ac [ada orki
LI pletelLI up c king
csrictedm I riafle
ig a f tho Project wouldi an dan ublished form which was of use tos ii n arror irethods in my pursuit of
s LI V vito h powerful nbuilt regioni uP hange Later, after I had looked
i e fb nap ords which I user a i b ecpyng a ‘mall offscreen6Uscaoid lock,
t
rI
lisp0
1
App a
a s ad se corsl
lay g‘Li and k
r goo’wol’igk wIat ur
gt Fara
w c 5
aU’
v IC
a&
gr
Ic firhd
t
dii
Se
U
r iran lin editingv ior Ma Fort comes
er P c tar sgthcsourc” odes g I atirgooin and
di U LhidsS”
i zg obogetar
a i r dsr
btA
‘i/rd id F” “t Syrrposiurr
a ‘th moflths toiearnautcragramrairg
-ac! sriaarnatithrcwcwa-thetaraina
ii ‘i d ic I Ii s M ee cc a i a ge
x. - ref d 11i an c o, tar r It cc ii €rg u r
/ kS d u t1Oo5 nan an —‘ta n InC Mac. MacFotan nac cr ano bendred ooibex naps
a ‘an ‘‘ yr rannr TL. rant af tue toOl o routines ear. he aaneaned reasonably easiti
‘a 4 a by in on pm f,r W da r a ‘i’g o t needed tack lam I the
)l aria sin Ii e v no bee cci nc” ‘ic ‘ie sine an se a u g c d cci
nanassembler words beh edow yau ‘0 manlpulate certain “egisters withOut coropuing the full
arse’rbier nankage
a g an e as o v n ii’ c cx c v C obo or Pane L
.be ‘or ne in c’ainw’;L at the prodocbvitv of Forth aver other !anguages, For me the best eature of
Forth is to be able to write a word, put it in the thcuonary, that is compile n’, and then test it
mini ban’ y. I ned a ri in b exb ‘nd con”der bet ‘wih ‘at ka e to “peed hoe chasing bugs
o z in g do n
Ar’ advantage of MacForth is that it comes with an ndine assembler. When a program is running, but
‘ou are unhap y with the spend of some part of it some of the Forth words can be recoded in
a” I e ensil (I a ive Solutions have said that taos of the importan Forth words in the
kerncl have already been coded in assembler and I have only used assembler in lv o programs, Fields
and Hooke’s Law, in Fields 1 achieved a big increase in speed but in Hooke’s Law it was probably
not worth the effort.
A disadvantage to using MacForth is that it is supported from the U.S.A. but if you are prepared to use
the telephone at five or six in the morning then they have a telephone hotline available for an hour each
clay Support is mainly offered on CSI Forth Forum on Compuserve, an electronic bulletin board. I
vould suggest that you do not join the National MacForth Users’ Group. I sent my money in March,
98 and, to date (April, 988), have received absolutely no response This group is independent of
Creative Solutions.
I c iacludc he e a nu nbcr of a cc dump showing most of the programs which have beer
cv loped using Forti. Al included a very quick outline of the method used to get the end result A
umuer o monographs are available which include the Forth code and highlights of the methods used
,n .oore detail,
Sticking
!“i,
PROJECTILE MASS456 a
TARGET MASS2345678, 1
VEIJ3CICY DISPLAYOEF ORE ArT R
‘a” “,niS!2j
tNITIAL VELOCITY
® Inelastic
rfS u””a fl lorti’ Sy toos’urr
?
J
LE
4
Inginaily this motion was achieeci using the toolbox region procedures to calculate the new areas todraw and undraw, as t would be entirel’ unsatisfactcry to draw and undraw the entire masses because
of Lb licker obtained. The effect obtair d us ig the regio i method wa easor ably satisfactory but
tar on wa. change/ ta b Emap ietho’ w’uc1 w’ r ticeably bate.
File
_____________
I TROLLEY 1ASS RtCK IIASS123456789 23456789
23 56
gain a bitmap method is sed” e T e trolle) and brick ire act ally stored ‘n memory in the same
itmap but clip regions are u ed before kopp ng, tr Ir w ca’ o then’ separately The trolley bitmap
as a blank area six pixels wide behird the Li’ hey This is used o erase the previous trolley on the
screen since the maxirnan’ rasiance Liit the trol n’ is mosed at onoc is six pixels
NN ll4 ( 0
L I A
MU1LL iO0
T e car ion II s bee dra ii in MacPaint and is stored in the resource fork of the application (On th.
ar app 00 ns sts of two parts, the code par and the resource part) I is copied to an
of screen bitmap at the boginning of the program It was found, that to actually draw the spokes each
ame was too slow, and so 66 small bitmaps were set up with the spokes in different positions. There are
6 different positions for the spokes of the big wheel giving an angle of 5° between each position of the
s okee nce a rotation of 1800 will bring the spokes back to their mitial position. Similarly there are
o dii Ic cat positions for the small wheel giving an angle of 6° between each position of the spokes
a File
Extensioniso-i
2O—
,1rhefl a ousedown e :ent is detecte-d in either the storage or the carrier areas, and a mass is present,
11 arro cars’ r is changed to a mass cursor and a mass is undrawn. Each of the masses are separate
cgions Th carrier and spring are drawn to an offscreen bitmap before being copied to the screen
Originally the entire spring was drawn each time the spring was extended or compressed. This took
about 21 tickcounts (2 1/60 second) to draw the spring. It was then changed so that only one and a half
oils need be actually drawn and then the whole coil was copied four times to complete the entire
spring. This procedure reduced the time to draw the spring to 8 tickcounts. It was then decided to code
this up in assembler and this further reduced the tinie to S tickcounts, Whether it was worth the effort
to code it in assembler is questionable.
F
— 1—
9eorGraj
iLl
Stiffness
s us a9ar Foc’ Syipsu
I \
arat tire
iI
a File
______ _____
_— P ssure/LiolumePressure
N4Oj ii
k iiiiEi1I I
25 GrapiJ
(r6rnph
ifl Pressure Volume the masses are added to the piston region when they are placed on the pressurevessel, making only one region to move. This region is moved by drawing and undrawing the essentialparts only. The drawing of the gas molecules has been set up as a background task. The speed of thesemolecules varies with the temperature. In Pressure/Temperature the flickering flame has also beensee up as a background task, The flame consists of three bitmaps which are alternately copied to thescreen. The height of the bitmaps, which is determined by the temperature, is controlled by using oneof twenty clip regions. Floating ro’t arithmetic i used when drawing the graph inPressure/Volume.
Forth Sympswri
Fi’e
hit PoInt
Power 5uppI
I e car ii diagrams were drawn ir MacPaint, s red in the resource fork of the application and copied
to a bitmap at start up
The graph is kept in an offscreen bitmap so that screen updates can be made of this area easily. This
a olds having to ‘remember” what was drawn on the graph and to redraw the dots and lines each time
A bitmap of the blank graph is used when clearing the graph. This is done for speed reasons since
memory is not usually a consideration nowadays.
Frst Austraiian Forth Symposium
Circuit 2
Valtnge10
9
a
J
[eGrph rph
UneJ1/
1/I /
ii],0 005 010 0,5 C20 025 030 035
Curre t
ba,
wj
ii gdr iigtherear. i.z cpus stagard then the ‘tad mo es up while the ball comae
aOrtae dow aol it h a the “fluid badlyyb ada o a kc [as been pressed. The imc est
5 error mode to da w the ball, and then undraw
sdo antlc aJ
)‘ 05 lcVby dra vu p U
hi dwrtogcthrh I us toppedandthebai
hit the bottom of the01 15 asewastousethc
si agai stag the same mode
Ti bail, hand and cylinder were dmawi ir Ma Psi t ce
T Sal asbcer ac Jar
0 a
4 File
Disterre00
90
90
0
0
5
Timer
Hot
Ic ii!]
1]
FLI
a
F
a a
Rmcv.rq. L
he charges are drawn onto the screen directly as well as to an offscreen bitmap. The field s drawn tothe offscreen bitmap, pare of this bitmap is then copied to the screen after the charges in this area areredrawn, The field force vectors are ctosed in arrays and, therefore, updating the screen is very quickw ien another charge is added and a large number of charges are already presentWhen this program
as originally written the screen drawing for twelve charges took almost three minutes. This waseduced with some optimisation to two and a half minutes, Two words were then coded up in assemblerid thc drawing time was further reduced to around half a minute A very acceptable time and welloih the trrc pent learning assembler
Amplitude Frequertc initial Position
Flrsr Austraan Forth Sympos:um
S
k LZmEsc ThtIi . ii
ph
aa
r
± p
Un t
p
Is4k
w
U
I
*1
U a
800
a tin Postiorw amw
8 otaldvi 2696Y
a0 0 W
itance
e Sitirap Tin al wsa bI suuor
a’ bitnap d op
I ouvould ik60 ai a could fort it
BaileyDE, gal
ertiary Education” B ‘tt
Jr1141 or te In dugan ly i
facForth P uscJndytSnbtkLnt_nc 4 !‘ 82
RT
Isstanc ‘- S
fmal gr
4 Teleptioi 3 A c41g8 S,mp.cr