Open Collections

UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

Design and implementation of a simple systems language for microcomputers Lee, Peter C. 1979

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
831-UBC_1979_A7 L45.pdf [ 4.33MB ]
Metadata
JSON: 831-1.0065612.json
JSON-LD: 831-1.0065612-ld.json
RDF/XML (Pretty): 831-1.0065612-rdf.xml
RDF/JSON: 831-1.0065612-rdf.json
Turtle: 831-1.0065612-turtle.txt
N-Triples: 831-1.0065612-rdf-ntriples.txt
Original Record: 831-1.0065612-source.json
Full Text
831-1.0065612-fulltext.txt
Citation
831-1.0065612.ris

Full Text

DESIGN AND IMPLEMENTATION OF A SIMPLE SYSTEMS LANGUAGE FOR MICROCOMPUTERS by PETER C. LEE B.Math.,  U n i v e r s i t y o f Waterloo,  1977  A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE  REQUIREMENTS FOR THE DEGREE OF MASTER OF APPLIED SCIENCE in  THE FACULTY OF GRADUATE STUDIES (DEPARTMENT OF ELECTRICAL ENGINEERING)  v  We accept t h i s t h e s i s as conforming to the required  THE  standard  UNIVERSITY OF BRITISH COLUMBIA February 1979  (c)  Peter.C. Lee, 1979  In presenting t h i s thesis in p a r t i a l f u l f i l m e n t of the requirements f o r an advanced degree at the U n i v e r s i t y of B r i t i s h Columbia, I agree that the Library s h a l l make i t f r e e l y a v a i l a b l e f o r reference and study. I f u r t h e r agree that permission for extensive copying of t h i s thesis f o r s c h o l a r l y purposes may be granted by the Head of my Department or by his representatives.  It i s understood that copying or p u b l i c a t i o n  of t h i s thesis f o r f i n a n c i a l gain s h a l l not be allowed without my written permission.  j,  Electrical  Department of  Engineering  The U n i v e r s i t y of B r i t i s h Columbia 2075 Wesbrook Place Vancouver, Canada V6T 1W5  natP  DE-6  BP  75-51 1 E  F  e  b  2 3  '  ]  9  7  9  fL  ABSTRACT  The studied systems  problems o f software development through  the  language,  design  called  and E.  f a m i l y o f s y s t e m s programming and  i t s predecessors  l a n g u a g e , and from  implementation E  is  from  of  a  simple  a d e s c e n d a n t o f t h e BCPL  languages.  arise  f o r microcomputers are  D i f f e r e n c e s between  E  the d e s i g n o f E as a minimal  the o b j e c t i v e o f e n a b l i n g  interactive  tracing  of E programs.  A operate programs  development  system  i n a microcomputer  f o r E h a s been with  may be d e v e l o p e d u s i n g  l a r g e computer  system.  constructed  16K b y t e s o f memory. a cross compiler  which  may  As w e l l , E  w h i c h r u n s on a  iii TABLE OF CONTENTS PAGE ABSTRACT TABLE OF CONTENTS LIST OF FIGURES ACKNOWLEDGEMENT 1)  2)  INTRODUCTION  1  1.1 MICROCOMPUTERS AND SOFTWARE 1 .2 AVAILABLE MICROCOMPUTER SOFTWARE DEVELOPMENT TOOLS 1.2.1 ASSEMBLER LANGUAGE PROGRAMMING 1.2.2 BASIC SYSTEMS 1.2.3 ALGOL LIKE LANGUAGES . 1.3 MOTIVATION AND OBJECTIVES OF THE E PROJECT  1 2 3 4 6 7  CONCEPTS OF AN E DEVELOPMENT SYSTEM 2.1 2.2 2.3 2.4 2.5  3)  4)  5)  i i i i i iv v  11  THE E MACHINE IMPLEMENTATION OF THE E MACHINE PORTABILITY TRANSLATION OF E PROGRAMS TRACING E PROGRAMS  11 15 1? 18 ..20  FEATURES OF THE LANGUAGE E  24  3.1 3.2 3.3 3.4 3.5  24 24 25 26 28  MODULARITY CONTROL STRUCTURES EXPRESSIONS ' DATA STRUCTURES INTERRUPT AND MULTITASKING PROGRAMMING  A BRIEF DESCRIPTION OF THE LANGUAGE E  31  4.1 4.2 4.3 4.4 4.5  31 33 35 3^ 37  TOKENS EXPRESSIONS ACTION STATEMENTS DECLARATIONS DEFINITIONS .  DESIGN AND IMPLEMENTATION OF E 5.1 5.2 5.3 5.4  THE SPECIFICATION THE BOOTSTRAP SYSTEM • AN EMULATOR OF THE E MACHINE THE PORTABLE SYSTEM  '  "  39 39 40 41 42  6)  CONCLUSIONS  ^5  7)  RECOMMENDATIONS FOR FUTURE WORK  48  REFERENCES  ^9  iv  APPENDIX APPENDIX APPENDIX APPENDIX APPENDIX APPENDIX  A B C D E F  — — — — — —  ISP DESCRIPTION OF THE. E MACHINE ASCII CODE OF THE E CHARACTER SETS SUMMARY OF E ASSEMBLER INSTRUCTIONS SAMPLE E PROGRAM SUMMARY OF THE LANGUAGE E SAMPLE USE OF A PORTABLE E DEVELOPMENT  SYSTEM  55 ?0 ?1 75 84 90  LIST OF FIGURES  FIGURE 1 FIGURE 2 FIGURE 3  — — —  A FRAME OF THE E MACHINE ACTION OF AN E MACHINE INTERRUPT SEQUENCE AN E TRANSLATION SYSTEM  12 14 19  V  ACKNOWLEDGEMENT  I like  t o thank my a d v i s o r s , Dr. G.F. S c h r a c k and D r . P.D.  Lawrence, f o r t h e i r many s u g g e s t i o n s and comments t h r o u g h o u t t h e course  o f the p r o j e c t .  I like  t o thank Dr.  Schrack, i n p a r t i c u l a r ,  f o r h i s v a l u a b l e e x t r a help d u r i n g the w r i t i n g o f t h i s  thesis.  1 1). INTRODUCTION  1.1 MICROCOMPUTERS AND SOFTWARE  "as long as there were no machines, programming was no problem at a l l ; when we had a few weak computers, programming became a mild problem; and now we have gigantic computers, programming has become an equally gigantic problem." (Dijkstra 72, p. 861) The relevance of this statement applies to microcomputers as much as to the gigantic computers mentioned. Within five years, a revolution in hardware technology has created the microcomputer, and along with i t , a proportionately expanding software problem (Nicholls 76, Doerr 78, Yasaki 77, Noyce 77). The problem resulted not as much from the overwhelming complexity of microcomputer software projects, as from the need to put the many new computers (Osborne 76) with different characteristics and cost trade-offs to work.  The following are some of the considerations relevant to microcomputer software: A) Software i s an important part of systems cost, particularly since hardware cost i s low. B) Memory efficiency i s important since memories form as much as 50% of the hardware cost (Kornstein 77)• C) Minimal systems software support i s to be expected because of memory overhead, and the novelty of microcomputers. D) Software should be adaptable to different peripheral configurations to minimize redesign for different hardware  2 software E)  configurations.  O p e r a t i n g system c o n c e p t s a r e r e q u i r e d s i n c e many a p p l i c a t i o n s use the m i c r o p r o c e s s o r a s t h e c o - o r d i n a t i o n center f o r several devices.  F)  L i m i t s i n speed and memory w i l l  cause microcomputers t o be  used f o r d e d i c a t e d a p p l i c a t i o n s , t h u s c a u s i n g microcomputer s o f t w a r e t o remain modest i n s i z e . Microcomputer s o f t w a r e has t o e x i s t c l o s e t o t h e hardware l e v e l because o f minimal systems s u p p o r t , r e q u i r e m e n t o f knowledge  o f p e r i p h e r a l s , and o p e r a t i n g system  The l e v e l o f programming systems programming  characteristics.  which meets t h e s e r e q u i r e m e n t s i s  (Wulf 71, N i c h o l s 75 p . 32-3*0 i and s o f t w a r e  t o o l s f o r microcomputers s h o u l d p r o v i d e systems  programming  capabilities.  1.2  AVAILABLE MICROCOMPUTER SOFTWARE DEVELOPMENT TOOLS  The  importance o f software f o r microcomputers i s w e l l  r e c o g n i z e d , and a c t i v e work i s b e i n g done i n t h e a r e a by e l e c t r o n i c s m a n u f a c t u r e r s , s o f t w a r e companies, a n d r e s e a r c h institutions. B l e a s d a l e 77, Kahn 78, the  See Gibbons 75i Bass & Brown 76, G a l l a c h e r 77.  K n o t t e k 78,  Watson  Hawkins & d ' A r a p e y e f f 77,  77, Yasaki  77,  and Phoenix 78 f o r g e n e r a l i n f o r m a t i o n on  topic.  Most a v a i l a b l e software development t o o l s f a l l  i n t o one o f  3 the f o l l o w i n g t h r e e  categories:  A)  assembler language programming;  B)  BASIC systems;  C)  ALGOL l i k e l a n g u a g e s .  The f o l l o w i n g s e c t i o n s d i s c u s s each o f t h e s e g r o u p s . Some e x p e r i m e n t a l work does n o t f a l l  i n t o any one o f the above  categories,  i n c l u d i n g a c a l c u l a t o r system c a l l e d GAMMA  (Cleaveland  & S a t t e n 76),  the language C which i s a n o t h e r  descendant o f BCPL (Lucklama 77» version of Pascal  (Chung & Yuen 78).  any one o f t h e above 1 .2.1  Madden 77)»  and a  simplified  E a l s o does n o t f i t i n t o  categories.  ASSEMBLER LANGUAGE PROGRAMMING  Assembler l a n g u a g e s p r o v i d e a mnemonic c a p a b i l i t y t o s p e c i f y the machine code o f a computer.  Assembler  language  programming i s o f f e r e d a s s t a n d a r d s u p p o r t by most m a n u f a c t u r e r s of microcomputers Generalized  ( M o t o r o l a 751  I n t e l 76,  Texas  assemblers are a l s o being developed  Johnson G.R.  76).  Development  an assembler program, machine code.  76). (Mueller  &  support c o n s i s t s o f p r o v i s i o n o f  which t r a n s l a t e s the a s s e m b l e r language t o  An a s s e m b l e r r e q u i r e s l i t t l e  o f f e r e d u s u a l l y a s a s t a n d - a l o n e program  memory, and i s thiis  f o r the  microcomputer.  A t e x t e d i t o r and some p e r i p h e r a l s u p p o r t i s r e q u i r e d t o complete the development  system.  Assembler programming has s e v e r a l advantages:  4 A)  I t i s the only t o o l that allows d i r e c t access of a l l the resources of the computer.  Because of t h i s a b i l i t y , assembler i s  suitable f o r systems programming. B)  Assembler language programming optimizes the speed of the software.  Thus i n any a p p l i c a t i o n which i s time c r i t i c a l ,  assembler i s the only choice. C)  The a v a i l a b i l i t y of standalone development without much support required i s an asset since then the support cost f o r development i s low.  D)  Interactive t r a c i n g of machine code i s possible, using standard manufacturer provided monitors, since assembler language i s close to machine code. The main disadvantage of assembler language i s that i t  e n t a i l s i n e f f i c i e n t use of programmer time: A)  Programmer time i s the predominant cost f o r software development and maintenance.  B)  Since microcomputer architectures are f a i r l y p r i m i t i v e , each assembler i n s t r u c t i o n does very l i t t l e .  Programs are long and  are error prone. C)  An assembler program i s very l i m i t e d i n p o r t a b i l i t y .  A  given assembler program w i l l work only on a machine with the same i n s t r u c t i o n set. 1.2.2  BASIC SYSTEMS  BASIC (Be ginners All-purpose Symbolic Instruction Code)  5 systems form a prominent f o r microcomputers Most vendor  p a r t o f the a v a i l a b l e s o f t w a r e  (Maples & F i s h e r 77,  o u t l e t s f o r microcomputers  bytes  of  Minimum memory r e q u i r e m e n t s v a r y from JK  (Phoenix 78 p . 7 ) .  76).  Lientz  o f f e r s a l e o f BASIC.  Many v e r s i o n s a r e a v a i l a b l e i n v a r y i n g d e g r e e s sophistication.  78,  Phoenix  tools  to  12K  Standalone development f o r BASIC i s  s t a n d a r d , and minimum support i s r e q u i r e d .  A BASIC  system  i n c l u d e s a b u i l t - i n e d i t o r , and a program i s executed a s i s by the  system.  There a r e s e v e r a l r e a s o n s why A)  BASIC i s p o p u l a r :  The main a t t r a c t i o n o f BASIC i s t h a t i t i s a system.  complete  Once l o a d e d , or i n t e r f a c e d u s i n g ROM,  program  development can take p l a c e w i t h o u t o t h e r s u p p o r t .  This  c o n t r a s t s w i t h the c o n t i n u o u s t r a n s l a t i o n r e q u i r e m e n t s  of  a s s e m b l e r s and c o m p i l e r s . B)  BASIC i s easy t o l e a r n .  C)  BASIC i s p o r t a b l e s i n c e i t i s simple and w i d e l y  D)  BASIC p r o v i d e s enough computing like  capability for calculator  applications.  Ogdin  71):  Source programs a r e s t o r e d i n memory and i n t e r p r e t e d .  The  BASIC has s e v e r a l weaknesses (Bass & Brown 76, A)  used.  s i z e o f a program i s r e s t r i c t e d s i n c e the s t o r a g e o f s o u r c e data i s i n e f f i c i e n t .  A l s o , the p r o p e r use o f s y m b o l i c names  i s impeded, s i n c e names are r e s t r i c t e d t o 2 o r 3 c h a r a c t e r s i n an e f f o r t t o save memory.  6 B)  F e a t u r e s t o p e r m i t modular programming and which a l l o w programs  C)  t o grow g r a c e f u l l y a r e m i s s i n g .  The l a c k o f a b i l i t y t o d e f i n e complex the l a c k o f a c c e s s t o hardware systems programming.  makes BASIC u n s u i t a b l e f o r  BASIC i s an a p p l i c a t i o n s p r o d u c t  t a i l o r e d f o r use i n a c a l c u l a t o r l i k e  1.2.2.  d a t a s t r u c t u r e s and  fashion.  ALGOL LIKE LANGUAGES  D e r i v a t i v e s o f ALGOL o r P L / l which has been implemented f o r microcomputers  i n c l u d e the l a n g u a g e s PL/M,  (Motorola 76,  I n t e l 75,  & Gibbons 77.  USCD 78)..  Brown 78,  W i r t h 70,  PL/Z, and PASCAL  F y l s t r a 76,  Furgerson  T h i s approach a p p l i e s the c o n c e p t s o f  h i g h l e v e l language development 66,  Bass 78,  MPL,  ( D i j k s t r a 66,  P o l l a c k & S t e r l i n g 76,  Randell & R u s s e l l  Sammet 69)  to  microcomputers, and i s b e i n g a c t i v e l y developed'by many groups. Support f o r t h e s e l a n g u a g e s u s u a l l y i s i n the form o f a cross-compiler.  Development  u s i n g a l a r g e h o s t computer  system  i s encouraged, though some s t a n d - a l o n e systems a r e a v a i l a b l e . I f standalone development  i s used, then a l a r g e amount o f memory  a s w e l l as an e d i t o r i s r e q u i r e d .  F a s t p e r i p h e r a l , such a s  d i s k s , a r e u s e f u l s i n c e the power o f t h e s e languages w i l l encourage c o r r e s p o n d i n g l y l a r g e  programs.  The d i r e c t i o n o f t h i s a p p r o a c h r e p r e s e n t s the b e s t  effort  t h u s f a r t o p r o v i d e s o f t w a r e s u p p o r t f o r microcomputers: A)  W e l l r e c o g n i z e d t e c h n i q u e s t o enable easy c o n s t r u c t i o n o f  7 complex programs a r e p r o v i d e d . B)  These languages may  "be used f o r systems programming  since  t h e y were d e s i g n e d w i t h t h a t c a p a b i l i t y i n mind.  The main weakness o f t h i s approach  i s that  support  requirements are l a r g e : A)  T r a d i t i o n a l programming i s done on l a r g e computers where u n l i m i t e d memory and f a s t p e r i p h e r a l s a r e t a k e n f o r g r a n t e d . Thus the t r a n s l a t i o n systems f o r t h e s e l a n g u a g e s  are large  complex. B)  The  c o m p i l e r s f o r these languages p e r f o r m  changes t o the  code and thus i n t e r a c t i v e t r a c i n g i s made more d i f f i c u l t . C)  S u b s t a n t i a l s u p p o r t i s r e q u i r e d f o r the i m p l e m e n t a t i o n t h e s e languages (USCD 78 p. 9) T h i s c o s t may  on t a r g e t systems.  An 8K a s s e m b l e r  i s r e q u i r e d as minimal be u n a c c e p t a b l e  run-time  of  program  support.  to users with l e s s  sophisticated applications. D)  A u s e r may  n o t e a s i l y adapt the language  to d i f f e r e n t  hardware c o n f i g u r a t i o n s s i n c e s u p p o r t i s complex.  1.2  MOTIVATION AND  The  OBJECTIVES OF THE  E PROJECT  c o n c e p t i o n o f E d i d n o t f o l l o w any  approaches,  o f t h e above  a l t h o u g h i t i s c l o s e s t t o the ALGOL l i k e  languages.  I n s t e a d , E was m o t i v a t e d by the BCPL f a m i l y o f systems programming languages 69,  Braga  e t a l . 76,  which i n c l u d e BCPL, B, and Eh R i c h a r d s e t a l . 74,  (Richards  Johnson S.C.  731  Braga  and  8 76).  The approach o f t h i s f a m i l y c o n t a i n s an e l e g a n c e and  s i m p l i c i t y which seemed i d e a l f o r a p p l i c a t i o n s t o microcomputers. As w e l l , d e v e l o p e r s o f microcomputer s o f t w a r e t o o l s have l a r g e l y o v e r l o o k e d these examples.  T h i s f a m i l y o f l a n g u a g e s , i n c l u d i n g E, have the f o l l o w i n g common f e a t u r e s : A)  a simple and c o n c i s e  B)  a rich  syntax,  set of operators  d e s i g n e d f o r systems programming  purposes, C)  easy means t o d e f i n e e x t e r n a l modules,  D)  an untyped p r i m i t i v e d a t a s t r u c t u r e ,  E)  a c l e a r and c o n c i s e  F)  t h e aim o f p o r t a b i l i t y a s a d e s i g n  The  language C was a l s o d e r i v e d from BCPL.  considered  Input/Output system, and goal. However, C i s n o t  here t o he a p a r t o f t h i s f a m i l y s i n c e G r e v i v e d t h e  idea of data types,  and was adapted t o one computer, t h e PDP-11.  D i f f e r e n c e s "between E and i t s p r e d e c e s s o r s a r o s e m a i n l y from t h e o b j e c t i v e o f c r e a t i n g a minimal system. t h i s g o a l came from  The b a s i s o f  Dijkstra:  "Another l e s s o n we s h o u l d have l e a r n e d from the r e c e n t p a s t i s t h a t t h e development o f ' r i c h e r ' o r 'more p o w e r f u l ' .languages was a m i s t a k e i n t h e sense t h a t these baroque m o n s t r o s i t i e s , these conglomerations o f i d i o s y n c r a s i e s , a r e r e a l l y unmanageable, both m e c h a n i c a l l y and m e n t a l l y . I see a g r e a t f u t u r e f o r v e r y s y s t e m a t i c and v e r y modest l a n g u a g e s . When I s a y 'modest', I mean t h a t , f o r i n s t a n c e , not o n l y ALGOL 60's 'FOE c l a u s e ' , b u t even FORTRAN's 'DO l o o p ' may f i n d t h e m s e l v e s thrown out a s b e i n g t o o baroque." ( D i j k s t r a 72 p . 685, r e p e a t e d i n Plum 77 p . 218) A minimal system means t h a t o n l y the f e a t u r e s d i r e c t l y  relevant  t o the  s o l u t i o n o f a l i m i t e d problem a r e p r o v i d e d .  f e a t u r e s which are n o t • simple  obviously u s e f u l are not  t r o u b l e of h a v i n g  exclusion.  it  t o be b u i l t and  used  d e c r e a s e s the amount o f  which has  t o be  o f E because  seemed t o be t a k i n g the. p a t h o f s y s t e m a t i c i t y and  than i t s  The  modesty.  and  E, i s  and  simpler  predecessor.  o t h e r major cause o f the u n i q u e n e s s o f E d e r i v e d  the g o a l o f e n a b l i n g  i n t e r a c t i v e t r a c i n g f o r E.  p o s s i b l e a p o s i t i v e approach, as s o f t w a r e may by m o n i t o r i n g  d i r e c t execution,  T r a c i n g makes  then be  verified  i n the form of a  most important consequence o f t h i s was  the c h o i c e  or r e v e r s e P o l i s h , n o t a t i o n t o r e p r e s e n t  "bug".  of  expressions.  More g e n e r a l l y , the E p r o j e c t a t t e m p t s t o p r o v i d e  a way  d e v e l o p software which o f f e r s the a d v a n t a g e s o f a h i g h e r language: control structures,  from  r a t h e r t h a n the b a t c h method o f  p a s s i v e l y waiting f o r e r r o r s to occur,  postfix,  and  when compared t o ALGOL o r P L / l ,  each o f i t s subsequent developments, B, Eh,  the  learned.  BCPL f a m i l y formed the b a s i s o f the d e s i g n  BCPL i s a l r e a d y q u i t e simple  A)  to  a d d r e s s e d a problem r e l e v a n t t o microcomputer s o f t w a r e ,  alone  The  of having  M i n i m a l i t y a l s o means t h a t e x i s t i n g t o o l s are  system which has  The  justification for their  whenever p o s s i b l e , because t h e i r use  The  included.  t o implement them, and  t h i n k about them, i s s u f f i c i e n t  Extra  to  level  B)  easy means o f m o d u l a r i z i n g programs,  C)  compact r e p r e s e n t a t i o n o f e x p r e s s i o n s , and  D)  high  portability,  w h i l e s t i l l r e t a i n i n g the advantages o f a s s e m b l e r programming: A)  minimum c o s t i n  B)  h i g h memory  C)  ability  implementation  efficiency  t o a c c e s s hardware and p e r i p h e r a l s , i n c l u d i n g  i n t e r r u p t s , and D)  a b i l i t y t o i n t e r a c t i v e l y t r a c e t h e s o f t w a r e d u r i n g program development.  11 2)  2.1  CONCEPTS OF THE E DEVELOPMENT SYSTEM  THE E MACHINE  An a b s t r a c t computer, c a l l e d the E Machine, s e r v e s a s the semantic b a s i s f o r the language E .  The E Machine i s more  c o n c r e t e when compared t o s i m i l a r d e v i c e s i n BCPL (OCODE, see Peck 75)  and Eh ( t h e Eh Machine, see Braga 76 p . 2 ) .  The E  Machine has a d e f i n i t e memory s t r u c t u r e w i t h a 1 6 - b i t a d d r e s s bus and an 8 - b i t b y t e a t each a d d r e s s .  A 1 6 - b i t word i s s t o r e d  a s two c o n s e c u t i v e b y t e s w i t h t h e h i g h o r d e r byte h a v i n g t h e lower a d d r e s s .  I n comparison, OCODE has a vague a d d r e s s bus,  and does n o t d e f i n e t h e word s i z e o f each memory l o c a t i o n . E Machine has a w e l l d e f i n e d i n s t r u c t i o n s e t w i t h a o p e r a t i o n f o r each i n s t r u c t i o n .  The  specific  I n comparison, the Eh Machine  does n o t f i x the f o r m a t o f the d a t a f o r i t s i n s t r u c t i o n s . Appendix A c o n t a i n s an I n s t r u c t i o n Set P r o c e s s o r (ISP, see D i g i t a l 71  Appendix C) d e s c r i p t i o n o f the complete E Machine.  The E Machine has f o u r r e g i s t e r s , a program c o u n t e r (PC), a s t a c k p o i n t e r (SP) , a frame p o i n t e r ( F P ) , and a s t a t u s  flag  (FLAG). The FLAG i s used t o implement an i n t e r r u p t system. PC and t h e SP p l a y the o b v i o u s r o l e s .  The FP i s p r e s e n t t o  enable t h e management o f a f u n c t i o n frame. a f u n c t i o n frame i n t h e E Machine.  The  Figure 1  illustrates  12  0 - unlimited o t h e r parameters o t h e r parameters parameter o f current function  0-8 parameters  parameter o f current function  return  FT  PC  of last frame  Automatic  r  0 - 250 bytes  Data  a u t o m a t i c d a t a count  (A)  parameter d a t a count  GO  f*  A  Frame  o f 'the  E  0 - unlimited parameters  Machine  The  E Machine i s a pure s t a c k machine (Bulman 77)•  a r e no d a t a m a n i p u l a t i o n r e g i s t e r s nor I n s t e a d , the  top  element o f the  elements o f the  condition  stack f i l l  There  code b i t s .  these r o l e s .  An  s t a c k i n the E Machine i s a 1 6 - b i t word.  the E Machine p o s s e s s e s the  Thus  c h a r a c t e r i s t i c s of a 16-bit  microprocessor.  The An  o v e r a l l d e s i g n o f the  i n s t r u c t i o n set i s quite  i n s t r u c t i o n code i s always a b y t e .  immediate d a t a may i n s t r u c t i o n s o f the  follow  Z e r o t o two  each i n s t r u c t i o n code.  E Machine may  bytes  o f the  The  stack, basic  20  i n t o 3 groups:  be d i v i d e d  e x e c u t i o n c o n t r o l , and  39  as  the  20  instructions include  primitive functions  instructions.  and  the  other  housekeeping i n s t r u c t i o n s a l l o w management  The  basic  of  79  The  h o u s e k e e p i n g i n s t r u c t i o n s , the p r i m i t i v e f u n c t i o n s , instructions.  simple.  are  function  interfacing.  z e r o a d d r e s s o p e r a t i o n s and  computation o p e r a t o r s o f the language E. interrupt, multitasking,  A p p e n d i c e s G.3,  C.4,  and  C.5  I/O,  The and  summarize the  Machine i n s t r u c t i o n s w h i l e Appendix A d e s c r i b e s t h e i r  act other user E  actions  completely.  An  i n t e r r u p t system i s d e f i n e d  A s i n g l e i n t e r r u p t l i n e t r i g g e r s an  as a p a r t  o f the E Machine.  i n t e r r u p t sequence.  An  i n t e r r u p t a d d r e s s i s presumed t o be p r o v i d e d a l o n g w i t h  the  i n t e r r u p t , g i v i n g the E Machine a v e c t o r e d i n t e r r u p t An and  i n t e r r u p t sequence pushes the then pushes the PC  and  capability.  f o u r r e g i s t e r s onto the  stack,  FP a g a i n , as i l l u s t r a t e d i n F i g u r e  2.  14 After an interrupt, the stack i s the same as a f t e r execution a c a l l i n s t r u c t i o n to a function with 4 parameters. interrupt routines may  of  Thus  he written as functions of the language  E.  SP "before interrupt sequence  -p  CM  saved  SP  CM  return  PC  CD  H  O  o -p o  > 4 parameters  co <M  fe CM  FP  saved  CM  o  CM  of l a s t frame FLAG  return  FP  PC  of l a s t frame  SP a f t e r interrupt sequence Figure 2  -  Action of an E Machine Interrupt Sequence  15 The  i n s t r u c t i o n s e t o f the E Machine i s d e s i g n e d  i n t e r f a c e c l o s e l y t o the r e q u i r e m e n t s o f the  language E .  t o k e n i n an E program w i l l t r a n s l a t e t o a t most one o f the E Machine. o f the  The  primitive functions,  instruction  t o the  i m p l e m e n t a t i o n o f the u s u a l c o n t r o l s t r u c t u r e s , e n t r y and  re-entrant  2.2  function  e x i t instructions allow a  structure  recently published  and  two  allow  the  four  naturally  c a l l i n g mechanism.  IMPLEMENTATION OF THE  The  operators  W i t h i n the housekeeping i n s t r u c t i o n s ,  jump i n s t r u c t i o n s t o g e t h e r w i t h comparison f u n c t i o n s  function  A  t o g e t h e r w i t h some  other i n s t r u c t i o n s , correspond e x a c t l y  o f the E l a n g u a g e .  to  E MACHINE  o f the E Machine i s q u i t e  s i m i l a r to  a b s t r a c t machines (Tenenbaum 78,  78),  e s p e c i a l l y i n the f u n c t i o n c a l l i n g and  This  shows a convergence o f i d e a s on the  other  Chung & Yuen  f r a m i n g mechanisms.  b a s i c requirements of a  machine a r c h i t e c t u r e which w i l l a i d s o f t w a r e development, i n contrast  t o most a v a i l a b l e computers, which i g n o r e  requirements o f software  The as  ( D i j k s t r a 72  general architecture  simple a s many c u r r e n t  and  p.  861,  structure  microprocesssors.  simplicity  o f the E Machine i s the f a c t t h a t  i s shorter  than an  Appendix C) .  ISP  the  Bulman 77  p.  19).  o f the E Machine i s An  i n d i c a t i o n of  i t s ISP  description  d e s c r i p t i o n ' f o r the PDP-11 (see D i g i t a l  Thus t h e r e seems t o be no d i f f i c u l t y  the  i n an  LSI  71,  16  r e a l i z a t i o n of a microprocessor with the basic architecture of the E Machine.  Such a microprocessor w i l l have a d i s t i n c t  software advantage over other microprocessors.  Programming at  the assembler l e v e l i s e a s i e r since the i n s t r u c t i o n s are more powerful, and the speed and memory disadvantages of high l e v e l language implementation are eliminated.  An assembler program to emulate the actions of an E Machine i s expected to be the method by which a target microprocessor i s interfaced to the semantics of the E language. Conceptually, an E Machine may also be r e a l i z e d by hardware, by microprogramming, or by programming i n a high l e v e l language.  From experience, i t  was found that a 2K byte assembler program i s s u f f i c i e n t to r e a l i z e a l l i n s t r u c t i o n s of the E Machine, except interrupt and f i l e access i n s t r u c t i o n s .  This emulator or i n t e r p r e t e r method of implementation has the advantage  of easy i n t e r f a c i n g requirements and high memory  e f f i c i e n c y , and i s s i m i l a r to the approach used by USCD PASCAL (USCD 78).  Execution speed has been s a c r i f i c e d .  An assembler  program w i l l be a t l e a s t 10 times f a s t e r than an E Program implemented i n t h i s  way.  A macro or i n l i n e code generation scheme (see Richards 71) has been rejected, although i t can generate code which may execute up to f i v e times f a s t e r than an i n t e r p r e t i v e method. The cost-of i n l i n e code-generation includes the requirement of  at least three times more memory, plus a more complex implementation problem which i s more sensitive to the architecture of the target machine.  An example of a conflict  which w i l l tax a macro implementation i s the fact that the ordering of bytes to form a 16-bit word for the Motorola 6800 and the Intel 8080 are opposite to each other.  2.2  PORTABILITY  Traditionally, portability of compilers has received the major share of attention (Richards 7 1 , Braga et a l . 7 6 ) . With microcomputers, this consideration i s not as crucial.  Instead,  the main problem i s the development and maintenance of software for the many target microprocessors with their many different applications.  A compiler and i t s supporting software  development system i s just a special kind of application. The E Machine and i t s implementation i s the key to the portability of E.  The language E has the property that the only  part of an E system which i s unique to each target system i s the 2K assembler program which emulates the E Machine.  A given E  program always translates to the same E Machine Code no matter what the target system i s .  With a running emulator, the only  requirement to execute E programs i s the generation and loading of E Machine Code.  18  This method may be compared to that of BCPL, which uses macro t r a n s l a t i o n , thus e n t a i l i n g a modification to the compiler f o r transportation of programs, or to PASCAL, which requires an 8K assembler program to interpret the language.  This  minimization of implementation requirements was made p o s s i b l e by the  conception of the E Machine as a concrete hardware  system  with the expected r e s t r i c t i o n s i n complexity and features, instead of as a loose structure which attempts e i t h e r to optimize speed, l i k e BCPL, or to provide a sophisticated underlying structure, l i k e PASCAL.  2.4  TRANSLATION OF E PROGRAMS  A software development system requires f a c i l i t i e s to create and e d i t programs, plus f a c i l i t i e s to translate high l e v e l languages to an executable code.  In accordance with the aim.of  using e x i s t i n g t o o l s whenever possible, an e d i t o r i s presumed to be provided by the e x i s t i n g system.  Only t r a n s l a t i o n programs,  ^ which t r a n s l a t e s E programs to E Machine Code, the i n s t r u c t i o n code of the E Machine, are constructed to r e a l i z e an E development  system.  An E t r a n s l a t i o n system requires two programs, A) a one-pass E Compiler to translate E programs to an intermediate language, the E Assembler Language, and B) a -two-pass E-Assembler/Linker-to translate E Assembler  19  Language modules t o E Machine Code i n an a b s o l u t e module  load  format.  S i n c e the E Machine Code p r o d u c e d by t h e t r a n s l a t i o n programs i s independent o f the implementation system, c r o s s - c o m p i l e r development i s e a s i l y done.  The o n l y r e q u i r e m e n t f o r  implementation on d i f f e r e n t t a r g e t systems i s a m o d i f i c a t i o n o f the A s s e m b l e r / L i n k e r t o produce a s u i t a b l e l o a d module f o r the t a r g e t system.  F i g u r e 3 i l l u s t r a t e s an E t r a n s l a t i o n system.  E  program  E Assembly Language'  E  Figure 3  --  Machine Code  An  E  T r a n s l a t i o n System  20 Because of the minimization of the E language, the E Compiler, which i s the more complex of the two programs, i s s t i l l quite manageable.  In a high level language suitable for  compiler writing, a compiler may be realized in less than 4000 lines of code.  A portable version of the E Compiler, written in  E, may run in 16K bytes of memory.  2.j5 TRACING E PROGRAMS Tracing in any form i s rarely available for high level languages.  The scarcity of such tools seem to stem from a  combination of neglect, plus the d i f f i c u l t y of developing, maintaining and using such tools. "The computer cycle consists basically of six phases:. specification, functional decomposition, coding, testing, debugging, and evaluation. In recent years software engineers have concentrated on the second and third of these phases ... Their emphasis has detracted from the progress in other phases." (Johnson M.S. 78 p. ! ) • A principal aim of the development of E i s the provision of tools to allow interactive tracing.  The development of extensive and complex debugging or testing software systems seems to be the only approach used thus far to provide software testing tools (see Johnson 78 p. 6-12). Such an approach i s feasible on large computing systems where memory i s unlimited.  Even so, the complexity of these testing  systems make them experimental instead of practical tools.  E a v o i d s the d e s i g n and development o f complex s o f t w a r e t o enable i n t e r a c t i v e t r a c i n g . language  Instead, e x i s t i n g  l e v e l t r a c i n g systems a r e used.  assembler  Interactive  tracing  systems f o r assembler programming a r e w e l l d e v e l o p e d , and o f f e r e d a s s t a n d a r d p r o d u c t s f o r most minicomputers microcomputers  ( D i g i t a l 71 P-  Texas 75 S e c t i o n 5.4,  16-6,  T e k t r o n i x 77a  and  M o t o r o l a 75 S e c t i o n Chapter  are  7-2,  10).  The E Machine forms t h e b a s i s o f the t r a c i n g method. An  E  program i s t r a c e d by f o l l o w i n g the e x e c u t i o n o f the E Machine. T h i s e n t a i l s a knowledge o f the E Machine b e f o r e t r a c i n g may used.  However, such a c o m p l e x i t y i s u n a v o i d a b l e w i t h  t r a c i n g system,  be  any  and t h e E Machine i s a s i m p l e r c o n s t r u c t t h a n  the semantic d e s c r i p t i o n s o f most h i g h l e v e l  languages.  An i n t e r f a c e i s p r o v i d e d i n the E development system  to  r e l a t e the source o f an E program t o i t s g e n e r a t e d E Machine Code.  The  s y n t a x o f E, i n p a r t i c u l a r the use o f p o s t f i x  n o t a t i o n , i s d e s i g n e d so t h a t the sequence o f g e n e r a t e d  E  Machine i n s t r u c t i o n s i s the same a s the sequence o f tokens i n the source program. Machine i n s t r u c t i o n .  Each token i s t r a n s l a t e d i n t o a t most one By u s i n g the d e v i c e t h a t a n u l l E Machine  instruction i s possible token may  be though  machine i n s t r u c t i o n .  E  (the assembler d i r e c t i v e  .NULL), each  of as being t r a n s l a t e d i n t o exactly Thus the E Machine Code may  one  be thought  as an e x a c t semantic r e p r e s e n t a t i o n o f an E Program w i t h each Machine i n s t r u c t i o n c o r r e s p o n d i n g t o each token o f the E  of E  program.  Of course, only tokens i n the a c t i o n section of an E  function, the statements enclosed hy the "brackets  ($  and  )$,  r e s u l t i n executing E Machine Code.  A correspondence of the source to the E Machine Code i s provided "by l i s t i n g s from the t r a n s l a t o r programs.  The  first  column of numbers of the compiler l i s t i n g , l i s t e d i n Appendix D . l , gives a l i n e number to each l i n e of the E program source. The second column of numbers provide a count of the relevant tokens.  T h i s count r e l a t e s d i r e c t l y to the addresses of  generated E Machine i n s t r u c t i o n s as l i s t e d i n the Assembler/Linker load map token  H.TEMP  of Appendix D. 2.  For example, the  i n l i n e 34 i n Appendix D.l has a count of 20  (decimal), and.is translated to an i n s t r u c t i o n with the address of 201D hexadecimal as l i s t e d i n Appendix  D.2.  With t h i s interface, a standard monitor may be used to trace the execution of E programs.  With the normal  implementation of the E Machine as an assembler program, a hardware breakpoint f a c i l i t y i s i d e a l .  Then, a breakpoint may  be planted i n the generated code i n a transparent fashion, and t r a c i n g may be performed exactly as with assembler programming. I f only software tracers or debuggers are a v a i l a b l e , then breakpoints may be implemented by the use of an i l l e g a l opcode, though t h i s breakpoint i s no longer transparent.  The advantage  of t h i s scheme l i e s i n the f a c t that minimal  23  software development i s required capability. avoided.  to r e a l i z e a t r a c i n g  The d i f f i c u l t i e s of high l e v e l language t r a c i n g are  The disadvantage i s that one has to i n t e r a c t a t a low  l e v e l , using addresses and machine i n s t r u c t i o n s , instead of symbolic names and high l e v e l control  A s p e c i a l monitor, written  structures.  i n E, to provide a standard  t r a c i n g i n t e r f a c e f o r E programs with s p e c i a l adaptation to the E Machine, i s quite f e a s i b l e .  The main d i f f i c u l t y of such a  system i s to define an e f f e c t i v e i n t e r f a c i n g mechanism between the tracer and the interrupt structure  of target systems.  Of  course, such requirements are much more complex f o r more extensive concepts of interactive tracing (see Johnson 78 M.S. p. 99).  3_. ^.1  FEATURES OF THE  LANGUAGE E  MODULARITY  An E program i s a s e r i e s of single l e v e l modules (see Parnas 72,  Yohe 7^ P- 278)  d e f i n i t i o n statement. procedures.  with each module being a function  There are no i n t e r n a l blocks  or  Even though the E Compiler t r e a t s each module as a  separate e n t i t y , i m p l i c i t linkage e x i s t s between modules.  The  E  Assembler/Linker performs the necessary actions to l i n k E function names and external data names.  A programmer i s encouraged to write an E program as a series of small functions. language.  Only functions e x i s t i n the E  Subroutines are not provided  since a subroutine i s  simply a function with i t s r e s u l t discarded.  3.2  CONTROL STRUCTURES The basic sequential, loop, and decision structures of  structured programming (see Dahl et a l . 72 p. 17) as constructs i n E.  The  are a v a i l a b l e  sequential structure i s i m p l i c i t i n the  constructs of the language which allow a l i s t of statements whenever one i s allowed. while statement. statement.  A loop structure i s provided  by a  A decision structure i s provided by an  if-else  25 A fourth structure i s the function i n t e r f a c i n g mechanism. Function entry i s an i m p l i c i t part of the semantics of the language.  The appearance of a function name i n an expression i s  s u f f i c i e n t to cause entry to a function.  E x i t from a function  i s made using a return statement, which a l s o returns a r e s u l t to the c a l l i n g routine.  Limited jumps are a v a i l a b l e within a loop i n E. The break statement e x i t s from the nearest loop. immediately  A next statement  r e s t a r t s execution of the nearest loop.  function c a l l i s provided i n the form of an operator,  An i n d i r e c t :GALLS .  T h i s f a c i l i t y allows easy w r i t i n g of jump table algorithms. Neither the goto statement, nor l a b e l s within the body of a function, are defined i n the language.  2-2  EXPRESSIONS In E, actual computation may only be s p e c i f i e d i n the form  of an expression.  An expression i s a p o s t f i x formula, with the  operator following the operands.  Each operator has a f i x e d  number of operands, from zero to eight.  An operand may be a  constant, a byte or word of data i n memory, an address of memory, or the evaluation of an operator.  Operators may be one  of the 59 predefined operators (see Appendix C) , or a function name.  26 Evaluation of an expression i s from l e f t to r i g h t .  The  p o s t f i x notation guarantees that no ambiguity i s p o s s i b l e . neither brackets nor a hierarchy of operators e x i s t s .  The  Thus use  of p o s t f i x notation a l s o means that the c a l l i n g format f o r a function of E i s exactly the same as the use of a predefined operator.  In p o s t f i x notation, an operator does not separate as i n i n f i x notation. distinction. with a  :  3_.4  :ADD  Operators i n E require more v i s u a l  Thus operator names are defined tokens which s t a r t  character, and are followed by any sequence of  characters. is  operands  For example, the predefined operator f o r a d d i t i o n  .  DATA STRUCTURES  Like BCPL, E has a typeless data structure. which may  The only data  be s p e c i f i e d i n E i s a contiguous byte array.  The  advantages of such a data structure are described i n Richards p. 56I.  69  I t should be emphasized that t h i s method of d e s c r i b i n g  p r i m i t i v e data i s more suitable to systems programming than the provision of data types.  Systems programming usually involves  memory management, and requires the d e f i n i t i o n and  manipulation  of complex data structures: "One of the most outstanding c h a r a c t e r i s t i c s of systems programs i s t h e i r concern with a wide v a r i e t y of data structures and schemes f o r representing these structures. Observations of what systems programmers do reveals that a  27 l a r g e f r a c t i o n o f t h e i r d e s i g n e f f o r t i s spent i n c o n s t r u c t i n g r e p r e s e n t a t i o n s f o r e f f i c i e n t l y encoding i n f o r m a t i o n t o be p r o c e s s e d " (Wulf 71).  With a t y p e l e s s language, such d a t a s t r u c t u r e s may constructed  be  u s i n g the most p o w e r f u l f e a t u r e a v a i l a b l e i n a  computer language, t h a t i s , f u n c t i o n s . area  the  A d a t a s t r u c t u r e i s an  o f memory p l u s f u n c t i o n s t o manage i t . Thus,  e f f i c i e n t l y define types.  functions  F o r example, the a d d i t i o n o p e r a t o r  E d e f i n e s i t s operands as 16-bit a b s o l u t e  With a typed language, the  magnitude numbers.  c o n s t r u c t i o n of data  i s impeded by the e x c l u s i v e a v a i l a b i l i t y o f h i g h e r s t r u c t u r e s such a s c h a r a c t e r s , s t r u c t u r e s a r e u s e f u l i f the constructable  structures  level  numbers o r r e c o r d s .  intended  Such  data structure i s  u s i n g i t s l i m i t e d template l i k e a b i l i t i e s .  s t r u c t u r e does not f i t ! i n t o t h i s c a t e g o r y , however,  When a  the  d e f i n i t i o n o f r e q u i r e d d a t a s t r u c t u r e s becomes more complex.  An  example o f t h i s was  problem was Compiler. E.  encountered i n t h i s p r o j e c t .  the c o n s t r u c t i o n o f a symbol t a b l e f o r an Two  compilers  In the d e s i g n  o f the  were w r i t t e n ,  one  E  i n P L / l , and  symbol t a b l e , i t was  The  found t h a t  one  in  the  normal P L / l methods f o r c o n s t r u c t i n g d a t a s t r u c t u r e s were not s u i t a b l e f o r the t a s k .  The  symbol t a b l e has  t o be a b l e  accommodate f a i r l y l o n g s t r i n g s w i t h o u t too much waste. the  to Thus  s t r i n g v a r i a b l e o f P L / l , which always u s e s the maximum  amount of d e c l a r e d memory, was  not  of  suitable.  The  ordinary  record structure of PL/i was also unsuitable since the information f i e l d s of symbol table entries have several formats. A based v a r i a b l e was not used because the r u l e s which govern access e n t r i e s i n based variables were complex, vaguely described, and l i k e l y to be implementation dependent.. In the end, a symbol table entry i n PL/i was designed as a s e r i e s of characters i n a character array and conversion was required f o r every access of the symbol table.  In contrast, a s i m i l a r entry  i n the E symbol table required no conversions  a t a l l . Thus, f o r  t h i s example, even P L / l , a language known f o r i t s range of data types, was clumsier i n i t s a b i l i t y to implement a moderately complex data structure, than the typeless language E.  2.$  INTERRUPT AND MULTITASKING PROGRAMMING  E avoids the incorporation of operating systems concepts, such as semaphores, communications channels, or task c o n t r o l structures (Habermann 76) i n i t s d e f i n i t i o n .  Instead, E  provides the basic t o o l s required f o r the w r i t i n g of i n t e r r u p t routines and multitasking systems.  These t o o l s , i n turn, allow  the implementation of higher l e v e l operating systems concepts as E functions.  The  semantics of interrupt programming f o r E i s expressed  by the i n t e r r u p t system of the E Machine, implemented using b i t s i n the status f l a g , FLAG.  Interrupt on, i n t e r r u p t o f f , and wait  29 statements o f t h e E l a n g u a g e p r o v i d e d i r e c t c o n t r o l o f t h e system.  The o p e r a t o r  :INSTF  p r o v i d e s a'software  interrupt  capability.  Two o p e r a t o r s p r o v i d e t h e c a p a b i l i t y o f w r i t i n g an E program a s a s e r i e s o f t a s k s o r p r o c e s s e s . switch operator,  One i s a c o n t e x t  :CONS¥I , which l o a d s the E Machine r e g i s t e r s  from a c o n t e x t v e c t o r i n memory.  The r e g i s t e r s , t o g e t h e r w i t h a  r e s e r v e d a r e a o f memory f o r t h e s t a c k , i s s u f f i c i e n t t o d e f i n e completely the s t a t e o f a task.  A context switch  enables  r e t u r n s from i n t e r r u p t s , t h e c r e a t i o n o f a t a s k , o r the r e s t a r t of a d e a l l o c a t e d t a s k . save o p e r a t o r ,  :CONRSV  The o t h e r i s t h e f u n c t i o n r e t u r n c o n t e x t .  T h i s o p e r a t o r saves t h e r e t u r n c o n t e x t  o f t h e f u n c t i o n w i t h t h e topmost frame on t h e s t a c k (see Appendix A ) , and e n a b l e s a t a s k s c h e d u l e r t o e x i s t a s an E function.  The s c h e d u l e r i s c a l l e d a s an E f u n c t i o n by a  deallocating task.  On e x e c u t i o n , t h e s c h e d u l e r saves t h e  r e s t a r t c o n t e x t o f t h e t a s k by t h e  rCONRSV  o p e r a t o r , and a l a t e r  c o n t e x t s w i t c h t o t h i s v e c t o r w i l l resume t h e t a s k .  The  d e f i n i t i o n o f t h e E Machine a s a s t a c k machine  i m p l i c i t l y d e f i n e s a s i m p l e method f o r t h e implementation o f concurrent t a s k s .  A separate  d a t a a r e a o f each t a s k .  stack i s a l l o c a t e d f o r the l o c a l  C o n t r o l o f a t a s k i s done by a  s c h e d u l e r u s i n g t h e c o n t e x t s w i t c h and r e t u r n c o n t e x t instructions.  save  W i t h i n a t a s k , any p r i m i t i v e f u n c t i o n , o r any  u s e r d e f i n e d f u n c t i o n which i s r e - e n t r a n t , may be f r e e l y  used.  S i n c e the o n l y r e q u i r e m e n t o f r e - e n t r a n c y i s t h a t no e x t e r n a l d a t a i s m o d i f i e d , a t a s k may sharable E functions.  be e a s i l y w r i t t e n a s a s e r i e s o f  31 A BRIEF  k)  E  DESCRIPTION  i s a programming  programming language  detail  requires  from  Appendix  E  most  Sammet  k.l  TOKENS  Interchange)  may  the University  computer  summary  of  Except  Standard  f o r the end-of-file,  an E  each  The  i t  differs  i n  including Eh. u s i n g BNF  Code E  for  notation  Information  programs  carriage  character l i s t e d  (see  return,  line  i n Appendix  B  token.  exception,  every  token  Comments  the  d e s c r i p t i o n o f E.  the language  t o be remembered  or  from  76).  languages,  (American  characters,  of  evolved  (Braga  since  needs  one o r more  E  of Waterloo  a brief  one r u l e  feed  systems  5*0 .  be used t o form  line  at  c h a r a c t e r s may b e u s e d t o f o r m  and space  Without by  a  59 A S C I I  B).  Only  E  designed f o r  such an introduction  69 p .  set of  Appendix  language  sections offer  other  gives  (see  A  developed  following  language  LANGUAGE  a p p l i c a t i o n s f o r microcomputers.  Eh,  The  feed,  OF T H E  the separator  when  i s separated characters:  writing  from  E  the next  carriage  tokens. token  return,  space.  may b e w r i t t e n  by e n c l o s i n g them  with  the  / * and  32 */  tokens.  Comments may e x i s t between any two t o k e n s i n a n E  program and a r e i g n o r e d d u r i n g c o m p i l a t i o n .  E Assembler  Language codes may be i n t e r s p e r s e d w i t h i n a n E program by e n c l o s i n g them w i t h t h e /"  and  "/  tokens.  The a s s e m b l e r e s c a p e s  are emitted as i s t o the object f i l e , ' and are otherwise  ignored  during compilation.  The  basic vocabulary  o f E c o n s i s t s o f constants,  names, f u n c t i o n names, keywords, a n d p r e d e f i n e d  data  operators.  D i f f e r e n t k i n d s o f t o k e n s a r e u s u a l l y i d e n t i f i a b l e by t h e f i r s t c h a r a c t e r o f the  One  token.  may w r i t e d e c i m a l , h e x a d e c i m a l , c h a r a c t e r , o r s t r i n g  constants: A)  A decimal constant  +3070 B)  $0000  $2DFE  A character constant s t a r t s with a •A  D)  -0001  A h e x a d e c i m a l c o n s t a n t s t a r t s w i t h a $ c h a r a c t e r , e.g. $80  C)  +03  s t a r t s w i t h a + o r a - c h a r a c t e r , e.g.  c h a r a c t e r , e.g.  '$  A s t r i n g constant "00  *  starts with'a  "  c h a r a c t e r , e.g.  "THISISASTRING :•  A t h r e e c h a r a c t e r h e x a d e c i m a l c o n s t a n t may be embedded i n a s t r i n g t o denote a b y t e o f any v a l u e , e.g. "$00  "THIS$20IS$20A$20STRING  I n a d d i t i o n t h e keywords TRUE a n d FALSE each r e p r e s e n t c o n s t a n t s which a r e p r o d u c e d by c o m p a r i s o n f u n c t i o n s .  special  33 D a t a names a r e u s e d t o a c c e s s a n a r e a o f memory. A d a t a name s t a r t s w i t h a n a l p h a b e t c h a r a c t e r , e . g . H.STR  H.TEMP  AK  SYM.SPT  F u n c t i o n names e n a b l e a c c e s s o f u s e r d e f i n e d f u n c t i o n s . A f u n c t i o n name s t a r t s w i t h a c o l o n , e . g . :FERROR.G  :SYM.HASH  :SYM.CLR  One may a l s o s p e c i f y a n a d d r e s s name, a n d a n a s s i g n m e n t name. T h e a d d r e s s name f i l l s t h e r o l e o f t h e a d d r e s s o p e r a t o r i n E h ( s e e B r a g a 76 p . 1 4 ) . An a d d r e s s name i s a d a t a name o r a f u n c t i o n name w i t h a n added ampersand c h a r a c t e r , e . g . &SYM.SPT  &AK  &:SYM.HASH  An a s s i g n m e n t name i s u s e d t o a s s i g n d a t a t o memory. A n a s s i g n m e n t name i s a d a t a name w i t h a n added e q u a l s i g n , e . g . =H.STR  =AK  =SYM.SFS  Keywords a r e r e s e r v e d , and a r e l i s t e d i n Appendix E . l .  The  p r e d e f i n e d operators provide b a s i c computation c a p a b i l i t y t o E programs, and a r e a l s o r e s e r v e d . They a r e l i s t e d i n Appendix E.2.  The operators i n t e r f a c e d i r e c t l y t o the stack i n s t r u c t i o n s  of t h e E Machine.  Thus, A p p e n d i x C a n d A p p e n d i x A may be  c o n s u l t e d f o r d e t a i l s on t h e o p e r a t i o n s o f t h e p r e d e f i n e d operators.  4.2  EXPRESSIONS  34  E, l i k e BLISS (Wulf 71), i s an e x p r e s s i o n o r i e n t e d language.  An e x p r e s s i o n i n E i s a p o s t f i x f o r m u l a , w i t h an  operator f o l l o w i n g a l i s t  o f operands.  i s a property o f the operator.  The number o f operands  An o p e r a t o r i n E may be a  p r e d e f i n e d o p e r a t o r , o r a f u n c t i o n name.  For the p r e d e f i n e d  o p e r a t o r s , t h e number o f operands i s p r e d e t e r m i n e d .  For  f u n c t i o n names, t h e number o f operands i s a d e c l a r e d v a l u e o f each f u n c t i o n name.  An operand may be a c o n s t a n t , a d a t a name, an a d d r e s s o r the e v a l u a t i o n o f an o p e r a t o r . o c c u r s from l e f t  to right.  name,  E v a l u a t i o n o f an e x p r e s s i o n  No a m b i g u i t y  i n the order of  e v a l u a t i o n i s p o s s i b l e because o f the p o s t f i x n o t a t i o n .  Thus  t h e r e a r e no b r a c k e t s , n o r i s t h e r e a h i e r a r c h y o f o p e r a t o r s .  E has no assignment s t a t e m e n t s .  I n s t e a d , an assignment  name i n an e x p r e s s i o n a s s i g n s t h e l a s t operand e v a l u a t e d t o t h e d e s i g n a t e d d a t a name.  F o r example, t h e e x p r e s s i o n  H.TEMP +03 :RMUL H.STR :B@ :ADD =H.TEMP i s interpreted as follows: ( :RMUL ) H.TEMP and +03  A)  Multiply  B)  Get t h e b y t e  C)  Add  D)  Assign  ( :B@ ) w i t h a d d r e s s  . i n H.STR .  ( :ADD ) t h e r e s u l t s o f (A) and (B) . (=H.TEMP ) t h e r e s u l t o f (C) t o H.TEMP .  4.2  ACTION STATEMENTS  A c t i o n s t a t e m e n t s a r e w r i t t e n t o e v a l u a t e e x p r e s s i o n s and t o p r o v i d e program c o n t r o l s t r u c t u r e s .  The  e v a l u a t i o n s t a t e m e n t s i m p l y e v a l u a t e s an e x p r e s s i o n  w i t h no o t h e r e f f e c t s , e.g. EVAL  The The  H.STR  :DEC  =H.STR  w h i l e statement a l l o w s t h e w r i t i n g o f a l o o p s t r u c t u r e .  w h i l e statement b e g i n s w i t h t h e keyword  WHILE , f o l l o w e d by  an e x p r e s s i o n , f o l l o w e d by a l i s t o f a c t i o n s t a t e m e n t s e n c l o s e d in  (* and *) b r a c k e t s , and f o l l o w e d by a  j  token.  The a c t i o n o f  a w h i l e statement c o n s i s t s o f the repeated e v a l u a t i o n o f the e x p r e s s i o n , f o l l o w e d by e x e c u t i o n o f t h e l i s t  of action  s t a t e m e n t s , a s l o n g a s t h e e x p r e s s i o n e v a l u a t e s t o TRUE.  When  t h e e x p r e s s i o n does n o t e v a l u a t e t o TRUE, t h e l o o p ends.  Lines  33 t o 3 ? i n A p p e n d i x D . l p r o v i d e an example o f a w h i l e statement.  The  i f - e l s e statement a l l o w s t h e w r i t i n g o f a d e c i s i o n  structure.  An i f - e l s e statement c o n s i s t s o f an i f c l a u s e ,  f o l l o w e d by any number o f e l s e c l a u s e s .  The i f c l a u s e  starts  w i t h t h e keyword I F , and an e l s e c l a u s e s t a r t s w i t h t h e keyword ELSE.  An e p x r e s s i o n f o l l o w s t h e keyword, w h i c h i s f o l l o w e d by  a l i s t o f a c t i o n statements enclosed i n  (? and  )? brackets.  e x p r e s s i o n s o f t h e c l a u s e s a r e e v a l u a t e d one a f t e r t h e o t h e r .  The  36 When one evaluates to TRUE, the l i s t of a c t i o n statements of the clause i s executed, followed by a skip of a l l the other else Lines 63 to 73 i n Appendix D.l  clauses i n the statement.  provide an example of an i f - e l s e statement.  The expression may be absent f o r a while statement, or an else clause.  In both cases, the absence of an expression i s  equivalent to the presence of a TRUE constant as expression.  The return statement e x i t s from a function, and returns the evaluation of i t s expression to the c a l l i n g routine, e.g. RETRN  "4-0  G. INDEX  :SYM.SPT  ;  The four statements above are s u f f i c i e n t to write most E programs.  S i x other statements e x i s t .  keyword followed by a  ;  token.  Each consists only of a  They are present to h a l t a  program, to c o n t r o l i n t e r r u p t s , and to e x i t from loops.  4.4  DECLARATIONS  A l l data names and function names i n a c t i o n statements must be previously declared.  A declaration statement s t a r t s with the  keyword DECL .  The second token s p e c i f i e s the kind of name. PARAM,  AUTO,  EXTRN,  and  FNCTN  The keywords  specify parameter data,  37 automatic data, external data, and function names respectively. Parameter data i s i n i t i a l i z e d on entry to a function, and corresponds to the operands of a function c a l l i n an expression. Automatic data i s l o c a l data which i s a l l o c a t e d on entry to a function.  External data corresponds to s t a t i c data i n memory.  Functions are the defined functions of an E program.  The t h i r d token of a declaration statement contains the name being declared.  The fourth token indicates the type a t t r i b u t e of the name. Type i s a non-negative decimal number.  The keyword  corresponds to type of +1, and the keyword type of +2.  BYTE  WORD corresponds to  For data names, type indicates the number of  contiguous bytes of the data area accessed through the name. A parameter always has type  WORD  . Since a parameter may hold a t  most one 16-bit word, only data of the type as an operand i n an expression.  BYTE or WORD may appear  For function names, type i s the  number of parameters of the function.  Lines 86 to 100 i n Appendix D.l contain declarations of a l l the d i f f e r e n t kinds of names of E.  DEFINITIONS  A series of function d e f i n i t i o n s form the bulk of E  38 programs. The structures of the previous sections a l l contribute to the formation of a function  definition.  function definition consists of the keywords  DEF  A  FNGTN ,  followed by the function name, followed by a l i s t of declarations enclosed in  (#  and  action statements enclosed in followed by a  ; token.  ($  )#  brackets, followed by a l i s t  and )$  Lines 155 to 177  an example of a function definition.  brackets, and in Appendix D.l provide  A definition of a function  must exist in an E program before the function may be declared and used..  External data also have to be defined before i t may declared and used.  be  External data are defined by the external  definition statement. This consists of the words  DEF  EXTRN ,  followed by the data name, followed by the type, followed by an optional i n i t i a l i z a t i o n l i s t of constants or address names. Lines 261 to 264 of Appendix D contain examples of external data definition statements.  Synonyms may be specified for constants using the manifest constant definition statement. DEF  MCON EOS$  $80  ;  specifies the data name E0S$ hexadecimal constant  $80.  For example,  to be the synonymn of the  39 5_i  J5..1  DESIGN AND  IMPLEMENTATION OF E  THE SPECIFICATION  The design of an E development  system required f i v e months  of work, and r e s u l t e d i n the document "E Language S p e c i f i c a t i o n " (Lee 7 8 ) .  The syntax of E was developed using the structure of simple precedence grammar (see Aho & Ullman 77 p. 1 9 4 - 1 9 6 ) .  The d i r e c t  a p p l i c a t i o n of simple precedence grammar was possible only because of the spartan nature of E language constructs. languages usually require more complex t h e o r e t i c a l  Other  frameworks,  such as an LALR grammar (see Aho & Ullman 77 Chapter 6) .  The semantics of E was defined as a combination of the action of the E Machine, plus the t r a n s l a t i o n of E programs to E Machine Code.  An intermediate language, the E Assembler  Language, was defined as the interface between the E Compiler and the E Assembler/Linker.  The method i s somewhat ad hoc.  However, i t s key elements, an abstract machine, an intermediate language, and the use of syntax directed t r a n s l a t i o n (see Aho & Ullman 77 Chapter 7)» represent r e l a t i v e l y well formed techniques within the underdeveloped f i e l d of semantics specification.  j>.2  THE BOOTSTRAP SYSTEM  The  i m p l e m e n t a t i o n g o a l o f t h e p r o j e c t was t h e r e a l i z a t i o n  o f a microcomputer-based  E development system.  t o use E t o s u p p o r t t h i s microcomputer  I t was  decided  s o f t w a r e development.  T h i s c h o i c e p r o v i d e d e f f i c i e n t use o f memory, p o r t a b i l i t y o f t h e p r o d u c t , as w e l l a s a means t o e x e r c i s e and t e s t t h e E method o f developing software.  However, an E development system must be  a v a i l a b l e b e f o r e E programs may  be w r i t t e n and e x e c u t e d .  This  i n i t i a l system i s c a l l e d t h e b o o t s t r a p system, and c o n s i s t s o f an E C o m p i l e r and an E A s s e m b l e r / L i n k e r d e v e l o p e d u s i n g the M i c h i g a n T e r m i n a l System (MTS)  o f t h e Computer C e n t e r o f  U n i v e r s i t y o f B r i t i s h Columbia  ( L e i g h 76,  The  H a l l 77,  Amos  77).  s e l e c t i o n o f an i m p l e m e n t a t i o n language was a c h o i c e  between P L / l , and BCPL. wider a v a i l a b i l i t y .  P L / l was  chosen m a i n l y because o f i t s  I n r e t r o s p e c t , i t seems t h a t BCPL m i g h t  have been more s u i t a b l e , a s i t s use would have e n t a i l e d a l o w e r c o s t i n programming and computing  time.  because i t p r o v i d e d a b a s i s o f comparison  P L / l was  chosen a l s o  between E and P L / l ,  s i n c e the same t r a n s l a t i o n programs w i l l be w r i t t e n u s i n g E i m m e d i a t e l y a f t e r w a r d s (see S e c t i o n 3•4).  Such a comparison i s  n o t u s e f u l w i t h BCPL, s i n c e E and BCPL a r e r e l a t i v e l y  The E B o o t s t r a p C o m p i l e r c o n s i s t o f  alike.  3500 l i n e s o f P L / l  s o u r c e codes and t a b l e s , w h i l e t h e E B o o t s t r a p A s s e m b l e r / L i n k e r c o n s i s t s of  2500 l i n e s .  T h e i r c o m p l e t i o n r e q u i r e d t h r e e months  41  of work, and r e s u l t e d i n a cross-compilation development system using P L / i and MTS.  The compiler has a basic e r r o r recovery  c a p a b i l i t y , so that a syntax error w i l l not terminate compilation.  Instead, the remaining tokens of a module are  discarded, with compilation continuing a t the beginning of the next d e f i n i t i o n statement.  5_._3_ AN EMULATOR OF THE E MACHINE  A program was written to emulate the actions of the E Machine using the Motorola 6800 f a c i l i t i e s of the Tektronix 8002 uProcessor Development System (Tektronix 77a, Tektronix 77b) a t the Department of E l e c t r i c a l Engineering of the U n i v e r s i t y of B r i t i s h Columbia.  This development required only h a l f a month  of work.  The main p o r t i o n of the emulator, which implements the system independent portions of the E Machine, consists of a 2K byte assembler program. f o r the E Machine stack.  An a d d i t i o n a l 0 . 5 K bytes was a l l o c a t e d An E program implements the f i l e  access features of the emulator, and occupies IK bytes of memory.  This use of E minimized programming i n assembly  language and a l s o gave an i n i t i a l test of E as a systems language.  An i n t e r r u p t system was not implemented because of  l a c k of access to interrupt f a c i l i t i e s on the development system.  42 j$.4  THE PORTABLE SYSTEM  The E bootstrap t r a n s l a t o r s and the E emulator allowed the development and execution of E programs which may access f i l e s . T h i s development system was used to construct the t r a n s l a t i o n programs to provide a portable E development system.  The system  i s portable because only two steps are required f o r a transfer of the t r a n s l a t i o n programs to other small machines: A)  the implementation of an emulator of the E Machine on the target system which executes a l l the combinatorial instructions, p l u s the f i l e i n t e r f a c i n g i n s t r u c t i o n s , and  B)  the i n t e r f a c i n g required to load the E Machine Code produced by t r a n s l a t o r programs i n t o the memory of the target system.  An Assembler/Linker was constructed f i r s t using a pure cross compilation method.  Load modules of E Machine Code were  downloaded from MTS to the Tektronix system using an ordinary 300 baud RS232C asynchronous terminal l i n k .  The r e s u l t was a  1800 l i n e E program which t r a n s l a t e d to approximately 4K bytes of E Machine Code.  Together with the E emulator of 3-5K "bytes,  and a symbol table of %  bytes, the portable Assembler/Linker  may thus run i n I3K bytes of user memory.  The portable E Assembler/Linker requires 1 second of processor time to process 30 characters of input.  This speed i s  quite slow, but i s comparable to the p r i n t i n g speed of the hardcopy terminal attached to the microprocessor development  43 system.  The speed may be' improved by an a s s e m b l e r  i m p l e m e n t a t i o n o f some o f the modules o f t h e program.  The u s e r  f u n c t i o n s o f t h e E language were i n c o r p o r a t e d t o i n t e r f a c e such assembler r o u t i n e s .  The assembly speed may a l s o be improved by  d e c r e a s i n g t h e number o f c h a r a c t e r s i n t h e mnemonics o f the i n t e r m e d i a t e language, thus d e c r e a s i n g the computing requirement of the Assembler/Linker.  Once the p o r t a b l e A s s e m b l e r / L i n k e r was c o m p l e t e d , i t was u s e d t o assemble t h e E A s s e m b l e r Language modules o f t h e developing portable E Compiler.  Thus o b j e c t modules, i n s t e a d o f  a l o a d module, was downloaded from MTS.  The d e s i g n o f a l l f i l e s  i n t h e E development system as A S C I I f i l e s w i t h a l i m i t e d c h a r a c t e r s e t f a c i l i t a t e d t h e communications r e q u i r e m e n t s .  The  a b i l i t y o f the A s s e m b l e r / L i n k e r t o assemble t h e p o r t a b l e E C o m p i l e r a l s o means t h a t t h e E development T e k t r o n i x system may be s e l f - m a i n t a i n e d .  system on t h e An E C o m p i l e r may  deal  w i t h a r b i t r a r i l y l a r g e E programs, s i n c e t h e symbol t a b l e i s e r a s e d a t t h e end o f each module.  Thus, a s l o n g a s each module  i s k e p t s m a l l , t h e c o m p i l e r s h o u l d have no symbol t a b l e overflow.  Such a s i t u a t i o n does n o t h o l d f o r t h e  A s s e m b l e r / L i n k e r , w h i c h has t o remember a l l t h e e x t e r n a l d a t a names and f u n c t i o n names o f a complete  program.  The p o r t a b l e E c o m p i l e r c o n s i s t s o f a 3^00 w h i c h t r a n s l a t e s t o 8K b y t e s o f E Machine Code. 3.5K  line  program  Together with  b y t e s o f t h e e m u l a t o r , and 4K b y t e s o f symbol t a b l e ,  this /  44 r e s u l t s i n a c o m p i l e r w h i c h may r u n i n 16K b y t e s o f u s e r memory. The speed o f t h e C o m p i l e r i s comparable t o t h a t o f t h e Assembler/Linker.  The p o r t a b l e t r a n s l a t i o n programs were c o m p l e t e d i n one and a h a l f months.  The f a s t c o m p l e t i o n t i m e was p o s s i b l e p a r t l y t o  t h e f a c t t h a t t h e same programs had a l r e a d y been w r i t t e n u s i n g PL/l.  However, t h i s h a s t o be b a l a n c e d a g a i n s t t h e f a c t t h a t  t h e development system a v a i l a b l e f o r t h e p o r t a b l e system was more p r i m i t i v e t h a n MTS, and e x e c u t e d e v e r y t h i n g a t a s l o w e r speed.  The p i v o t a l f a c t o r was t h e use o f i n t e r a c t i v e t r a c i n g t o  t e s t t h e E programs.  T h i s experience w i t h t r a c i n g confirmed i t s  u s e f u l n e s s i n q u i c k l y o b t a i n i n g enough knowledge on t h e e x e c u t i o n b e h a v i o u r o f a program t o v e r i f y i t s c o r r e c t n e s s , a n d a l s o i n p i n p o i n t i n g any e r r o r s t h a t i n t e r f e r e w i t h e x e c u t i o n .  Appendix F c o n t a i n s a sample program w h i c h i l l u s t r a t e s t h e development sequence o f an E program u s i n g t h e p o r t a b l e system a s implemented on t h e T e k t r o n i x system.  The sample program sums  an a r r a y o f 6000 1 6 - b i t numbers, and a l s o g i v e s a b a s e l i n e f o r t h e performance o f E programs.  The c o m p i l e d code f o r t h e sample  program o c c u p i e d 48 b y t e s o f memory, and r e q u i r e d 8 seconds t o execute.  T h i s may be compared w i t h a M o t o r o l a 6800 a s s e m b l e r  program t o p e r f o r m t h e same c o m p u t a t i o n , w h i c h o c c u p i e d % o f memory and r e q u i r e d 0.4 seconds t o e x e c u t e .  "bytes  ^5  61  CONCLUSIONS  A development  system, w h i c h e n a b l e s t h e development o f  systems l e v e l s o f t w a r e f o r m i c r o c o m p u t e r s u s i n g t h e language E, h a s been c o n s t r u c t e d . development  The t r a n s l a t i o n programs which form t h e  system h a s been e x t e n s i v e l y t e s t e d .  In particular,  a p o r t a b l e E C o m p i l e r , and a p o r t a b l e E A s s e m b l e r / L i n k e r has been v e r i f i e d by t h e i r use i n c o m p i l i n g and l i n k i n g t h e m s e l v e s . Thus, a p o r t a b l e development  system e x i s t s f o r E which h a s been  demonstrated t o be s e l f m a i n t a i n i n g .  The performance o f t h e system h a s been e v a l u a t e d by t h e g e n e r a t i o n and e x e c u t i o n o f a sample program.  Comparison o f t h e  E program w i t h an e q u i v a l e n t a s s e m b l e r program  showed t h a t t h e  code g e n e r a t e d from an E program i s a t l e a s t a s memory e f f i c i e n t a s a s s e m b l e r programming, and t h a t a n E program e x e c u t e s 20 times slower than an assembler  program.  Developing software using E has t h e f o l l o w i n g implementation advantages: A)  The . i m p l e m e n t a t i o n o f E on a t a r g e t system r e q u i r e s o n l y a 2K b y t e a s s e m b l e r program a s b a s i c s u p p o r t .  B)  A p o r t a b l e t r a n s l a t i o n system f o r E i s a v a i l a b l e w h i c h can run  on a m i c r o c o m p u t e r w i t h 16K b y t e s o f memory.  A l t e r n a t i v e l y , a t r a n s l a t i o n system f o r E i s a l s o  available  on l a r g e computers w h i c h s u p p o r t P L / i . C)  An E program u s e s memory a t l e a s t a s e f f i c i e n t l y a s  46  a s s e m b l e r programming. D)  By t h e c o r r e s p o n d e n c e o f t h e s o u r c e E program t o t h e g e n e r a t e d E Machine Code, i t i s p o s s i b l e t o u s e i n t e r a c t i v e t r a c i n g t o t e s t E programs.  The  m e r i t s o f E a s a programming language i n c l u d e t h e  following: A)  E i s s i m p l e r t h a n most o t h e r l a n g u a g e s i n t h a t i t embodied fewer concepts i n i t s c o n s t r u c t i o n .  Thus, t h e e f f o r t  r e q u i r e d t o l e a r n and master t h e use o f E a s a t o o l i s s m a l l e r t h a n f o r o t h e r l a n g u a g e s , and t h e c h a n c e s o f E confusing i t s users B)  (Plum 77)  i s diminished.  The development o f s o f t w a r e a s a s e r i e s o f s m a l l modules i s e n c o u r a g e d by t h e ease w i t h which e x t e r n a l f u n c t i o n s may be written.  C)  H i g h e r l e v e l s e q u e n t i a l , d e c i s i o n , and l o o p s t r u c t u r e s a r e used t o c o n t r o l e x e c u t i o n .  D)  Features  a r e i n c l u d e d t o e n a b l e t h e use o f E a s t h e means t o  r e a l i z e operating E)  systems.  Complex d a t a s t r u c t u r e s may be e a s i l y c o n s t r u c t e d by t h e use o f f u n c t i o n s because E does n o t p r e d e f i n e d a t a  types.  To b a l a n c e t h e s e a d v a n t a g e s , t h e i m p l e m e n t a t i o n method f o r E d e s c r i b e d h e r e s u f f e r s from l o n g e x e c u t i o n t i m e s .  As w e l l , E  i s u n f a m i l i a r t o programmers because many o f t h e t r a d i t i o n a l features present  i n high l e v e l languages a r e n o t i n c l u d e d .  47 The e x p e r i e n c e o f t h e p r o j e c t showed t h a t computer l a n g u a g e development i s a complex a c t i v i t y .  Some o f t h e p a r t s o f t h e  p r o b l e m , such a s s e m a n t i c s , s y n t a x , i m p l e m e n t a t i o n , o p e r a t i n g systems, programming p r a c t i c e s , and s o f t w a r e t e s t i n g , form e n t i r e f i e l d s by t h e m s e l v e s .  The c h a l l e n g e was t h e i n t e g r a t i o n  of t h e e x i s t i n g knowledge i n t h e s e f i e l d s t o p r o d u c e a u s e f u l t o o l w i t h i n the l i m i t a t i o n s o f microcomputer technology.  Seen  i n t h i s l i g h t , t h e r a p i d c o m p l e t i o n o f development systems f o r the  l a n g u a g e E showed t h e v a l u e o f t h e approach o f m i n i m i z i n g a  problem whenever p o s s i b l e , and o f making use o f a v a i l a b l e  tools  whenever p o s s i b l e . "We s h a l l do a much b e t t e r programming j o b , p r o v i d e d t h a t we approach t h e t a s k w i t h a f u l l a p p r e c i a t i o n o f i t s tremendous d i f f i c u l t y , p r o v i d e d t h a t we s t i c k t o modest and e l e g a n t programming l a n g u a g e s , p r o v i d e d t h a t we r e s p e c t t h e i n t r i n s i c l i m i t a t i o n s o f t h e human mind, and a p p r o a c h t h e t a s k a s V e r y Humble Programmers." ( D i j k s t r a 72 p. 866)  48 72  RECOMMENDATIONS FOR FUTURE WORK  The s u c c e s s f u l c o n s t r u c t i o n o f a p o r t a b l e E t r a n s l a t i o n system h a s demonstrated t h e u s e f u l n e s s o f E a s a c o m p i l e r writing tool.  However, many o f t h e o t h e r p r o p e r t i e s mentioned  have n o t y e t been v e r i f i e d , i n c l u d i n g : A)  p o r t a b i l i t y , which may be t e s t e d by t h e i m p l e m e n t a t i o n  of E  Machines and E development systems on d i f f e r e n t m i c r o p r o c e s s o r s and m i n i c o m p u t e r s , B)  o p e r a t i n g systems f e a t u r e s , which may be t e s t e d by u s i n g E t o w r i t e an o p e r a t i n g system, and  C)  r e l e v a n c e t o t h e microcomputer s o f t w a r e development, w h i c h may be t e s t e d by u s i n g E t o w r i t e t h e s o f t w a r e o f complete microcomputer a p p l i c a t i o n s .  The r e a l i z a t i o n o f a n E Machine u s i n g microprogramming  on a  m i n i c o m p u t e r , o r u s i n g b i t s l i c e hardware such a s t h e AM2900 • (Advanced 76), may a l s o be an i n t e r e s t i n g development.  Such a  r e a l i z a t i o n o f an E Machine w i l l d e m o n s t r a t e t h e u s e f u l n e s s o f t h e s t a c k machine c o n c e p t by t h e r e m o v a l o f t h e e x e c u t i o n t i m e disadvantages  o f E programs.  49 REFERENCES  Advanced M i c r o D e v i c e s I n c . , (1976), "The AM2900 F a m i l y D a t a Book", Advanced M i c r o D e v i c e s I n c . , C a l i f o r n i a , U.S.A., 1976 (172 p a g e s ) . • Aho  A.V., U l l m a n J.D., (1977), " P r i n c i p l e s o f C o m p i l e r D e s i g n " , A d d i s o n - W e s l e y P u b l i s h i n g Co., O n t a r i o , 1977 (604 p a g e s ) .  Amos D., (1977), " U s i n g P L / i a t UBC", Computing C e n t e r , U n i v e r s i t y o f B r i t i s h C o l u m b i a , Vancouver, Nov. 1977 (81 pages). Bass  C , (1978), "PL/Z: A F a m i l y o f Systems Programming Languages f o r M i c r o c o m p u t e r s " , IEEE Computer v o l . 11 n o . 3 i p. 34-39, March 1978.  Bass  C , Brown D., (1976), "A P e r s p e c t i v e on M i c r o c o m p u t e r S o f t w a r e " , P r o c . o f t h e IEEE vol.64 no.6, p . 905-909, June 1976.  B l e a s d a l e E., (1977), "Development o f H i g h - L e v e l Languages", M i c r o p r o c e s s o r v o l . 1 no. 4 , p. 241-244, A p r i l 1977B r a g a R., (1976), "Eh R e f e r e n c e Manual", Dept, o f Comp. S c i . , U n i v e r s i t y o f W a t e r l o o , W a t e r l o o , O n t a r i o , 1976 (32 p a g e s ) . B r a g a R., M a l c o l m M.A., Sager G.R., (1976), "A P o r t a b l e L i n k i n g L o a d e r " , Symposium on T r e n d s and A p p l i c a t i o n s 1976, p . 124-128, I E E E Computer S o c i e t y , 1976. W.L., (1978), "Modular Programming i n PL/M", IEEE Computer v o l . 11 no. 3 , p.40-46, March 1978.  Brown  Bulman D.M., (1977), " S t a c k Computers: An I n t r o d u c t i o n " , IEEE Computer v o l . 11 n o . 5, p . 18-28, May 1977. C l e a v e l a n d J.C., S a t t e n C D . , (1976), "The D e s i g n a n d I m p l e m e n t a t i o n o f a S i m p l e Programming Language f o r M i c r o c o m p u t e r s " , AFIPS Conf. P r o c . V o l . 64, p . 629-635. AFIPS P r e s s , 1976.  50 Chung K.M., Yuen H., (1978), "A T i n y P a s c a l C o m p i l e r " , B y t e v o l . 3 no. 9, p . 58-65, S e p t . 1978. Dahl  O.J., D i j k s t r a E.W., Hoare C.A., (1972), " S t r u c t u r e d Programming", Academic P r e s s , New Y o r k , 1972 (150 p a g e s ) .  D i g i t a l Equipment Corp., (1971), " P D P - l l / 2 0 , 1 5 , r 2 0 P r o c e s s o r Handbook", D i g i t a l Equipment Corp., U.S.A., 1971 (app. 150 pages). D i j k s t r a E.W., (1966), "A P r i m e r o f ALGOL 60 Programming", Academic P r e s s , New Y o r k , I966 (114 p a g e s ) . D i j k s t r a E.W., (1972), "The Humble Programmer", CACM v o l . 15 no. 10, p.859-866, Oct. 1972. D o e r r J . , (1978), "Low-Cost M i c r o c o m p u t i n g : The P e r s o n a l Computer a n d S i n g l e - B o a r d Computer R e v o l u t i o n s " , P r o c . o f the IEEE v o l . 66 no. 2, p . 117-130, Feb. 1978. F u r g e r s o n D.F., Gibbons A . J . , (1977), "A H i g h - L e v e l M i c r o p r o c e s s o r Programming Language", P r o c . o f Compcon '77, IEEE Computer S o c i e t y , p . 185-188, 1977F y l s t r a D.H., (I976), "PL/M6800: A Compatible H i g h - L e v e l Language f o r t h e M o t o r o l a M i c r o p r o c e s s o r " , P r o c . o f the 1976 Symposium on T r e n d s a n d A p p l i c a t i o n s , IEEE Computer S o c i e t y , p. 103-106, 1976. G a l l a c h e r J . , (1977), "Software f o r Hardware E n g i n e e r s " , M i c r o p r o c e s s o r v o l . 1 n o . 3 , p . 169-180, Feb. 1977. Gibbons A . J . , (1975), "When t o Use H i g h e r L e v e l Languages i n M i c r o c o m p u t e r Based Systems", E l e c t r o n i c s v o l . 48 no. 6, p . 107-111, Aug. 7 1975. Habermann A.N., (I976), " I n t r o d u c t i o n t o O p e r a t i n g System D e s i g n " , S c i e n c e R e s e a r c h A s s o c i a t e s I n c . , T o r o n t o , 197& (372 p a g e s ) . Hall  R.H., ( e d . ) , (1977), "The MTS Commands Manual", Computing C e n t e r , U n i v e r s i t y o f B r i t i s h Columbia, Vancouver, Feb. 1977 (123 p a g e s ) .  51 Hawkins C , d ' A r a p e y e f f A., (1977), " D e v e l o p i n g S o f t w a r e f o r M i c r o s " , Datamation v o l . 23 no. 7, p . 76-80, J u l y 1977. I n t e l C o r p . , (1975), "8008 and 8080 PL/M Programming Manual (Rev. A ) " , I n t e l Corp., U.S.A., 1975 (app. 100 p a g e s ) . I n t e l C o r p . , (1976), "8080 Assembler Language Programming Manual (Rev. C ) " , I n t e l Corp., U.S.A., 1976 (62 p a g e s ) . Johnson S . C , (1973), "User's R e f e r e n c e t o B on TSS", B e l l L a b o r a t o r i e s , Murray H i l l , New J e r s e y , U.S.A., 1973 (32 pages). Johnson M.S., (1978), "The D e s i g n and I m p l e m e n t a t i o n o f a Run-Time A n a l y s i s a n d - I n t e r a c t i v e Debugging E n v i r o n m e n t " , Ph.D. T h e s i s , Dept. o f Comp. S c i . , U n i v e r s i t y o f B r i t i s h C o l u m b i a , Vancouver, 1978 (194 pages) . Kahn  K . C , (1978), "A S m a l l - S c a l e O p e r a t i n g System (Foundation f o r M i c r o p r o c e s s o r A p p l i c a t i o n s " , P r o c . o f t h e IEEE v o l . 66  no. 2, p . 209-216, Feb. 1978. Knottek  N.  f  (I978), " M i n i and M i c r o c o m p u t e r S u r v e y " ,  Datamation  v o l . 24 no. 8, p . 113-131, Aug. 1978.  K o r n s t e i n H., (1977), "Memories and M i c r o c o m p u t e r s " , M i c r o p r o c e s s o r v o l . 1 no. 4, p . 253-257, A p r i l 1977. Lee  P.C., (1978), " S p e c i f i c a t i o n o f t h e Language E", Memorandum t o D r . C F . S c h r a c k , Dept. o f E l e c . Eng., U n i v e r s i t y o f B r i t i s h C o l u m b i a , Vancouver, Nov. 1978 (90 pages, 160 pages appendices).  L e i g h J . L . , (1976), " I n t r o d u c t i o n t o t h e Computing C e n t e r and MTS", Computing C e n t e r , U n i v e r s i t y o f B r i t i s h Columbia, V a n c o u v e r , S e p t . 1976 (62 p a g e s ) . L i e n t z B.P., (I976), "Comparative E v a l u a t i o n o f V e r s i o n s o f BASIC", CACM v o l . 19 no. 4, p . 175-181, A p r i l 1976. Lucklama H., (1977), "UNIX on a M i c r o p r o c e s s o r " , P r o c . o f t h e A F I P S 1977 N a t i o n a l Computer C o n f e r e n c e , p . 237-242, AFIPS P r e s s , 1977.  52 Madden J.G., (1977), "C: A Language for Microprocessors", Byte vol. 2 no. 10, Oct. 1977. Maples M.D., Fisher E.R., (l977). "Real-Time Microcomputer Applications Using LLL BASIC", IEEE Computer vol. 10 no. 9. . p. 14-21, Sept. 1977. Motorola Inc., (1975), "M6800 Microprocessor Applications Manual", Motorola Inc., U.S.A., 1975 (app. 400 pages). Motorola Inc., (1976), "MPL Language for the M6800 Microprocessor (Preliminary)", Motorola Inc., U.S.A., March 1976 (60 pages). Mueller R.A., Johnson G.R., (1976), "ASM/GEN: A Cross-Assembler Generating System for Microcomputers", Colorado State University, Colorado, U.S.A., 1976. Nicholls J.E., (1975), "The Structure and Design of Programming Languages", Addison-Wesley Publishing Co., Ontario, 1975 (571 pages). Nicholls J.E., (1976), "An Overview of Microprocessor Applications", Proc. of the IEEE vol. 64 no. 6,-p. 951-953, June 1976. Noyce R.N., (1977), "Microelectronics", Scientific American Vol. 237 no. 3 , p. 62-69, Sep. 1977. Ogdin no.  J.L., (1971), "The Case Against BASIC", Datamation vol. 15 9,  P-  34-41,  Sep.  1  1971.  Osborne A., (I976), "An Introduction to Microcomputers: Vol. II Some Real Products", Adam Osborne and Associates Inc., U.S.A., 1976 (app. 400 pages). Parnas D.L., (1972), "On the Criteria to be Used in Decomposing Systems into Modules", CACM vol. 15 no. 12, p.° 1053-1058, Dec. 1972. Phoenix Group Inc., (1978), "Byte Shopper: The Microcomputer Guide (Issue No. 3 ) " , Microage Wholesale, U.S.A., Spring 1978 (72 pages).  53 Peck  J . E . , (1975), "The Essence o f Computer S c i e n c e " , Dept. o f Comp. S c i . , U n i v e r s i t y o f B r i t i s h C o l u m b i a , V a n c o u v e r , 1975 (47 p a g e s ) .  Plum  T., (1977), " F o o l i n g t h e U s e r o f a Programming Language", S o f t w a r e : P r a c t i c e and E x p e r i e n c e v o l . 7» P- 215-221, 1977.  P o l l a c k S.V., S t e r l i n g T.D., (1976), "A Guide t o P L / l " , R i n e h a r t , a n d W i n s t o n , T o r o n t o , 1976 (63O p a g e s ) .  Holt,  R a n d e l l B., R u s s e l l L . J . , (1966), "ALGOL 60 I m p l e m e n t a t i o n " , Academic P r e s s , New Y o r k , I966 (418 p a g e s ) . R i c h a r d s M., ( l 9 6 9 ) 1 "BCPL: A T o o l f o r C o m p i l e r W r i t i n g a n d Systems Programming", P r o c . o f AFIPS I969 S p r i n g J o i n t C o n f e r e n c e , p . 557-566, AFIPS P r e s s , I969. R i c h a r d s M., (1971), "The P o r t a b i l i t y o f t h e BCPL C o m p i l e r " , S o f t w a r e : P r a c t i c e a n d E x p e r i e n c e v o l . 1, p . 135-146, 1971. R i c h a r d s M., e t a l . , (1974), "The BCPL Programming M a n u a l " , Dept. o f Comp. S c i . , U n i v e r s i t y o f B r i t i s h C o l u m b i a , V a n c o u v e r , 1976 (86 p a g e s ) . Sammet J . E . (I969), "Programming Languages: H i s t o r y a n d F u n d a m e n t a l s " , P r e n t i c e H a l l I n c . , U.S.A., I969 (785 p a g e s ) . T e k t r o n i x I n c . , (1977a), "8002 u P r o c e s s o r L a b System U s e r ' s M a n u a l " , T e k t r o n i x I n c . , Oregon, U.S.A., 1977 (app. 400 pages). T e k t r o n i x I n c . , (1977b), "8002 u P r o c e s s o r s L a b 6800 A s s e m b l e r & E m u l a t o r U s e r ' s M a n u a l " , T e k t r o n i x I n c . , Oregon, U.S.A., 1977 (app- ^00 p a g e s ) . 1  Tenenbaum A.S., (1978), " I m p l i c a t i o n s o f S t r u c t u r e d Programming f o r M a c h i n e A r c h i t e c t u r e " , CACM v o l . 21 n o . 3, p . 237-246, March 1978. Texas I n s t r u m e n t s I n c . , (1976), "990 Computer F a m i l y Systems Handbook", T e x a s I n s t r u m e n t s I n c . , U.S.A., I976 (app. 200 pages). USCD, (1978) "USCD P a s c a l " , ACM SIGPC Notes v o l . 1 no. 1, p . 6-15, A p r i l 1978.  Watson I.W., (1976), "Comparison o f C o m m e r c i a l l y A v a i l a b l e S o f t w a r e T o o l s f o r M i c r o p r o c e s s o r Programming", P r o c . o f t h e IEEE v o l . 64 no. 6, p . 910-920, June 1976. W i r t h N., (1970), "The Programming Language PASCAL", A c t a I n f o r m a t i c a v o l . 1, p . 36-63, 1970. Wulf  W.A., (1971), "BLISS: A Language f o r Systems Programming",  CACM v o l . 14 no. 12, p. 780-790, Dec. 1971.  Y a s a k i E.K., (1977), " M i c r o c o m p u t e r s : F o r Fun and P r o f i t ? " , Datamation v o l . 23 no. 7, P- 66-77, J u l y 1977Yohe  J.M., (1974), "An Overview o f Programming P r a c t i c e s " , Computing S u r v e y s v o l . 6 no. 4 , p . 221-245, Dec. 1974.  55  APPENDIX A  —  I S P DESCRIPTION OF THE E MACHINE  THE INSTRUCTION SET PROCESSOR (ISP) NOTATION I S USED TO DESCRIBE THE E MACHINE. DIGITAL 71, APPENDIX C, DESCRIBES THE I S P NOTATION. THE NOTATION USED HERE CONTAIN SOME SYNTAX CHANGES: 1)  SINCE DIFFERENT FONTS ARE NOT AVAILABLE, A COMMENT I S ANY NUMBER .OF CHARACTERS BETWEEN A SLASH, /, AND THE END OF A LINE. A SLASH I S NO LONGER USED FOR DEFINING SYNONYMS.  2)  ROUND BRACKETS, ( ) , REPLACE SQUARE BRACKETS. SHOULD RESOLVE POSSIBLE AMBIGUITIES.  3)  & REPRESENTS THE I REPRESENTS THE II REPRESENTS THE Xl REPRESENTS THE MOD REPRESENTS THE  THE CONTEXT  LOGICAL AND OPERATOR. LOGICAL OR OPERATOR. CONCATENATE OPERATOR. LOGICAL EXCLUSIVE OR OPERATOR. REMAINDER OPERATOR.  4)  ALL ARITHMETIC OPERATIONS USED HERE DEAL WITH DATA AS ABSOLUTE BINARY NUMBERS, OR AS PURE BIT PATTERNS. CONSTANTS I N ARITHMETIC OPERATIONS ARE ASSUMED TO BE • RIGHT JUSTFIED, WITH 0 FOR ALL UNSPECIFIED B I T S .  .5) 6)  THE SIDE EFFECTS NAMING CONVENTION I S NOT USED.  CONSTANTS DEFAULT TO HEXADECIMAL NUMBERS. THUS . A DIGIT SPECIFIES k BITS... .A BINARY. NUMBER I S SPECIFIED BY A B CHARACTER AT THE END OF THE CONSTANT.  .  56  PRIMARY MEMORY MP(0000:FFFF)<  / 1 6 BIT ADDRESS SPACE GIVING 64K /8 BIT BYTES OF ADDRESSABLE MEMORY  0:7>  REGISTERS AND PROCESSOR  STATE  PC < 0 : F >  /16 BIT PROGRAM COUNTER  SP < 0 : F >  / 1 6 BIT STACK POINTER  FP<0:F>  / 1 6 BIT FRAME POINTER FOR FUNCTION /FRAME CONTROL  FLAG < 0 : F > INT EN :=  FLAG < 0 ^  RUN  :=  FLAG<1>  WAIT  :=  FLAG < 2 >  ON OFF  := I B := OB  /16 BIT STATUS FLAG / "INTERRUPT ENABLE / RUN / WAIT FOR INTERRUPT /  DEFINES ACTIVE STATES FOR LINES  INPUT/OUTPUT IO(00:FF) <0:7>  /256 ADDRESS SPACE OF 8 BIT 10 PORTS  INTERRUPT LINES RESET RESET-ADD < 0 : 1 5 > INTREQ INT-ADD < 0 : 1 5 >  /RESET TO I N I T I A L I Z E PROCESSOR /RESET JUMP ADDRESS /INTERRUPT REQUEST /INTERRUPT JUMP ADDRESS  57 ADDRESSING  OPERATIONS  ASGNW (MEMADD<0:15>, DATAl6<0:15» /WORD ASSIGNMENT ( MP(MEMADD ) <- DATAl6<0:7> ; MP(MEMADD + 1) <- DATA1'6<8:15> ) ASGNB (MEMADD, DATA8<0:7>) ; MP(MEMADD ) <- DATA8  :=  PUSHW (DATA16) ; SP <- SP - 2 ; ASGNW (SP, DATA16)  :=  PUSH  /BYTE ASSIGNMENT ) /PUSH WORD TO STACK  NEXT )  /PUSH BYTE TO STACK (DATA8) := [ SP <- SP - 2 ; NEXT ASGNW (SP, 00 | | DATA8 ; ) /IMMEDIATE WORD  IMW ;  MP(PC + 1 ) || MP(PC + 2)  )  ^  MP(PC + 1)  )  /IMMEDIATE BYTE  1MB  TOSW  (DATA8) [  TOSB  MP(SP + DATA8 + DATA8) | | MP(SP + DATA8 + DATA8 + l )  (DATA8)  )  [  MP(SP + DATA8 + DATA8 + l )  (  FP + (00 | | 1MB)  ) /FRAME ADDRESS )  (DATA16) := ( MP(DATA16) || MP(DATA16 + l )  RETRNP (DATA16, PARAMN<0:7>) (  /NTH ELEMENT BYTE FROM /TOP OF STACK  :=  FRAD  MW  ./NTH ELEMENT FROM TOP OF /STACK  :=  :=  /WORD OF MEMORY ) /RETRN FOR PRIMITIVE /FUNCTION  PARD <- DATA16 ; SP <- SP + PARAMN +PARAMN ; .NEXT . PUSHW (PARD) ; PC <- PC + 1 )  PARA<0:15> PARB<0:15> PARC<0:15> PARD<0:15>  /INTERNAL REGISTERS  INSTRUCTION FORMAT  INST<0:7> : = MP(PC)  /INSTRUCTION I S BYTE I N MEMORY /POINTED BY PC  INSTRUCTION INTERPRETATION PROCESS  RESET  = > (RESET-SEQUENCE) /RESET ON INITIALIZES PROCESS REGARDLESS /OF PROCESSOR STATE  INT-REQ & INTEN & RUE & ""RESET => (INTERRUPT-SEQUENCE) /INTERRUPT ACTIVATED ONLY WHEN INTEN ON ((~INTREQ &~WAIT & R U N )  (INTREQ & ""INTEN & RUN)) & PRESET => (EXECUTION-SEQUENCE) /NORMAL EXECUTION I F RUN ON AND NO WAIT /OR INTERRUPT  WAIT RUN  RESET-SEQUENCE ( RUN <WAIT. <INTEN < PC <-  => () => () /NO EXECUTION AT WAIT OR  ON OFF OFF RESET-ADD  INTERRUPT-SEQUENCE ( WAIT <- OFF NEXT PUSHW (SP NEXT PUSHW (PC NEXT PUSHW (FP PUSHW (FLAG NEXT PUSHW (PC NEXT PUSHW (FP INTEN <OFF PC <INT-ADD EXECUTION-SEQUENCE := ( EXECUTE-INSTRUCTION  RUN  59  INSTRUCTION EXECUTION  EXECUTE-INSTRUCTION  :=  /INSTRUCTION CODE CHECK ( INST<7> = IB ) => (RUN <- OFF ) /OPCODE ERROR ( INST =00  ) =>  (RUN <- OFF )  ////////////////////////// /PUSH AND POP INSTRUCTIONS /PUSHBA /PUSH BYTE ABSOLUTE ( INST = 0 2 ) => ( PUSHB (MP(lMW)) PC <- PC + 3 ,/PUSHBI /PUSH BYTE IMMEDIATE ( INST = 0 4 ) => ( PUSHB (1MB) PC <- PC + 2  ; NEXT  )  ; NEXT )  /PUSHBX /PUSH BYTE INDEXED ( INST = 0 6 ) => ( PUSHB (MP(FRAD)) ; NEXT PC <- PC + 2 ) /PUSHWA /PUSH WORD ABSOLUTE ( INST = 0 8 ) => ( PUSHW (MW (IMW)) ; NEXT. PC <- PC + 3 ) /PUSHWI /PUSH WORD IMMEDIATE ( INST = OA ) => (PUSHW (IMW) PC <- PC + 3  ; NEXT  )  /PUSHWX /PUSH WORD INDEXED ( INST = OC ) => ( PUSHW (MW(FRAD)) ; NEXT PC <- PC + 2 ) /PUSHWF /PUSH FRAME ADDRESS ( INST = OE ) => ( PUSHW (FRAD) PC <- PC + 2 /POP /POP STACK ( INST = 10 ) =>  ( SP <- SP + 2 PC <- PC + 1  J NEXT )  ; )  60  ASSIGNMENT INSTRUCTIONS /ASGNBA /ASSIGN BYTE ABSOLUTE ( INST = 12 ) => ( ASGNB (TOSB (OO), IMW) ; NEXT PC <- PC + 3 ) /ASGNWA /ASSIGN WORD ABSOLUTE ( INST = 14 ) => (ASGNW (TOSW (00), IMW} PC <- PC + 3 )  ; NEXT  /ASGNBX /ASSIGN BYTE INDEXED ( INST = 16 ) => ( ASGNB (TOSB (00) , FRAD) ; NEXT PC <- PC + 2 /ASGNWX /ASSIGN WORD INDEXED ( INST = 18 ) => ( ASGNW (TOSW (00) , FRAD) ; NEXT PC <- PC + 2 /OPCODE ERROR ( INST = 1A ( INST = IC ( INST = IE  => => =>  ( RUN <- OFF ) ( RUN <- OFF ) ( RUN <- OFF )  6l  //////////////////////////////// / EXECUTION CONTROL INSTRUCTIONS /JMP  /JUMP UNCONDITIONAL  ( INST = 20  ) =>  /JNT /JUMP NOT TRUE ( INST = 22 ) =>  ( PC <- IMW  )  ( (TOSB (00) ~= FF) = ( SP <- SP + 2 ; PC <- IMW ; ELSE SP <- SP + 2 ; PC <- PC + 3  ) /HALT  /HALT PROCESSOR  ( INST = 24 /NOP  ) =>  ( RUN <- OFF  )  ( PC <- PC + 1  )  /NO OPERATION  ( INST = 26  ) =>  /CALL /CALL FUNCTION ( INST = 28 ) =>  ( PUSHW (PC + 3) ; NEXT PUSHW (FP) ; PC <- IMW )  /ALST /ALLOCATE STACK ( INST = 2A ) =>  ( SP <- SP - 1MB ; PC <- PC + 2 /SETFP /SET FRAME POINTER ( INST = 2C ) => ( PUSHW (IMW) ; NEXT FP <- SP PC <- PC + 3  ) .  )  /RETRN /RETURN FROM FUNCTION CALL ( INST = 2E ) => ( F P < - MW (PP + MP(FP + 1) + 2) PC<- MW (FP + MP(FP + 1) + 4 ) SP <- FP + MP(FP + 1) + MP(FP) + 4 ASGNW (TOSW, FP + MP(FP + l ) + MP(FP) + 4 ) )  / MULTITASKING AND EXTRA CONTROL  INSTRUCTIONS  /INTON /INTERUPT ENABLE ( INST =30 ) => ( INTEN <- ON PC <- PC + 1  ;  /INTOFF /INTERRUPT DISABLE ( INST = 32 ) => ( INTEN <- OFF PC <- PC + 1  ;  /WAIT /WAIT FOR INTERRUPT ( INST =34 ) => ( WAIT <- ON PC <- PC + 1  ;  /OPCODE ERROR ( INST = 36  )  =>  ( RUN <- OFF )  /:INSTF /SOFTWARE'INTERRUPT ( INST = 38 ) => ( PUSHW (SP ) j PUSHW (PC ) ; PUSHW (FP ) ; PUSHW (FLAG) ; PUSHW (PC ) ; PUSHW (FP ) ; INTEN <- OFF PC <- TOSW  NEXT NEXT NEXT NEXT NEXT (06)  /:CALLS /INDIRECT FUNCTION CALL ( PARD <- TOSW (00) ( INST = 3A ) SP <- SP + 2 PUSHW (PC + 2 ) PUSHW (FP ) PC <- PARD /:CONSWI /CONTEXT SWITCH ( SP <( INST = 3C ) PC <<FP FLAG <-  NEXT  MW (TOSW(OO) + 6 ) MW (TOSW(OO) + 4 ) MW (TOSW (00" + 2 ) MW (TOSW(00 )  /:CONSRV /SAVE CONTEXT OF FUNCTION RETURN ( INST = 3E ) = > ( MW (TOSW(00) + 6) <FP + MP (FP + 1) + MP (FP) + MW (TOSW(OO) + 4) <MW(FP+MP(FP+l)+4) MW (TOSW(00) + 2) <MW(FP+MP(FP+l)+2) MW (TOSW(00) + 0) <FLAG ) /OPCODE ( INST ( INST ( INST ( INST  ERROR = 40 = 42 =44 = 46  ) ) ) )  => => = > =>  ( ( ( (  RUN <RUN<RUN <RUN <-  OFF OFF OFF OFF  ) ) ) )  63 ////////////////////////////// /INDIRECT ASSIGNMENT FUNCTIONS /:=B@ ( INST  /ASSIGN BYTE INDIRECT 48 ) => ( ASGNB (TOSW(OO) ,TOSB(Ol)) RETRNP(TOSW(00) >02 )  /:=¥@ ( INST  /ASSIGN WORD INDIRECT 4A ) => (ASGNW (TOSW(OO) ,TOSW(Ol)) RETRNP(TOSW(00),02 ) )  /:=B# ( INST  /ASSIGN BYTE INDEXED 4C ) => ( ASGNB (TOSW(Ol) + TOSW(00) ,TOSW(02) ) ; RETRNP(TOSW(01) ,03 ) )  /:=W# ( INST  /ASSIGN WORD INDEXED 4E ) => ( ASGNW (TOSW(Ol) + TOSW(OO) + TOSW(OO), TOSW(02)) ; RETRNP(T0SW(01) ,03 ) )  /:=STR ( INST  /ASSIGN TO STRING 50 ) => ( PARA <- TOSW (00) ; PARB <- TOSW (01) ; NEXT MP (PARB) ~= 80 => ( ASGNB (PARA, MP(PARB)) PARA <- PARA + 1 PARB <- PARB + 1 : NEXT ) NEXT ASGNB (PARA,80 ) ; RETRNP(TOSW(00),02  /:=ARR ( INST  /ASSIGN TO ARRAY 52 ) => ( PARA <- TOSW (00) PARB <- TOSW (01) PARC <- TOSW (02) j NEXT PARA ~= 0000 => ( ASGNB (PARB, MP(PRAC)) PARA <- PARA - 1 PARB <- PARB + 1 PARC <- PARC + 1 : NEXT ) NEXT RETRNP(TOSW(01),03)  64 //////////////// / PUSH FUNCTIONS /:B® /PUSH ) ( INST = 54  =>  ( RETRNP(00 || MP (TOSW (OO)) ,01)  /:W@ /PUSH WORD INDIRECT ( INST = 56 ) => ( HETRNP(MW(TOSW(0.0))  ,01)  )  )  /:B# /PUSH ) ( INST = 58  =>  ( RETRNP(00 | | MP(TOSW(.0l) + TOSW(OO)) ,02) )  /PUSH /:W# ) ( INST = 5A  =>  ( RETRNP(MW(T0SW(01) + TOSW(OO) + TOSW(00) ,02) )  /OPCODE ERROR ( INST = 5C ( INST = 5E  ) )  => =>  ( RUN <- OFF ( RUN <- OFF  ) )  65  ////////////////////// / ARITHMETIC FUNCTIONS /:INC INST  60  :DEC INST  62  :NEG INST  64  /INCREMENT  ) =>  ( RETRNP( TOSW(OO) + 1  , 01) )  ( RETRNP( TOSW(OO) - 1  , 01) )  ( RETRNP( - TOSW(OO)  , 01) )  /DECREMENT  ) =>  /NEGATE  ) =>  /:ADD INST  /ADD 66 )  /:SUB INST  68  =>  ( RETRNP(TOSW(01)  +  TOSW(OO), 02) )  ( RETRNP(TOSW(Ol)  -  TOSW(OO), 02) )  /SUBTRACT  ) =>  :RMUL INST  /RIGHT SIDE OF BITWISE MULTIPLY 6A ) => ( RETRNP( (TOSW(Ol) X TOSW(00) )<10:1 F>, , 02 )  /:LMUL INST  /LEFT SIDE OF BITWISE MULTIPLY 6C ) => ( RETRNP( (TOSW (01) X TOSW(OO) )<00:0F>, , 02 )  /:DIV INST  /ABSOLUTE MAGNITUDE DIVIDE 6E ) => ( RETRNP(T0SW(01)  /:REM INST  /ABSOLUTE MAGNITUDE REMAINDER 70 ) => ' ( RETRNP(T0SW(01) MODTOSW(02), 02) )  /:AND INST  /BITWISE AND 72 ) => ( RETRNP(T0SW(01)  &  /:OR INST  /BITWISE INCLUSIVE OR 74 ) => ( RETRNP(T0SW(01)  | TOSW(OO) , 02) )  /:XOR INST  /BITWISE EXCLUSIVE OR 76 ) => ( RETRNP(TOSW(01)  X| TOSW(OO), 02) )  /  TOSW(OO) , 02) )  TOSW(OO), 02) )  /:NOT INST  . /BITWISE INVERT 78 ) => ( RETRNPC'TOSW(OO)  /:LS INST  /LEFT SHIFT ONE, ZERO FILL 7A ) => ( RETRNP(0B || TOSW(00)<T0:l4> , 01) )  /:RS INST  /RIGHT SHIFT ONE, ZERO FILL 7C ) => ( RETRNP(TOSW(00) 1,15  /:LS4 INST  /LEFT SHIFT FOUR, ZERO FILL 7E ) => ( RETRNP( 0 || TOSW(00)<0:11> , 01) )  /:RS4 INST  /RIGHT SHIFT FOUR, ZERO FILL 80 ) => ( RETRNP( T0SW(00>C4:15> | | 0 , 01) )  , 01) )  I I OB , 01) )  /OPCODE ERROR INST = 82 INST = 84 INST = 86 INST = 88 INST = 8A INST = 8C INST = 8E  ) ) ) ) ) ) )  => => => => => => =>  ( ( ( ( ( ( (  RUN <- OFF RUN <- OFF RUN <- OFF RUN <- OFF RUN <- OFF RUN <- OFF RUN <- OFF  ///////////////////// /COMPARISON FUNCTIONS /:?EQ /COMPARE FOR EQUALITY ( INST = 9 0 ) => ( (TOSW(01) = TOSW (OO)) => (RETRNP(OOFF, 02) ; ELSE RETRNP(0000, 02) )) . /:?EQ /COMPARE FOR DIFFERENCE ( INST =92 ) => ( (TOSW(01) = TOSW (00)) => (RETRNP(OOFF, 02) ; ELSE RETRNP(0000, 02) )) /:?LT /COMPARE FOR LESS THAN ( INST =94 ) => ( (TOSW(Ol) TOSW (OO)) => (RETRNP(OOFF, 02) ; ELSE RETRNP(0000, 02) )) /:?GT /COMPARE FOR GREATER THAN ( INST =96 ) => ( (TOSW(Ol) TOSW (OO)) => (RETRNP(OOFF, 02) ; ELSE RETRNP(0000, 02 )) /FUNCTION TO TEST STRING UNTIL DIFFERENT TSTR := (PARA <- TOSW (01) ; PARB <- TOSW (00) ;• NEXT MP (PARA) ~= 80 & MP (PARA) = MP(PARB) ( PARA <- PARA + 1 ; PARB <- PARB + .1 ; )  =>  /: STR?EQ /COMPARE STRINGS FOR EQUALITY ( INST =98 ) => ( TSTR ; NEXT MP (PARA) = MP (PARB) => (RETRNP(OOFF, 02) ; ELSE RETRNP(0000, 02) )) /:STR?NE /COMPARE STRINGS FOR DIFFERENCE ( INST = 9A ) => ( TSTR ; NEXT MP (PARA) ~= MP (PARB) => (RETRNP(OOFF, 02) ; ELSE RETRNP(0000, 02) )) /: STR?LT /COMPARE STRINGS FOR LESS THAN ( INST = 9C ) => ( TSTR ; NEXT MP (PARA) < MP (PARB) => (RETRNP(OOFF, 02) ; ELSE RETRNP(0000, 02) )) /:STR?GT /COMPARE STRINGS FOR GREATER THAN ( INST = 9E ) => ( TSTR ; NEXT MP (PARA) > MP (PARB) => (RETRNP(OOFF, 02) ; ELSE RETRNP(0000, 02) ))  /OPCODE ERROR ( INST = AO ( INST = A2 ( INST = A4 (- INST = A6  ) => ) => ) => )  ( ( ( (  RUN <RUN <RUN <RUN <-  OFF OFF OFF OFF  ) ) ) )  //////////////////////// /MISCELLANEOUS FUNCTIONS /:B2W /2 BYTES TO ONE WORD CONVERSION ( INST = A8 ) => (RETRNP (TOSW(01)<8:15> II TOSW(00)<8:15>, 02 ) ) /:SWAPB /SWAP BYTES ( INST = AA ) =>  (RETRNP (TOSW(00)<8:15> II T0SW(00)<0:7>, 02 ) )  /:SEL /SELECT DATA ( INST = AC ) => ( TOSW(02)<8:15> =FF => ( RETRNP( TOSW(Ol), 03) ; ELSE RETRNP( TOSW(02),03) )) /:STRADV /ADVANCE TO END OF STRING ( INST = AE ) => (PARA <- TOSW (00) ; NEXT (MP (PARA) ~= FF) => (PARA <- PARA + 1 ) ; NEXT RETRNP (PARA + 1, 01 ) ) /OPCODE ERROR ( INST = BO ( INST = B2 ( INST = B4 ( INST = B6  ) ) ) )  => => => =>  ( ( ( (  RUN RUN RUN RUN  <- OFF <- OFF <- OFF <- OFF  /////////////////////// /INPUT OUTPUT FUNCTIONS /:FOPEN /FILE OPEN ( INST = B8 ) =>  (SY STEM-DEPENDENT)  /:FCLOSE / F I L E CLOSE ( INST = BA ) =>  (SYSTEM-DEPENDENT )  /:RDCH /READ A CHARACTER ( INST = BC ) => (RETRNP (00  10(TOSW(00)), 0 1 ) )  /:WRCH /WRITE A CHARACTER ( INST = BE ) => (IO(TOSW(00)) <- TOSW(0l)<8:15> ; RETRNP (TOSW(00), 02) ) /:FLUSH /FLUSH 10 BUFFER ( INST = CO ) => (SYSTEM-DEPENDENT)  /OPCODE ERROR I N S T =: C 2 I N S T = : CHI N S T = C6 I N S T = C8 INST = CA INST = CC I N S T =: C E INST = DO INST = D2 I N S T = D4I N S T = D6 I N S T = D8 INST = DA INST = DC INST = DE  )  =:>  )  -  >  >  ) )  =:> =:>  )  =: >  ) ) ) ) )  =: > =: > =: > =: > =: >  >  >  >  >  ( ( ( ( ( ( ( ( ( ( ( ( ( ( (  RUN RUN RUN RUN RUN RUN RUN RUN RUN RUN RUN RUN RUN RUN RUN  < -O F F < -O F F < -O F F < -O F F < -O F F < - OFF < - OFF < -O F F < -O F F < -O F F < -O F F < -O F F < -O F F < -O F F < -O F F  /////////////// /USER  FUNCTIONS INST INST INST INST INST INST INST INST  /OPCODE ( INST ( INST INST INST INST INST INST INST  EO E2 E4 E6 E8 EA EC EE  ERROR = F O = F 2 = F 4 = F6 = F 8 = F A = F C =F E  => => => =>  =>  > > ) => ) => ) => > > >  (SYSTEM- •DEPENDENT) (SYSTEM- •DEPENDENT) (SYSTEM- •DEPENDENT) (SYSTEM- •DEPENDENT) (SYSTEM- •DEPENDENT) (SYSTEM- •DEPENDENT) (SYSTEM- •DEPENDENT ) (SYSTEM- •DEPENDENT)  RUN RUN RUN RUN RUN RUN RUN RUN  <<<<<<<<-  OFF OFF OFF OFF OFF OFF OFF OFF  70 APPENDIX  0  B  —  ASCII CODE OF THE E CHARACTER SET  2  4  3 0  @  1  l  A  2 3 45 6 7 8 9  2 3 4  1  0  SP  #  EOF  $  .  % &  t  .  (  A B C  LF  D  CR  ) -X+  E F  -  5  •6 7 8 9  /  D  E F G H  7  P  —  —  Q  —  —  R S  —  —  —  —  T U  —  —  —  —  V w  —  —  —  —  X Y Z  —  —  —  —  —  —  :  I J  i  K  —  —  L  —  —  M  —  —  N  —  —  —  —  =  t  _ —  B C  6  5  V  0  — -  NOTES: 1) 2)  3)  — INDICATES THE ASCII SYMBOL IS NOT WITHIN THE E CHARACTER SET. THE ASCII CODE FOR THE SYMBOL IS IN HEXADECIMAL. THE FIRST HEXADECIMAL DIGIT IS THE ROW ON TOP OF THE MATRIX, AND THE SECOND HEXADECIMAL DIGIT IS THE COLUMN TO THE LEFT OF THE MATRIX. FOR EXAMPLE THE CODE FOR SP IS HEXADECIMAL 20. MULTIPLE CHARACTERS REPRESENT NON-PRINTING ASCII SYMBOLS. EOF REPRESENTS END OF FILE. • LF REPRESENTS LINEFEED. CR REPRESENTS CARRIAGE RETURN. SP REPRESENTS SPACE.  71 APPENDIX C  C.l  —  SUMMARY OF E ASSEMBLER INSTRUCTIONS  GLOSSARY OF TERMS  THE FOLLOWING TERMS ARE USED IN THE TABLES SUMMARIZING THE E. ASSEMBLER INSTRUCTIONS: <DATA8> <DATA16> -  VARIABLE OR CONSTANT INTERPRETED AS AN 8-BIT VALUE. VARIABLE OR CONSTANT INTERPRETED AS A 16-BIT VALUE.  < EXNAME > <INNAME> -  EXTERNAL NAME INTERNAL NAME  < CONST> <BDECI> <WDECI> < BHEXD > <WHEXD> <CHAR>  ANY CONSTANT BYTE DECIMAL CONSTANT (8 BITS) WORD DECIMAL CONSTANT .(16 BITS) BYTE HEXADECIMAL CONSTANT (8 BITS) WORD HEXADECIMAL CONSTANT ( l 6 BITS) CHARACTER CONSTANT (8 BITS)  C.2  ASSEMBLER DIRECTIVES  ASSEMBLER INST.  DESCRIPTION  .NULL  TRIGGERS PRINTING OF A LOADMAP ENTRY STARTS A NEW MODULE DEFINES EXTERNAL NAME DEFINES INTERNAL NAME DEFINES LINKAGE CHECK FOR EXTERNAL NAME DECLARES LINKAGE CHECK FOR EXTERNAL NAME SET PC TO CONST ADD CONST TO PC START LISTING OF LOAD MAP STOP LISTING OF LOAD MAP  .MODULE .DEFX .DEFI .FLINK  <EXNAME> <INNAME> <EXNAMEXCONST>  .CLINK  <EXNAMEXCONST>  .ORG <CONST> .MEM <CONST> .MAPON .MAPOFF  72 C.3  HOUSEKEEPING INSTRUCTIONS  ASSEMBLER INST. ._  MACHINE CODE  INST. DESCRIPTION LENGTH  PUSHBA PUSHBI PUSHBX PUSHWA PUSHWI PUSHWX PUSHWF POP  DATA16 DATA8 DATA8 DATA16 DATA16 DATA8 DATA8  02 04 06 08 OA OC OE 10  3 2 2 3 3 2 2 1  PUSH BYTE FROM ABSOLUTE ADDR. PUSH IMMEDIATE BYTE PUSH BYTE FROM INDEXED ADDR. PUSH WORD FROM ABSOLUTE ADDR. PUSH IMMEDIATE WORD PUSH WORD FROM INDEXED ADDR. PUSH INDEXED ADDR. POP ONE ELEMENT OFF STACK  ASGNBA  <DATA16>  12  3  ASGNWA  <DATA16>  14  3  ASGNBX  <DATA8>  16  2  ASGNWX  <DATA8>  18  2  ASSIGN BYTE OF TOP TO ABSOLUTE ADDR. ASSIGN WORD OF TOP TO ASBOLUTE ADDR. ASSIGN BYTE OF TOP TO INDEXED ADDR. ASSIGN WORD OF TOP TO INDEXED ADDRESS  JMP JNT  <DATA16> <DATA16>  20 22  3 3  26  24  1 1  HALT NOP  CALL  <DATA16>  28  3  ALST SETFP  <DATA8 > 2A <DATA8XDATA8>2C  2 3  RETRN  2E  1  OF STACK OF STACK OF STACK OF STACK  JUMP TO ABSOLUTE ADDR. JUMP IF TOP OF STACK NOT FF TO ABSOLUTE ADDR. SUSPEND PROCESSOR NO OPERATION  CALL TO DEFINED FUNCTION AT ABSOLUTE ADDR. ALLOCATE STACK SPACE SET FP AND STACK FOR DEFINED FUNCTION EXECUTION RETURN FROM FUNCTION CALL  73  C.4  PRIMITIVE FUNCTIONS  ASSEMBLER INST.  PARAM. NO.  MACHINE CODE  :=B@ :=W@ :=B# :=W# :=STR :=ARR  2 2  :B@ :W@ :B# :W#  1 1 2 2  54 56 58  :INC :DEC :NEG :ADD :SUB :RMUL :LMUL :DIV -.REM  1 1 1 2 2 2 2 2 2  60 62  : AND :OR :XOR :N0T  2 2 2 1  :LS :RS :LS4 :RS4  INST. LENGTH  DESCRIPTION  1 1 1 1 1 1  ASSIGN BYTE TO INDIRECT ADDR. ASSIGN WORD TO INDIRECT ADDR. ASSIGN TO BYTE INDEXED ADDR. ASSIGN TO WORD INDEXED ADDR. MOVE STRING MOVE BYTE ARRAY  1 1 1 1  PUSH PUSH PUSH PUSH  1 1 1 1 1 1 1 1 1  INCREMENT DECREMENT NEGATE ADD SUBTRACT RIGHT UNSIGNED MULTIPLY LEFT UNSIGNED MULTIPLY UNSIGNED NUMBER DIVIDE UNSIGNED NUMBER REMAINDER  72 74 76 78  1 1 1 1  BITWISE BITWISE BITWISE BITWISE  1 1 1 1  7A 7G 7E 80  1 1 1 1  LEFT SHIFT 1 BIT, 0 FILL RIGHT SHIFT 1 BIT, 0 F I L L LEFT SHIFT 4 BITS, 0 FILL RIGHT SHIFT 4 BITS, 0 F I L L  :?EQ :?NE :?LT  2 2 2  90 92 94  1 1 1  :?GT  2  96  1  :STR?EQ :STR7NE :STR?LT :STR?GT  2 2 2 2  98  9C 9E  1. 1 1 1  COMPARE FOR EQUALITY COMPARE FOR NONEQUALITY COMPARE FOR UNSIGNED MAGNITUDE LESS THAN COMPARE FOR UNSIGNED MAGNITUDE GREATER THAN COMPARE STRINGS FOR EQ COMPARE STRINGS FOR NE COMPARE STRINGS FOR LT COMPARE STRINGS FOR GT  :B2W :SWAPB :SEL :STRADV  2 1  A8 AA AC AE  1 1 1 1  BYTES TO WORD CONVERSION SWAP BYTES SELECT 1 OF 2 PARAMETERS ADVANCE TO END OF STRING  3 3  2 3  3  1  48 4A 4C 4E 50 52  5A  64 66 68  6A 6C 6E 70  9A  '  BYTE WORD FROM FROM  FROM FROM BYTE WORD  INDIRECT ADDR. INDIRECT ADDR. INDEXED ADDR. INDEXED ADDR.  LOGICAL AND LOGICAL OR LOGICAL EXCLUSIVE OR LOGICAL INVERT  74 C.5  OTHER INSTRUCTIONS  ASSEMBLER INST.  PARAM. NO  INTON INT OFF WAIT  MACHINE INST. CODE.LENGTH  DESCRIPTION  30 32 34  1 1 .1  INTERRUPT ENABLE INTERRUPT DISABLE WAIT FOR INTERRUPT  INTSF CALLS CONSWI CONRSV  1 1 1 1  38 3A 3c 3E  1 1 1 1  SOFTWARE INTERRUPT INDIRECT FUNCTION CALL CONTEXT SWITCH SAVE RETURN CONTEXT  FOPEN FCLOSE RDCH WRCH FLUSH  2 1 1 2 2  B8 BA BC BE CO  1 1 1 1 1  FILE OPEN FILE CLOSE READ A CHARACTER SAVE RETURN CONTEXT FLUSH 10 BUFFER  1 1 1 1 1 1 1 1  EO E2 E4 E6 E8 EA EC EE  1 1 1 1 1 1 1 1  USER USER USER USER USER USER USER USER  UFO UF1 UF2 UF3 UF4 UF5 UF6 UF7  C.6  '  FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION  0 1 2  3 4 5 6 7  DATA DEFINITION INSTRUCTIONS  ASSEMBLER INST. <BDECI> <WDECI> <BHEXD> <WHEXD> < CHAR> <EXNAME> <INNAME>  INST. LENGTH 1 2 1 2 1 2 2  DESCRIPTION  BYTE DECIMAL CONSTANT WORD DECIMAL CONSTANT BYTE HEXADECIMAL CONSTANT WORD HEXADECIMAL CONSTANT ASCII CHARACTER CONSTANT EXTERNAL NAME INTERNAL NAME  APPENDIX D  APPENDIX D . l  —  SAMPLE E PROGRAM  —  COMPILER LISTING OF E MODULES WHICH IMPLEMENTS A SYMBOL TABLE  ?6  E COMPILER VERSION B.O.O. START OF COMPILE  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 9 14  .ORG  j*  * * X X X X X X X * * * * * * * * * * * * * * * * * * * * * * *  /* /* /* /* /* /* /* /*  THE FOLLOWING ROUTINES IMPLEMENTS A HASHED SYMBOL TABLE WHOSE ENTRIES ARE ALLOCATED AND REMOVED I N A STACK L I K E FASHION. AN ENTRY I N THE SYMBOL TABLE I S A SERIES OF CONTIGUOUS BYTES POINTED TO BY AN ENTRY I N A HASH TABLE. AN ENTRY I N THE SYMBOL TABLE HAS 3 FIELDS: A SYMBOL STRING WHICH I S AN E STRING, A SYMBOL ID WHICH I S A BYTE, AND INFORMATION WHICH I S A BYTE ARRAY. */  J * *******  DEF DEF' DEF DEF DEF  X X X X- f r * * * * * - * * X X X X  X X X X X X -XHf •X-*-X-X-*-X-X-X--*-X-*-X-X-*^  MCON MCON MCON MCON MCON  EOS$ STB.STRL STB.HSHN STB.HSHL STB.EMPTY  $80 +3070 +0512 +1024 $FFFF  /* /* /* /* /* /*  * * * * * *  X -X X X •X-*-X--X--X--X--X--X--X--X-  V  END OF STRING MARKER DATA TABLE LENGTH HASH ENTRY NUMBER HASH TABLE.LENGTH EMPTY ENTRY IN HASH TABLE V  •X--X--X--X-X X X X - X * W * * * W * * X X X X X ^ - X - - X - - X - ^ * - X - - X - ^ - X - - X - - X - ^ - X - X - - X - T < - ^ X  X X X X X X-X--X--X-X-  SYMBOL TABLE HASH FUNCTION. TAKES A STRING AS PARAMETER AND RETURNS A NUMBER . FROM +0000 TO STB.HSHN - 1 FNCTN :SYM.HASH DEF DECL PARAM H.STR ; (# DECL AUTO H.TEMP WORD :  /*  )# ($ EVAL  $0000 H.STR  EVAL  11 11 18 23 25 28 30 30 37 )$  H.STR  41 42 43 44 45 46 47 48 49 50 51 52 53 54 55  /"  =H.TEMP :DEC =H.STR  ; \  WHILE. H.STR :INC=H.STR :B@ EOS$ (* EVAL H.TEMP +03 :RMUL H.STR :B@ :ADD =H.TEMP ; )*  V  /* INIT COUNT /* DEC FOR LOOP /* LOOP TO ADD V :?NE /* ADD EACH CHAR V  ;  H.TEMP +05 :RMUL  RETRN  08  H.TEMP  STB.HSHN  /* RETRN VALUE :REM ;  */  02  1 •X-X X X X X X X X W * W M W * * * * ^ W * » * * * M W * W * * » * 1 FUNCTION TO LOOK FOR A GIVEN NAME IN THE SYMBOL TABLE. 1 1 1* RETURNS INDEX"OF TABLE I F FOUND. RETURNS STB.EMPTY 1 /* I F NOT FOUND. V 1 DEF FNCTN :SYM.LOOK L.STR 4 (# DECL PARAM i / * TARGET NAME FNCTN DECL :SYM.HASH +1 ; / * HASH FUNCTION 9 FNCTN :FERROR.C DECL +1 ; / * FATAL ERROR 14 V 19 STB.HSHL ; DECL EXTRN SYM.SPT 19 LK WORD •; DECL AUTO 24 L.TEMP WORD ; DECL AUTO 29 . 34 )# 1 ($  56 57 58 59 60 61 62 63 64  65 66 67 68 69 70 71 72 73 74 75 76 77 78  79  2 2 7 11 11 11  /* *** SETUP FOR SEARCH LOOP EVAL L.STR :SYM.HASH =L.TEMP EVAL -0001 =LK  17 18 24  (*  /* *** LOOP TO SEARCH FOR ENTRY *** */ WHILE LK :INC =LK STB.HSHN :?NE " IF &SYM.SPT L.TEMP :W# STB.EMPTY ; (? RETRN STB.EMPTY )? ELSE &SYM.SPT L.TEMP :W# L.STR (? RETRN L.TEMP ; )? ELSE (? EVAL L.TEMP :INC STB.HSHN :REM =L.TEMP :  28 29 35  39 40 41  ^5  46 49  51 53 53 53 57 57 )$  )*  83 84  85 86 87 88  89  90 91  92 93 94  1 1 1 /* 1 •/* 1 /* 1 DEF 4 (# 9 13 17 21 21 26 31 36 36  95 96 41 97 98  46  108  19  :?EQ  :STR7EQ  ; -X-X--X-  /* *** HASH TABLE OVERFLOW EVAL "01 :FERROR.C :  L. STR  80 81 82  77  /  OA  04  LK  H H t - X - X X X X X X-X-X X X X  A A A A A A A A A A A A A A A A A A A A' A A A A 7  FNCTN : SYM.ADD DECL PARAM .NAME DECL PARAM .ID DECL PARAM .INFO DECL PARAM , INFOL DECL DECL DECL  FNCTN FNCTN FNCTN'  DECL DECL DECL  EXTRN EXTRN EXTRN  SYM.HASH SYM.LOOK FERROR.C SYM, SPT SYM, STR SYM, SFS  /*  02  L.TEMP  X**iHHHHHH(-*  NAME OF ENTRY ID OF ENTRY INFO OF ENTRY INFO LENGTH V  +i +i +i  STB.HSHL STB. STRL WORD  51 DECL AUTO AK WORD ; 99 51 DECL AUTO A.TEMP WORD : 100 56 101 61 )# 102 1 ($ /* *** RETURN INDEX OF ENTRY I F ALREADY PRESENT *** */ IF A.NAME :SYM.LOOK =A.TEMP STB.EMPTY :?NE 103 2 (? RETRN A.TEMP ; 104 8 105 14 #-x-x/* *** FIND FREE CELL AND ADD 106 14 */ EVAL A.NAME :SYM.HASH =A.TEMP 10? 14  109 23 110 23 111 29 112 30  -0001 =AK  EVAL WHILE  AK :INC =AK  STB.HSHN  :?NE  (* IF  &SYM.SPT A.TEMP :W#  STB.EMPTY ? E Q :  113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147  36 37 37 ^3 ^5 46 47 48 50 52 53 58 58 58 62 63 64 69 71 71 71 74 75 75 76 80 81 84 86 86 88 88 88 92 92 )$  /* *** ADD ENTRY EVAL SYM.SFS &SYM.SPT A.TEMP :=W# EVAL A.INFO A.ID A.NAME SYM.SFS :=STR :STRADV :=B@ :ING A.INFOL :=ARR A.INFOL :ADD =SYM.SFS /* IF  150  151 152 153 154 155  156 157 158 159 160 161 162 163 164  •/*• *** NORMAL RETURN RETRN A.TEMP  -x-x-x-  */  /  -x-x-x- -x-  )? ELSE (? EVAL  )? )*  A.TEMP :INC STB.HSHN :REM =A.TEMP  ;  • *  /*  *** HASH TABLE OVERFLOW EVAL "01 :FERROR.C ;  -x-x-x-  */  • *  10 OA  A.ID AK  OE 04  A.INFO A.TEMP  OC 02  1 1 1  / *  X X X X X X •X-X-X-X- X X X X •X-X-X--X-X--X--X-X--X-X--X--X--X^  X X X X X -X-  1 /* FUNCTION TO .ACCESS AN ENTRY OF SYMBOL TABLE 1 /* TAKES ERROR CODE AND POINTER INDEX AS PARAMETERS 1 /*' RETURNS POINTER TO ENTRY I F NO ERROR 1 /* EXITS TO :FERROR.C I F ERROR 1 DEF FNCTN :SYM.GPT PARAM G.CODE DECL 4 (# 5 PARAM G.INDEX DECL 9 DECL FNCTN :FERROR.C +1 13  18 18 23 28 )# 1 ($ 2 165 2 6 166 11 167 12 168  *** TEST FOR STRING TABLE OVERFLOW SYM.SFS &SYM.STR :SUB STB.STRL :?GT EVAL "00 :FERROR.C ; ;  (? )?  A.NAME A.INFOL  148 149  78  (?  12  DECL DECL  IF IF (?  )? ELSE ELSE  AUTO EXTRN  G.TEMP SYM.SPT  G. INDEX G.INDEX  */ */ */ */  WORD STB.HSHL  G. INDEX STB.HSHN :?GT G.INDEX STB.HSHN:FERROR.C :?GT EVAL G.CODE &SYM.SPT &SYM.SPT  *j  :W# =G.' :W# =G.TEMP  /* RANGE CHECK  /* ENTRY CHECK  169 170 171 172 173 174  175 176 177  17 18  19 24  25 26 30 32 32 )$  (? )? ELSE (? RETRN )? ;  G. CODE  178  179  180 181 182 183 184  185  186 187  189 190 191 192 193 194  195 196 197  08  G. INDEX  G.TEMP  02  1 1 1 /* • 1 /* FUNCTION RETURNS POINTER TO NAME I N SYMBOL TABLE :SYM.GNM 1 DEF FNCTN A A A A A A A A A A A A A A A A A A A A A  4 (#  9  DECL DECL  14 )#  1 ($ RETRN 7 )$  PARAM FNCTN  "An A A A A A A A A A  G.INDEX :SYM.GPT  "40  G.INDEX  +02  A A  A A A A A A A A A A A A A A A A A A A A A A  ; ;  :SYM.GPT  06  1 1 j_  -X--X-X-X X X X X X X X X  X*-X--X--X--X--X--X-X-*-X--X--X--X-^  X X X-X-X--X--X--X-X-X--X--X-X-*-X-X-  1 /* FUNCTION RETURNS POINTER TO ID I N SYMBOL TABLE 1 DEF FNCTN rSYM.GID 4 (# DECL PARAM G.INDEX ; DECL FNCTN :SYM.GPT +02 ;  14 1 ($ RETRN  "41 G.INDEX :SYM.GPT  :STRADV  8 )$  06  G.INDEX  198 199 200 201 202 203  :FERROR.C  G.TEMP  OA  G.INDEX  188  79  STB.EMPTY :?EQ EVAL G.CODE  1 1  1  I 1 /* FUNCTION RETURNS POINTER TO INFO IN SYMBOL TABLE 1 DEF FNCTN :SYM.GNF / vA  Y AY AVA V AV A VTvV V AV AV AVA V AV AY AV AY AV AV AV AV AV AV AY AV AV AV AY AV AV AV A V AV AV AV A Y A V AV A Y A V A V A Y AY Ay A V A y A V A Y AV A Y A V AY A y V A y A YA A At r  *  4 (#  204  DECL PARAM G. INDEX ; 5 DECL FNCTN :SYM.GPT +02 205 9 206 14 )# 207 1 ($ RETRN "42 G.INDEX :SYM.GPT :STRADV :INC 208 9 )$ G. INDEX 06 209 1 1 210 XXXXXXXXXX1 /* -X-X--X-X X X X X X X X X X X X-X--X--X-*-X--X--X-*-X-X--X--X-^HHfr*** 211 FUNCTION TO DELETE TOP SYMBOL OF SYMBOL TABLE 1 •/* 212 :SYM.DEL 1 DEF FNCTN 213  214  215 216  4 (# 5 9  DECL DECL  PARAM EXTRN  D. INDEX SYM.SPT  STB.HSHL  217  218  14  DECL DECL  19  EXTRN AUTO  SYM.SFS D .TEMP  WORD WORD  ; ;  80  219 24 )# 220 1 ($ IF &SYM.SPT D.INDEX :W# =D:TEMP STB.EMPTY :?EQ 221 2 RETRN FALSE ; 222 9 (?• )? > . ; EVAL D.TEMP =SYM.SFS 223 15 224 19 RETRN STB.EMPTY &SYM.SPT D.INDEX =W# ; 225 25 )$ !  D. INDEX 226 227  228  229 230 231 232 233 234 235 236 237 238 239  240 241 242  243  244  245  246 247 248 249  250  08  1 1 1 /* 1 '/* 1 /* 1 DEF 4 (# 5 10 15 20 25 )# 1 ($ 2 6 12 • 13 17 19 20 27 29 31 35 35 )$  X--X-#-X--X--X-XHfr-X-X-X-X--X--X-X^  DECL DECL DECL DECL  261  262  1 1 1 1 1 1 4 1  SYM.SPT SYM.SFS SYM.TOS K  STB.HSHL WORD WORD WORD  -X-  ; ; ; ;  EVAL -0001 =K' ; WHILE K :INC =K STB.HSHN :?NE (* IF &SYM.SPT K :W# SYM.TOS :DEC :?GT (? EVAL STB .-EMPTY &SYM.SPT :  :=W# ;  ;  )? )*  RETRN  SYM.TOS  • 1  =SYM.SFS  9  XXXx-x--x^-x-x--x--x-^^-x--x-*-x-^^-x--x-XXXXXXXXX****XXXXXX-***************  j*  /* THIS FUNCTION INSERTED TO COMPLETE NAME L I S T FOR LINKAGE /* OF T H I S MODULE BY I T S E L F . DEF FNCTN :FERROR.C (# DECL PARAM F.MES ; )# ($  •  )$ ; 06  1 1 1 1 /  *  263  1  264  1 /*  265  1  266 267  EXTRN EXTRN EXTRN AUTO  *  02  F.MES 259 260  *  FUNCTION TO CLEAR SYMBOL TABLE DOWN TO T H E DATA WITH ADDRESS LOWER THAN SYM.SFS FNCTN :SYM.CLR  K  251 252 253 254 255 256 257 258  02  D .TEMP  X X X X X X X X X X - X - X X X X X X X X X X X X X X X  *  *  X X X X X X-X-X X X X X X X X-X-X X X X X  SYMBOL T A B L E DATA AREA DEFINITION  11 /" .ORG $2DFE "/  X * * * * * * * * *  268 269 2?0 271 272 273 274 275  1 1 1 1 1 1 1 1  DEF DEF DEF DEF  EXTRN EXTRN EXTRN EXTRN  NORMAL TERMINATION  SYM.SPT SYM.SFS SYM.TOS SYM.STR  STB.HSHL WORD WORD STB.STRL  APPENDIX D.2  —  LOAD MAP GENERATED FROM ASSEMBLING THE PREVIOUS E MODULES  E ASSEMBLER E ASSEMBLER  PASS #1 PASS #2  ****E PROGRAM LOAD MAP **** .SYM.HASH 2000. 2005 2005 2005 2008 2011 2011 2013 2014 201F 2021 2022 2024 202G 202E 2030 2031 **** :SYM.LOOK 2O36 203B 203B 203B 203D 2049 2049 204B 204C 205A 205B 205E 205F 2069 206B 206C 206E 2075 2075 2075 2077 2082 2085 2085 2085 **** :SYM.ADD 2090 2095 2095 2095 2097 20A5 20A6 20A6 20A6 20B1 20B3 20B4 20B4 .2000 20C3 20G5 20G6 20D5 20D6 20D7 20D7 20E3 20E4 20E6 20E7 20F4 20F5 20F8 20F9 2106 2106 2108 2109 210F 2110 2112 2113 211F 2120 2121 **** :SYM.GPT 2127 212C 212G 212C 212E 213B 213E 213E 2141 214D 214F 2152 2153 2159 2159 215A ****. :SYM.GNM 215A 215D 215D 215D 2160 **** : SYM. GLD 2169 216C 216C 216G 216F **** :SYM.GNF 2179 217C 217G 217G 217F **** :SYM.DEL 218A 218F 218F 218F. 2192 219E 21A0 21Al 21Al 21AA 21AD 21AF 21B0 **** :SYM.CLR 21Bl 21B6 21B6 21B6 21B9 21C4 21C5 21G8 21C8 21D6 21D6 21D9 21DG 21E6 21E6 21E9 21EG **** .FERROR.C 21ED 21 FO 21 FO 21 Fl **** SYM.SPT 2DFE **** SYM.SFS 31 FE **** SYM.TOS 3200 **** SYM.STR 3202 NORMAL TERMINATION  200A 2016 2025 2034  200B 2017 2026 2035  200B 2019 2028 2036  200D 201A 2029 2036  200E 201D 202C  2010 201D 202C  2040 204E 2062 206F 2078 2088  2042 2051 2062 2072 207B 208B  2043 2052 2065 2072 207C 208C  2043 2055 2066 2074 207E 208D  2046 2055 2066 2075 207F  2048 2058 2066 2075 2082  209A 20A6 20B6  209C  20D9 20E9 20FC 2109 2116  20A8 20B7 20CA 20DB 20EA 20FC 2109 2116  209F 20AB 20B9 20CD 2 ODD 20ED 20FF 2109 2119  20A0 20AD 20BC 20CD 20E0 20EE 2102 2109 2119  20A3 20AE 20BD 20D0 20E1 20EE 2103 21 OB 2119  20A3 20AE 20C0 20D3 20E2 20F1 2106 210C 211C  2131 2143 2156  2132 2144 2156  2135 2146 2156  2135 2149 2156  2137 214A 2158  213A 214D 2159  2162  2165  2166  2166  2171  2174  2175  2176  2176  2181  2184  2185  2186  2187  2187  2194 21A1 21 Bl  2195 21 Al 21 Bl  2197 21 A3  219A 21A6  219B 21A7  219E 21A7  21BB 21 CB 21 DE 21 ED  21BC 21 CD 21 DF 21 ED  21 BC 21 CE 21EO  21BE 21D1 21E3  21BF 21D2 21E3  21 Cl 21D3 21E6  20C9  84 APPENDIX E  BNF THE THE THE  SUMMARY OF THE LANGUAGE E  I S USED BELOW TO SUMMARIZE THE LANGUAGE E. CHARACTERS // STARTS A COMMENT. SQUARE BRACKETS,C 1, ENCLOSES AN OPTIONAL CLAUSE. CURLY BRACKETS ,{ }, ENCLOSES A CLAUSE WHICH MAY BE REPEATED ANY NUMBER OF TIMES, INCLUDING ZERO.  E.l  KEYWORDS  <KEYWORD>  E.2  <OPERATOR>  DEF MCON PARAM BYTE EVAL INTON RETRN (# (* TRUE ENDPROG  DECL EXTRN AUTO WORD WHILE INTOFF HALT  }  #  )*  | FNCTN  | INIT  | | | 1 1  1 ELSE  IF WAIT BREAK ($ (?  1 NEXT 1 )$ 1 )?  FALSE  OPERATORS  : := =B@ =STR  m INC ADD RMUL AND LS ?EQ STR?EQ B2W  INTSF CONSWI FOPEN RDCH UFO UF4  // PRIMITIVE FUNCTIONS =W@ | :=B# | :=W# =ARR W@ | :B# I :W# DEC | :NEG SUB LMUL REM I DIV OR XOR NOT RS LS4 RS4 ?NE ?GT I ?LT STR7GT | STR?LT STR?NE I SEL | STRADV SWAPB // OTHER STACK INSTRUCTIONS CALLS CONRSV FCLOSE sFLUSH WRCH iUF2 | :UF3 UF1 :UF6 UF5 J :UF7  85 E.3  —  CHARACTER CLASSES // SIGN CHARACTERS  <SIGN>  + 1-  <DCHAR>  0|l|2|3|4j5|6|?|8|9  <HCHAR>  0|1 |2|3l4|5l6|7|8|9|A|B|C|D|E|F  // DECIMAL CHARACTERS // HEXADECIMAL CHARACTERS // ALPHABET CHARACTERS A|B|C|D|E|F|G|H|I |J|K|L|M |N|0|P Q|R|S|T|U |V |W|X|Y|Z // PRINTABLE CHARACTERS <ACHAR>|<DCHAR>  <ACHAR>  <PCHAR>  | l#l$l^l&l*l(l)l*l+l,|-l.|/|:1;l=l? ,,  E.4  —  CONSTANTS  <DECI>  | I I |  // DECIMAL NUMBER <SIGN><DCHAR> <SIGN><DCHAR><DCHAR> <SIGN>CDCHAR><DCHAR><DCHAR> <SIGNXDCHAR><DCHAR><DCHARXDCHAR> <SIGN><DCHAR><DCHAR><DCHARXDCHARKDCHAR> // BYTE HEXADECIMAL NUMBER  <BHEXD>  ::  $<HCHAR><JlCHAR>  <¥HEXD>  : :  // WORD HEXADECIMAL NUMBER $<HCHAR> <HCHAR><HCHAR>'<HCHAR> // CHARACTER CONSTANT  <CHAR>  '<PCHAR>  ::  // STRING CONSTANT "{<PCHAR>}  <STRING> : i  "// CONSTANTS := <BDECI> I <WDECI> I <BHEXD> I <WHEXD> I <CHAR> | <STRING> j TRUE: | FALSE  <CONSTANT>  E. 5  —  NAMES // DATA NAME  <DNAME>  ::=  <ACHAR> <PCHAR> // FUNCTION NAME  <FNAME>  ::=  :<PCHAR>{<PCHAR>}  <&NAME>  ::=  &<DNAME> &<FNAME>  =NAME  ::=  =<DNAME>  // ADDRESS NAME  // ASSIGNMENT NAME  -  EXPRESSIONS  <EXPR> I <CONSTANT> I <DNAME> I <&NAME> <EXPR> • <=NAME > <EXPR> <EXPR> <EXPR> <EXPR>  INTSF CALLS CONSWI CONRSV  <EXPRXEXPR> <EXPR><EXPR> <EXPR> <EXPR> <EXPR> <EXPR> < E X P R X E X P R > <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPRXEXPR> <EXPR> <EXPR> <EXPR> <EXPR><EXPR> <EXPR><EXPR> <EXPR> <EXPR> <EXPR><EXPR> <EXPR> <EXPR> <EXPR><EXPR> <EXPR><EXPR> <EXPRXEXPR> <EXPR><EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR><EXPR> <EXPR> <EXPR> <EXPRXEXPR> <EXPR> <EXPR> <EXPR><EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> ' <EXPR> <EXPR> <EXPR> <EXPR>  =B@ =W@ =B# =W# =STR =ARR B@ W@ E#  w# INC DEC NEG ADD SUB RMUL LMUL DIV REM AND OR XOR NOT LS RS LS4 RS4 ?EQ ?NE ?LT ?GT STR?EQ STR?NE STR7LT STR?GT B2W SWAPB SEL : STRADV  87 I I I I I I | I I ) | j |  <EXPR> * E X P R > <EXPR> <EXPR> < E X P R > <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR> <EXPR>  //  F U N C T I O N S WITH 0 PARAMETERS  //  F U N C T I O N S WITH 1 PARAMETER  //  F U N C T I O N S WITH 2 PARAMETERS  //  F U N C T I O N S WITH 3 PARAMETERS  //  F U N C T I O N S WITH k PARAMETERS  //  F U N C T I O N S WITH 5 PARAMETERS  //  F U N C T I O N S WITH 6 PARAMETERS  //  F U N C T I O N S WITH 7 PARAMETERS  //  F U N C T I O N S WITH 8 PARAMETERS  <FNAME> <EXPR?-  <FNAME>  <EXPR> < E X P R >  <FNAME>  I <EXPRXEXPR><EXPR><FNAME> I  <EXPR><:EXPR><EXPR> <EXPR> <FNAME>  I  < E X P R > <EXPR> < E X P R > <EXPRXEXPR> -CFNAME>  |  <EXPR><EXPR> <EXPR> < E X P R > < E X P R > <:EXPR> < F N A M E >  I  <EXPR><EXPRXEXPR> ' <EXPR><EXPR> <EXPR> <EXPR> ,. <FNAME>  J  < E X P R > < E X P R > <!EXPR> < E X P R > < E X P R > <EXPR> < E X P R > <EXPR> <FNAME>  88 E.7  —  ACTION STATEMENTS  <ACTION> ::=  <EXPR>  EVAL |  //  EVALUATION STATEMENT  //  WHILE STATEMENT  ;  WHILE £<EXPR> ] (* { <ACTION> }  )*  // | -C  I | |  IF <EXPR> ( ? . { <ACTION> > ELSE EXPR (? { <ACTION> }  C <EXITA> 1  )?  t<EXITA>]  )?  ;  IF-ELSE STATEMENT  //  INTERRUPT ON  //  INTERRUPT OFF  //  WATT FOR INTERRUPT  //  RETURN STATEMENT  //  HALT STATEMENT  //  BREAK STATEMENT  //  NEXT STATEMENT  INTON INTOFF WAIT  <EXITA> RETRN <EXPR> HALT  ;  BREAK  ;  NEXT  :  <EXITB>  1  ;  : :=  RETRN <EXPR>  ;  HALT  :  E.8  —  DECLARATIONS  <DECLARE> ::= DECL  PARAM  <DNAME>  | DECL  AUTO  <DNAME> <TYPE> ;  | DECL  EXTRN  <DNAME> <TYPE> ;  | DECL <TYPE> E. 9  —  <DEFINE>  FNCTN : :=  //  PARAMETER DECLARATION  //  AUTOMATIC DECLARATION  //  EXTERNAL DECLARATION  //  FUNCTION DECLARATION  ;  <TFNAME> <3TPE> ; . <BDECI> | <WDECI> | BYTE  | WORD  DEFINITIONS  : :=  // DEF FNCTN <FNAME> (# { <DECLARE> } )# ($ { <ACTION> } I <EXTTB> 1 )$  FUNCTION DEFINITION  //  EXTERNAL DEFINITION  | DEF EXTRN <DNAME> <TYPE> [ INIT { <INITV> } ]  | DEF  <INITV>  MCON  <DNAME>  ::= •CCONSTANT>  ;  // MANIFEST CONSTANT // DEFINITION <£CONSTANT> ;  | <T&NAME>  90 APPENDIX F // 11 // 11 11 fl //  —  SAMPLE USE OF A PORTABLE E DEVELOPMENT SYSTEM  THE FOLLOWING. LISTS THE USE OF AN E DEVELOPMENT SYSTEM AS IMPLEMENTED ON THE TEKTRONIX 8002 UPROCESSOR LAB AT THE DEPARTMENT OF ELECTRICAL ENGINEERING OF THE UNIVERSITY OF BRITISH COLUMBIA. SEE TEKTRONIX 77A FOR A REFERENCE ON THE COMMANDS. BELOW. TWO SLASHES, //, INDICATES THE START OF A COMMENT WHICH ANNOTATES THE COMMAND AND RESPONSE SEQUENCE.  // PRESS RESTART BUTTON TO START SYSTEM. A 6800 SYSTEMS DISK fl CONTAINING THE E DEVELOPMENT SYSTEM LOAD MODULES IS IN // DISK DRIVE 0. TEKDOS  VERSION 2.1  6800  // TEKDOS STARTING MESSAGE  > L  // LIST FILES ON DISK  EDEMO  // NAME OF DISK  FILE NAME  BLOCKS  TEKDOS FDUMP COPYSYS TKEDLCMP TKEULASM EML  16 3 2 38 29 8  TOTAL FILES TOTAL BLOCKS USED BLOCKS AVAILABLE TOTAL BAD BLOCKS  // TEKDOS FILES  // E PORTABLE COMPILER fl E PORTABLE ASSEMBLER/LINKER // E MACHINE EMULATOR 61 207 97 0  // MANY HIDDEN TEKDOS FILES  > EDIT ADDLOOP  // CREATE SAMPLE E PROGRAM // USING TEKDOS EDITOR  ** EDIT VER 1 . 6 * * ** NEW FILE ** *I INPUT: DEF FNCTN :ADD.ARRAY (# DECL EXTRN NUM.ARRAY DECL EXTRN SUM DECL AUTO K  )# ($  // INSERT COMMAND TO EDITOR // ROUTINE TO ADD  +12000  ;  WORD WORD  ; //SUM ; // COUNTER  6000 WORDS  // WORD ARRAY  EVAL -1 =K // INITIALIZATION EVAL +00 =SUM WHILE K :INC =K +6000 :?NE'// ADDITION LOOP (* EVAL &NUM.ARRAY K :W# SUM :ADD =SUM  )*  i  1  DEF DEF  EXTRN EXTRN  SUM NUM.ARRAY  WORD  +12000 // CR TO EXIT FROM INPUT MODE  91 *FILE *DOS* EOJ  // EXIT FROM EDITOR  > EDIT OADDLOOP  // CREATE OBJECT FILE  ** EDIT VER 1 .6 ** NEW FILE ** *FILE *DOS* EOJ  •x-x-  CLEAR SYSTEM  > A *  // LOAD COMPILER // TAKE APP. 1 MINUTE TO LOAD  > RHEX TKEDLCMP *RHEX* EOJ > GO 10 E COMPILER VERSION P.0.1 ENTER FILES: CONO OADDLOOP ADDLOOP  NOV 1978  LISTING OBJECT SOURCE CONO I S CONSOLE OUTPUT COMPILER EXECUTION MESSAGE COMPILER LISTING FOLLOWS  ...EXECUTING'  0001 0001  0002 0004  0003 0010 0004 0015 0005 0020  0006 0001 0007 0006  START.EXECUTION AT LOCATION. 10 COMPILER MESSAGE  FNCTN :ADD.ARRAY DEF DECL .EXTRN NUM.ARRAY (# DECL EXTRN SUM DECL AUTO K  +12000 WORD WORD  )# ($ EVAL  0008 0010  0009 0016 0010 0025 0011 0027  -1 =K +00 =SUM EVAL WHILE K :INC =K +6000 :?NE EVAL &NUM.ARRAY K :W# SUM (*  :ADD =SUM  )*  02 0012 0001 K  0013 0001 DEF 0014 0001 DEF  0015 0001  EXTRN EXTRN  SUM NUM.ARRAY  WORD  +12000  NORMAL TERMINATION > A*  // CLEAR SYSTEM  // THE COMPILER EMITS ERROR MESSAGES I F SYNTAX ERRORS ARE DETECTED. / / A N EDIT COMPILE CYCLE MAY BE USED TO CORRECT SYNTAX ERRORS.  92 >  COPY OADDLOOP CONO .MODULE .DEFX :ADD.ARRAY . C L I N K N U M . A R R A Y + 1 2 0 0 0 . C L I N K S U M +2 A L S T $02 . F L I N K : A D D . A R R A Y $ 0 0 S E T F P $ 0 0 $ 0 2 . M A P O N . N U L L . N U L L P U S H W I -1 A S G N W X $ 0 2 P O P . N U L L P U S H W I +00 A S G N W A S U M P O P . D E F T , 0 2 . N U L L P U S H W X $02 : I N C A S G N W X $ 0 2 P U S H W I + 6 0 0 0 : ? N E J N T ',01 . N U L L P U S H W I N U M . A R R A Y P U S H W X $ 0 2 :W# P U S H W A S U M : A D D A S G N W A S U M P O P J M P , 0 2 . D E F I , 0 1 . N U L L HALT .NULL .MAPOFF . M O D U L E . M A P O F F . D E F X S U M . F L I N K S U M +2 . M E M +2 .MODULE .MAPOFF . D E F X N U M . A R R A Y . F L I N K N U M . A R R A Y +12000 .MEM'+12000 *COPY* EOJ >-EDIT  LADDLOOP  ** E D I T V E R 1 . 6 * * N E W F I L E ** * FILE * DOS* E O J  // C R E A T E L O A D  MODULE  FILE  **  > RHEX TKEULASM *RHEX* E O J  // L O A D  ASSEMBLER/LINKER  // E X E C U T E G O1 0 E ASSEMBLER/LINKER VERSION P.0.0 SEPT 1978 ENTER FILES: // L I S T I N G L O A D E R O B J E C T CONO LADDLOOP OADDLOOP ENTER START ADDRESS: // L I N K A G E A D D R E S S F O R T H I S OCCO EXECUTING PASS #1 EXECUTING PASS # 2 ***** P R O G R A M L O A D M A P ***** A D D . A R R A Y OCCO OCCE OCCB 0CD1 0CD2 0CC5 0CC5 0CC5 0CC8 OCCA OCCB OCDE 0CE3 OCDE 0CF1 OCDB 0CD2 0CD4 0CD5 0CD7 OCDA OCFO OCEF OCEH0CE7 0CE8 OCEB OCEC OCEF  >  SYSTEM  E  :  ***** S U M O C F O ***** N U M . A R R A Y 0CF2 NORMAL TERMINATION >  A  // P R I N T L O A D > COPY LADDLOOP CONO /0CC010192A012C00020AFFFF1902100A0000140C8B / 0 C D 0 1 0 1 A F 0 1 0 0 C 0 2 6 0 1 8 0 2 0 A 1 7 7 0 9 2 2 2 0 C E F 0 A 0 C 96 . /0CE0101BF20C025A080CF0661H-0CF010200CD22HA1 *COPY* E O J > RHEX E M L *RHEX* E O J > RHEX *RHEX*  MODULE  1  // L I N K T O E M A C H I N E  EMULATOR  LADDLOOP EOJ  > WHEX 0000 OCFF 1 0 TKADDLOP *WHEX* E O J  // S A V E  COMPLETE  MODULE  93 > L  // LIST F I L E S  EDEMO F I L E NAME  BLOCKS  TEKDOS FDUMP COPYSYS TKEDLCMP TKEULASM EML ADDLOOP OADDLOOP LADDLOOP TKADDLOP  16 3 2 38 29 8 1 1 1 9 65 219 75  TOTAL F I L E S TOTAL.BLOCKS USED BLOCKS AVAILABLE TOTAL BAD BLOCKS  0  // RUN THE TEST PROGRAM UNDER DEBUG CONTROL > A * > RHEX TKADDLOP *RHEX* EOJ >  DEBUG  // INITIATE DEBUGGER  >  BKPT OCCO  // SET BREAKPOINT AT ENTRANCE  > BKPT 0CD2  // SET BREAKPOINT AT THE START /I OF EACH PASS THROUGH ADDITION // LOOP  > GO 10  // START EXECUTION  LOC INST 001E E600 001E BREAK > GO 001E E600 001E BREAK  MNEM R LDA B  OPER X/PC FADD 00 +0CC0=0CC0  LDA  00  B  RA RB XREG SP 3F 2A OCCO 3FFF  CC CO  // BREAK AT ENTRANCE, CONTINUE EXECUTION +0CD2=0CD2 00 OC 0CD2 3FFB CO  94 // BREAK AT START OF LOOP fl CHECK DATA INITIALIZED CORRECTLY // CHECK SUM  > EXAM OCFO OCFO=00 OO > EXAM OA OOOA=3F PC  // OA IS LOCATION OF E MACHINE FP  > EXAM 3FFC  // CHECK K IN FRAME  3FFC=00 02 FF FF >G0 001E E 6 0 0  LDA  > EXAM OCFO  B  // START ANOTHER PASS THROUGH LOOP 00 +0CD2=0CD2 FF OC 0CD2 3FFB CO // BREAK AT START OF LOOP // CHECK SUM  OCFO=FF 18 > EXAM 0CF2  // CHECK FIRST WORD OF ARRAY  0CF2=FF 18  // CONSISTENT WITH INTENDED ACTION  > EXAM 3FFC  // CHECK K  3FFC=00 02 00 00  // K NOW 0000  > CLBP  // CLEAR BREAKPOINT, DO SPEED MEASUREMENT  > GO  // PROGRAM WILL HALT AT COMPLETION  > A *  // E PROGRAM HALTS BY RETURNING TO TEKDOS 11 SYSTEM, EXECUTION REQUIRED 8 SECONDS // CLEAR SYSTEM  // INCONSISTENCIES IN CONTENTS OF DATA, OR FAILURE TO ARRIVE 11 AT A BREAKPOINT, WILL REVEAL SEMANTIC ERRORS. 11 AN EDIT, COMPILE, AND EXECUTE CYCLE MAY BE USED TO CORRECT //THE SEMANTIC ERRORS. // 11 /I 11 // 11 //  DEVELOPMENT SEQUENCE OF SAMPLE PROGRAM IS COMPLETE. A PROGRAM HAS BEEN ENTERED, COMPILED, ASSEMBLED & LINKED, AND TESTED UNDER DEBUG CONTROL. THE DEVELOPMENT SEQUENCE HAS CREATED A LOAD MODULE, TKADDLOP, WHICH MAY BE EXECUTED BY USE OF THE COMMAND SEQUENCE: > RHEX TKADDLOP > GO 10  

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.831.1-0065612/manifest

Comment

Related Items