SYMBOLIC LANGUAGE PROCESSOR FOR.A by Billy...
Transcript of SYMBOLIC LANGUAGE PROCESSOR FOR.A by Billy...
Symbolic language processor fora small instructional computer
Item Type text; Thesis-Reproduction (electronic)
Authors Walter, Billy Wayne, 1944-
Publisher The University of Arizona.
Rights Copyright © is held by the author. Digital access to this materialis made possible by the University Libraries, University of Arizona.Further transmission, reproduction or presentation (such aspublic display or performance) of protected items is prohibitedexcept with permission of the author.
Download date 08/05/2018 14:15:02
Link to Item http://hdl.handle.net/10150/318181
SYMBOLIC LANGUAGE PROCESSOR FOR.A
SMALL INSTRUCTIONAL COMPUTER
by
Billy Wayne Walters
A Thesis Submitted to the Faculty of the
COMMITTEE ON COMPUTER SCIENCE
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
Memory Reference Instructions (MRI) .......... 7Operate Instructions..........-................. 9Input-Output Transfer Instructions ............... 12
3 SLIC IMPLEMENTATION.................... 13
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
Assembler Usage . . . . ............... 27Assembler Commands .................... . . . . 27Assembler Instructions . . . . . ............. 28
Machine Language Processor U s a g e ................. 31
5 RECOMMENDATIONS AND CONCLUSIONS ..................... 32
APPENDIX A: SAMPLE PROGRAMS ....................... 36
APPENDIX B: SLIC COMMANDS AND SIC INSTRUCTIONS.................. 51
APPENDIX C: SLIC PROGRAM L I S T I N G ................................. 52
LITERATURE CITED 99
LIST OF ILLUSTRATIONS
Figure
1. Register organization „ , .
2. MRI instruction format . e
3. Operate instruction format
4 e IOT instruction format.. e .
5. SLIC syntax table . . . . .
6e Symbol table structure „ . .
7. Example of assembler commands
LIST OF TABLES
Table Page
1 o Indexing and indirect addressing ......... 8
2. MR I instructions...................................... . 9
3. Operate instructions .......................... 11
4. Lexical analysis table structure ...................... 18
vii /
ABSTRACT
This thesis presents a symbolic language processor for a small
instructional computer called SIC. The processor known as SLIC, pro
vides the capability to process machine-level instructions for the SIC
computer on the CDC 6400 computer system. . Debugging facilities are
included to assist students with computer program development. A
FORTRAN source listing of the processor and sample SIC machine-level
programs are included as appendices.
CHAPTER 1
INTRODUCTION . /
The purpose of this thesis is to provide a laboratory for
students of computer design who use the text Introduction to Digital
Hardware Systems by Professors Hill and Peterson (in press.) of The
University of Arizona. Hill and Peterson in their text present a Small
Instructional Computer, hereafter referred to as SIC, to describe gen
eral computer design concepts. The processor described herein provides
the user with a pseudo-SIC computer for execution of the SIC instruc
tions. This paper describes a processor known as SLIC (Symbolic Lan
guage processor for a small Instructional Computer) which will
translate SIC symbolic instructions into SIC machine instructions and
emulate their execution. SLIC provides the capability of executing the
symbolic instructions or the machine instructions given in Hill and
Peterson.
The SLIC processor consists of four basic modules: the super
visor (SUPERV) which has the responsibility of assessing the type of
run to be made, i.e., assembly or machine language and enabling execu
tion if no fatal errors have been detected; the assembler (ASSEMB)
which translates valid symbolic instructions into executable code and
loads them into SLIC memory; the loader (LOADR) which reads machine
language instructions' and loads them into SLIC memory; and the emula
tor (MULATR) which executes valid instructions.
2.SLIC is not intended to teach computer design but rather to
provide a vehicle for .understanding design principles. It is hoped
that by using this processor the user will gain a better understanding
of the use of machine-level computer instructions.
SLIC is written in FORTRAN EXTENDED for the Control Data Cor
poration (CDC) 6400 Computer. SLIC has been adapted to run on the CDC
time-sharing system INTERCOM 2 at The University of Arizona, Tucson.
Scope of Work
This thesis consists df five chapters: Introduction, SIC Com
puter, SLIC Implementation, SLIC Programming, and Conclusions and Rec
ommendations. In addition there are three appendices: Sample Programs,
SLIC Commands and SIC. Instructions,, and SLIC Program- Listing.
Chapter 2 describes the architecture of the SIC computer.
Chapter- 3 explains in detail how the assembler is constructed. Chapter
4 tells how to use the SLIC processor.
CHAPTER 2
' ; SIC COMPUTER -
The SIC computer as designed by Hill and Peterson (in.press)
permits the study of the functional units of a digital computer by in
vestigating their logical operations without being burdened with the
intricacy of electrical engineering or the sophistication.of large
scale computers. By approaching computer design in this manner,
classes have been held at The University of Arizona equally divided be
tween computer science students with little or no engineering back
ground and electrical engineering students with little or no computer
science background. The idea is to get the students involved with the
logical ordering of logical components of a small computer. The SLIC
processor will supply students with a virtual SIC computer to use as a
tool for the understanding of machine-level programming concepts.
SIC is similar to what is. called a minicomputer (Auerbach Stand
ard EBP Reports revised to 1971); that is, the architectural constraints
usually limit the word size, memory size, hardware configurations, and
instruction repertoire. Other features used for defining minicomputers
are usually their small physical dimensions and economical circuit de
sign.
The smallest addressable unit of internal storage in the SIC
computer is the word. There are 8,192 random access core memory words.
Each of these words contain 18 binary digits or bits. The memory word
3
locations which are numbered from 0 to 8191 (17777 octal) are called
the memory addresses. The SIC computer is a stored-program computer
with data and instructions represented in the same internal form.
Registers
Before instructions can be executed or operations performed on
data, these words must be fetched from their respective memory addresses
and stored in .temporary storage locations known as registers. A de
scription of each of the seven SIC registers follows.
Instruction Register (IR)
Machine-level instructions which have been loaded directly into
memory or translated from another language and loaded into memory are
fetched in some prescribed order and placed into the IR. Once an in
struction has been placed into the IR, it can be decoded to determine
the operation to be executed. The IR contains 18 bits.
Program Counter (PC)
The PC contains the address of the next instruction to be exe
cuted. The PC is updated at some time during or after the execution of
an instruction. The PC is incremented to the next instruction in se
quence unless the instruction being executed is a branch instruction.
In the case of a branch instruction the address of the instruction be
ing branched to is loaded into the PC. The PC is 13 bits long so that
addresses from 0 to 8191 can be stored.
Memory Address Register (MA)
The address of information (data or instructions) to be read
from or written into memory is placed into the, MA register before the
memory read or write operation is performed. The MA which contains ad
dresses is 13 bits long.
Memory Data Register (MD)
The MD register is the register into which information is
placed when a read from memory is performed. Conversely, when a write
to memory is performed, the information to be written is placed into
the MD register before the write operation is executed. The MD regis
ter is 18 bits long.
Accumulator (AC)
The AC is a general-purpose ^register used for arithmetic and
logical operations. An argument of the operation to be performed usu
ally resides in the AC prior to execution. The result of the operation
is left in the AC. The AC is 18 bits long, but appended to the left
most bit is a "link" bit which-may be set as the result of some opera
tion, e.g., arithmetic overflow.
Index Registers A and B (IA and IB)
The IA and IB are indexing registers which may be added to the
contents of the MA to manipulate the address of data being read from
memory. The IA and IB registers are 13 bits long.
Data Paths
The interconnecting data paths of memory and registers are
given in Figure 1. The arrowheads indicate the direction of data
flow. Note that the link bit of the AC is denoted by M^.u
IB MAIA
PC
IR
AC MD Randomaccessmemory
Figure 1. Register organization
When a register transfer from an 18-bit register to a 13-bit
register occurs, only the right-most 13 bits of the 18-bit register are
transferred. If the transfer is from a 13-bit register to an 1.8-bit
register, then the 13 bits are stored in the right-most 13 bits of the
18-bit register.
Instructions >
The instructions of the SIC computer have two formats. The
first format is that of the single-address memory reference instruction
(MRI) which is diagrammed in Figure 2.
Memory Reference Instructions (MRI).
A MRI instruction performs some operation on an operand stored
in memory, such as adding the contents of* a specified location to the
contents of the accumulator. The bits of the instruction words are
numbered from left to right using zero-origin numbering.
0 1 2 3 4 5 - 1 7
Figure 2. MRI instruction format
The right-most-13 bits (bits 5 through 17) contain the address
of the operand to be read from memory.
Bits 3 and 4 are used to specify whether indexing or indirect
addressing are to be applied to the address specified in bits 5 through
17. The bit combinations are given in Table 1. If bit 3 is zero and
bit 4 is one, then the address in bits 5 through 17 specifies the ad
dress of a memory location containing a word whose last 13 bits are the
address of the operand. If bit 3 is one 'and bit 4 is zero, the con
tents of the IA are added to the MA after bits 5 through 17 of the
instructions have been moved to the MAe Likewise, if bits 3 and 4 are
ones, the contents of the IB are added to the MA.
Table 1. Indexing and indirect addressing.
Bi ts3 4 Meaning
0 0 No indexing or indirect addressing
0 1 Indirect addressing
1 - 0 Add index register A to address
1 1 Add index register B to address
The MRI instructions to be performed are determined by bits 0
" through '2. The^se Are listed 'in Table 2 using the mnemonic forms of the
SLIC processor.
The ISZ instruction increments the operand and skips the next
instruction if the operand is equal to zero. LAC will load the accum
ulator with the operand. The AND instruction will cause the logical
anding of each bit of the operand with each bit of the accumulator
leaving the results in the accumulator. TAD will add the operand, to
the contents of the accumulator leaving the results in the accumulator.
The JMS instruction will increment the program counter and store its
contents in the address specified in the operand-address portion of the
instruction; then the program counter will be set to the value of the
operand-address plus one. The DAC instruction will deposit the operand
in the accumulator. If all of the bits in bits 0 through 2 of the
9
Table 2. MRI instructions.
MNEMONIC Bits T1 . 4..OPCODE 0 - 2 ' Description
ISZ 0 0 0 Increment and Skip on Zero
LAC 0 0 1 Load Accumulator
AND 0 1 0 Logical And
TAD 0 1 1 Two1s-Complement Add
JMS 1 0 0 Jump to Subroutine
DAC 1 0 1 Deposit Accumulator
JMP 1 1 0 Jump
- 1 1 1 Non-MRI Instructions
instruction word are one, then the instruction is not a memory refer
ence instruction. These instructions will be discussed later in this
chapter.
Note that the SIC computer contains only one arithmetic operator,
the Two1s-Complement Add (TAD). Examples of two1s complement arithme
tic can be found in many introductory computer books (Flores 1963, pp.
32-33; Gruenberger 1969, pp. 45-57; Gear 1969, pp. 26-31). No divide,
multiply, or floating-point operations have been implemented in the SIC
design.
Operate Instructions -
The operate instructions perform some operation on the contents of
registers, halt execution, or perform no operation. Since the operate\ . . '
' ' L :
10
instructions (specified by bits 0 through 2 equal to all ones and bit 3
equal to zero) do not require the time consuming memory fetches of the
MRI instructions, several operate instructions can be executed during
one clock cycle. The clock cycle is divided into three event times.
This permits the combination of several instruction executions provided
the instructions are logically meaningful. A halt (HLT) and set accum
ulator (STA) would be an illogical operation.
The operate instructions (Figure 3) and their groupings within
the three event times are given in Table 3. If a rotate of the AC is
to be performed,the direction of the rotation is set with bit 4. If
bit 4 is zero, the rotation is set with bit 4. If bit 4 is zero, the
0 1 2 3 4 5 - 9 10 - 13 1 4 - 1 7
Figure 3. Operate instruction format
rotation will be to the left. If bit 4 is one, the rotation will be to
the right. The link bit of the AC is included in the rotation which is
circular. A Rotate AC Right (RAR) instruction will move the link bit-
to bit 0 of the AC and bit 17 of the AC to the link. One rotation is
permitted per event time; thus RAR 3 would generate an instruction
730210 (represented in octal notation) for a three-position right ro
tation.
The HLT instruction terminates the execution of further in
structions of a sequence. The CLL instruction will clear the link to
11
Table 3. Operate instructions.
Eventtime Bit(s) Instructions
4 0 Rotate direction is t.o the left1 Rotate direction is to the right
5 0 NOP1 Rotate AC
6,7 00 NOP01 HIT10 CLL11 STL
8,9 00 NOP01 STA10 CLA11 CMA-
1011,12,13
14
15
16
17
0 NOP1 Rotate AC
000 NOP001 SZL010 DFAOil DFB100 DTA101 DTB110 INA111 INB
0 NOP1 Rotate AC0 NOP1 SKN0 NOP1 SKZ0 NOP1 SKP
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
5 Alphameric literal, blank or / 1 Delimiterelse 7 • Error
2 Name ■ 6 A to Z 2 Continueor 0 to 9
blank or , 1 End of fieldWise ' 7 Error
3 Absolute 5 0 to 7 3 Continueaddress blank or / 1 End of field
else 7 Error
4 Numeric 6 0 to 7 4 Continueliteral blank 1 End of field
else 7 Error
5 Alphameric 3 not a ^ 5 Continueliteral 1 End of field
6 Negative ~ (minus) 6 Continuenumber 0 to 7 4 Continue
else 7 Error
7 Error - , ^ / or blank 1recovery else 7
DelimiterContinue
19
The maximum length in characters column, has no valid meaning
for the starter5 negative number, or error recovery segments. The
characters column is used in conjunction with the pointer to next table
column to determine which table is to be used to analyze the element.
The meaning column gives an abbreviated meaning of the entry.
The diagnostics performed during lexical analysis will detect
illegal characters in elements and elements which are too long.
Syntactic Analysis
The syntactic analysis portion performs a mechanical inspection
of the element list to see if all of the rules (Figure 5) of the SLIC
assembly language are observed. The symbol table which is used in pass
..two is ,generated, the location counter is maintained, and indirect ad
dressing and indexing are detected. Next, valid instruction codes are
generated from the symbolic operation codes and written onto the disk
for processing by pass two. In the case of the MRI instructions, the
memory locations may or may not be known, so the instructions written
to the disk are devoid of these addresses. These addresses are the
subject of pass two to be discussed later.x Before exiting pass one
the literal pool is assigned addresses immediately following the last
instruction or data assignment processed.
The rules which govern the syntactic analysis are given in the
syntax table in Figure 5. To use the syntax table, the elements en
closed in each grouping (denoted by a left bracket) are checked seri
ally, beginning with the first grouping, until an element type is de
tected. Then the arrow to the right or left which points away from the
20
Start Name —--
Absolute Address
blank field
Op Code
Numeric Literal
Alphameric Literal
I
A
B
Operand
Absolute Address
Numeric Literal
Alphameric Literal
blank field
Operand
Absolute Address— > -
vend of
analysis
Figure 5„ SLIC syntax table
. ■ 21
element is followed to determine what permissible elements may follow
the one detected. Should an element type not be detected in a group
ing, then a violation of the syntax rules has occurred. Diagnostics
produced in syntactic analysis reveal violations of the syntax rules.
They reflect symbols, symbolic operation codes, absolute address, or
operands which are illegal.
Pass Two - , '
Pass two of the SLIC assembler produces executable machine-
language code, loads the machine code into memory, and gives a listing
of the code produced, the location of the code in memory and the orig
inal symbolic instructions. In producing valid machine code, pass two
reads the code written .on the disk file during pass one and updates the
memory reference instructions with the addresses of the symbols and
literals found in the symbol table and literal pool. Undefined symbols
are detected and a diagnostic is produced. After listing the literal
pool and symbol table, the assembly process is completed and the SLIC
processor proceeds immediately to execute the machine language code
that was generated, providing no fatal errors were detected during as
sembly.
Symbol Table Structure
In the construction of compilers, the symbol table has for a
long time been recognized as a critical factor affecting execution-time
efficiency (Katzan 1970). Thus, many elaborate and complex methods
have been devised for structuring the symbol table. Several of the
■ . 22methods, linked list (Knuth 1969, pp. 251-303; Flores 1965, pp. 55-60),
tree structures, hash sum indexing (Cries 1971, pp. 213-230), scatter
storage (Maurer 1968, pp. 35-38; Morris 1968, pp. 38-44), and binary
search (Price 1971, 49-64) to mention a few, have complex algorithms,
large storage requirements, and/or require a special ordering of the
table.
The method chosen for the SLIC processor was the linked list. ■
Considering the governing design factors mentioned earlier in this
chapter, "the student programs to be written for the SLIC processor were
believed not to justify the coding of complex algorithms. The use of
the linked list table allows easy insertion of items into the middle of
the table. This allows the symbol table to be kept in alphabetical
order. Thus, at the end of pass two, an alphabetically ordered list of
the symbol table is obtained.
The SLIC symbol table contains three values per table entry
(Figure 6). The first value is a pointer to the next symbol in the
Pointer to next symbol Symbol Address of
symbol
Figure 6. Symbol table structure
symbol table. A zero.in this position indicates that the end of the
list has been reached. The second value in the symbol table is the
symbol itself. The third value entered is the SLIC memory address of
23
the symbol. The symbol!s address is the value of the location counter
at the time symbol was encountered.
Literal Pool Structure
The literal pool is a linked list like the symbol table de
scribed above and has the same characteristics« The differences in the
two tables exist only in their usage. An attempt to make a duplicate
entry in the symbol table generates an error, but in the literal, table,
duplicate literals are considered to be normal. The address of the
symbol is entered into the symbol table at the time that the symbol is
entered, but in the literal pool the addresses to be assigned to the
literals are not entered until the end of pass one, which is after the
literal ,pool is built .,. .As .with the -.symbol. table,, the listing of the
literal pool is in ascending order.
Machine Language Processor
Incorporated within the SLIC.processor is the capability to
load machine language instructions directly into memory and execute
them. By the judicious use of the three event times of the operate in
structions, a student may construct instructions which are not in the
SLIC assembler's repertoire.
The machine language processor requires that the input instruc
tions follow a fixed format. The rules which control machine language
processing are given in Chapter 4.
Emulator
The emulator fetches the instructions stored in SLIC memory be
ginning at the location passed, to it from the assembler (or machine
language processor). ' The instructions are decoded to determine the.
operations that are to be performed, A FORTRAN equivalent of the in
struction is then executed. If the instruction is not a branch or skip
instruction, the next instruction in memory is fetched and executed.
In the case of the branch or skip instruction, the next instruction
executed is at the location specified by the branch or skip instruc
tion, Instructions may be tagged to produce a register trace and/or
memory dump. When a register trace is requested, the contents of each
of the seven registers and the link bit are printed at the end of the
execution of the instruction. Likewise, the dump of the specified mem
ory locations is given after the instruction that is tagged is encoun
tered, Upon encountering a halt (HLT 70200) instruction, the SLIC
processor terminates.
CHAPTER 4
SLIC PROGRAMMING
. With any programming system there are rules which govern the
use of the hardware and software. Obviously this should be expected
with the SLIC processor and the SIC language. Contained within this
chapter are the intricacies that control the use of the SLIC program
ming system. The following discussion pertains to the execution of the
SLIC processor on the CDC 6400 at the University of Arizona Computer
Center, To execute the SLIC processor at a location other than The
University of Arizona, a source copy of the SLIC processor should be
obtained from the University of Arizona Computer Science department.
SLIC Processor Commands
Three processor commands are used to direct the action to be
taken by SLIC. These commands are used to initiate assembly or machine
language processing and to provide the user with debugging aids.
$ASSEMBLY and $MACHINE
The first card of a SIC program should be either a $ASSEMBLY or
a $MACHINE card. The $ASSEMBLY card causes all of the remaining cards
to be processed as a symbolic language program and directs the assembly
of the instructions into machine code. Providing that no fatal errors
are encountered during assembly, the SLIC processor will initiate
25
26
execution of the code generated. The $MACHINE card causes the loading
of the machine,language cards into SIC memory and initiates execution
if no fatal errors are encountered. If no ‘̂ ASSEMBLY or $MACHINE card
is found at the beginning of the job, $ASSEMBLY is assumed.
$TRACE
The $TRACE command prints the contents of the seven SIC regis
ters and the link bit after SIC instructions are executed. The $TRACE
card may appear any place in the input stream of an assembly job be
tween the $ASSEMBLY card and the END card of the assembly program. The
first appearance of a $TRACE card will set the trace condition on. The
next appearance of a $TRACE card will set the trace condition off. This
procedure of turning the trace condition on and off may -be foilowed as
many times as desired throughout the remainder of the SIC program.
$DUMP(i,j)
The $DUMP(i,j) command dumps the contents of SLIC memory begin
ning at the location and ending at the location, where i and j
are two octal numbers that meet the conditions 0^i$8191, O^j3:8191, and
i^j. The dump command causes the dump to be taken after the instruc
tion following the $DUMP(i,j) has been executed and causes the dump
everytime the instruction is executed. There may be no more than ten
$DUMP(i,j) commands located between the $ASSEMBLY and the END card of
the assembly program. If more than ten dumps.are attempted, a diag
nostic will be generated and no more dumps taken.
27
Assembler Usage
The usage of the facilities of the assembler are detailed in
the following discussion. The explanation includes the use of the
three assembler commands, the format of the symbolic instructions, and
the use of symbolic and absolute addressing. '
Assembler Commands
There are three assembler commands. These commands are used to
set the location counter (ORG), to signal the end. of assembly (END) of"
a program, and to denote comment cards (*).- The ORG command sets the
location counter to the octal value which follows the word ORG. The
ORG command can begin in any column, except column one, provided the
va'lue foil owing the - word ORG .ends .heiore .column . 3,5. Since the ORG com
mand is not executable, it should not have a label. Figure 7 illus
trates an example which sets the location counter to 100 before the
first instruction. The absolute address of the instruction with the
$ASSEMBLY** THIS IS AN EXAMPLE OF THE USE* OF THE THREE ASSEMBLER COMMANDS"k
ORG 100$TRACEBEGIN', NOP
* e
e
LAST, HLTEND BEGIN .
Figure 7. Example of assembler commands
28
symbolic address of BEGIN is 100 octal. The END command tells the as
sembler that all symbolic instructions have been read and processed by
pass one of the assembler„ The word END is followed by a symbolic or
absolute address that gives the location of the instruction that is to
be executed first. If the END command is omitted, one will be supplied
by the SLIC processor. The internally generated END command sets exe
cution to begin at location zero and creates errors if any data cards
follow the SIC program. The END command (Figure 7) has a format"simi
lar to that of the ORG. That is, the word END can begin in any column
except column one, provided the address field is ended before column
35. The END command.is not executable and should not have a label.
A comment card, also exemplified in Figure 7, is denoted by an
asterisk in column one. It may be placed anywhere between the ^ASSEMBLY
card and the END command. The contents of all card columns after the
asterisk in column one are explanatory and have no effect on the pro
gram 1s assembly or execution.
Assembler Instructions
In order to properly utilize the SLIC assembler, the meanings
of the various elements of a SIC instruction, the delimiters of the
elements, and the usage of symbolic and absolute addressing should be
explained. The explanation that follows gives more details as to the
format of the symbolic instructions of the SLIC processor.
All instructions have a free format with a few exceptions.
Labels (symbolic and absolute) and only labels begin in column one.
All instructions must end before column 35. Labels, operation codes,
29
operands, numeric literals, and absolute addresses may not contain em
bedded blanks.
There are four basic elements to a SIC instruction. In some of
these instructions some of -the elements may be null. The four elements
are the label, the operation code, the indexing/indirect addressing in
dicator, and the operand. They occur in that order. Any instruction
may have a label. All MRI instructions must have an operand and may or
may not have an indexing/indirect addressing indicator. No operate or
IOT instruction may have operands except for the rotate (RAR and RAL),
instructions which may have a parametric operand to specify the number
of places to be rotated. The data definition statement may or may not
have a label and contains a numeric or alphameric literal in the oper
ation field.
The delimiter that is used to separate each of the elements
consists of one or more blank spaces. In addition, a comma may be
used after a symbolic label and a slash may be used after an absolute
address label. The beginning of an absolute address is denoted by an
octal digit, the beginning of a numeric literal is denoted by an equal
sign or a left parenthesis, and an alphameric string is enclosed in.
not equal signs. Table 4 in Chapter 3 provides a tabular presentation
of the lexical structure of the various elements. Example programs are
provided in Appendix A to show how each of the instructions just de
scribed are used.
Symbols contain from one to six characters. Absolute addresses
are any octal numbers between 0 and 17777. A numeric literal contains
30
from one to six octal digits, while the alphameric literal contains
from one to three characters.
The indexing/indirect addressing indicators are I, A, and B for
indirect addressing, indexing with index register A, and indexing with
index register B, respectively. These indicators are placed after a
MRI operation code and separated by at least one delimiter. The indi
cators are followed by an operand (symbolic or absolute) which is sep
arated from the indicators by at least one delimiter, ■ If the indicators
are not followed by an operand, then the indicators will be treated as
operands, thus allowing I, A, and B to be used as symbols as well as
indicators.
Assignment of instructions to memory locations begins at loca
tion zero and proceeds in increments of one. The location of instruc
tions in SLIC memory may be altered with the ORG command as discussed
earlier. Literals are assigned the locations after the last executable
statement. Therefore care should be taken when using the ORG instruc
tion to prevent the destruction of the literals assigned in pass one by
the code loaded in pass two.
Any data to be read by the SIC program (READ instruction)
should be placed in the job stream immediately following the END card
of the SIC program. All numerics (literals and addresses) input to the
SLIC processor are octal numbers. Likewise, all data input must be oc
tal numbers and punched in the first six columns of the data cards.
Any output to the printer which is created by the SIC program, that is,
using the WRITE instruction, will be a six-digit octal number printed
in columns 13 through 18.
31A program listing is produced by pass two as the machine•code
is loaded into memory. For each instruction the listing contains the
SLIC memory location of the instruction being loaded, the machine code
generated for the instruction, and an 80-column card image of the in
struction. Following the program listing is the literal pool if any
literals were used. Next, a listing of the symbol table is generated,
if the program used any symbolic labels.
Machine Language Processor Usage
The machine language processor is very simple in its structure.
A $MACHINE card is used to invoke the processor which inputs instruc
tions and loads them into memory. After the $MACHINE card no symbolic
.instructions or ..commands are.permit.ted,. The $ TRACE, $DUMP(i,j), ORG,
END, and comment cards (*) are not permitted and will generate diag
nostics. ' .
The only input that is permissible is the octal address of
each instruction in card columns 1 through 5 right-justified with zero
fill and the octal machine instructions in card columns 7 through 12.
The machine language processor examines each of the incoming addresses
looking for 77777 in the first five locations. When this is encoun
tered the loading of the instructions into memory is halted and the
right-justified octal number in columns 7 through 12 is used as the ad
dress for execution to begin. An example of machine language process
ing is given in Appendix A.
CHAPTER 5
RECOMMENDATIONS AND CONCLUSIONS
The.use of pseudo-computers for.pedagogical purposes has been a
popular idea in the computer sciences (Knuth 1969, Hull 1966). These
hypothetical computers are used to describe hardware that is believed
to best typify computer construction and operation. Since the physical
construction of computers for purely academic purposes is seldom eco
nomically feasible, many of the hypothetical machines are implemented
using various forms of computer simulations. The SLIC processor is one
such implementation. A project such as the SLIC processor encounters,
during the course of development, many problems which were unforeseen
at the outset. The original plans for the SLIC processor were that the
assembler would be one-pass, but difficulties arose in making a program
listing which would include the generated machine code,' would be mean
ingful to novice computer .programmers, and would be aesthetically
pleasing.
There are several areas where improvements in the SLIC processor
could benefit the user. Extensions or modification to the SIC assembly
language that would allow the use of Define Constant and Define Storage
instructions would fit in very nicely with the language’s present
structure. Other extensions such as the ability to perform simple
arithmetic operations within the operand field and a restructuring of
32
' . . 33
the method for specifying the indexing/indirect addressing indicators
could add to the power and cleanliness of the language.
Two other more ambitious extension or projects would include
the emulation of the IOT structure described in Chapter 10 of Hill and
Peterson (in press) and the ability to create at assembly time new sym
bolic mnemonics for operate instructions. For example, the mnemonic
DAS might deposit the contents of the IA into the AC and skip the next
instruction if the AC is equal to zero. The machine language code for
this instruction is 700042 as can be easily verified using Table 3 in
Chapter 2.
SLIC as it is presently structured requires only a small amount
of system resources. The processor requires 27000 octal words to load
and execute. Small SIC programs of no more than 50 source statements
will load and execute in approximately two seconds. By restructuring
some of the tables used by the assembler, it is felt that some improve
ment in the execution time could be achieved. At present the lexical
analysis table is packed with 20 values per 60-bit word. This packing
of the table means that for each character scanned, the index in the
table is calculated and then the value is extracted. Changing the
table to one value per 60-bit word increases the table size by approxi
mately 400 words. Since lexical analysis is a time consuming portion
of SLIC, the increase in execution time would probably offset the extra
core required. The element list structure is another area that could
be changed to provide minor efficiency improvements.
- ' . ' 34
In Chapter 3 one of the reasons given for the use of the FOR
TRAN programming language was that the SLIC processor would be port
able. High-level programming languages often have several enticing
features which extend the capabilities of the language. These capabil
ities are usually used at the expense of portability. Such was the
case with the development of SLIC. Every effort was made to limit the
use of nonstandard features. In some cases, such as end-of-file
checks, nonstandard features are unavoidable. In other instances, the.
use of nonstandard features provides a considerable amount of efficiency
or convenience. The use of the SHIFT function, the octal format speci
fication, and the right-justified alphameric format specification are
examples of areas that can create problems when attempting to use the
SLIC processor on a computer system other than the CDC 6400.
Some of the design conventions used by SLIC are restricted to
the CDC 6400. For example, the tables used in lexical analysis and
syntactic analysis phases utilize all 60 bits of the CDC 6400 computer
word. The improvements to run-time efficiency mentioned earlier would
eliminate this problem with the lexical analysis table,and the syntac
tic analysis table can easily be divided into a table of two or three
words per entry. The pseudo-SIC memory of 8192 words is packed into
2731 CDC 6400 computer words. This packing permits 20 bits to be allo
cated for the 18-bit SIC word. The two extra bits are used for the
trace and dump functions. Since very few computers are capable of
handling 60 bits of information in a word, this memory structure
probably will need changing when implementing SLTC on a computer other
than the CDC 6400.
The only true measure of a program such as SLIC is made after
the program has been used for an extended period of time. Many comment
statements are included in the source program of the SLIC processor to
aid in the maintenance of the program. The author feels that the de
sign of the SLIC processor is good, but its usefulness as a classroom
aid will be its only criterion of success.
APPENDIX A
SAMPLE PROGRAMS
36
S L I C, PROCESSOR
^ASSEMBLY PROGRAM;• * ■ • .
* ' IMPLEMENTATION OF A FORTRAN DO LOOP
• *. THIS PROGRAM- PERFORMS* THE SIC EQUIVALENT OF* THE FOLLOWING FORTRAN* STATEMENTS
* K = 0' » 00 90 J=l,6* -• • .K = MCJ> + K* N(J> = K
■ * 9 0 CONTINUE* • ' -*9 THE DATA RE)* * ■ 0 00 0 07* 000011* 000001
0 00 021* 000005
000006
00 001 000000■ > 00001/ CO
.00002 777772 0 0 00 2/10 0 0 0 700000 10000/ NOP^ ;READ ARRAY M10001 7400 00 10 001/ READ10002 ' 510200 10 0 02/ DAC 1020010003 740000 1000 3/ READ10004 510201 10004/ DAC 1020110005 740003 10005/ READ10006 510202 10 0 0 6/ DAC 1020210007 740000 10007/ READ10 010 . 5102.03 10010/ . DAC 102031C Oil 740000 10011/ READ10012 510204 10012/ DAC 1020410013 740000 10013/ READ10014 510205 10014/ DAC 10205— -TRAC^ ON «»«■»“ STRACE ON
^ )PERFORM DO LOO!10015 701000 10015/ CLA10016 500001 10016/ DAC 00110017 700100 10017/ DTA.10020 250200 10 02 0/ TAD A 1020010021 760000 10021/ WRITE10022 ' 500301 10022/ DAC 00110023 =50210 10023/ DAC A 1021010 024 700140 10024/ INA10 025 000002 10025/ ISZ 00210026. 610020 10026/ JMP 10 02 010 027 702000 10027/ HIT
* ARRAY M10200 000000 10200/ (010201 000000 10201/ (0
S L I C PROCESSOR
10202 000000 10202/ CO10203 , ■ 000000 10203/ CO10204 000000 102 04/ CO10205 0 0 0000 10205/ (0
* ,ARRAY10210 000000 10210/ (010211 0 0 0 0 0 0 10211/ (010212 000000 10212/ CO10213 000000 10213/ CO10214 0 000 0 0 10214/ (010215 000000 10 215/ (0
END 10 00 0
BEGIN EXECUTION AT LOCATION .1 0000
39S L . I C PROCESSOR
//TRACE OM //PC IR LINK AC MD . MA IA IB
10 015 701000 0 0 0 0000; 701000 10015 0 0 0 0 0 0000010016 500001 0 .000000 000000 00001 0 00 0 0 000 0010017 700100 0 0000 00 700100 10017 0 0 0 0 0 0 0 0 0010020 35020 0 . o 000007 000007 10200 0000 0 , 00000
00000710021 76 0 00 0 0 000007 76000.0 10021 0000 0 000 0010022 5 00 001 0 0000 07 000007 0 00 01 000 0 0 00 00010023 550210 0 000007 000007 10210 0000 0 0 0 0 0010024 700140 0 000007 700140 10024 0000 1 0000010025 000002 0 000007 777773 000 02 00001 0000010020 610020 0 00 00 07 610020 10026 ’ 000 01 0 0 0 0010020 350201 0 ■ 0000 20 0 0 0011 10201. 000 01 00 000
00002010 0 21 760000 . 0 000020 760000 ICO 21 000 01 00000100 22 5 00 001 0 00 0 020 003020 00001 00001 0000010023 550211 0 0 0 0 0 2 0 0 0 0 020 10211 .000 01 000 0010024 7 0014 0 0 000020 700140 10024 000 02 000 0010025 000002 0 000020 777774 00002 000 0 2 0 0 0 0 010020 610020 0 0 0 0 0 2 0 610 0 20 10026 00002 0000010020 350202 0 000021 000001 10202 00002 0 00 00
000021JLdOZl 760000 0 . 000021 760000 10021 00002 0000010022 500001 0 000021 000021 00001 0 0002 0000010023 550212 0 000021 000021 10212 . 00002 ' 0000010024 700140 0 000021 7 0 014 0 10024 00003 0 0 0 0010025 000002 \ 0 000021 777775 00002 000 03 0000010020 610020 0 000021 610020 10026 0 0 0 0 3 x 00 0 0010020 350203 o' 000042 0 0 0 0 21 10203 00003 00000
00004210021 760000 0 000042 760000 10021 000 03 0 0 0 0 010022 . 500001 0 000042 000042 0 0001 0 0 0 0 3. 000 0010023 550213 0 . 000042 * 000042 10213 0000 3 0.00 0010024 700140 0 000042 700140 10024 000 04 000 0010025 0 0 0 0 0 2 0 000042 777776 0 00 0 2 000 04 000 0010020 610020 0 000042 610020 10026 000 0 4 00 0 0010020 350204 0 000047 000005 10204 00004 00000
00004710021 760000 0 000047 760000 10021. 00004 0 000010022 500001 0 000047 000047 00001 000 04 0 00 0010023 550214 0 • 00 0 047 000047 10214 000 04 0000010024 700140 0 000047 700140 10024 000 05 000 0010 025 000002 0 000047 777777 0 00 02 . 00005 000 0010 020 . 610020 0 000047 610020 10026 000 05 0 0 0 0 010020 350205 0 000055 000006 10205 0000 5 0 00 00
00005510021 760000 0 000055 760000 10021 00005 0000010022 500001 • 0 0 00055 000055 00001 000 0 5 000 0010023 550215 0 000055 000055 10215 000 05 0 00 0010024 700140 0 000055 700140 10024 . 0 00 06 0 0 0 0 010026 000002 ' 0 .000055 000000 0 0002 0 0006 - . 0000010027 702000 0 000055 702000 10027 00006 . 900 00
VALUE OF PC AT TERMINATION WAS 10027
S L I C PROCESSOR40
3ASSE MBLY PROGRAM"TRACE ON *»-»=• STRACE
& THIS PROGRAM SOLVES THE#&
N - Ml f A5S(M2) -*
LOAD M200000 10010% BEGIN , LAC M2
TEST FOR NEGATIVE M200001 7 0 0003 SKP00002 600013 JMP ABS00003 300100 GO ? TAD Ml
STORE TEMPORARY RESULT00004 500103 DAC N
* LOAD M300005 100102 LAC M3
* SUBTRACT M300 0 06 701400 CM A000 07 300104 TAD = 1
STORE N00010 300103 TAD N00 011 500103 DAC N
SOUMP(1C'0,103)00012 702000 HLT
* 'OBTAIN'' ABSOLUTE VALUE0 C 013 701400 ABS, CMA00 014 300104 TAD = 100015 600003 JMP GO
ORG 100* DEFINE DATA AREAS
00100 000010 Ml, CIO00101 777776 M2, C-200102 0000 04 M3, (400103 000000 N, (0
END BEGIN
L I T E R A L P O O L
ADDRESS LITERAL 00104- 000001
SYMBOL ADDRESS
ABS 00013BEGIN 00000GO 00003Ml 00100M2 . 00101M3 00102N 00103
BEGIN EXECUTION AT LOCATION 0 0000
42
i//TRACE
PCON //
XR LINK AC
00000 100101 0 7777760 00 01 700003 0 777776
. 00013 600013 0 77777600013 701400 0 00000100014 300104 0 000002
-v 0 0 0 0 3 600003 0 0 00 0 0200003 300100 0 00001200004 500103 0 0 0 0 01200005 100102 0 00000400006 701400 0 7777730 00 07 300104 0 77777400010 300103 1 . .0000060 0 Oil 500103 1 0 00 0.06
.00012 702000 1 000006
. • ' ♦ D U M P *LOCATION
0 010 0 000010 777776 000004 000006
S L I C PROCESSOR
MO MA XA IB
777776 00101 0 00 0 0 000007 0 0 0 0 3 00001 0 00 0 0 00 0 00600013 00002 0 000 0 000 00701400 0 001 3 0 00 0 0 00 0 00000001 00104 000 0 0 0 0 0 0 0600003 00015 0 000 0 00 0 000 0 0010 00100 0000 0 00 0 0000 0012 00103 000 0 0 00 0 00000004 00102 0 000 0 00 0 00701400 00006 • 000 0 0 00 0 00000001 00104 . 0 0 0 0 0 000 00000012 00103 000 00 0 0 0.0 0000006 00103 000 0 0 0 0 0 0 0702000 00012 0000 0 000 00
♦ E N D D U M P *
VALUE OF PC AT TERMINATION WAS 00012
S L I C PROCESSOR
SASSEMBLYjg.* THIS PROGRAM UTILIZES A
- » • SUBROUTINE TO COMPUTE THE*' . OR FUNCTION USING> OEMOPGANZS THEOREM,*' * ' READ THE VALUE 777600* FROM THE CARD READER
0 0200 740000 200 READ00201 501012 201 DAC 1012
«• READ THE VALUE 000077. * . FROM THE CARD READER
00202 740000 202 READ 101300203 501013 00203 DAC 1013
* JUMP TO SUBROUTINE TO* EXECUTE THE OR FUNCTION
00204 4 010 0 0 204 JMS 100000205 760000 20 5 WRITE00207 702000. 207 HLT* y
*** SUBROUTINE OR ''• ' ■ '> • .
«=>«=>«. 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
* DEFINE DATA* AREA
01012 000000 1012 -001013 000000 1013 = 0
END 200
BEGIN EXECUTION AT LOCATION 00200
44
/ / T R A C E ON //PC IR LINK AC
01001 101012 0 77760001002 701400 0 000177.01003 501012 0 0 00177010 0 4 101013 0 00007701005 701400 0 . 77770001006 201012 0 00010001007 701400 0 77767701010 501012 Q 777677
//TRACE OFF//. 777677
S L I C PROCESSOR
MD HA XA IB
777600 01012 000 0 0 0 0000701400 0100 2 000 0 0 000 00000177 01012 0 00 0 0 0 0 0 00000077 01013 0000 0 0 00 00701400 . 01005 0 0 0 0 0 0 0 0 000 0 0177 01012 0000 0 00 0 00701400 01007 . 0 0000 00000777677 01012 000 0 0 00000
VALUE OF PC AT T ERMINATION WAS 00207
45S L I C PROCESSOR
SASSEM8LY* MULTIPLICATION PROGRAM
THIS PROGRAM WILL-PERFORM THE MULTIPLICATION Op TWO IS^BIT
* NUMBERS. M L T R AND MLTR — *THE MOST SIGNIFICANT 18-BITS
* OF THE 36-BIT PRODUCT IS STORED& IN P R O D 1. AND THE LEAST&
&
SIGNIFICANT '18-BITS IN PROD2,&
* THE EXAMPLE MULTIPLIES& 4 BY 4 .
A'CE ON <s>eBee STRACE^ . SET INDEX TO -18 DECIMAL
00000 117777 START LAC =-2200001 517770 DAG INDEX
READ MULTIPLIER — MLTR
00002 740000 READ00'00 3 ^ 1 7 7 7 5 . OAC MLTR00004 700003 SKP0 0 0 0 5 600007 JMP COMP100006 600015 JMP LOCI00007 701400 COM*! CMA00010 317776 TAD = 100 011 517775 DAC MLTR00012 117771 LAC SIGN00013 7 014 0 0 CMA00014 517771 DAC SIGN
READ MULTIPLICAND — MLTD •
00015 740000 LOCI READ00016 517774 DAC MLTD
RACE OFF“ ~ STRACE0 0 017 700003 SKP00020 60 00 22 JMP C0MP200021 600030 JMP LOG 20 0 022 701400 C0MP2 CMA00 023 317776 TAD00 024 517774 OAC MLTD00025 117771 LAC SIGN00026 701400 CMA00 027 517771 DAC SIGN00 030 117775 LCC2 LAC MLTR00031 •730000 RAR00032 517775 DAC MLTR00 033 700020 SZL00 0 34 600036 JMP L0C300035 600041 JMP L0C40 0 036 117772 LOC3 LAC PROD100 0 37 317774 TAD MLTD
S L I C PROCESSOR
000L0 517772 DAC PROD100041 7 04000 L0C4 CLL00042 117772 LAC PROD100043 730000 RAR00 0 44 517772 DAC PROD100 045 117773 LAC PR0D200 046 730000 RAR0 0 0 47 517773 DAC PROD200 050 017770 ISZ INDEX00051 600030 JtiP L0C200 052 117771 LAC SIGN00053 7000 03 SKP00 054 600056 JMP L0C5
S D U M P (17772,17773)00055 702000 HLT00056 117773 LOC5 LAC PR00200057 7 014 0 0 CMA00060 517773 DAC PROD200061 117772 LAC PROD!0 0 062 701400 CMA00063 7 04000 CLL00064 317776 TAD = 100065 517772 DAC PRODi00066 117773 LAC PPOD20 0 067 7 0 00 20 *SZL00070 317776 TAD = 10 0 071 517773 DAC PR002
SDUMP(17772, 17773)00072 702000 HLT
, ORG 17770e SET UP DATA STORAGE
17770 000000 INDEX -o17771 0 0 0 0 0 0 SIGN = 017772 000000 PROD 1 “ 017773 000000 PE002 = 017774 0000 00 MLTD -017775 000000 MLTR = 0
END START
L I T E R A L P O O L
-ADDRESS1777617777
LITERAL000001777756
47S L I C PROC
SYMBOL ' ADDRESS
COMP1 0 0 0 07COMP? 00022INDEX 17770LOCI 00C15 .LOG? 00030LOG 3 00036L0C4 0 0 041LOG 5 00 056MLTD 17774MLTR 17775PROD 1 17772PROD? 17773SIGN 17771START 00000
BEGIN EXECUTION AT LOCATION OOOOO
in
S L I C PROCESSOR48
//TRACE ON //, PC XR LINK AC MO MA XA IB
00000 .117777 0 777756 777756 17777 0 000 0 000 0000001 517770 0 777756 777756 17770 000 0 0 000000 0002 740000 0 000004 740000 00002 0 0 0 0 0 00 0 0000003 517775 0 .00 00 04 0 0 0 0 0 4 17775 0 0 0 0 0 • 000000 0005 7 0 0 0 0 3 0 000004 7 0 0003 00004 0 00 0 0 0 00 0000015 600015 0 000 0 O h- 600015 00006 0 0 0 0 0 0000000015 740000 0 00 0 0 04 740000 00015 0000 0 0 0 0 0 00 0016 517774 0 0000 04 0 0 0004 17774 0 000 0 0 00 00
//TRACE OFF//
* D U M P *LOCATION
17772 00000 0 0 0 0 0 2 0
* E N D . D U M P ^
VALUE OF PC AT T E RMINATION WAS 0 0 055
MACHINE INSTRUCTIONS S L I C PROCESSOR
SMACHINE .0 0 0 25 000000 0 0026 07 07 07. 00 027 0 0 00 0.0 00024 707000 00 023 0 00 07 000100 01234500101 10010000102 73021000103 50002500104 20002600105 50 0027.00106 10 002500107 73021000110 73021000111 50002500112 20002300113 30002700114 500027 0 0115 10 0 0 2500116 73000000117 200024 00120 300027 0 012.1 760000 0 0122 7020 00 77777 000101
BEGIN EXECUTION AT-LOCATION 00101
s L I C PROCESSOR
305214VALUE OF PC. AT TERMIN A T I O N WAS 00122
APPENDIX B
SLIC COMMANDS AND SIC INSTRUCTIONS-
Processor Commands
$ASSEMBLY
$MACHINE
ISZ
LAC
$TRACE
$DUMP(i,j)
* (comment card)
ORG
Operate Instructions
DAG JMP
JMS AND
HLT
NOP
CLA
STA
CMA
MRI Instructions
CLL RAR
STL . RAL
SKP DTA
SKZ DTB
SKL DFA.
10T Instructions
READ WRITE
END
TAD
DEB
INA
INB
51
APPENDIX C
SLIC PROGRAM LISTING
52
OO
OO
OO
OQ
O53
o o o o o o e o o o o , o o e o e e e e e o o o e o o o o o o o o o 6 6 6 o e e e o o o o e o o o " e o e o o e e e c o o o o o e e e o o o e
o o
„ MAIN PROGRAM SUPERV .O O0. PURPOSE
THE SUPERV HAS THE RESPONSIBILITY TO DETERMINE THE TYPE OF JOB TO BE RUN AND TO INITIATE ITS EXECUTION .
O 0o o o o o o o o o o o e o o o o e o o o o o o o o o e e o e o o o o e o e e e e o o o o o e o e o o o o o o e o e o o e o o e e o e o o ©
PROGRAM SUPERV (INPUT = 6 5 » OUTPUT=65,TAPE5 = INPUT» T A P B 6 =0UTPUT?• CTAPE 7=65)
LOGICAL TRACE LOGICAL ERRFLG
'■ LOGICAL OOUMP INTEGER FIELD INTEGER XQTBEGINTEGER ERROR '
COMMON /ONE/ L I N C N T ^ I T E X T (60),I C O U N T ,NUMBER COMMON /TWO/ • TRACE,ERROR,ERRFLG,DDUMP
. COMMON /THREE/ ICHAR, KINO, FIE L D ( A , 2),IPOINT, LOCATE COMMON /TEMPRY/ ITEMP, IS6 VE, KSAVE COMMON M E M O R Y (2731)
DATA TRACE/.FALSE*/DATA NUM9ER/0YDATA ERROR/O/DATA I P 01NT/0/DATA ID0LLR/1RS/DATA IT/IRT/DATA KK/4/
CC-- ZERO S L I C MEMORY
00 10 1=1,2731 MEMORY(I) = 0
10 CONTINUE REWIND 7
C-- READ AND TEST FIRST CHARACTER FOR CONTROL CARD
CALL GETNEX(ITEMP)I F (ICHAR.NE.IOOLLR)GO TO 5 IPOINT = IPCINT * 1
C-- TEST FOR ASSEMBLY LANGUAGE JOB
CALL GETNEX(ITEMP). ISAVE = 1
CALL CHECK(ISAVE)I F d S A V E . N E , 0) GO TO 30
20 TFOINT = 0NUMBER = NUMBER 4-1W R I T E (7) KK,ITEXT,ITEMP,ITEMP,IT EMP,ITEMP .
'GO TO 6 •5 CONTINUE
SUPERV FORTRAN EXTENDED VERSION 2 , 0/E .04/29/72
CALL E R R O U E (20). CALL ERRWRT(l) • '
C — BEGIN ASSEMBLER PROCESSING .
6 CONTINUECALL ASSEMB(XQTBEG)GO TO 50
C— TEST FOR MACHINE LANGUAGE JOB
3 0 CONTINUEIFOINT = 2
. CALL G E T N E X (ITEMP)ISAVE = 2CALL CHECK(ISAVE)•IF(ISAVE•N E e 0)GO TO 40 CALL P A G H E D (2) .W R I T E (6 $ 60 0 0) ITEXT
C — BEGIN MACHINE LANGUAGE PROCESSING
CALL LOADR (XQTBEG)• CALL ERRWRT(O) . . '
GO TO 50 ;
C-- TEST FOR POSSIBLE STRACE CARD
4 0 CONTINUEIFOINT = 1I F d C H A R . E Q . I D G O TO 5 CALL E R R Q U E (21)CALL ERRWRT(l)GO TO 20
C-- TEST FOR FATAL ERRORS . .
5 0 CONTINUEIF(oNOT.ERRFLG)GO TO 60 W R I T E(6 9 6 0 0 2)STOP
60 TRACE = .FALSE.W R I T E (6,6001) XQTBEG
C — BEGIN EXECUTION
CALL MULATR(XQTBEG)STOP
C6000 FORM AT'( 8X , 8 0R1)
.6001 FORMAT(1H0,3X, 28HBEGIN EXECUTION AT LOCATION , 05)6002 FORMAT(1H-,3X,39HEXECUTION INHIBITED DUE TO FATAL ERRORS)
END
oo
oo
oo
oo
oo
oo
oo
55
cc
FORTRAN EXTENDED VERSION 2 . 0/E 04/29/72
o e e e o o o e e e e o o o o o o o o o e e e e e o o c e o o o o o o o o e o o e o e o o o e o o o e o o o o e e o e e o o o o o e e o o
= . - « « SUBROUTINE 6SSEMB
PURPOSETHE ASSEH8 SUBROUTINE PERFORM THE ASSEMBLY OF SIC SYMBOLIC ,
. PROGRAMS, IT IS A TWO PASS ASSEMBLER. THE FIRST PASS
. , PERFORMS LEXICAL AND SYNTACTIC ANALYSIS AND THE SECOND.. . • PASS RE SOL VS THE SYMBOLIC ADDRESSES.0 . «
DESCRIPTION OF PARAMETERS »XQT9EG «■ ADDRESS THAT EXECUTION IS TO BEGIN
G 6o o e e e o e e e o o o e o o o e o e e c e e e o o e e o o o o o e o o e o e o e e c e o o o e o o o e o e e o e s e G e e e o o o e o o
SUBROUTINE ASSEM8(XQTBEG)' INTEGER ELMENT
INTEGER FIELDINTEGER XQTBEG . . . . -INTEGER SYMTAB .•"V" 'INTEGER ERROR LOGICAL DCUMP LOGICAL "ERR'FLG LOGICAL TRACE LOGICAL NEGATE
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)
DATA DOUMP/,FALSE*/DATA IERR/6H ERROR,7HWARNING/DATA IDUMMY/0/DATA KDUMMY/0/DATA KOUNT/58/DATA ISET19/1000000 8/DATA ISET20/200000GB/DATA IRAR/3RRAR/DATA TRAL/3RRAL/DATA IADJ/33B/DATA LENGTH/6,5,6,3/DATA LOCATE/0/DATA KK/3/DATA KKK/2/DATA KKKK/6/DATA KKKKK/4/
oo
oo
oo
oo
56&SSEMB FORTRAN EXTENDED VERSION 2« 0/E 04/2S/72
' # » J?.Q &
* P A S S O N E " *& $
C — BEGIN .LEXICAL ANALYSIS
5 CONTINUE
C-- INITIALIZE ELEMENT. LIST
DO 10 1=1,2 DO 10 J=l,4
10 FIELD(J,I) = 02 0 ELNFNT = 1
NUMBER = NUMBER ♦ 13 0 CONTINUE ■
C-- GET FIRST CHARACTER , :
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) .
ITYPE = 1 TRACE= 2 OPERATE INSTRUCTION= 3 ERR CONDITION
o o o
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*)
END
o o o o o o o o o oo ooooooooo
FORTRAN EXTENDED VERSION 2, 0/E 04/29/72 63
© e o e e o o o e e o e o o o e o o o e o o e e o o o o e e o e e o o o o o o o o e e e o e e o e o o o e e e o e e e e e c e o o e o e o
SUBROUTINE CHAIN ' ,-o " . o
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
10 RETURN END
op
oo
oo
oo
oo
oo
64FORTRAN EXTENDED VERSION 2...0ZE . 04/29/72
e o o o o o s o o o o o o e o c o o o o o e o o e o o © o o o e o e e o e e e e e o o o o o o o o o o o g o o e o © o e ® o 8 © o o o o o
. . - . ■ - . ■■■ "■ ■. ' • . •• ;■ .SUBROUTINE CHECK
. . ■ ■ ■■PURPOSE . iTHE CHECK SUBROUTINE TEST CONTROL CARDS TO SEE IF THEYARE $ ASSEMBLY ^MACHINE »TRACE OR SDUMP
DESCRIPTION OF PARAMETERS 'ISAVE - TELLS WHICH COMMAND TO TEST FOR .
o o o o o o o o o o o o o o o e e o o o - O O 0 06 O O O O 0 © 0 6 O 0 O' . 0 0 6 0 0 0 0 0 0 6 0 0 0 0 0 6 e e o s e e o e o o
SUBROUTINE CHECKCISAVE) LOGICAL DDUMP LOGICAL TRACE INTEGER • ERROR INTEGER ERRFLG INTEGER FIELD
DIMENSIONDIMENSIONDIMENSIONDIMENSION
IASMS < 8} IMACH C7> IDUMPC5) I T R A C E (5)
. ..,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)
END
O CTO O O O O O o
.67FORTRAN EXTENDED VERSION 2,0/E 04/29/72 :
o o o e o o « o © o o o o G c e o o e » o o a o o © o . © o o o G O o e © o o o o o o o o . o o o o o e o o c o o o o o o o e e c o e ^ o o o
SUBROUTINE COMMND
o - PURPOSETHE COMMND SUBROUTINE TEST FOR SOUMP, COMMENT CARDS (*),OR STRACE „ IF TRACE THEN THE TRACE FLAG IS SET,
o o o e o o o o p o o o o o o o o o o o o o o o o o o o o o e o e o o o o o o o o o o o o o o e o o o o c e o o o o o o o e o e o o o o c
SUBROUTINE COMMND... INTEGER ON
INTEGER OFF INTEGER ERROR INTEGER FIELD LOGICAL DDUMPLOGICAL . TRACE - , .LOGICAL ERRFLG
CCOMMON /ONE/ L I N C N T , I T E X T ( S 0 > » I C O U N T ,NUMBER
' COMMON /TWO/ TRACE,ERROR,ERRFLG,DDUMP COMMON /THREE/ ICHAR, KIND, F I E L D (4,2),IPOINT , LOCATE COMMON /TEMPRY/ I T E M P , I.SAVE , KS AVE
CDATA 0N/9HTRACE ON /DATA 0FF/9HTRACE OFF/
"'DATA TBL"A'NK'/T'0‘H -/DATA IASTRK/1R*/DATA KK/i/DATA KKK/4/
CITEMP = IBLANK IF(IP0INT,NE.2)G0 TO 20
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
■WRITE (7) KK ? ITEMP, ITEXT , ITEHPS I'TEM'Pj ITEMP 35 CALL ERRWRT(l)
RETURNEND
oo
oo
oo
oo
oo
oo
FORTRAN EXTENDED VERSION 2.0/E 04/29/72o © o o o o o e e o o o e o o o o © o o o e o o o o o o o o o o e e o o o o o o o e o e c o e o o o o o o © o e c o o o
SUBROUTINE DUMP
PURPOSETHE DUMP SUBROUTINE WILL DUMP THE SPECIFIED LOCATION SLID- MEMORY.
o DESCRIPTION OF PARAMETERSMA - ADDRESS DUMP HAS REQUESTED FROM
.o o o e c c o e o o o o o o c o o o o o o o o e o e o o o o o o c o c o o o o o o o e e o o o o 0 0 6 0 0 0 0 o e e o ©
SUBROUTINE DUMP(MA)INTEGER REDMEMF
CDIMENSION ITEMP(iO)
CCOMMON /FOUR/ IFROM(2,10), ITO(ID)
CW R I T E (6 »6 002)
C— TEST FOR DUMP ADDRESS
• DO 10 1=1,10 J = IIF(M6.EQ.IFR0M(2,I))G0 TO 20
10 CONTINUEW R I T E (6,6000)RETURN .
C-- DETERMINE LIMITS OF DUMP
20 K = IFR0M(1,J) f 1 L = ITO(J) + 1M = 0
• 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
SUBROUTINE ERRQUE(ERRNUM)LOGICAL ERRFLGLOGICAL TRACELOGICAL DDUMPINTEGER ERRNUM,ERRSET,ERROR
COMMON /TWO/ TRACE,ERROR,ERRFLG,ODUMP
DATA ERRSET/i/
ERROR = SHIFT(ERRSET,(ERRNUM-1) > .DR. ERRORRETURNEND
oo
oo
oo
oo
oo
oo
71FORTRAN EXTENDED VERSION 2,0/E 04/29/72
oooeoeeooooooocooooeoooooooOGOOOopeoooooocccooooooeoooooocccrceooeooooSUBROUTINE ERRWRT
PURPOSETHE ERRWRT SUBROUTINE PRINTS ERROR MESSAGES.
DESCRIPTION OF PARAMETERSXUNIT •» IF EQ 0 PRINT ERROR MESSAGE
IF GT 0 WRITE ERROR MESSAGE
o e . o o o e o o o o e e e e o e e e o e o o o o o o o e e o e - o o o o o o e o e o o o o o G o o o o o o e o e e o e e e c o o s e
cc
SUBROUTINE ERRWRT(IUNIT)INTEGER ERROR LOGICAL TRACE LOGICAL DOUMP LOGICAL ERRFLG
DIMENSION IERRC25,3)
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
20 CONTINUE ERROR = 0
• RETURN 'C6000 FCRMAT(2X,6H***** ,A7,6H »****,14X,3A10)
END
OO
OO
OO
OO
OO
OQ
OO
O
73
FORTRAN EXTENDED VERSION 2.0/5 04/29/72
o ©o . o o o © o o o o o o © o o e o o o e o e G < 5 © o o e o o o o © o e c o o o © o o o o o c e o © © © o o o o o o o o e ^ o o o c o o o o
SUBROUTINE FIND IO ' V ■ ■ ■ ' ' . • . o
PURPOSETHE FIND SUBROUTINE SEARCHES THE SYMBOL TABLE(OR LITERAL POOL) FOR DUPLICATE SYMBOLS<OR LITERAL)
O ftDESCRIPTION OF PARAMETERS *
SYMBOL - SYMBOLCOR LITERAL WHICH IS BEING SEARCHED . „FOR IN TABLE©
IHIT - FLAG DENOTING WHETHER SYMBOL WAS FOUNDLIST - ARRAY CONTAINING SYMBOL TABLE OR LITERAL POOL
e o o o e & o o D . o o e o < > o o f t c c e o o e e o o o o c o o e © e e o f t O f t o o f t o o c e © © o c o e e © o f t e f t o o © f t © f t o o o o ©
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
o -
o o o o o o o o o o o o o o o o o o e o o o o o o G o o o o o o o o o o o o o c o o e e o o a e o o , « > o o o o o o o c c o © e o o o o o o
SUBROUTINE GETNEX(IEND) 'INTEGER FIELD
COMMON /ONE/ L I N C N T ,I 7 E X T (80),ICOUNT»NUMBERCOMMON /THREE/ ICHAR, KIND, F I E L D (4,2) ,IPOINT, LOCATE
DATA T F L A G / O /
IF.( IPOINT . GT o 0) GO TO 10 R E A D (5,5000)ITEXT IPOINT = 1 I F (E O F (5))20,15
10 TEND = 0I F (IPOINT.GT.35)RETURN
15 CONTINUE IFLAG = 1
' IEND = 1ICHAR = ITEXT(IPOINT)RETURN
20 IEND = -1IF(IFLAG.NE.O)RETURN
' WRITE(6,6000)STOP
C5000 F O R M A T (8 0R 1 )6000 FORMAT(5X,22HN0 SIC PROGRAM FOUND)
END
OO
OO
OO
OO
OO
OO
OO
O
75FORTRAN EXTENDED VERSION 2.0/E 04/29/72
o o o o o o o o o o o o o © c o o o o o o c o o o o o o © o e o o o o o © o o o e o o o o © c o o o o © o o © © o o o o o e © e o o o o o
© e
SU9R0UTINE INOINX .O o
PURPOSETHE INDINX SUBROUTINE TEST FOR POSSIBLE INDEXING OR INDIRECT A D D R E S S I N G , . .
• ' e . DESCRIPTION OF PARAMETERS
INOFLG - IF EQ 0 POSSIBLE INDIRECT ADDRESSINGIF EQ i POSSIBLE INDEXING WITH REG AIF EQ 2 POSSIBLE INDEXING WITH REG B
„ IF LT 0 NONE OF ABOVE ARE POSSIBLE0 • ' . ° o o o o o D o e o o e o o e o c o o o o o o o o o e s c e o o o o o o c c o c c . o © e o o & o & o o o o o © e © c o o o © c o o « o o o ©
SUBROUTINE IND I N X (INDFLG)INTEGER FIELD
c ■COMMON /THREE/ ICHAfi, KINO, ■ F I E L D (4,2) »IPOINT, LOCATE COMMON /TEMPRY/ ITEMP, ISAVE, KSAVE
CDATA INDRCT/11003000000000000000B/DATA INDEXA/OiOO 00 000 0 000000000 06/
: DATA- I N D E X B / 0 2 0 0 0 0 0 00000000000008/c
ITEMP = FIELDC3,1)
C-- TEST FOR NAME IN OPERAND FIELD
I F (F I E L D (3 »2),NE.2)GO TO 30
C-- TEST FOR POSSIBLE IND. ADDRESSING
IFCITEMP.NE.INDRCT)GO TO 10 INDFLG = 0
■ RETURN .
C— TEST FOR POSSIBLE INDEXING
10 I F d T E M P . N E . INDEX A) GO TO 20 INDFLG = 1 RETURN
C-- TEST FOR POSSIBLE INDEXING
20 IF<ITEMP.NE.INDEXB)GO TO 30 INDFLG = 2 RETURN
30 INDFLG '= -1FIELO(A,l) = ITEMP F I E L D ( t , 2) = FIELD C 3,2)RETURN '
•END
oo
oo
oo
oo
oo
oo
76FORTRAN EXTENDED VERSION 2,0/E 04/29/72 '
©oooooooooooeeoooooooooQooooeoeeeieooo&oooocoocooGGeoooooooocooooeGoo©■ ■ ■ : ' ■ ;■ . .SUBROUTINE LOAOR ,
PURPOSE ITHE LOAOR SUBROUTINE READS AND LOADS MACHINE LANGUAGE
o . INSTRUCTIONS INTO MEMORY.® e
DESCRIPTION OF PARAMETERSXQTBEG - ADDRESS WHERE EXECUTION IS TO BEGINNING
. ' • . . . ■ •ooooooeoteoeoooooooeooooooooooooeGCoooo&oocoocoococoootvocioocoooeceooo
SUBROUTINE LOADR (XQTBEG)INTEGER XQTBEG
C, COMMON /ONE/ LINCNT,ITEXT(8 0 ) , I C O U N T »NUMBER
C -DATA IT/1HT/DATA IENO/77777B/DATA IBITl?/i0 00 00 9B/DATA KOUNT/58/DATA MAXMEM/8192/DATA LING NT/52/
READ MACHINE LANGUAGE INSTRU,
5 REAO(5,5000)IAD&R,INSTRU,ITRACE IFCEOF<5))80,10
10 CONTINUEIF(LI N C N T oGT,KOUNT)CALL PAGHED<3)
C — IF TRACE SET TRACE BIT
I F (ITPACE o EG«IT)INSTRU = INSTRU .OR, IBIT19 WRITE-(6,6000) IA DDR,INSTRU, IT RAGE
C — TEST FOR END OF LOADING OF MACHINE JOB
IFCIADDRoEOoIENDlGO TO 50 I F d A O D R o G T o M A X M E M ) CALL ERR0UEC12)
C— LOAD INSTRUo INTO SLID MEMORY
CALL WRTMEM(IAODR,INSTRU)CALL ERRWRT(O)GO TO 5 -
50 CONTINUEIF t INSTRU .GEo 0 .AND, INST RU , LE » MAXMF. M ) GO TO 60
‘ CALL ERRQUE (2)GO TO 70
60 CONTINUE
C-- SET ADDRe EXECUTION TC BEGIN
XQTBEG = INSTRU .RETURN . •
80 CONTINUE '
77LOADR FORTRAN EXTENDED VERSION 2.0/E
CALL E R R Q U E (22): 7 0 XOTBEG = 0
RETURN
50 0 0 F0RHAT(05,lX»06,iX,Ai)600 0 FORM A T (8 X ,05 «IX $ 0 6 »I X ,A 1)
END
04/29/72
OOOOOOOOOOOOO
78FORTRAN EXTENDED VERSION 2.0/E 04/29/72
© o o o o e o e g o 6 o e o e e o o o e o e o e e e e o o o e o o o e o e e o C i o e e o o o e d o o e o o e o e e o e o e e o 0 6 6 0 0 0
SUBROUTINE MULATR • .. . PURPOSE
THE MULATOR SUBROUTINE EXECUTES A FORTRAN EQUIVALENT OF EACH OF THE SIC INSTRUCTION , IT ALSO INITIATES TRACE AND DUMP WHEN REQUESTED.
' . « . . .DESCRIPTION OF PARAMETERS . -XQTBEG - ADDRESS WHERE EXECUTION IS TO BEGINNING
e o o o o © c < > © e o < ? G e o o o e e e e o o 6 © 6 o o e e c © e e e e o e o c e o e o e o e © e c 0 6 e o G © © o o e e c o © o © ® e o
SUBROUTINE MULATR CXQTBEG)LOGICAL ODUMP LOGICAL TRACELOGICAL ERRFLG .INTEGER DMPFLGINTEGER ERROR "INTEGER AC INTEGER PC INTEGER XQTBEG INTEGER CDC6400INTEGER REDMEMF ' .INTEGER ROTATEFCOMMON </ONE/ . LINCNT ?ITEXT{8 0) 9ICOUNT, NUMBERCOMMON /TWO/ TRACE,ERROR,ERRFLG,DDUMP COMMON /THREE / LINK,AC,PC,HA ) IDIREC, ITEMP, LINSTRt ISET
MEMORY(27 31)IC00E/7'0 0 0 0 OB/LAST13/17777B/LAST19/1777777B/0006400/42/
COMMON DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA • DATA
IONE/18/ITWO/3 8/ ITHREE/7 8/ 118/7777773/ 119/10000008/ MAXMEM/8192/ INDSET/20000B/
C— SET INITIAL VALUESERROR - 0 LINCNT = 59 HA - 0 IP = 8 MD - 0 AC ~ 0 IA = 0 IP - 0 LINK = 0 PC - XQTBEG
10 CONTINUEC-- SET MEMORY AODR REG TO CONTENTS OF PC
79MUL4TR FORTRAN EXTENDED VERSION 2« 0/E
MA = PC .AND, LAST13 HASAVE = MA
C = “ FETCH NEXT INSTRU.
. MD = REDMEMF(NA,ITEMP,CMPFLG) .. , CALL T R A F L G d T E M P )
IP = MD .AND, 118LINSTR = I R .A N D ,ICODEINSTRU = SHIFT(LINSTR,3+CDC640 0>
C-- SEPARATE OPERATE INSTRU.C-- FROM MRI-IOT INSTRU,
I F I I N S T R U .EQ.7)GO TO 120
C—" M R IITEHP = SHIFT(IR,5+CDC6400) ,AND. ITWO
C — TEST FOR AND PROCESS INDEXING C— AND INDIRECT ADDRESSING
GO TO (60,20,30,AO) »IT£MP -5-1
C-- INDIRECT ADDRESSING
20 CONTINUEMA = IR .AND. L A S T 13MD -= REDMEMF (m a »ITEMF, IDUMMY)CALL TRAFLG(ITEMP)IR = LINSTR .OR. ( (MD .AND. LAST 13) .OR,GO TO 60
C— INDEX A
30 ITEMP = IA GO TO 50
C-= INDEX 8
A-0 ITEMP =1850 I = (IR.ANO.LAST13) * ITEMP
I F (I .GE.l .OR. I .IE. NAXMEMJGO TO 55 . . CALL E R R Q U E (2)
CALL EPRHRT(O)■ WRIT E(6,100 3) MA
S T O P .55 IR = IR + ITEMP
C— TEST FOR J M P60 IF(INSTRU.EO. 6)GO TO 310 / MA = IR. AND, LAST13 "
• C-~ BRANCH FOR J M S D A G
04/29/72
INDSET)
o o o
- • 80 MULATR FORTRAN EXTENDED VERSION 2oO/E' 04/29/72
IF(INSTRU«GE,4)G0 TO 110 -HD = REnNENF(MA»ITEMP.,IDUMMY)GO TO (7.0»80»90»100) $INSTRU + 1
'C— i s z70 MD = (MD + 1> sANDo 118
CALL NEGCHK(MD) .'CALL WRTMEH (HA?HOS IF(MOoNE» 0)GO TO 300PC * PC + 1 •GO TO 300
80 CONTINUE
C” = L A CAC = {(AC.AND.119) .OR. MO) .AND. LAST19CALL NEGCHK(AC) .GO TO 300 • •
C — “ A N D
90 AC = (AC.AND.119) .OR. {AC.AND .MD) .CALL NEGCHK(AC) -GO TO 300
C “ ra T A D
100 AC = AC + (MD.AND.118)CALL NEGCHK (AC).GO TO 300
C-- STORE A C IN M DC— AND BRANCH FOR D A G
110 MD = A C,AND.118• I F (I N S T R U .NE. 4) GO TO 115
C-- SET RETURN ADDR. FOR J M S
MD = (PC + 1) .AND, LAST13IF(T RACE)MD = MD.OR, 119 PC = IR.AND.LAST13
115 CONTINUECALL WRTMEM (MA,MO)GO TO 300 '
•C~ “ BRANCH FOR IOT INSTRU.
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 '
o * . <
O ■ SUBROUTINE OP.RANO . . ,- ; . • : . '■ ' ' .. ' - .
p u r p o s e ,THE OPRAND SUBROUTINE CHECKS FOR INOIXING OR INDIRECT
. . ■ ADDRESSING AND SET THE CONDITION. IT PLACES LITERALS INTHE LITERAL POOL. . ,
€>■ ’ ' '
DESCRIPTION OF PARAMETERSINDFLG - IF EQ 0 POSSIBLE INDIRECT ADDRESSING
IF EQ 1 POSSIBLE INDEXING WITH REG A .. IF EQ 2 POSSIBLE INDEXING WITH REG B
IF LT 0 NONE OF ABOVE ARE POSSIBLEINSTRU . - INSTRUCTION BEINT PROCESSED <LA8TST - IF EQ 0 SYMBOLIC ADDRESSING
IF EQ 1 ABSOLUTE ADDRESSING 'o ■ ' . ■ .G © o o o * G c o o o o o o o G O © o o o o o © o o o e & G O © o o © o © e e © G e o o o © o © o o © G o c o o o c o o o o o o € e o e <
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
7 FIELD { 4', 1) =SHIFT(FIELD (4,1) $18) .6 IF(INDFLG.NE.-1>CALL ERRQUE(15)
F I E L D (4,1) = FIELDC4»i) .AND, LAST13
C-- PLACE LITERAL IN LITERAL POOL
CALL CHAIN(FIELD(4,1),0,IHIT,LITPOL,INITAL) 10 IH.IT = 0 15 CONTINUE
IF(IHIT.GT.HAXHEM)CALL ERRQUE(2)INSTRU = INSTRU .ORe (I H I T .A N D e L A S T 1 3 )GO TO (50,20,30,40),INDFLG +2
C— SET INDIRECT ADDR. BIT
"20 INSTRU = INSTRU 4- SETIND GO TO 50
C — SET INDEX A BIT
30 INSTRU = INSTRU + STNDXA GO TO 50
C-- SET INDEX 8 BIT
40 INSTRU = INSTRU + STNDXB50 RETURN '12 CALL E R R Q U E (6)
RETURN 'END
o o o o o o o o o o o
87FORTRAN EXTENDED VERSION 2.0/E 0 4/29/72
o o o o o o o o o o o o o o o o o o © o o o o Q © o o o o © o o o o o o c o o o c © o o e o o o t > o o o o o o o o o o o p o o o o o e
SUBROUTINE PAGHED
PURPOSETHE PAGHED: SUBROUTINE PRINTS PAGE HEADINGS.
. ■ ■ -DESCRIPTION OF PARAMETERS
J - HEADING TO BE PRINTED• °
o e e o o c o e o o o e e o o e o o e o o o o e c o e e o o e e o G e e o o o e o e e e e e o e o o o o e e o e o o e e e e o o Q o ©
SUBROUTINE PAGHED(J) .C
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
oo
oo
oo
oo
o89
FORTRAN EXTENDED VERSION 2.0/E 04/29/72© d e e e o e o o e o o o o e . o e o e o e . © © o o o e e e e o e e o o o 6 e o o ® 6 o i s o o o © e e 0 © e e e o ® 6 6 6 o o 6 o e 6 b © o
SUBROUTINE REGTRC
PURPOSETHE REGTRC SUBROUTINE PRINTS THE CONTENTS OF THE SICREGISTERS. .
'o o o o o o o o o o o o d e o o e o s o o o o o o o o e e o o e o e s e o e o e o e o o o o e e e e o Q e . e o c o o e o e o o e o o o e e
SUBROUTINE REGTRC INTEGER AC INTEGER PC
C '
COMMON /ONE/ L I N C N T , I T E X T (60)$IC O U N T ,NUMBER COMMON /THREE / L I N K ,A C , P C * H A ,M O , I R , I A ,18,
C IDIREC, ITEMP, LlNSTR, ISETDATA KOUNT/56/DATA IONE/100 000 08/
CIFC L I N C N T .GT.KOUNT)CALL PAGHE0(3)
. LINK = SHIFT(IONE.AND.AC,-18)W R I T E (6,±002)PC,IR,LINK,AC,HD,HA, IA, IBLINCNT = LINCNT 4 1RETURN
C1002 FORMAT(4X,05,4X,06,6X,G1,5X,06,4X,06,3 (4X,05))
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
INSTRU = I R O T A T {ISAVE)RETURN
10 CONTINUECALL ERRQUE<8)
•SET ROTATION TO 1 POSITION
ISAVE = 1 GO TO 20
oo
oo
oo
oo
oo
oo
oo
: • 91FORTRAN EXTENDED VERSION 2.0/E 0 4/29/72
e © © o e o o o 6 o o o o o e 6 6 t i 6 o @ e e o o o o o e o e o e o e o e o o e o o e o e o e o e e y o e o o o o e o o o o o o o o e e o
■INTEGER FUNCTION ROTATEF
PURPOSE. ■. THE ROTATEF FUNCTION PERFORM THE CIRCULARo A C oo
o DESCRIPTION OF PARAMETERSIDIREC - IF EQ 0 ROTATION IS LEFT
0 - IF EQ 1 ROTATION IS RIGHTAC -. ACCUMULATOR
o . o
© e e e e e o e o e o e o e o e e o e o e o o e o o o o o o o o e o e e e o e o e e f r o o e © 6 6 0 0 6 0 0 0 6 6 0 0 6 6 0 0 6 6 6 6 6 0
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 .
i -© e > o o e < > e » G e o o e o o o e o o © o o e o o o o o e o e e o o e < ? o o o c o e 6 G 6 o e o o o o o o o o e o e e o
SUBROUTINE SCAN(INDEX,IENO)INTEGER FIELD
COMMON /THREE/ ICHAR, KIND* F I E L D C 4 , 2 ) » IPOINT, LOCATE
CALL G E T N E X (IEND)IF ( IEND.LT.1)RETURN CALL TYPEdNDEX-t-ICHAR)IPOINT = IPOINT *■ 1
RETURNEND
93FORTRAN EXTENDED VERSION 2,0/E 04/29/72
© c e o o e e o o o c e o o o o o e o o e o e e o o . e e o o o o e o o o e e o e o e e o o o o o o o e o o e e e e o e e e o o e o o o o o
c .c ..C oc .C ec . c .C 0
SUBROUTINE SEARCH
PURPOSETHE SEARCH SUBROUTINE DOES A BINARY SEARCH FOR OP CODES AND RETURN THE MACHINE INSTRUCTON AND TYPE ASSOCIATED WITH THE OP'CODE.
C . C .C 6
SYMBOLCODEITYPE
SYMBOLIC OP CODE MACHINE INSTRUCTION INSTRUCTION TYPE
C . C
SUBROUTINE SEARCH(SYMBOL,CODE,ITYRE) INTEGER SYMBOL,CODE,HIGH,AVERAGE,FIRSt INTEGER T A B L E (31)
CDATA LAST,FIRST DATA TABLE /
/0 00000 000077777777? 7 B , 7 7 7 7 7 ? Q 0 0 0000000 00 00 3/
C 0000000006000000040 36,000000000600000004233,020000 0 0 0040 000 0116046,7010 0000 03 0000 0314016,7040 0 0000 30000031.4146, C 7 0 140000030000 0315 DIB,500000 000400000401036,70004000030 0 0004 0 6 016, C 7 0 0 060000300000406026,7001000003000 00424 0IB,700120000300000424029, C'OOO'O 0 00 OOTC 0 00 05160 4"E,7'02'0'00 0 O'C'3 00'001 014249, 70 0160 00 0 300001115 013$ .C70 016 00 003 0 00 01116 0 26, 0 0 00 00 0 0 0400 0 Oil 23326 , 60 00 0 0 00 0 ‘,000012152 0 6, 04000.0 00 004 0 0001215236, 10000000 0400 001401036,70 00 0 000030000161720 8, C 0 0 0 000000200001722078,710000000300002201146,73000 0000300002201228, 0700003000300002313206,7000020003000 02313326,7 00 4 OO O G O 300002324018, 0706 0 0 00 00 3 000 02324148,7 000200 0 03 00002332146, 30 00 00000400.002601043, 07400 0000 0500220501048,760 0 000 00527221124056/
LOW= 0 HIGH = 3 2
1000 AVERAGE=(HIGH+LOW+l)/2CbDE=TA6LE(AVERAGE).AND.LAST IF(CODE-SYM80L)1010,1040 ,1020
1010 LOW=AVERAGEI F (HIGH-LOW-l)1000,1030
1020 HIGH-AVERAGEIF(HIGH-LOW-l)10 0 0,103 0
1030 CONTINUE ITYOE = 7 CODE = 0 CALL E R R D U E (9)RETURN
1040 ITYPE = S H I FT(TABLE(AVERAGE),30).AND,63CODE = S H I F T (TA8LE(AVERAGE).AND.FIRST,13) RETURN
'END .
C
O O O O O o O o O o o o o o o o
94FORTRAN EXTENDED VERSION 2,0/E 04/29/72
o o o o o o o o o o o o o o o o c o c G i f l o o o o o e o o e e o e o o e e o o o o o o o c e e e o o e o o e - o o o o o o o o e o o o o o o
.. SUBROUTINE SYMBOL ,o -
PURPOSE ,, THE SYMBOL SUBROUTINE DETERMINES WHETHER SYMBOLIC OR
ABSOLUTE LABELS ARE TO BE USED, IF SYMBOLIC THE SYMBOL , IS ENTERED IN THE SYMBOL TABLE,
, ' DESCRIPTION OF PARAMETERS ,LABTST - IF EG 0 SYMBOLIC ADDRESSING
IF EQ 1 ABSOLUTE ADDRESSINGIADDR , - LOCATION COUNTERIFIND - FLAG FOR DUPLIGAT..;LABELS ' ,
o o o o © e c o e o o c e o o e e o o o o o e o o o o 0 0 0 0 0 0 6 o e o e o e o o o o e e o o o o o o o o o c e c o e e o o e e e o o G .
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
33 IF(LABTST,EQoi)GO TO 40
95SYMBOL FORTRAN EXTENDED VERSION 2,0/E
35 CONTINUECALL E R R Q U E (14)RETURN
40 CONTINUE •IAOOR = F I E L D (1,1)
mo i f i n d = -iRETURN ■
70 CONTINUECALL E R R Q U E (13)RETURN
' END
04/29772
FORTRAN EXTENDED VERSION 2,0/E 04/29/72© O O O O O O O O O O O © O O O O O O O ' O O » O © © O O C © G O O O O O e O e O O G O O O O O O O 6 O © O 0 O 0 © O O O © O
SUBROUTINE TRAFLG
PURPOSETHE TRAFLG SUBROUTINE PRINT HEADINGS FOR TRACE
ITEMP - IF EQ 0 TRACE FOR PRESENT INSTRUCTION IS OFF IF EQ i TRACE FOR PRESENT INSTRUCTION IS ON
o e e o o o e o o o o e o e c o o o e o o o o o o o © o o o o o o e o o c o o © e e e o o o e o e e c c o o c o o c o o o e
SUBROUTINE TRAFLG(ITEMP) , . ' .LOGICAL OOUMP LOGICAL ' TRACE LOGICAL ERRFLG •INTEGER ERROR
COMMON /ONE/ L I N C N T ,I T E X T (80>s IC O U N T ,NUMBER COMMON /TWO/ TRACE,ERROR,ERRFLG,OOUMP
DATA KOUNT/58/
IF(ITEMF,EO„0)GO TO 10 IF(TRACE)RETURN TRACE = , TRUE,IF CLINCNT. G T , KOUNT) CALL PAGH'EDX3)WRITECfc, 1000)GO TO 20
0 IF(.NOT.TRACE)RETURN ■TRACE - .FALSE,W R I T E (6,1001)
0 LINCNT = LINCNT + 2 RETURN
0 FORMAT(2X, 13H//TRACE ON ///6X , 2-HPC,7X , 2HIR,6X , 4 H L I N K , 6 X ,2HAC C2HMD,7X,2HMA,7X,2HIA»7X»2HIB/)
1 FORMAT(2X,13H//TRACE OFF//)END
FORTRAN EXTENDED VERSION 2.0/E 04/29/72o o o o o o o o o o o c c o o o o o o e o © o o o o o o o o o o o o c o a e o e o o o o o o o o o o o o c o o e e o o o o o o o e c ©
»SUBROUTINE TYPE . .
. . ' • ■ ■ ■ • ' 'PURPOSE
THE TYPE SUBROUTINE EXTRACTS THE TABLE POINTERS USED IN LEXICAL ANALYSISY
- • - 'DESCRIPTION OF PARAMETERS
NEXT - INDEX INTO TABLE. 1
o o o e o o o o o o e o o o e e o e e o e o o o o e o o e o o e o e e o o e e e e e e e o o c e e e o e e o ^ e e o e e o o o o e o o -
SUBROUTINE TYPE(NEXT) .INTEGER FIELD ' '
DIMENSION ITABLEC23) -
COMMON /THREE/ ICHAR, KIND, F I E L D (4,2), IPOINT,LOCATE
DATA ITABLE /0 2222222222222222222B, 222222233333333777703,C 7 6 7 0 6 1 7 7 7 7 7 7 5 7 7 7 7 7 7 7 6,77 7 7 1 2 2 2 2 2 2 2 2 2 2 2 2222B,22222222222222222 2 2 2 B, C 2 7 7 7 7 7 7 7 7 1 1 7 7 7 7 7 7 7 7 7 B , 777777771777777777779,777777777777777333338, 03337777717777177777 7 6,7777777777 7717777777 6,77777 7 777 77777777 774 9, 0444^^4477777771771776,7 77777777777777715556,55555555555 555555555B, '0555555555555555555556,555555551555555555556,177777777777777777776, 07777777441,444^477 7676, 7 77777 777 777777 777776,77771777777777777 77 7 0, 0 7 7 7 7 77777777777777776,777717777 117777717778,777777770000000000003/
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
o o o G o e o o o o o o o o o o G G o o c o o o o o e o e o o o o ^ o o e o o o o e o © o e e o e o o e o e o e e o e o o e e e e e e o ©
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.
2 0
6 735 5