FORTRAN DESCRIPTION The FORTRAN compiler system translates a symbolic source program written according to American Standard Basic FORTRAN specifications into a relocatable object program which can be loaded and executed under control of the Basic Control System. The FORTRAN Compiler accepts as input paper tape containing a control statement and a source language program. The output produced by the Compiler may include a punched paper tape containing the object program; a listing of the source language program with diagnostic messages, if any; and a listing of the object in program assembly level language. CONTROL STATEMENT The control statement specifies the output to be produced; it must be the first statement of the source program. FTN, p1, p2, p3 FTN is a free field control statement. Following the comma are one to three parameters, in any order, which define the output to be produced. The control statement must be terminated by an end-of-statement mark, (CR)(LF). Spaces embedded in the statement are ignored. The parameters may be a combination of the following: I B Binary output: A program is to be punched in relocatable binary format suitable for loading by the Basic Control System loader. L List output: A listing of the source language program is to be produced during Pass One. A Assembly listing: A listing of the object program in assembly level language is to be produced in the last pass. SOURCE PROGRAM The source program follows the control statement. Each statement is followed by the end-of-statement mark, (CR)(LF). Specifications statements must precede executable statements. The last statement in each program submitted for compila- tion must be an END statement. Up to five source programs may be compiled at one time. The last program must be followed by an END$ statement, if less than six programs are to be compiled. (For complete details see FORTRAN Program- mer's Reference manual.) The control statement, each of the five programs, and the END$ terminator may be submitted on a single tape or on separate tapes. If more than five programs are contained on a tape, the compiler processes the first five and halts with the T- Register containing 102077. The remaining programs must be compiled separately. BINARY OUTPUT The punch output produced by the compiler is a relocatable binary program. It does not include system subroutines introduced by the compiler, or library subroutines referred to in the program. 5-1 OPERATING INSTRUCTIONS The exact operating procedures for a compilation depend on the available hardware configuration. One possible allocation of equipment might be as follows: Compiler Standard Unit Physical Unit Input/Output Designation Assignment Binary output Punch Output 2753A Tape Punch List output Teleprinter Output 2752A Teleprinter Assembly listing Teleprinter Output 2752A Teleprinter Source Tape(s) Input 2737A Punched Tape Reader If there are two output devices as shown above, there are two passes (8K memory) or four passes (4K memory). The list output and an intermediate binary tape are both produced during the first pass; the assembly listing and the binary output are both produced during the last pass. If one output device is available list output and intermediate binary output are written on the same tape during the first pass (the Compiler ignores the list output when reading the binary data during the second pass). The Binary output is then produced in the next to the last pass; and the assembly listing, in the last pass. PAPER TAPE SYSTEM The following procedures indicate the sequence of steps for compilation of a source program: A. Set Teleprinter to LINE and check that all equipment to be used is operable. If the Teleprinter is the only output device, turn ON punch unit. B. Load FORTRAN Pass 1 using the Basic Binary Loader. C. If the System Input/Output (SIO) subroutines are on a tape which is separate from FORTRAN Pass 1, load the tape using the Basic Binary Loader. D. Set Switch Register to starting address of FORTRAN Pass 1: 000100 E. Press LOAD ADDRESS. F. Place source language tape in device serving as the Standard Input unit (e.g., Punched Tape Reader). G. Press RUN. H. If more than one source tape, repeat Steps F and G for each tape. I. Perform either of the following depending on memory size: 4K Memory 1. At end of Pass 1 (T-Register contains 102077) load Pass 2 using the Basic Binary Loader. 2. Remove binary output from Standard Punch device and place in device serv- ing as the Standard Input unit. (If only one output device, both binary and list output are on the same tape.) 5-2 3. Set Switch Register to: 000100 4. Press LOAD ADDRESS. 5. Press RUN. 6. At end of Pass 2 (T-Register contains 102077), load Pass 3 using the Basic Binary Loader. 7. Remove binary output from Standard Punch device and place in device serv- ing as Standard Input unit. 8. Set Switch Register to: 000100 9. Press LOAD ADDRESS. 10. Press RUN. 11. At end of Pass 3 (T-Register contains 102077), load Pass 4 using the Basic Binary Loader. 12. Remove binary output from Standard Punch device and place in device serv- ing as Standard Input unit. 13. Set Switch Register to: 000100  14. Press LOAD ADDRESS. 15. Press RUN. 16. At end of Pass 4, the relocatable binary object tape is on the Standard Punch unit. Either of the following conditions may exist: a. If the T-Register contains 102077, the compilation is complete. If an assembly listing was requested, it is on the List Output device. b. If the T-Register contains 102001, an assembly listing pass is to be performed: (1) Place binary output from Pass 3 in deyice serving as Standard In- put unit. (Turn off Teleprinter punch unit.) (2) Press RUN. (3) At end of listing pass, T-Register contains 102077. 8K Memory 1. At end of Pass 1(T-Register contains 102077), load Pass 2 using the Basic Binary Loader. 2. Remove binary output from Standard Punch device and place in device serv- ing as the Standard Input unit. (If only one output device, both binary and list output are on the same tape.) 3. Set Switch Register to: 000100 4. Press LOAD ADDRESS 5-3 5. Press RUN. 6. At end of Pass 2, the relocatable binary object tape is on the Standard Punch unit. Either of the following conditions may exist: a. If the T-Register contains 102077, the compilation is complete. If an assembly listing was requested, it is on the List Output device. b. If the T-Register contains 102001, an assembly listing pass is to be performed: (1) Place binary output from Pass 1 in device serving as Standard In- put unit. (Turn off Teleprinter punch unit.) (2) Press RUN. (3) At end of listing pass, T-Register contains 102077. MAGNETIC TAPE SYSTEM Following are the steps for a compilation when using a magnetic tape system: A. Set Teleprinter to LINE and check that all equipment to be used is operable. If the Teleprinter is the only output device, turn ON punch unit. B. Load FORTRAN Pass 1 using the Magnetic Tape Binary Loader. C. Place source language tape in device serving as the Standard Input unit. D. Press RUN. E. At the end of compilation, the relocatable binary object tape is on the Standard Punch unit. Either of the following conditions may exist: 1. If the T-Register contains 102077, the assembly listing was requested and is on the List Output device. 2. If the T-Register contains 102001, an assembly listing pass is to be per- formed. Turn off Teleprinter punch unit. Press RUN. 5-4 BASIC CONTROL SYSTEM LOADER OPERATING PROCEDURES SUMMARY The Basic Control System Loader is used to load the object programs generated by FORTRAN and any referenced library routines. Listed below is a summary of procedures for normal loading of relocatable object programs and library routines (and for the printing of a Memory Allocation Listing):t 1. Load the Basic Control System tape using the Basic or Magnetic Tape Binary Loader. 2. Set Switch Register to 000002, press LOAD ADDRESS, and set Switch Reg- ister to 000000. 3. Place FORTRAN generated relocatable object tape in Standard Input unit. 4. Press RUN. The loader types "LOAD" it expects another relocatable or li- brary program. 5. If more than one relocatable object tape is to be loaded, repeat Steps 3 and 4 for each. Otherwise set Switch Register to 000004 to load library rou- tines. 6. Place Program Library tape in device serving as Program Library unit. 7. Press RUN. When the loading operation is complete, the loader types "*LST". Press RUN. The Loader types "*RUN" indicating the program is ready for execution. HALTS During the operation of the Compiler, the following halts may occur: T-Register Explanation Action 102000 Memory overflow: the pro- Irrecoverable error, pro- gram is too long. gram must be revised. 102001 End of binary object tape If only one output device, output, start of assembly place intermediate binary listing. in Standard Input unit and press RUN. 102007 For all passes except first, If punch error, restart with unrecognizable record on Pass 1. intermediate binary tape: If wrong tape, restart cur- rent pass. 1) Punch error on previous a) Load FORTRAN pass. pass. b) Set Switch Register to 2) Wrong tape supplied as 000100. input for pass. c) Press LOAD ADDRESS. d) Place previous binary tape in input device. t See Chapter 3 for details and options. 5-5 T-Register Explanation Action 102010 External Symbol Table Irrecoverable error; pro- overflow; the number of gram must be revised. external symbols exceeds 255. 102011 Checksum error. Attempt to re-read record (binary records are sepa- rated by 4 feed frames). Pass 1. 102017 A tape write error has oc- Restart with beginning of curred during Pass 1. Pass 1. 102027 A tape read error has oc- Restart with beginning of curred during Pass 2. Pass 1. 102066 Tape supply low on 2753A Load new tape and press Tape Punch. RUN. 102077 Normal end of pass or Proceed as indicated in compilation above steps. Diagnostic messages or halts might also occur for the following: Operation System Reference Loading FORTRAN Basic Binary Loader Chapter 1 compiler or SIO Magnetic Tape Binary Chapter 2 tapes Loader FORTRAN FORTRAN Appendix A compilation Loading object BCS Relocating Chapter 3 programs and Loader library routines Executing I/O I/O system (FRMTR) Appendix D operations during running of object program Executing Basic Program Library Appendix E External Functions during running of object program 5-6