SYMBOLIC LANGUAGE PROCESSOR FOR.A by Billy …arizona.openrepository.com/arizona/bitstream/10150/318181/1/AZU_TD... · SYMBOLIC LANGUAGE PROCESSOR FOR.A SMALL INSTRUCTIONAL COMPUTER
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Symbolic language processor fora small instructional computer
In Partial Fulfillment of the Requirements For the Degree of
MASTER OF SCIENCE
In the Graduate College
THE UNIVERSITY, OF ARIZONA
1 9 7 2
STATEMENT BY AUTHOR
This thesis has been submitted in partial fulfillment of requirements for an advanced degree at The University of Arizona and is
under rules of the Library.
Brief quotations from this thesis are allowable without special permission, provided that accurate acknowledgment of source is made. Requests for permission for extended quotation from or reproduction of this manuscript in whole or in part may be granted by the head of the major department or the Dean of the Graduate College when in his judgment the proposed use of the material is in the interests of scholarship. In all other instances, however, permission must be obtained from the author.
deposited in the University Library to be made available to borrowers
SIGNED:
APPROVAL BY THESIS DIRECTOR
This thesis has been approved on the date shown below:
RALPH E. GRISWOLDProfessor of Computer Science
ACKNOWLEDGMENTS
The author is indebted to Dr. Ralph E. Griswold for providing
many hours of his time for guidance and assistancee Gratitude is also
due Dr. Robert L. Baker and Dr. Frederick J. Hill for their comments
and suggestions. Finally, the author wishes to thank Mrs. J. L. Cude
for her expertise in typing the.present document.
TABLE OF CONTENTS
Page
LIST. OF ILLUSTRATIONS.............. vi
LIST OF T A B L E S ........................... .\............ vii
A B S T R A C T ...................................... viii
CHAPTER
1 . INTRODUCTION . .......... 1
Scope of W o r k .......... 2
2 SIC COMPUTER . . . . . . . . ............... 3
R e g i s t e r s ....................... . . . ........ 4Instruction Register (IR) .................... 4Program Counter (PC) . . ..................... 4Memory Address Register (MA) ................ . 5Memory Data Register ( M D ) ..................... 5Accumulator (AC.) ................. 5Index Registers A and B (IA and IB) . . . . . . 5
Data P a t h s ............... 6Instructions ......................................... 7
Supervisor............... 14A s s e m b l e r ................. 14
Table-driven Techniques . . ................... 15Pass O n e .......... 16Lexical Analysis . ................. 17Syntactic Analysis . . . ........................ 19Pass T w o . 21Symbol Table Structure . . . . . . . . 21Literal Pool Structure . ................... 23
Machine Language Processor . . . . ................. 23Emulator............ 24
IV
TABLE OF CONTENTS— Continued
CHAPTER Page
4 SLIC PROGRAMMING . . . . . . 25
SLIC Processor Commands............ 25$ASSEMBLY and $ M A C H I N E ........................ ' 25$TRACE ................... 26$DUMP(i,j) . . . . . . .......... 26
12zero. . The link is set to one. using the STL instruction. The AC can be
set to all ones with the STA instruction. By using the CLA, the AC can
be cleared to all zeros. The CMA instruction performs a oneT s comple
ment of the contents of the AC.
The SZL instruction will skip the next instruction in sequence
if the link is zero. Also the third event time will be bypassed. The
DFA and DFB instructions deposit the contents of IA and IB registers,
respectively, into the right-most 13 bits of the AC. The DTA and DTB
instructions deposit the right-most 13 bits of the AC into the IA and
IB registers, respectively. The INA and INB instructions will incre
ment the contents of the IA and the IB registers. The SKN, SKP, • and
SKZ instructions will skip the next instruction if the contents of the
AC is, respectively, negative, positive, or equal to zero.
Input-Output Transfer Instructions
The Input-Output Transfer (lOT) instructions (Figure 4) are
specified by bits 0 through 3 being all ones. The two TOT instructions
are implemented rather simply. When bit 4 is equal to zero, an octal
value is READ from the card reader and placed in the accumulator. When
bit 4 is equal to a one, the octal contents of the AC are written
(WRITE) to the line printer. No attempt has been made to implement the
complex I/O structure defined in Kill and Peterson (in press).
0 1 2 3 4 5 - 17
Figure 4. I0T instruction format
CHAPTER 3
SLIC IMPLEMENTATION
In this chapter the construction of the four basic modules,
supervisor (SUPERV), assembler (ASSEMB), loader (LOADR), and emulator
(MULATR), which make up the SLIC processor will be presented. The SLIC
processor is implemented in FORTRAN EXTENDED on the Control Data Cor
poration (CDC) 6400 computer at The University of Arizona Computer Cen
ter. FORTRAN EXTENDED has several salient features which make it
attractive as the development language. Foremost is the ease of pro
gramming. FORTRAN EXTENDED, when compared with the CDC 6400 COMPASS
assembly language, provides better diagnostics, faster program develop
ment, reasonably efficient object code generation, and the need for
less intricate hardware and software knowledge. Since FORTRAN is one
of the most widely accepted and implemented computer languages, the
SLIC processor would be portable to many computers with a minimum of
reprogramming. Another feature of FORTRAN EXTENDED which makes it at
tractive is the availability of a SHIFT function, which when used in
conjunction with the logical "AND,M "OR," and "NOT" operations provides
character manipulating capability.
Several key factors governed the development of the SLIC proc
essor. These factors are listed as follows:
13
14
1o SLIC must be easy for inexperienced student programmers to
use.
2. SLIC.would process only short student jobs.
3. SLIC must provide good diagnostics.
4. SLIC must provide the capability, to "look" into pseudo-SIC
memory and registers for debugging.
5. SLIC must be an inexpensive classroom aid.
Supervisor
The supervisor determines the type of job to be run. If the
job is a symbolic assembly job, the assembler is called to translate
the symbolic statements into machine code. If the job is a machine
language job, then .the loader is called to input the. job and load it
into SLIC memory. After returning from one of the two above processes,
the supervisor checks to see if any fatal errors have occurred; if so,
the job is terminated; otherwise, execution of the machine code is in
itiated.
Assembler
Symbolic instructions must be translated into a machine form
before they can be processed by a computer. An assembler as defined
by Katzan (1970, p. 11)
. . . translates programs written in a symbolic machine language into the more precise numeric language of the computer.In addition to being able to specify machine operation codes symbolically, the programmer is permitted to represent numerically addressed storage locations in the computer by alphameric symbols of his own choosing, to define constants and data areas, and to control the operation of the assembler
15program itself. The assembler program translates symbolic instructions into machine instructions, assigns storage locations, and performs the auxiliary functions necessary to generate an executable machine language program.
SIC introduces assembly language instructions as -a means of
teaching the operations of machine-level instructions to computer de
sign students. Through the use of the SLIC processor, students can ob
serve the functioning of the SIC memory and internal registers by writ
ing short SIC assembly language programs and using the assembler trace
and dump commands discussed in Chapter 4.
The SLIC assembler is a two-pass assembler. The functions of
and techniques used in the development of each of the passes will be
discussed subsequently.
■., Tahl e.-?.d riven,, Techni ques
The'SLIC assembler uses a table-driven technique for lexical
analysis and to some extent for the syntactic analysis portion.of pass
one. Table-driven techniques are a special form of syntax-directed
compiling. Cheatham and Sattley (1964, p. 31) define syntax-directed
compiling as given below.
The phrase "syntax-directed” . . . refers to the methodby which the compiler is given the syntactic specification of the language it is to compile. That is, rather.than having the syntactic structure of the language reflected in the actual encoding of the compiler algorithm, a "syntax-directed” compiler contains (or uses, as parametric data) a relatively simple and direct encoding of the syntactic structure of the language, for example, as it might be expressed in Backus Normal Form.
With table-driven compiling the encoding mentioned by Cheatham
and Sattley is in the form of indexes or pointers in tables. These
pointers are directed by the input string of characters in lexical
16
analysis and by the element list (or other tables built during lexical
analysis) in syntactic analysis. The history of the path(s) followed
by these pointers determines the analysis. Liu, Chang, and Marks
(1967, p. 691) state that the idea of using replaceable tables to con
trol the operations of a compiler is extended in a table-driven com
piler system to include not only syntactic analysis but also the
allocation of memory and code generation. These replacement tables
make the incorporation of extensions or modifications much easier than
when the syntax is embodied into the translator (irons 1961, pp. 31-
55).
Pass One
.Pass, one .initi,ate,s ..the as.semUly process by reading the input
stream. The components of the input stream are analyzed one character
at a time to build character groupings into words and to separate as
sembler commands from symbolic instructions. If an assembler command
is encountered, then the appropriate action is initiated. When a sym
bolic instruction is recognized, lexical analysis and syntactic analy
sis are performed.
A major function of pass one is the building of a table of sym
bolic labels which is called the symbol table. A location counter,
which in the SLIC assembler begins at zero, is maintained to assist in
the internal referencing of symbols and instructions. The value of the
location counter when a label is encountered is an entry in the symbol
table. The symbol table structure will be discussed later in this
• 17
chapter. The instruction codes, less .the memory reference addresses,
are written onto, a disk file to be processed in conjunction with the
symbol table by pass two.
Lexical Analysis
The lexical analyzer which is a table-driven submodule of the
assembler reads the input stream and builds the characters into symbolic
elements. These elements and a value representing the element types are
entered into a double entry element list which drives the syntactic
analysis phase. The possible element types are listed below. When
1. Name -
2. Absolute address _
3. Numeric literal
4. Alphanumeric literal
absolute addresses or numeric literals are encountered, they are con
verted from BCD to binary numbers.
The structure of the table which is used to drive the lexical
analysis phase is given in Table 4. The table column gives the refer
ence number of that segment. This is the number to which the pointers
refer. The segments column gives the element which that segment of the
table analyzes. The first segment, starter, determines from the first
character of an element what the element type being processed should
be. The negative number segment checks for a possible negative number
and then branches to process numeric literals. The error recovery seg-/
ment processes all characters after an error condition until a delimi
ter is encountered; then processing of the next element begins.
18
Table 4. Lexical analysis table structure.
Maximum PointerTable Segments length in Characters to next Meaning
characters table
1 Starter $ o r * 0 Trace or comment cardA to Z 2 Name0 to 7 3 Absolute address= or ( 6 Numeric literal
«=>«=>«. T R A C E 0 N •»«=•«» STRACE ON FOR REST OF010 0 0 .. 7 0 0 0 0 0 10 0 0 NOP01001 101012 1001 LAC 101201002 701400 . 1002 CNA01003 501012 1003 DAC 101201004 101013 1004 LAC 101301005 701400 1005 C P A '01006 201012 1006 AND 101201007- 701400 1007 CM A01010 501012 1010 DAC 101201011 621000 1011 JMP I 1000
DIMENSION IDATA(84)DIMENSION IERR(2)DIMENSION L E N G T H (4)
COMMON /ONE/ L I N C N T »I T E X T (80) , IC O U N T ,NUMBERCOMMON /TWO/ TRACE,ERROR,ERRFLG.ODUMPCOMMON /THREE/ ICHAR, KINO, F I E L D (4,2),I P O I N T , LOCATECOMMON /TEMPRY/ ITEMP, ISAVE, KSAVECOMMON /TABLE/ SYMTAB(3,50), LITP0L(3,5Q>
EQUIVALENCE ( S Y M T A B (1,i ) ,I D U M M Y ), (LITPOL(i,1),KDUHMY)
CALL SCANC 0 9IEND)C-- TEST FOR END OF LINE OR END OF FILE
IF(IENO)330,40,50 40 IPOINT - 0
GO TO 30
C ~ “ TEST FOR LABEL
50 IF (IPOINT 0 EQ» 2 oAN.D. KINO.EQ. . 1) ELMENT = ELMENT 4-1 IF(KIND.EO»1)GO TO 30GO TO 60 . •
57 ELMENT = ELMENT + 1
C-- HAVE ALL ELEMENTS BEEN PROCESSED
IF(ELMENT»GT,4)G0 TO 220 6 0 CONTINUE :
FIELD(ELMENT,2) = KIND
C— BRANCH ACCORDING TO POSSIBLE ELEMENT TYPE
GO T O ( 7 0 , 80,90,90,90,85,85,80) ,KIND 4 - 1
C— TEST FOR $ T R A C E ,S D U M P , OR. »
70 CALL COMMND IPOINT = 0 GO TO 20
C”" PROCESS LITERALS
57; . A.SSEMB FORTRAN EXTENDED VERSION 2/0/E 04/29/72
8 0 CONTINUE
C=~ GET NEXT CHARACTER / -
CALL SCAN( (KIND-1)>64,IEN0)'
C-~ TEST FOR END OF LINE OR END OF FILE . •
IF(IENO)330,220,60 85 CONTINUE , . ; :
C — GET NEXT CHARACTER
. CALL S C A N ( C K I N 0 - 1 ) * & 4 , I E N D ) .F IELD(ELMENT,2) - K I N D
C"= TEST FOR END OF LINE OR END OF FILE
IF(IEND)330,220,86 66 GO T O ( 6 0 , 60,60,60,90,90,67,60),KINO + 1
' C— NEGATEVE LITERAL
87 NEGATE = .TRUE,GO TO -85
90 CONTINUEKINSAV = KIND - 1
C-- DETERMINE ELEMENT MAX LENGTH , \
LOOP = LENGTH(KINSAV)ITEMP = 0 - - •I F (K I N S A V ,N£.2 .AND. KINSAV.NE.3)GO TO 900
C— PROCESS NEMERICS
DO 120 1=1,LOOPICHAR = ICHAR - IADJITEMP = S H I F T ( I T E M P , 3) .OR. ICHAR
C-- GET NEXT CHARACTER
CALL SCAN(KINSAV^6 4 , IENO) ,
C — TEST FOR END OF LINE OR END OF FILE
IF(IEND)330,220,110 110 CONTINUE
C“ ~ TEST FOR DELIMITER
I F (KINO.EQ.lt GO TO 130
C-- TEST FOR ERROR . w •
I F (K I N D , N E » 7)GO TO 120CALL E R R 0 U E U 3 ) ' .
58
ASSEM8 FORTRAN EXTENDED VERSION 2,0/E 04/29/72GO TO 57
120 CONTINUE GO TO 940
900 CONTINUE .
C-r PROCESS ALPHA CHARACTERS '
DO 910 1 = 1 , LOOP LEN = IITEMP = SHIFT(ITEMP,6) .OR. ICHAR
C — GET NEXT CHARACTER
CALL SCAN(KINSAV»64,IEN0>
C-- TEST FOR END OF LINE OR END OF FILE
IF(IENO)330,220,920 920 CONTINUE
C-= TEST FOR DELIMITER
IFCKIND.EQ.nGO TO 125C— TEST FOR ERROR •
IF(KIND.NE.71G0 TO 910 CALL ERR0UEC13i GO TO 57
910 CONTINUE .940 CONTINUE
CALL ERRQUE(KIND-H4>FIELD(ELHENT,2) = 7
C — PERFORM ERROR RECOVERY
' CALL S C A N (384,IEND)IF(IEND)330,220,57
125 CONTINUEIF(ELMENT.E0.2>GO TO 130
C— RIGHT JUSTIFY NON-NUMERICS
ITEMP = S H I F T(ITEMP,6 0 - (LEN*6))130 CONTINUE . . . .
FIELD(ELMENT,1) = ITEMP
C-- NEGATE NUMERICS LITERALS
IF(NECATE.AND,KINSAV.EQ,3 ) F I E L D ( E L M E N T ,1)=.N O T .(FIELD(ELMENT, . NEGATE = .FALSE.
GO TO (160,160, 140,220),ELMENT ' ' :
C-- TEST FOR P0SSI8LE INDIRECT ADDRESSING OR INDEXING
-1)
14Q CALL INDINX(INDFLG)IFdNOFLG.LT. 0)GO TO 220
160 CONTINUE
o o
o o
o o
59ASSEMB FORTRAN EXTENDED VERSION 2.0/E 04/29/72
C-- GET NEXT CHARACTERCALL SCAN( 0 ?IEND>
C-" TEST FOR END OF LINE OR END OF FILE . . \ "IF(IEND)330,220,57
C-- BEGIN SYNTACTIC ANALYSIS: 220 CALL SYMBOL(LABTST,LOCATE,IHIT)
IF(IHIT oGEe 0)CALL ERRQUE(4)C-- TEST FOR DATA DEFINITION STATEMENT
-IFCFIELD(2,2) 0EQo4 .OR. FIELD C 2, 2) . EQ.5) GO TO 299C-- TEST FOR VALID INSTRUCTION
CALL SEARCH(FIELD <2,1) , INSTRU,ITYPE) •C-- SET DUMP AND TRACE CONDITIONS
IF(ODUMP)INSTRU = INSTRU .OR. ISET20 . . . .IF(TRACE)INSTRU = INSTRU .OR. ISET19D D U M P = t FALSE,.
-•* ITYPE = 1 END CARD= 2 ORG CARO -= 3 OPERATE INSTRUCTION '= 4 MRI= 5 IOT
.= 7 ERRORGO TO <230,260,280,290,282,299,270),ITYPE
230 CONTINUEIF<LABTST.NE.0)GO TO 250 IF(FIEL0(3,2>.NE.2)GO TO 235 CALL FIND(FIELD(3,1),IHIT,SYMTAB)I F d H I T . G E . 0) GO TO 240
2 35 CONTINUE "CALL ERROUE(5)GO TO 335
. 2A0 XOTBEG = IHIT GO TO 340
*250 CONTINUEIF(FIELD(3,2).NE.3)G0 TO 235 XOTBEG - FIELD <3,1)GO TO 34 0
260 IF<FIELD(3»2)eNE.3)CALL ERROUE(6)LOCATE = FIELD(3,1)W R I T E (7) KKKKK,ITEXT,ITEMP,ITEMP,ITEMP,ITEMD GO TO 320
270 CONTINUEWRITE(7) KK,INSTRU,ITEXT»ITEMP,ITEMP,ITEMP GO TO 320
280 CONTINUE
ooooooo
o coo
ASSEH8 FORTRAN EXTENDED VERSION 2.3/E 04/29/72
I F (F I E L D (291).N E o I R A R )GO TO 261• ' CALL R O TATE(INSTRU>1 )
GO TO 282 •261 I F ( FIELn(29l ) .E Q .IRAL)CALL R O T A T E C I N S T R U > 0)282 CONTINUE
IFCTRACE)INSTRU = INSTRU .OR. ISET19 IFCDOUMP)INSTRU = INSTRU .OR. ISET20 DDUMP = .FALSE.W R I T E (7) K K K , LOCATE,INSTRU,ITEXT,ITEM0 ,ITEMS GO TO 30 0
290 CALL 0 ° R A N O (INDFLG,INSTRU,LARTST)W R I T E (7) KKKK,LOCATE,INSTRU, I T E X T , F I E L D (4,1),FIELD (4,2 GO TO 30 0
299 CONTINUE INSTRU = F I E L D (2,1)GO TO 282
300 CONTINUE 1 LOCATE = LOCATE * 1
320 IPOINT = 0CALL ERRWRT(l)GO TO 5
. 330 CONTINUEC A L L 'ERRQUE(22)
335 XOTBEG = 0 . 340 CONTINUE
-WRITE'L71 ■ K-K'K K K-, -I T EXT , 1T'EM0,TTEMP ,1-TEMP,HEMPCALL ERRWRT(l)IPOINT -- KDUMMY
342 I F ( I P O INT.EQ.0)GO TO 343
C-- ASSIGN ADDRESS TO LITERALS
: LITPOL (3,IPOINT) ■=. LOCATECALL W R T M E M ( L O C A T E , L I T P O L (2,I P O I N T ) )LOCATE = LOCATE + 1 IPOINT = L I T P O L d , I P O I N T )
• GO TO 342Jf. if. tf. 4. ^ 4. If 4. 4 4- 4- 4 4- 4- 4 $ 9
- & V. » P A S S T W O ** *- 4. 4. 4 4. q. & 4 4 q. q. V- lil 4. if 4. 4 4.
343 REWIND 7
WRITE PAGE H E A D I N G .
CALL P A G H E D (3)1 = 0 - ■
DO 370 M=l,NUMBER 1 = 1 4 - 1I F ( I - ((I/KOUNT)»KOUNT).EQ.0)CALL PAGHEDC3)R E A D (7) ITYPE,(IDATA(J),J=1,84) .
ASSEMB FORTRAN EXTENDED VERSION 2.0/E 04/29/72• = 4 ORG AND END= 5 ERROR STATEMENT
- . = 6 MR:
GO TO (345,346,347,343.349,350),ITVRE345 W R I T E (6,6 0 01)(10A T A (J ) ,J = i ,81),I
GO TO 37 0346 W R I T E (6,6 0 02 ) (IDATACJ),J=i , 8 2 ) ,1
GO TO 360347 W R I T E ( 6 ,6003)(lOATA(J),J=1,81),I
GO TO 37 0348 W R I T E (6,60 04 ) (I04TA(J),J=l,8 0 ) $1
GO TO370 . . .349 K = I D A T A (1)
1 = 1 - 1WRIT E (6,6 0 05) I E R R (K ) , ( ID A T A (J ) ,J = 2 ,4)GO TO 370 .
350 CONTINUE
C-- TEST FOR LITERALS IN LITERAL POOL
GO TO (356,354,356,351,351,356,356),I D A T A (64)351 CALL FIND(IDATA(8 3 ) ,IH I T ,LITPOL)
I F d H I T . LT. 0) WRITE(5,60 09)GOTO 35.5
C — RESOLVE ADDRESSES
354 CALL F I N D (I D A T A (83),IHIT,SYMTAB) .I F d H I T . G E . 0)GO TO 355 ' .CALL EFRQUE(l) '
355 CONTINUEIDATA (2) = I O A T A (2) .OR, IHIT
■ 356 WRITE ( 6 , 6 0 Q 2 ) ( I D A T A ( J ) ,J= l , 8 2 ) ,1
C-- LOAD INSTRUCTION INTO MEMORY
360 CALL W R T M E M d D A T A (1) , I DATA (2) )37 0 CONTINUE
CALL E R R W R T (0)I F ( K D U M M Y .EQ. 0)GO TO 380 IPOINT = KDUMMY GO TO 378
377 IF(IPOINT.Ed.Q)GO TO 380
C— LIST LITERAL POOL
LINCNT = LTNCNT + 1 .. I F (LINCNT.LT.KOUNT)GO TO 376
CALL P A G H E D (3)378 CONTINUE .
W R I T E (6,6006)LINCNT = LINCNT •+ 4
376 CONTINUEWPITE(6,6008) L I T P O L (3,IPOINT), L I T P O L (2,IPOINT) IPOINT = LITPOLd,IPOINT)'GO TO 377
380 CONTINUE
ASSEMP FORTRAN EXTENDED VERSION 2a 0/E 04/29/72
IPOINT = IDUMMY . IF {L ABTST o NE..0 .OR. IPOINT.EQ. 0 > GO TO 410 CALL P A G H E D (1)
400 CONTINUEI F d P O I N T o E O . 0)GO TO 410
C-« LIST SYMBOL TABLE . . e
'LINCNT - LINCNT + i IF CLINGNT.GT.KOUNT)CALL PAGHED(l)
■ W R I T E (6,600 0) (SY M T A 3 ( I ,I P O I N T ) ,1=2,3)IPO INT = S Y M T A B d , I P O I N T )GO TO 400 .
. 410 CONTINUE RETURN
C6000 FORMAT(10X,A6,5X,O5)6001 FORMAT(5X,3H— A9,3H-«— ,2X,80R1,1X,I5)6002 FORMAT(5X,O5,4X,O5,2X,8 0Rl,lX,I5>6003 FORMAT(5X,05,12X,3 0R1,1X,I5)6 004 FORMAT(22X,8 0R1,IX,15)6005 FORMAT(2X,6H***** ,A7,6H * » * * * , 14X,3A10)6006 F O R M A T (1 H - ,4 X ,23HL I T £ R A L P O O L/1H0,6X,7 HADDRESS,
C7HLITERAL)6008 FORMAT(7X,05,5X,06)WO 0'9 'rORM%TT3X T*LIT ERAL ' NOT -FOUND IN LITERA L -TABLE*)
PURPOSETHE CHAIN SUBROUTINE HILL PLACE A SYMBOL(OR LITERAL) KN THE SYMBOL TABLE(OR LITERAL POOL) IF IT HAS NOT BEEN
. . ENTERED YETo «o ' O
DESCRIPTION OF PARAMETERS .SYMBOL - SYMBOL(OR LITERAL) TO BE PLACED IN LINK LIST VALUE ' - ADDRESS TO BE ASSIGNED TO SYMBOL WHEN PLACED
IN TABLEIHIT - IF LESS THAN 0 SYMBOL WAS ENTERED IN TABLE
OTHERWISE DUPLICATE SYMBOL.» ' LIST - ARRAY. THAT CONTAINS SYMBOL TABLE OR LITERAL POOL .„ KPOINT - POINTER OF NEXT ENTRY INTO SYMBOL TABLE OR
LITERAL POOLO' ' • ■ ' «p e o e e e o e e o o o e o o e o e e o o e o e e e o e e e e e e o e o o o s e o o e o e c o e o o o o e e e e e e o e e e o . e e e e o e
SUBROUTINE CHA I N (S Y M B O L ,VALUE»IHIT $ L I S T »KPOINTt INTEGER SYMBOLINTEGER AFTER • ... ” -INTEGER BEFORE INTEGER VALUE
DIMENSION L I S T (3*50)
COMMON /TEMPRY/ AFTER,BEFORE,KSAVE
CALL F I N D ( S Y M B O L ,IHIT,LIST)
C-- TEST FOR SYMBOL IN TABLE ,
IF(IHIT.GE.O)GO TO 10
C-- PUT SYMBOL IN TABLE
L I S T d , K P O I N T ) •= AFTER L I S T (2,KPCINT)=SYMBOL L I S T (3,KPOINT)=VALUE L I S T d , B E F O R E ) = KPOINT KPOINT = KPOINT + 1
. ..,COHM.O.N ,y.O.N£Z . ..XT NO N.I., I TEXT (SO) »JC.O.UNT.? NUMBER COMMON /TWO/ TRACE,ERROR,ERRFLG,DDUMP COMMON /THREE/ICHAR,KIND,FIELD(4,2),I POINT,LOCATE COMMON /FOUR/ IFROH (2 , 10 > , ITO(.IO)
DATA IA0J/33B/DATA KTIHE/O/DATA lASMB/lRA,IRS,1RS,1RE,1RM,1RB,1RL,1RY/DATA IMACH/1RM,1RA,1RC,1RH,1R1,1RN,1RE/DATA IDUMP/iRB,lRU,lRM,lRP,iR</DATA ITRACE/1RT,1RR,1RA,1RC,1RE/
G O T O (10,40,60, 120)',ISAVE 10 CONTINUE
■ IS COMMAND SASSEMBLY
2030
40
DO 20 1=1,8I F d C H A R . N E e l A S M B d ) >G0IPOINT = IPOINT + .1CALL G E T N E X d T E M P )CONTINUEISAVE = 0RETURNCONTINUE
TO 115.
C — IS COMMAND 2MACHINE
DO 50 1=1,7I F d C H A R . N E d M A C H (I) )G0 TO 115 IPOINT = IPOINT + 1 CALL G E T N E X d T E M P )
50 CONTINUE
/
CHECK FORTRAN EXTENDED VERSION 2. 0/E 04/29/72 65
GO TO 30 120 CONTINUE
C-- IS COMMAND STRACE
DO 130 I = 1,5IF(ICHAR.NE.ITRACE(I))GO TO 115 ,IPOINT = IPOINT + 1 CALL GETNEX(ITEMP)
130 CONTINUE GO TO 30
60 CONTINUE
C-= IS COMMAND SDUMP
ISAVE = 0KTIME = KTIME + 1IFtKT I M E e G T . l Q ) W R I T E (5,6000)DO 70 1=1,5IF(ICHAR.NE.IDUMP(I))GO TO 110 IPOINT - IPOINT 4-1 CALL GETNEX(ITEMP)
70 CONTINUEKFLAG = 0 . .IFLAG = 0
.75 CALL TYPE(ICHAR+192)-IF4'K'IND.#E'«*)-GO TO 77 IFLAG = 1ICHAR = ICHAR - IADJISAVE = S H I F T (I S A V E ,3) .OR. ICHARGO TO 80
C— IFLAG EO TO 1 MEANS FIRST CHARACTER C-- OF FIRST PARAMETER HAS BEEN FOUND
77 IFCIFLAG.EO.l)GO TO 90 80 IPOINT = IPOINT 4- 1
CALL GETNEX(ITEMP)GO TO 75
C-" KFLAG EQ TO 1 MEANS PROCESS 2ND PARAMETER
90 I F C K F L A G . E Q . D G O TO 100 I F R O M d , K T I M E ) = ISAVE IFR0MC2,KTIME) = LOCATE KFLAG = 1 ISAVE = 0 GO TO 80
10 0 ITO(KTIME) = ISAVE
C-- SET DDUMP
DOUMP = .TRUE.IPOINT = 0 VGO TO 30
110 IPOINT - 0 GO TO 118
115 IPOINT = 1
CHECK FORTRAN EXTENDED VERSION 2.0/E 04/29/72
118 ISAVE = 1 . RETURN
C60 00 FORMAT(3X,37HM0RE THAN 10 DUMP REQUEST ENCOUNTERED)
C— TEST FOR COMMENT CARDIF(ICHAR.EQ,IASTRK)GO TO 25
C-= TEST FOR iTRACE CARO• CALL GETNEXCIEND)ISAVE = 4 . 'CALL CHECK (ISAVE)I F d S A V E . N E . 0) GO TO 10 ITEMP = ONIF(TRACE)ITEMP = OFF TRACE = .NOT, TRACE GO TO 30
10 CONTINUE C-~ TEST FOR SDUMP
IPOINT = 2 CALL GETNEX(IEND)ISAVE = 3 .CALL CHECK(ISAVE)IF(ISAVE,EQ,0)GO TO 25 ' .CALL ERRQUE (21)GO TO 25
20. CONTINUECALL E R R Q U E (10)
■ 25 CONTINUE• W R I T E (7) KKK,ITEXT,ITEMP,ITEMP,ITEMP,ITEM P
. GO TO 35
COMMND FORTRAN EXTENDED VERSION 2.0/E 04/29/7230 CONTINUE
• ISAVE = K = 1 DO 30 I = K,LITEMP (M-s-i) = REDMEMF (I-1,KTEMP, I DUMMY)M = M + 1IF(M.LT.8)GO TO 30W R I T E (6,60 01)ISAVE,(ITEMPCJ),J=1,6>M = 0ISAVE = ISAVE + 8
30 CONTINUEL = L - K 4- 1IF ( M . N E . 0)W R I T E (6,60 01 ) ISAVE,(ITEMP(J) ,J=1,L) WRITE(6,6003) . .RETURN
c ' '6000 FORMAT(3X,26HSYSTEM ERROR NO DUMP TAKEN)6001 FORMA T ( 3 X , 0 5 , 2 X , 8 ( I X ,06))60 02 F O R M A T d H O , 20X, 11H» D U M P */2X,8HL0CATI0N/)6003 FORMAT(1HO,16X,19H* E N D D U M P */lH )
END
FORTRAN EXTENDED VERSION 2.0/E x 04/29/72o o o o o o o o b o o e o s o o c c o o o o o o o e o o o o o o o o o o o o o e o o o o o o o o o o o o o o o o c e e o & o o
SUBROUTINE ERRQUE
PURPOSE yTHE ERRQUE SUBROUTINE SETS THE APPROPRIATE ERROR CONDITION
'DESCRIPTION OF PARAMETERSERRNUM - ERROR NUMBER
o o o o o e o o o o e o e O Q o e e o e o o e e o e o o e o e o o e o ^ o e e o o . e e o e e e o o t o e o o e o o o e e o Q e
COMMON /ONE/ LINCNT,ITEXK 80) ,ICOUNT,NUMBER COMMON /TWO/ TRACE,ERROR,ERRFLG,DDUMP
DATA C I E R R ( 1,1) ,1 = 1 ,3)/10HUNOEFINED ,10HOPE RA NO 910H ZDATA (I E R R ( 2,1) ,1=1,3)/10HILLEGAL AD,10HDRESS , 1 OH /DATA (IERR C 3VI) ,I=l,3) /iQHNAXE: T O O LVlOHONG si OH /DATA (IERR ( 4,1) ,1=1,3)/10HDUPLICATE ,10HLA3EL s 1 OH /DATA (IERR( 5,1) ,1 = 1 , 3 ) /10HUNDEFINED ,1QH0PE RA NO ON,10H END CARD zDATA (I E R R ( 6,1) ,1=1,3)/10HILLEGAL 0 , 10HPERAND , 1 OH zDATA ( I E R R ( 7,1) , 1 = 1 , 3 ) /10HNO OPERAND,10H ,1 OH zDATA (IERR < 6,1) , 1=1,3)/10HII LEGAL R , 10HOT AT ION , 1 OH zDATA (IERRC 9,1) ,1=1,3)/10HUN0EFINED ,10HOP CODE , 1 OH zDATA (XERRCIO,!) ,1 = 1 , 3 ) Z10H S ILLEGAL,10H AS BEG I N N ,1OHING CHAR. zDATA ( I E R R (11,I) ,1=1,3)/10.HSVMBOL TAR, 1GHLE FULL 9 10 H zDATA CIERR(12,1),1 DATA•(IERR(13,I),1 DATA (IERR(14,1) , I DATA (IERR C15 ,1) , I DATA (IERR(16,1) ,I DATA (IERR(17,1) , I DATA (IERR(18,1) ,1 DATA (IERR(19,1) ,1 DATA (IERR(2 0,1) ,I DATA (IERR(21,I) ,1 DATA .(IFPR (22,1) ,1 DATA (IEpR (23,1),I DATA (IERR(24,1) ,1
= 1 , 3 ) /10HILLEGAL LO,10HAD A D D R E S S , 1 0 H . /:1,3)/10HILLEGAL C H , 1 OHARACTER ,10H • " /:1,3)/10HILLEGAL LA,10HBEL ,10H /= 1 , 3 ) /10HIND ADDR/I,10HNOEXING WI,10HTH LITERAL/ =1,3)/10HSYM9OL TO,10HO LONG ,10H /■1,3)/10HADDRESS TO,1GHO LONG ,10H /=1,3)/10HLITERAL TO,lQHO LONG ,10H /:1,3)/10HLITERAL TO,10HO LONG ,1QH /=1,3)/10HNO J09 CAR,10HD »10H /:1,3)/10HILLEGAL CO,10HNTROL CARO,iOH /=1,3)/10HNO END CAR,10HO ,10H /:1,3) /10HORG HAS LA, 10H3EL ,10H ' /= 1,3) /1.0HEND HAS LA, 10H9EL ,10H /
DATA IERR0RZ6H ERRORZDATA IWARN/7HWARNING/DATA ERRFLGZeFALSEoZDATA K0UNTZ56ZDATA MAXZ24ZDATA KKZ5ZDATA KKKZ1ZDATA JJJZ2/
EPRHRT FORTRAN EXTENDED VERSION 2= 0/E 04/29/72
C-- TEST FOR ANY ERRORS OR WARNINGS
IFCERROR.EO.O}RETURN
C-- TEST FOR ERROR BY ERROR NUMBER
DO 10 I - 1,19.IF(tSHIFT (1,1-1).ANDoERROR) >EQ« 0)GO TO 10 ERRFLG = .TRUE.
C— IS ERROR MESSAGE TO BE WRITTEN ON DISK OR PRINTER'
' IF(IUNIT,GT.0) GO TO 5IF(LINCNT.GT.KOUNT)GALL PAGHED(3S WRITE(6,6000)TERROR, (IERR(ISJ),J=1,3)GO TO 10
5 ’ WRITE (7) KK,KKK$ CIERRd, J) , J=1 $ 3) , ITEXT ' ' NUMBER = NUMBER 4-1
10 CONTINUE
C— TEST FOR WARNING BY ERROR NUMBER
DO 20 1=20,MAXI F ((SHIFT(1,1-1).AND.ERROR) .EQ. 0) GO TO 20
C— IS ERROR MESSAGE TO BE WRITTEN ON DISK OR PRINTER
IF(IUNIT.GT.0) GO TO 15IF(LINCNT.GT.KOUNT)CALL PAGHED(3):WRITE(6,6000) IWARN,(IERR(I,J),J=1,3) .GO TO 20
15 WRITE(7) K K , J J J ,(IERR(I,J),J=1$3),ITEXT NUMBER = NUMBER + 1
SUBROUTINE FIND(SYMBOL,IHIT,LIST)INTEGER AFTER INTEGER. BEFORE '•INTEGER SYMBOL
DIMENSION LIST (3 ,50)
COMMON . /TEMPRY/ AFTER,BEFORE,KSAVE
AFTE'R '= LTST'Ol ,'!'). BEFORE = i ' '. "
IHIT - -1 10 IFTAFTER.EQ.O) GO TO 40
IF(LIST(2, AFTER)-SYMBOL)20,30,40 20 BEFORE = AFTER
AFTER=LIST Cl,AFTER)GO TO 10 ' :
30 IHIT = LIST(3,AFTER)40 CONTINUE . RETURN • END
oo
oo
oo
oo
oo
oo
oo
74
cc
' : FORTRAN EXTENDED VERSION 2.0/E . 04/29/72o o o o e o o o e o o o o o o o o o o o o o o o o e o o o o o o o o o o e o o o o e o o o c e o o o o o o o o o o o o o o e e e o c o o o
o
SUBROUTINE GETNEX
PURPOSE • •THE GETNEX SUBROUTINE READS THE INPUT STREAM AND RETURNS
0 . ONE CHARACTER EACH TIME IT IS CALLED. o
O ' DESCRIPTION OF PARAMETERS •IEND - IF EQ 0 END OF LINE »
IF LT 0 END OF FILE •IF GT 0 CHARACTER BEING RETURNED
120 IF( (SHIFT(IP»44-COC6400) .AND. TONE) ,GT. 0 > GO TO 320
— SET ROTATION DIRECTION . ,0 = LEFT . “ :1 = RIGHT
IDIREC = SHIFT(IR,5+CDC6400) .AND, TONE
C— TEST FOR ROTATION IN 1ST EVENT TIME
81MULATR FORTRAN EXTENDED VERSION 0/E 04/29/72
I F ( (SHIFT(IR? 6 + C D C 6 4 0 0 ) .AND. IO N E ) .N E . 0)AC = R O T A T E F (IDIREC »AC) CALL N E G C H K (AC$GO T 0'( 16 0 > 5 0 0 »140 » 15 0) ? (SHIFT ( I R 98-»-CDC6400).ANDeITHC) -i- 1
. C~= D L L ' -
140 AC = 118 .AND, AC . CALL NEGCHK(AC)GO TO 160
C-- - S T L ' .
150 AC = 119 .OR. AC160 GO TO (200,170,180,190),(SHIFT(IR.10+CCC6400) .ANO.ITHO) + 1
C-- S T A
170 AC = AC , O R . 118 GO TO 200
C“ ~ G L A
180 AC = AC .AND. (.NOT. 118)CALL NEGCHK(AC)GO T O 200
C=" C M A
190 AC - (119.AND.AC) .OR. ( (.NOT.AC) .AND. 118)CALL NEGCHK(AC)
C-- TEST FOR ROTATION IN 2ND EVENT TIME
' 200 I F ((SHIFT(IR,1H-COC640 0) .AND. ION E ) . N E , 0)AC = ROTATEF (IDIREC,AC)CALL NEGCHK(AC)GO TO (260,210,220,230 ,240,250,260,270),
C (SHIFT(IR,14+0006400) .AND. ITHREE) + 1
C-“ S Z L
210 I F ( (119.AND.AC) »EQ. 0)PC = PC + 1 GO TO 300
C - “ D F A
220 AC = (AC,AND.(.NOT,118)) .OR. (IA.AND,LAST13)CALL NEGCHK(AC)GO TO 280
C-- D F B
230 AC = (AC.AND.(.NOT.118)) .OR. (13.AND.LAST13)• CALL NEGCHK(AC)GO TO 280
C “ “ O T A
- • 82 M U LATR FORTRAN EXTENDED VERSION 2.0/E 04/29/72
240 IA = A C . A N 0 . U S T 1 3 '•GO TO 280 ' . '
C-- D T R
250 IB = AC.AN0.LAST13 ' 'GO TO 280 ,
C-- I N A : ;
260 IA = (IA f 1) .AND. LAST13GO TO 280 .
C— . I N B. •27 0 IB = (IB + 1) .AND. LAST13
C-- TEST FOR ROTATION IN 3RD EVENT TIME280 IF ( ( S H I F T d R , 15-6-0006 40 0) .AND. IONE). NE. 0) AG = ROT ATEF CIDIREC 9 A C )
GALL NEGCHK(AC)GO 70(300,281,282,283,284,265,266,287),
C (SHIFT(IR,18-i-CDC640 0) . AND.ITHREE) f 1
C— SKIP AC .GT. 0
281 IFC AC.GT.05PC ? PC + 1 GO TO 300
C— SKIP AC ,EQ. .0
282 I F ( A C . E Q .0)PC = PC * 1 GO TO 300
C— SKIP AC .GE. 0
283 I F ( A C .G E •0)PC = PC + 1' - •GO TO 300
C-- SKIP AC .LT. 0
284 I F ( A C .L T .0)PC - PC + 1 GO TO 300 ,
C-- SKIP AC .NE. 0
285 I F ( A C . N E •0)PC = DC * 1 GO TO 300
C-- SKIP AC .LE. 0
266 IF ( A C . L E . 0 ).PC = PC + 1GO TO 300 ' .
C— SKIP UNCONDITIONALLY
287 PC = PC + 1 300 CONTINUE
83MULATR FORTRAN EXTENDED VERSION 2,0/E . 04/29/72
C-- IF TRACE DUMP REGISTERS
IF(TRACE)CALL REGTRC FC = PC 4- i
C-= IF DUMP DUMP MEMORY
IFCDMPFLG.NE.0)CALL DUMP(MASAVE)GO TO 10
310 PC = IRoAND.LAST 13
C — IF TRACE DUMP REGISTERS
IF(TRACE)CALL REGTRC
C - “ IF DUMP DUMP MEMORY •
IFCDMPFLGoNEo 0)CALL DUMP (MASAVE)GO TO 10
320 IF( (SHIFT (IR,5+CDC6400) . AND. IONE) . NE. 0) GO TO .330
C-- R E A D
R E A D ( 5 91001) AC . ' .I F C E O F (5))325,300
325 HPITE (6 ,'l0 04) PC RETURN
330 LINCNT = L INC NT -i- 1IFCLINCNT.GT.5 2)CALL PAGHED(3)
C-- W R I T E
W R I T E (6,1000) AG GO TO 300
500 CONTINUE
C-- IF TRACE DUMP REGISTERS
IF(TRACE)CALL REGTRC
C== IF DUMP DUMP MEMORY
I F ( D M P F L G , N E . 0)CALL DUMP(MASAVE)W R I T E (6,1005) PC RETURN
C1000 FORMAT ( 8X,06).1001 FORMAT(06)1003 FORMAT(9X,16HVALUE OF HA WAS ,05)1004 F O R M A T (1 H 0 ,3 X ,58HE0F ENCOUNTERED EXECUTING INSTRUCTION AT S I C
. CLOCATION ,05)1005 FORMAT(1H0,3X,32HVALUE OF PC AT TERMINATION W A S , I X , 05)
. END
OO
OO
OO
OO
OO
OO
84FORTRAN EXTENDED VERSION 2.0/E 04/29/72
o o o o o f r o G o o o o o o o o o e o o o e o e c o e o o o o o G C o o o o o o e o e o o o o o e o o o o t i o o o o o o o o e e e o o c o
o „ °SUBROUTINE NEGCHK .
■ .PURPOSE .
THE NEGCHK. SUBROUTINE MAINTAINS THE PROPER SIGN FOR 13-BIT .WORDS. ' •
o oITEMP - CONTENTS OF REGISTERS WHOSE SIGN IS TO BE
CORRECTED .« . 00 0 0 0 6 o e o o o o o o o o e o e G o o o c e o e o t i o o o o c c o o o o o o o o o o o o o o c o e o e o o o o o c o o o o o o o o o o
SUBROUTINE NEGCHK(ITEMP)c ' • :
DATA ISIGN/4 0 0 0 0 08/DATA ISAVE/17777773/DATA KSIGN/AOOOOOOOOOOOOOOOOOOOB/
cIF((ITEMP.AND.ISIGN) .EQ. 0)GO TO 10
C-- SET REGISTER TO NEGATIVE
ITEMP = ITEMP .OR. KSIGN RETURN
. .10 CONTINUE
C — SET REGISTER TO POSITIVE
ITEMP = ITEMP .AND. ISAVERETURNEND
oo
Oo
oo
oo
oo
oo
oo
oo
oo
o
85FORTRAN EXTENDED VERSION 2.0/E 04/29/72
o c e o o c o o o o o o o e o G o e o t j e o o o o e o o o o c o o o o o o o o o o e o o o o o c o o o e e e o o o o o o o c o o o o o o '
SUBROUTINE O P R A N D (I N D F L G ,I N S T R U ,LA B T S T )INTEGER SYMTAB INTEGER SETINO INTEGER STNDX.A INTEGER STNDXB
.-INTEGER FIELD
COMMON /THREE/ ICHAR, KIND, F I E L D (4,2), IPOINT, LOCATE . COMMON /TABLE/ S Y H T A B (3,50), LITPOLC3,50)
DATA MAXMEM/8192/DATA SET I N D / 2 0 0 0 OB/ "DATA STNDXA/4 0 0 0 08/DATA STNDXB/6 00 0 OB/DATA LA ST13/177778/ .•DATA LAST18/777777B/DATA INITAL/2/
ITEMP = F I E L D (4,2)
-- TEST OPERAND FOR IND. AODR. OR INDEXING
I F (I T E M P .N E .0 .AND. ITEMP.NE. 1)GO TO 2 IF (FIELD (3, 2) .EQ. 0) CALL. ERRQUE(7)F I E L D (4,1) = F I E L D (3,1)F I E L D (4,2) = FIEL0(3,2)INDFLG = -i .
2 CONTINUE
■ - T E S T FOR SYMBOLIC LABEL
IF(LABTST.EC.O)GO TO 5GO TO (50,50,12,3,6,7,50,5 0) , ITEMP f 1
• 3 IHIT = F I E L D (4,1) .AND. LAST 13 GO TO 15
. 5 CONTINUEGO TO (50,50,10,3 ,6,7,50,50),ITEMP + i '
OPRAND FORTRAN EXTENDED VERSION 2= 0/E 04/29/72C-- RIGHT-JUSTIFY ALPHA LITERAL
COMMON /ONE/ LINCNT, I T E X K 8 0 ) , ICOUNT , NUMBERC
DATA IPAGE/0/G . " -
LINCNT = 4 IPAGE=JPAGE + 1 GO TO (10,20,30),J
10 W R I T E (6,10 0 2)IPAGE WRITE (6,10 00)RETURN
20 WRITEC 6,1001) IPAGE RETURN
3 0 W R I T E (6,1002) IPAGE RETURN
C1000 F O R M A T (10X,6HSYMB0L,5X,7HADDRESS/)1001 F O R M A T (1 H 1 / , 2 X , 2 OHMACHINE I N S T R U C T I O N S ,5 X ,18HS L I C PROCESSOR
C,T100,4HPAGE,I5//)1002 F0PMAT(1H1,T47,19HS L I C P R O C E S S O R , T 100, 4HPAGE ,15//)
END
FORTRAN EXTENDED VERSION 2.0/E 04/29/72o o e o o e o e o e o o o o e e o o o e o o o e e o o e e e e o o e o e o e o o o o e o o e o o e e e o e o e e o e e o e e
• INTEGER FUNCTION REOMEMF
PURPOSETHE REOMEMF FUNCTION READS 18-BITS WORDS FROM SIC MEMORY AND.DETECTS TRACE AND DUMP FLAGS,
DESCRIPTION OF PARAMETERSMA - ADDRESS INFORMATION IS TO BE READ FROMITRACE - IF EQ 0 NO TRACE
IF EQ 1 TRACE IDUMP - IF EQ 0 NO DUMP
IF EQ 1 DUMP • '
e e o & e e e e o o e G O O o e e e G e e e o o e e e o e e o o e e o e e o o o o e o & o e e e e o e c o e o o e o f t e o e
INTEGER FUNCTION REDMEMF(MA $IT R A C E $IDUMP) ’ .COMMON M E M O R Y (2731)
DATA LAST 20/37777776/DATA IDELET/7777773/DATA ION E / 0 0 0 000000000010000008/ .DATA 1 20/2 0 0000 0'8/ %DATA M AXMEM/8192/
TEST MEMORY LIMITS
IFCMA.GE.O .OR. MA.LT.MAXMEMIGO TO 10 CALL E R R O U E (2)
0 CONTINUE ICUMP = 0 ITRACE = 0
ADJ ZERO ORIGIN NUMBERING SYSTEM
M = MA + 1
CALCULATE MEMORY ADOR.
d = M - ((M/3)*3)REDMEMC = SHIFT(MEMORY((M+2)/3),20*J) .AND. LAST20 .IF(SHIFT((REDMEMF.AND,IONE),-18) .EQ.l)ITRACE " 1 I F t S H I F T ( (REDMEMF.AND.120),-19).NE.0) ICUMP = 1 REDMEMF = R E D M E M F .AND.IDELET RETURN END
FORTRAN EXTENDED VERSION 2,0/E 04/29/72e o o o o G O G O o c . o e o e o o o o o o o o o o e o O G O O o o o o o o c o o p o o o o o o c o o o c o e o o o o t s o o o o o
SUBROUTINE ROTATE
PURPOSETHE ROTATE SUBROUTINE DETERMINES WHICH ROTATE INSTRUCTION
DESCRIPTION OF PARAMETERS.INSTRU * MACHINE INSTRUCTION RETURNED
' IDIREC - IF EG 0 . ROTATION IS LEFTIF EQ 1 ROTATION IS RIGHT
e o o o o o o e o - e o e e e o e e o o o o o e e o o e e o o o o e o o e o o o o e e e o p e e o c e e o e o o ^ e o o e e o e o
SUBROUTINE R O T A T E ( I N S T R U sIDIREC)INTEGER FIELD
DIMENSION I R O T A T (81
COMMON /THREE/ .ICHAR, 'KIND, FTELD(4,2), IPOINT, LOCATE COMMON /TEMPRY/ ITEMP,ISAVE, KSAVE
DATA IROTAT/730000B, 730000B, 730200B, 7302108,C 7100008, 7100008, 7102003, 7102108/
■ TS'A'VE = FT'-ELD-(4-,l) •+ 1
TEST ROTATE PARAMETER LIMITS
I F U S A V E . L T , 1 .OR, ISAVE. GT. 4)G0 TO10 20 IF(IDIREC.EQ.0)ISAVE = ISAVE + 4
INTEGER FUNCTION R O T A T E F (I D I R E C »AC )INTEGER AC • .
. DATA 119/10000003/DATA M A S K / 17777768/
CIF(IDIREC)10»10»20
10 ROTATEF = (SHIFT(AC,1).AND.MASK) .OR. S H I F T ( (AC.AND.119)$” 18) RETURN
20 POTATEF = S H I F T ((A C .A N D .1),18) .OR. S H I F T (A C 1)RETORNEND
-.6
ROTATION OF THE
Ie
FORTRAN EXTENDED VERSION 2.0/E 04/29/72o o e e o e e e o e o o o o o e o & o o o e o o e o e o o o o s o o o e e o o o o o e c o o o o o o o o o o e c e e o o
SUBROUTINE SCAN
PURPOSETHE SCAN SUBROUTINE OBTAINS THE POINTER ASSOCIATED WITH
. EACH CHARACTER.
DESCRIPTION OF PARAMETERS ' INDEX - TABLE POINTER
IEND . - IR EQ 0 END OF LINEIF LI 0 . END OF FILEIF GT 0 CHARACTER BEING RETURNED .
SUBROUTINE SYMBOL(LA B T S T , I A D D R $IFINO)' INTEGER FIELD
INTEGER SYMSIZ INTEGER SYMTAB
CCOMMON /ONE/ . L I N C N T ,IT E X T (801,I C O U N T ,NUMBERCOMMON /THREE/ ICHAR, KIND, F I B L D <4,2),IPOINT , LOCATECOMMON /TABLE/ S Y M T A B (3,53), LITROL(3,50)
C .DATA SYMSIZ/5 0/DATA I NITAL/2/ -DATA ICOUNT/O/DATA ITEST/OZ
C-- BRANCH ACCORDING TO SYMBOL TYPE
GO TO (80,70,20,30,70,70,70,7 0 ) , F I E L D (1,2) > 1
C--' HAS LABEL TYPE BEEN SET
2 0 CONTINUEI F (ITEST o NE o 0)GO TO 25ITEST = 1 'LABTST = 0
25 IFCLABTST.NE.0)GO TO 35 IFIND = -l
C-- PLACE SYMBOL IN SYMBOL TABLE "
27 CALL C H A I N ( F I E L D(1,1),IADDR,IFIND,SYMTAB,INITAL) IF(IFIND,LT.O)ICOUNT = ICOUNT > 1
C— CHECK LIMIT ON SYMBOL TABLE SIZE
I F d C O U N T . E o . SYMSIZ) CALL ERRQUE (11)RETURN
30 CONTINUE ' 'i F d T E S T , N E « 0) GO TO 33 ITEST = 1 L A B T S T .= 1
I WORD - (NEXT/20) 4-1IFIELO = (NEXT*3) * 63 - (IW0RD*6D)KIND = SHIFT(ITABLE(IWORD),IFIELO) ,AND, 7RETURNEND
oo
po
oo
oo
oo
oo
o
98FORTRAN EXTENDED VERSION 2.0/E 04/29/72
o o o c e o G C d O o o o o o o o o o o o Q O O o o o o o o o o o e o o o o o o o o e o o o e o c o o o o o o o e o o c & o o e e o o o o.SUBROUTINE NRTMEM .
' ' ->
PURPOSETH E WRTHEM SUBROUTINE WRITES 20-BITS OF INSTRUCTION AND .FLAGS INTO SIC M E M O R Y . . .
0 *DESCRIPTION OR PARAMETERS ■ «
IADOR - . ADDRESS INFORMATION IS TO BE STOREDIDATA - INFORMATION TO BE STORED
SUBROUTINE W R T M E M d A D O R , I D A T A )COMMON M E M O R Y (2731)
DATA MASK/77777777777774 0 000 0 OB/DATA L A S T 2 0/3777777B/DATA MAXMEM/8192/
IFCIAODR.GE.O .OR. IADDR.LT.MAXMEM)GO TO 10 CALL E R R Q U E (2)
10 CONTINUEd D A X A = IDATA .AND, LA ST 20 J = 2 - (IAODR- ((IADDR/3)'^3))ITEMP = SHIFT(MASK,20*J) .AND. M E M O R Y (CIADDR+3)/3)M E M O R Y ((IAODR+3)/3) = SHIF T ( I D A T A ,20*J > . .OR. ITEMPRETURNEND
LITERATURE CITED
Auerbach Standard ED? Reports, 1'Minicomputer Design." Auerbach, Inc., Philadelphia, Pa., revised to 1971.
Cheatham, T. E c, and K. Sattley. "Syntax-Directed Compiling," Proceedings of the Eastern Joint Computer Conference, AFIPS, Vol.25, pp. 31-57, 1964.
Flores, Ivan. The Logic of Computer Arithmetic. Prentice-Hall, Inc.,Englewood Cliffs, N. J., 1963.
_____________ Computer Software. Prentice-Hall, Inc., EnglewoodCliffs, N. J., 1965.
Gear, C. William. Computer Organization and Programming. McGraw-Hill Book Co., New York, 1969.
Cries, David. Compiler Construction for Digital Computers. John Wiley and Sons, Inc., New York,. 1971.
Gruenberger, Fred. Computing: An Introduction. Harcourt, Brace andWorld, Inc., New York, 1969.
Hill, F. J., and G. R. Peterson. Introduction to Digital Hardware Systems. John Wiley and Sons, Inc. (in press).
Hull, T. E. Introduction to Computing. Prentice-Hall, Inc., Englewood Cliffs, N. J., 1966.
Irons, E. T. "A Syntax-Directed Compiler for ALGOL 60," Communications of the ACM, Vol. 4, pp. 51-55, Jan. 1961.
Katzan, Harry, Jr. Advanced Programming. Van Nostrand Reinhold Co., New York, 1970.
Knuth, Donald. The Art of Computer Programming. Addison-Wesley Publishing Co., Inc., Reading, Mass., Vol. 1, 1969.
Liu, C. L., G. D. Chang, and R. E. Marks, "The Design and Implementation of a Table-Driven Compiler System," Proceedings of the Spring Joint Computer Conference, AFIPS, Vol. 30, pp. 691-697, 1967.
Maurer, W. D. "An Improved Hash Code for Scatter Storage," Communications of the ACM, Vol. 11, pp. 35-38, Jan. 1968.
99
100
Morris, Robert. ’’Scatter Storage Techniques,” Communications of the ACM, Vol. 11, pp. 38-44, Jan. 1968.
Price, C. E. ”Table■Lookup T e c h n i q u e s ACM Computing Surveys, Vol. 3, pp. 49-64, June 1971.