366 Part 4 The instruction-set processor level: special-function processors
Section 4 Processors based on a programming language
of the pointers correspond to indirect addresses. Figure 2 shows a sketch of the overall system control and Tables 2 to 7 show to what extent the original statements have been altered.
Loading a program
A program, which is punched in a paper tape, is loaded into memory by energizing the tape read circuit which reads a statement on the tape, including the end-of-statement symbol +, into the I/O buffer. The read circuit is then de-energized. The least significant 6 bits of each word of the buffer hold the internal BCD representation of each symbol.
A scan circuit (Fig. 3) now picks up each symbol in the statement from left to right and as each symbol is decoded it reacts as follows.
1 If the first symbol is a digit, control is turned over to a Statement Number Load circuit. This circuit shifts the statement number digit by digit into a register (SHR). The maximum allowable length of a statement number is 4 digits and all statement numbers are carried internally in this form, i.e., a programmer's statement number 13 is carried in 2 words as 0013. A search is now made of the Symbol Table area. One of three possibilities exists:
Fig. 2. FORTRAN computer system.
a The statement number is not found in the Symbol Table. It is put into the Symbol Table followed by the value of the current Program location. The statement number is also put into the Program Area starting at this location and the Program Counter incremented appropriately, i.e., by 2 since two 8-bit words are used.
b The statement number is found in the Symbol Table because it has been previously referred to by an IF or GO TO. The current value of the Program Counter is placed into the two memory locations following the statement number. (These were left blank when the statement number was previously processed.) The statement number is put into the Program Area and the Program Counter is incremented.
c The statement number is found in the Symbol Table because it has been previously referred to by a DO statement. A description will be deferred until the DO statement loading is described since the circuit's behavior is more meaningful in that context.
2 After a statement number has been processed in this fashion or if the first symbol in the statement was not a digit (no statement number was assigned) then the scan circuit continues to pick up each symbol from left to right until it is able to classify the statement as to type. It then turns over control to the appropriate loading circuit as indicated in Fig. 3.
All of these loading circuits put the statements into the Program Area after replacing variable names and statement number references in the program with addresses or pointers. They also replace reserved names such as GO TO or CONTINUE with a single 8-bit code (token). Each unique variable name in the program, however, is also stored in the Symbol Table once using an 8-bit code for each symbol. For nonsubscripted variables the three words following the name are reserved for the data that will be associated with this name when the program is executed. Subscripted variable names are found in DIMENSION statements which must precede the use of these variables in the program. In this case as many locations following the name are reserved as have been computed from the DIMENSION statement. The name in the Symbol Table is preceded by a special symbol a , to indicate that it is a subscripted variable. In addition, the first of the two subscript values in the DIMENSION statement is also stored immediately following the name. This number is needed during program execution for constructing the proper element of the array specified by a subscripted variable.1 The address of
1
A pointer to the next available location in the Symbol Table is also stored for speed in Symbol Table searching.