This description of the PDP-11 FORTRAN IV OTS was developed by students at Middlebury College, Vermont working in cooperation with Digital FORTRAN personnel. Everyone involved tried to ensure that a useful body of information would be presented. Time and resources, however, were limited. It MUST be emphasized, therefore, that there is NO GUARANTEE of either the COMPLETENESS or FULL ACCURACY of all the material presented herin. FORTRAN IV OTS PREFACE AUDIENCE ASSUMPTIONS It is assumed that readers are advanced FORTRAN programmers. The material in this manual is not needed for normal use of FORTRAN, therefore beginning programmers may it confusing. MANUAL OBJECTIVES This manual describes the FORTRAN IV Object Time System (OTS), lists the global entry points in the OTS, and tells how to use knowledge of the OTS to reduce program size. STRUCTURE OF THIS DOCUMENT This manual contains nine chapters and three appendixes: 1. Chapter 1 describes the OTS and gives a brief explanation of threaded code. 2. Chapter 2 explains how the OTS handles I/O. 3. Chapter 3 tells how this manual and a knowledge of the OTS can be used to reduce program size. 4. Chapter 4 describes the OTS utility modules. 5. Chapter 5 describes the OTS file handling modules. 6. Chapter 6 describes the OTS conversion modules. 7. Chapter 7 describes the OTS arithmetic modules. 8. Chapter 8 describes the OTS subroutine support modules, including the modules that define the library subroutines. 9. Chapter 9 describes the OTS library functions. 10. Appendix A lists the OTS modules and their sizes. 11. Appendix B is a cross-reference listing of the OTS entry points and their modules. 12. Appendix C describes the OTS PSECTS, the OTS work area, for RT-11 and RSTS/E, the file descriptor block (FDB), and, for IAS, RSX-11, and VMS, the logical unit control block (LUB). USING THE MANUAL If you are not familiar with the FORTRAN IV OTS, the description of the OTS in Chapter 1 will clarify the explanations of the entry points. If you have a working knowledge of the OTS, you may wish to begin with Chapter 2. FORTRAN IV OTS PAGE 2 PREFACE RELATED DOCUMENTS The following documents are relevant to the use of the OTS. The proper User's Guide depends on your operating system. RT-11, RSTS/E FORTRAN IV User's Guide IAS, RSX FORTRAN IV User's Guide PDP-11 FORTRAN Language Reference Manual DOCUMENT CONVENTIONS The term RSX-11 refers to both RSX-11M and RSX-11M PLUS, unless otherwise noted. In this manual, an entry point name refers to the routine referenced by that entry point. CHAPTER 1 SUMMARY OF THE FORTRAN IV OBJECT TIME SYSTEM A FORTRAN IV source program must be run through a FORTRAN IV compiler and a task builder, or linker, before it becomes an executable program. The com- piler translates the source program into an object module; then, the task builder, or linker, produces the executable program by combining the object modules with the necessary routines from the FORTRAN IV Object Time System (OTS) and the user library (See Figure 1-1). The FORTRAN IV OTS is a library of assembly language modules; each module contains one or more routines that perform various functions needed by FOR- TRAN programs. A routine is referenced by an entry point, which is the ad- dress of the routine's first instruction. 1.1 OBJECT MODULES A compiler can generate two types of object modules; threaded code or in- line code. You choose threaded or inline code by using the appropriate compiler switch from the list below: RT-11 /code:xxx RSTS/E /I:xxx RSX-11M, IAS /CD:xxx where xxx is: EAE (EAE hardware) } EIS (EIS hardware) } inline code FIS (EIS and FIS hardware) } THR threaded code 1.2 THREADED AND INLINE CODE Most FORTRAN programs should be compiled with threaded code because thread- ed code is smaller and executes as fast as inline code. The exception is a FORTRAN program which uses only integer arithmetic; in this case, inline code executes faster and is as small as threaded code. Threaded code has one advantage regardless of the FORTRAN program being linked; it is FORTRAN IV OTS PAGE 1-2 hardware independent. In other words, threaded code object modules created under one system configuration can be linked under another configuration without being re-compiled. Inline and threaded code are compared in Figure 1-2. FORTRAN IV OTS PAGE 1-3 Figure 1-2 Comparison of Inline and Threaded Code Source Code Load Map Inline Code FORTRAN IV OTS PAGE 1-4 Threaded Code The numbers in parentheses following each statement are used later in the text. FORTRAN IV OTS PAGE 1-5 1.2.1 Inline Code When inline code is selected, the compiler produces the one-to-one PDP-11 machine instructions required for the arithmetic hardware in the system configuration. If a function cannot by performed by a short sequence of machine instructions, the OTS routine for that function is referenced. 1.2.2 Threaded Code Threaded code consists of entry points to the OTS routines and any argu- ments the routines may need. When the threaded code modules are linked, the task builder, or linker, creates a list of the routine and argument ad- dresses and places the address of this list in R4. Later, during program execution, the executive uses R4 as a virtual program counter to step through the threaded code. To begin execution, the executive loads the address of the first threaded code routine into R4, and executes the following instruction: JMP @(R4)+ This instruction passes control to the first routine and increments R4, the virtual program counter; R4 now points to the address of either the next routine or the arguments needed by the first routine (any arguments re- quired by a routine are placed in memory following the routine's entry point, see Figure 1-2, MOF$MS). The arguments are addressed in autoincre- ment address mode which increments R4 after the argument is referenced. Therefore, at the end of the routine, regardless of the number of arguments required, R4 contains the address of the next routine. At the end of the routine, the executive executes the instruction "JMP @(R4)+" which passes control to the next routine and again increments R4. In this way the exe- cutive uses R4 to step through the threaded code. Below is a step by step explanation of the threaded code in Figure 1-2; the numbers below correspond to the numbers in parentheses in that figure. 1. The internal statement number is incremented. 2. The variable, REAL, is moved from memory to stack. The address of the variable is $DATA+#000010 (see the load map in Figure 1-2). 3. A floating-point divide is performed. The numerator is on the stack and the denominator follows immediately in memory. The first word of the floating-point constant, 2.0, is #040400. 4. The value on top of the stack is converted to REAL*8. 5. The double-precision constant 3.1415926535D0 is added to the number on top of the stack. Only constants that fit in one 16-bit word are stored inline. Therefore, in this example, a memory lo- cation in the $DATAP PSECT holds the value of the double-precision constant. FORTRAN IV OTS PAGE 1-6 6. The value on top of the stack is moved to location DBLE. The ad- dress of DBLE is $DATA+#000000 (see the load map in Figure 1-2). 1.3 THE OTS MODULES The FORTRAN IV OTS is used on the following systems: 1. RSTS 2. RSX-11 3. RT-11 4. VAX Because of the differences between the systems, there are three groups of OTS modules: 1. Modules common to all of the systems (these modules use condition- al code where it is necessary to differentiate between systems) 2. Modules common to RT-11 systems, and RSTS/E systems running under the RT-11 emulator 3. Modules common to RSX-11 systems, IAS systems, and VMS systems running under RSX Compatibility Mode If you are using RT-11 or RSTS/E your FORTRAN OTS consists of the modules in groups 1 and 2 above. If you are using RSX-11, IAS or VMS your FORTRAN OTS consists of the modules in groups 1 and 3 above. In this manual, when a reference is made to the OTS modules as a group, the reference applies to the FORTRAN OTS which you are using. The modules of the OTS fall into six principal categories: 1. Utilities 2. File handling 3. Conversions 4. Arithmetic functions 5. Subroutine support 6. Library functions They are discussed briefly below and in greater detail in later chapters. 1.3.1 Utilities Utility routines perform functions needed by other routines. For example, they get files, put blocks in files, and check the status of specified FORTRAN IV OTS PAGE 1-7 bits. Under normal circumstances, the programmer does not see these rou- tines, because they are called only by other routines. 1.3.2 File Handling File-handling routines perform program I/O which includes reading, writing, opening and closing files. If an error occurs during I/O, the file han- dling routines direct program control; if the keywords END or ERR were used, control will be passed to a recovery routine, otherwise, control is passed to an exiting routine. 1.3.3 Conversions There are two types of conversions, arithmetic and I/O: 1. Arithmetic conversions convert data from one type to another. For example, if a program adds an integer to a real number, an arith- metic routine converts the integer to a real number before the ad- dition is performed. 2. I/O conversions convert data from internal format to external for- mat, or vice versa. For example, if an input format statement has an L field descriptor, the data is read as 'T' or 'F' and convert- ed to a -1 or 0, respectively, before being stored. 1.3.4 Arithmetic Functions The arithmetic routines perform math operations; multiplication division addition subtraction exponentiation and program control operations; branches DO statements logic The code needed to move variables from one storage area to another is also included in the arithmetic routines. FORTRAN IV OTS PAGE 1-8 1.3.5 Subroutine Support OTS subroutine support consists of the routine which transfers program con- trol to the subroutines defined in the OTS, and the routines that perform the subroutines defined in the OTS. 1.3.6 Library Functions The OTS library routines perform the FORTRAN library functions. 1.4 CALLING THE OTS ROUTINES Listed below are the calls used to reference the FORTRAN IV OTS routines. By far the most common calls are those using register 4 (R4) and the pro- gram counter (PC). 1. R3 calls are used to call SAVRG$ (see Section 4.34). 2. R4 calls are used to execute or simulate threaded code (see Sec- tion 1.2.2 for more information on threaded code). 3. R5 calls are used to call $CHKER (see Section 5.4.1) and $OPNER (Section 5.4.9). 4. PC calls are used to call all other user-defined and OTS routines; this is the PDP-11 standard calling convention. CHAPTER 2 I/O IN THE FORTRAN IV OBJECT TIME SYSTEM The I/O subsystem of the FORTRAN IV OTS uses two data bases. The first data base is the work area; this contains information concerning the I/O statement. The work area also contains an offset FILPTR which points to the second data base when an I/O operation is in progress. For RT-11 and RSTS/E systems, this second data base is the File Descriptor Block (FDB) which contains information concerning the file being processed. For IAS, RSX-11 and VMS, this second data base is the Logical Unit Control Block (LUB) which contains, among other things, the offset D.FDB which points to the FDB. Figure 2-1 The I/O Subsystem in the FORTRAN IV OTS I/O IN THE FORTRAN IV OBJECT TIME SYSTEM PAGE 2-2 Because only routines which deal directly with the files are system depen- dent, the I/O subsystem is divided into three levels (see Figure 2-1); this allows many of the routines to be used for all systems. The major difference between the systems is that in RT-11 and RSTS/E, the FDB is an OTS entity; in IAS, RSX-11 and VMS, the FDB is a system entity. This means that in RT-11 and RSTS/E systems all of the routines in the I/O sub- system are performed within the OTS; in IAS, RSX-11 and VMS systems the routines in the I/O subsystem often call system routines to perform file control and file processing. The three levels of the I/O subsystem are described below: 1. The compiled code interface level contains the I/O routines that are called directly from the compiled code. 2. The data formatting level contains the routines that convert vari- ables from internal representation to external representation and vice versa. 3. The record processing level contains the routines that act on the files. In addition to the routines in these three levels, there are also I/O sup- port routines used by routines in all three levels. The following sections will describe the three I/O levels and the I/O sup- port routines. 2.1 The Compiled Code Interface There are four types of compiled code interface: file interface, I/O com- mand interfac, I/O format statement interface, and I/O list interface. The sections below describe each type of interface. Table 2-1 lists the entry points and section references for the routines in the compiled code inter- face. For more information about a routine in this section, see the sec- tion reference of that routine in Table 2-1. I/O IN THE FORTRAN IV OBJECT TIME SYSTEM PAGE 2-3 Table 2-1 Compiled Code Interface Routines |-------------------------------| |Type of | Entry | Section | |Interface | Point | Reference | |-------------------------------| | |BKS$ | | | |$CSTM | | |File |$OSTM | | | |RWD$ | | |-------------------------------| | |DEC$ | | | |DEF$ * | | |I/O |DEO$ | | |Command |ENC$ | | | |ENO$ | | |-------------------------------| | |IBR$ * | | | |IBW$ * | | | |IFR$ | | |I/O |IFW$ | | |Format |ILR$ | | |Statement |ILW$ | | | |IRR$ * | | | |IRW$ * | | | |IUR$ * | | | |IUW$ * | | |-------------------------------| | |EOL$ | | | |TAC$ | | | |TAD$ | | | |TAF$ | | | |TAI$ | | | |TAL$ | | | |TAP$ | | |I/O List |TAQ$ | | | |TVC$ | | | |TVD$ | | | |TVF$ | | | |TVI$ | | | |TVL$ | | | |TVP$ | | | |TVQ$ | | | |TVS$ | | |-------------------------------| * These routines are different for RT-11, RSTS/E and IAS, RSX-11, VMS. I/O IN THE FORTRAN IV OBJECT TIME SYSTEM PAGE 2-4 2.1.1 File Interface There are four file interface routines. Because these routines act on files they are system dependent; they perform the same function on all systems but, are implemented one way for RT-11 and RSTS/E, and a different way for IAS, RSX-11 and VMS. The BKS$ and RWD$ routines perform the FORTRAN IV BACKSPACE and REWIND statements, respectively. The $OSTM and $CSTM routines are used to check the keywords given by the FORTRAN IV OPEN and CLOSE statements, respective- ly. 2.1.2 I/O Command Interface DEC$ and ENC$ perform the FORTRAN IV DECODE and ENCODE statements, respec- tively. If the format specifier in a DECODE or ENCODE statement is re- placed by a format given in an array, DEO$ and ENO$ perform the statements. Finally, DEF$ performs the DEFINE statement. 2.1.3 I/O Format Statement Interface The I/O statement interface routines first check to be sure that the de- sired I/O can be preformed on the specified file. If it cannot, the I/O statement interface routine generates an error; otherwise, the routine passes control to the data formattting level. For instance, if a formatted read statement occurs in a FORTRAN IV program, IFR$ checks the specified file. If the file is not formatted, IFR$ will generate an error rather than pass control to the data formatting level. ILW$ is called for list formatted write operations; IBR$ and IBW$ are called for object time I/O operations; IFR$ and IFW$ are called for for- matted I/O; IRR$ and IRW$ are called for random access I/O; and IUR$ and IUW$ are called for unformatted I/O. 2.1.4 I/O List Interface Before the data formatting level can translate the elements of the I/O list from internal to external representation or vice-versa, information about the elements is needed. For instance, their types, their sizes, the ad- dress of the first element, and how many elements there are; this is the information the I/O list interface places in the work area before passing control to the data formatting level. The I/O list interface routines with names beginning with 'TA' are used for elements which are arrays; the rou- tines with names beginning with 'TV' are used for elements which are vari- ables or constants. The EOL$ routine terminates the I/O list. I/O IN THE FORTRAN IV OBJECT TIME SYSTEM PAGE 2-5 2.2 Data Formatting Level Table 2-2 lists the entry points and section references for the routines in the data formatting level. These routines convert data, according to the format given, from internal to external representation, or vice-versa. The routines in modules $CONVF, $CONVI and $CONVL with entry points ending in 'O,' convert from internal to external representation; the routines in these modules with entry points ending in 'I,' convert from external to internal representation. The first letter of the entry point indicates which FORTRAN IV format is being used. The routines in module $FIO handle the conversions for all formats not co- vered in the first three modules listed in Table 2-2. $OBFJMT converts the data passed in run time I/O. For more information about a routine in this section, see Table 2-2 for the section reference of that routine. Table 2-2 Data Formatting Routines |-------------------------------| | Module | Entry | Section | | | Point | Reference | | | RCI$ | | |-------------------------------| | | $ECI | | | | ICI$ | | |$CONVI | ICO$ | | | | OCI$ | | | | OCO$ | | |-------------------------------| |$CONVL | LCI$ | | | | LCO$ | | |-------------------------------| | $FIO | $FIO | | | | $$FIO | | |-------------------------------| | $OBJFMT | $OBJFMT| | |-------------------------------| | | DCO$ | | | | ECO$ | | |$CONVF | FCO$ | | | | GCO$ | | |-------------------------------| I/O IN THE FORTRAN IV OBJECT TIME SYSTEM PAGE 2-6 2.3 Record Processing Level There are six record processing routines. Because these routines act o n files they are system dependent; they perform the same function on all systems but, are implemented one way for RT-11 and RSTS/E, and a different way for IAS, RSX-11 and VMS. Table 2-3 Record Processing Routines |-----------------------| | Entry | Section | | Point | Reference | |-----------------------| | $CLOSE | | | $EOF | | | $GETREC | | | $OPEN | | | $PUTREC | | |-----------------------| The $CLOSE and $OPEN routines perform the FORTRAN IV CLOSE and OPEN state- ments, respectively. $GETREC and $PUTREC read and write a file's records, respectively. $EOF performs the FORTRAN IV ENDFILE statement. For more information about a routine in this section, see Table 2-3 for the section reference of that routine. 2.4 I/O Support Routines The I/O support routines are called by routines in all levels of the I/O subsystem. Table 2-4 I/O Support Routines |--------------------- --| | Entry | Section | | Point | Reference | |-----------------------| | $CHKER * | | | $DUMPLAST | | | $FCHNL ~ | | | FND$ ~ | | | $GETBLK | | | $GETFILE | | | $GETINF | | | $INITIO | | | $OPCL ~ | | | $OPNER * | | I/O IN THE FORTRAN IV OBJECT TIME SYSTEM PAGE 2-7 | $PUTBLK | | | $SAVRG | | | $SAVR4 | | | $SETINF | | |-----------------------| * These routines are used by RT-11 and RSTS/E only. ~ These routines are different for RT-11, RSTS/E and IAS, RSX-11, VMS. $CHKER is called if an error occurs during an I/O operation; $OPNER if an error occurs during execution of the OPEN statement. $CHKER and $OPNER first check to see if the keyword ERR was used. If ERR was not used, they return control to the statement which caused the error; otherwise, they call $CLOSE to close the file and then $IOEXIT, which recovers the program from the error and passes control to the transfer statement given by ERR. $DUMPLAST prepares a buffer containing the last block of a file; then, if necessary, calls $PUTBLK to write it to the file. $INITIO is called by all of the I/O format statement interface routines to initialize I/O. $OPCL enters the OPEN statement keywords and the CLOSE statement keywords in the OTS work area. The following I/O support routines are called to get information for the calling routine: 1. $FCHNL gets the address of the File Descriptor Block (FDB) 2. FND$ is used in random access I/O for finding the address of a specified block 3. $GETBLK gets a block from a file 4. $GETFILE checks to see if an I/O operation is in progress, then calls $FCHNL to get the address of the FDB 5. $GETINF is used in random access I/O for finding the number of a specified record 6. $PUTBLK writes a block to a file 7. $SAVRG is a save/unsave coroutine for six registers 8. $SAVR4 is a save/unsave coroutine for four registers 9. $SETINF is used in random access I/O for finding the length of a specified record. $SETINF also enters the record length, and the number of the next block in the work area For more information about a routine in this section, see Table 2-4 for the section reference of that routine. CHAPTER 3 REDUCING PROGRAM SIZE This chapter explains how you can reduce program size through a knowledge of the OTS. It is written under the assumption that you have read the chapter entitled "Increasing FORTRAN IV Programming Efficiency" in the ap- propriate FORTRAN IV User's Guide. If you have followed all of the pro- gramming hints in that chapter and your program still needs space, this chapter should be useful. There are four sections in this chapter: 1. Section 2.1 explains the automatic code reduction done by the FOR- TRAN OTS 2. Section 2.2 explains how you can reduce code if your program uses run time formatting or list formatting 3. Section 2.3 explains how to use overlays on an RT-11 or RSTS/E system 4. Section 2.4 explains how to use overlays on an RSX-11M system 3.1 REDUCTIONS MADE BY THE OTS The OTS saves a FORTRAN programmer both execution time and memory space in two ways: by grouping the OTS entry points efficiently, and by optimizing the code for common arithmetic statements. 3.1.1 GROUPING OF THE ENTRY POINTS When object modules are linked, all references to OTS entry points must be resolved by including, in the task image, the OTS modules defining those entry points. Because entire modules must be brought into memory, entry points are grouped as efficiently as possible. They are placed in the same module: 1. If they share code. Several entry points may perform functions which are very similar, functions which differ only in a flag value or in the way arguments are passed. For instance, the mo- REDUCING PROGRAM SIZE PAGE 3-2 dule for random access, $RIO, contains the entry points IRR$, $IRR, IRW$, and $IRW; the pairs IRR$/$IRR and IRW$/$IRW differ in a read/write flag value, and the different placement of the dollar sign ($) within each pair indicates a difference in how arguments are passed. Because of their similar functions, the four entry points can share much of their code. 2. If they are likely to be used together. For instance, the utility routines $GETBLK and $PUTBLK, which are used for reading/writing blocks to/from a file, are both in module $RWBLK. Grouping these entry points into one module reduces the linker's overhead as it searches the library for unresolved references. 3.1.2 CODE OPTIMIZATION 3.2 DUMMY ROUTINES In order for a FORTRAN program to perform I/O operations the necessary I/O conversion routines from the OTS must be included in the task image. FORTRAN format statements indicate which I/O conversion routines are needed in the task image. Therefore, instead of searching the OTS for all of the I/O conversion routines, the task builder, or linker, searches and includes in the task image, only those routines needed by the program being pro- cessed. In run time and list formatting, however, the format is not speci- fied. Since the format is not specified in run time and list formatting, the linker must include all of the I/O conversion routines in the task image because any or all of them may be needed. However, if you know in advance which I/O formats are going to be used at run time or in the list, using dummy routines you can prevent the linker from including the unnecessary I/O routines. A dummy routine is a blank macro with the same name as a real routine's entry point. Because the linker searches the user library before the OTS, if there is a dummy routine, it will be included in the task image instead of the real routine. Say your FORTRAN program uses run time formatting and you know that the only format that will be input is the G format for real and double-precision numbers. Your program only needs the I/O conversion rou- tines that perform real and double-precision conversions. There are four modules that perform I/O conversions: $FIO, $CONVF, $CONVI and $CONVL (see Sections 4.1.4 and 5.2). $ILR/ILR$ and $ILW/ILW$ also per- form I/O conversions by calling routines in the $CONVF, $CONVI and $CONVL modules; however, $ILR/ILR$ and $ILW/ILW$ perform list formatting and are not applicable to the problem stated in the paragraph above. $FIO compiles REDUCING PROGRAM SIZE PAGE 3-3 the format statement and $CONVF performs I/O conversions for real, double-precision and floating-point variables; the routines in these mo- dules must be included in the task image. $CONVI performs I/O conversions for integer and octal variables and $CONVL performs I/O conversions for logical variables; the routines in these modules do not need to be includ- ed in the task image. You should make dummy routines to replace the routines in $CONVI and $CONVL. Look in Appendix A, MODULE SIZES; by putting dummy macros into the task image in place of $CONVI and $CONVL you have saved 306 decimal words. 3.3 OVERLAYING This section explains how you can use this manual to decide if certain OTS modules can be safely overlaid. If you need information on how to overlay see either the RSX-11M Task Builer Manual or the RT-11 Linker Manual. When planning an overlay, you should be aware that a number of different routines frequently call the same entry points. The modules that define these entry points should be put in the root. A list of these modules and their entry points follows. Module Entry point(s) $AOTS $AOTS $EOL $CHKER, $EOD/EOL$, $IOEXIT, $OPNER OTINIT $OTI, $$OTI, $$SET $SAVRE SAVRG$, THRD$ When you are overlaying a program, a routine in one section of an overlay region may call a routine in another section of the same overlay, and you must know whether the transfer of control is complete or temporary. In this discussion, "complete" means that program control does not return to the calling program; "temporary" means that control is returned to the calling program. If the tranfer of control from one section of a region to another is complete, fine. However, if the transfer of control from one section to another is temporary, the overlay will not work. To plan a successful overlay, you will need quite a bit of information about the entry points that your program calls. Chapters 3, 4, and 7 des- cribe the entry points, according to the following format. "Function" - tells what the entry point does, including which entry points are called and whether program control returns to the calling routine or not. "Defined in" - tells what module the entry point is defined in and, in par- entheses, lists all the other entry points defined in that module. "Called by" - lists the modules, and, in parentheses, the entry points that call the entry point being described. REDUCING PROGRAM SIZE PAGE 3-4 "Calls" - lists the entry points, not in the module, that are called by the entry point being described. Chapters 5, 6, and 8 are not organized in this way. Chapter 5 the I/O conversions and the data conversions, Chapter 6 describes the arithmetic routines and Chapter 8 describes the library function routines. The neces- sary information for these entry points is listed below: "I/O conversions" - these entry points are grouped by modules, therefore it is simple to find all the entry points in a module. "Called by" - following each I/O conversion entry point is a list, in par- entheses, of the entry points that may call it. Transfer of control is temporary. "Calls" - None "Data conversions" - these entry points are grouped by modules, therefore it is simple to find all the entry points in a module. "Called by" - $CVTDI and $CVTID are called by ILR$ ($ILR). Transfer of control is temporary. "Calls" - None "Arithmetic routines" - these entry points are grouped by modules, there- fore it is simple to find all the entry points in a module. "Called by" - the arithmetic entry points of the form $XXX are the only ones called. They are only called by other arithmetic routines or by li- brary function routines. Transfer of control is temporary. "Calls" - the entry points of the arithmetic routines share a lot of code within modules. Therefore, if one entry point in the module calls an entry point from outside of the module, all of the entry points in the module will need the entry point called. If any calls are made, a NOTE at the end of the module description will tell you which entry points are called. Transfer of control is temporary. "Library function routines" - all entry points in a given library function module can be found by looking through Table 8-1. "Called by" - None "Calls" - The entry points called by a function routine are listed in Table 8-1 after the routine. Transfer of control is temporary. It will probably take two or three tries to find an overlay plan that will work. To simplify the scratch paper stage of the process, each time you put a module into a segment, you should include both the module name and the entry point(s) in that module that your program calls. REDUCING PROGRAM SIZE PAGE 3-5 Once you have a draft of the overlay, you must check that no entry point in the overlay is called by a module in another segment of the same region, unless there is a complete transfer of control. To check this, follow these steps for each entry point in the overlay: 1. Find the entry point in this manual. 2. Determine if the "Called by" list include a module in another seg- ment of the same region. If so, go to step 3. If not, go to step 5. 3. Find the entry point listed in parentheses after the module name. This entry point transfers control to the entry point that you are checking. 4. If the transfer of control is complete, go to step 5. If the transfer of control is temporary, go to step 6. 5. The overlay is okay; proceed as indicated below. 6. The overlay will not work; try a new overlay plan. If the overlay you planned works, you must check that the entry points in the overlay do not temporarily transfer control to entry points in other segments of the same region, or call entry points in regions with a lower number. To simplify this check, next to each module list all of the entry points in that module. This is done by locating in this manual the entry point you know in the module: all other entry points in the module are listed in parentheses after "Defined in." Once all the entry points in the module are listed, follow the steps below for each entry point called by your program. 1. Find the entry point in this manual. 2. If "Calls" is followed by "None," go to step 8. If "Calls" is followed by any entry point(s), go to step 3. 3. Determine if the "Calls" list include any entry point(s) in a re- gion with a lower number. If so, go to step 9. If not, go to step 4. 4. Determine if the "Calls" list include any entry point(s) in anoth- er segment of the same region. If so, do steps 5 and 6 for each entry point in another segment. If not, go to step 7. 5. Find the entry point in this manual. This entry point transfers control to the entry point you are checking. 6. If the transfer of control is complete, return to step 1. If the transfer of control is temporary go to step 9. REDUCING PROGRAM SIZE PAGE 3-6 7. Determine if the "Calls" list include any entry point(s) in a re- gion with a higher number. If so, return to step 1. If not, go to step 8. 8. The overlay is okay. 9. The overlay will not work; try a new overlay plan. CHAPTER 4 UTILITIES This chapter describes the utility routines; the sections are arranged al- phabetically by the entry points which reference the routines. If the utility routine being described performs both threaded and inline code, the threaded code entry point is first, followed by the inline entry point in parentheses. "Function"- tells what the routine does. "Defined in"- gives the name of the module in which the entry point is de- fined. Where a module defines more than one entry point, a "see also" note directs the reader to the other entry point(s). "Called by"- lists the modules that call the routine being described. The entry points in parentheses, following the module names, are the entry points in the module that call the routine. "Calls"- lists the entry points that are called by the routine being described. All utility routines are called by JSR PC,xxx and returned by RTS PC, un- less otherwise noted at the beginning of the description. 4.1 BAH$ ($PSES) These routines are used by RSTS and RT-11 only; see PSE$ for the RSX-11 equivalent. Function: BAH$ performs a PAUSE statement. The routine prints the user's message, if one is given, and then waits for the user's response before continuing program execution. Defined in: $PAUSE Called by: None UTILITIES PAGE 4-2 Calls: None 4.2 BKS$ ($BKS) Function: BKS$ performs a BACKSPACE statement; that is, it resets a sequential file to the beginning of the previous record. This routine assumes that the logical unit number (LUN) of the file to BACKSPACE is on the stack. (See the PDP-11 FOR- TRAN Language Reference Manual for more information on the BACKSPACE statement.) Defined in: $BACKSPACE Called by: None Calls: $DUMPLAST SAVR4$ $GETBLK $GETFILE 4.3 $CAI Function: $CAI performs indirect subroutine and function calls; it is called, for both library and user-defined subprograms, when a subprogram is used as a parameter in another subprogram. Arguments are passed and returned on the stack. Defined in: $CALL Called by: None Calls: None 4.4 $CAL Function: $CAL performs subroutine and function calls; it is used for both library and user-defined subprograms. Arguments are passed and returned on the stack. Defined in: $CALL UTILITIES PAGE 4-3 Called by: None Calls: None 4.5 $CLOSE Function: $CLOSE closes a file. If the file is already closed, $CLOSE clears the file descriptor block (FDB), disassociates the logical unit, restores the registers, and returns control to the calling program. If the file is open, $CLOSE outputs the last block of the file (if necessary), checks that there is no more data after the last block, and closes the file. $CLOSE then clears the FDB, disassociates the logical unit, restores the registers, and returns control to the calling program. If an error is encountered in closing the file, error number 52 is generated. Defined in: $CLOSE Called by: CLOSTM ($CSTM, $CSTMI) $CLS (CLOSE) $EOL ($OPNER) $OPEN ($OPEN) OPNSTM ($OSTM, $OSTMI) Calls: $CHKER $DUMPLAST $FCHNL $GETBLK (RSTS only) $PUTBLK $WAIT 4.6 $CSTM ($CSTMI) Function: $CSTM checks the keywords for the CLOSE statement and then calls $CLOSE to close the file. Defined in: CLOSTM Called by: None Calls: $CHKER $CLOSE $$$DIS $$$ERR UTILITIES PAGE 4-4 $GETFILE $$OPCL 4.7 $DINT Function: $DINT is an internal OTS function; it finds the integer part of a double-precision number and returns the result on the stack. Defined in: $DINT Called by: DMOD (DMOD) DSIN (DCOS, DSIN) Calls: None 4.8 $DUMPLAST Function: $DUMPLAST creates a buffer containing the last block of the file. If this buffer differs from the version in the file, $PUTBLK is called to output the buffer. The pointer to the block is passed to $DUMPLAST in R0. Defined in: $DUMPLAST Called by: $BACKSPACE (BKS$/$BKS) $CLOSE ($CLOSE) $REWIND (RWD$/$RWD) Calls: $PUTBLK (conditionally called; see Function) 4.9 $ERRTB Function: $ERRTB initializes the error table in the work area (see Ap- pendix C.2). Defined in: ERRSS Called by: $OTI (OTI$/$OTI, $$OTI) UTILITIES PAGE 4-5 Calls: None 4.10 $FCALL Function: $FCALL calls single argument FORTRAN functions from within other FORTRAN functions. The pointer to the function is passed in R4; the pointer to the argument list in R5. Defined in: $FCALL Called by: $CABS (CABS) $CEXP (CEXP) $CLOG (CLOG) $CSIN (CCOS, CSIN) $CSQRT (CSQRT) $DABS (DABS) $TANH (TANH) $XDD (XFD$/$XFD, XDF$/$XDF, XDD$/$XDD) $XFF (XFF$/$XFF) Calls: None 4.11 $FCHNL Function: $FCHNL receives the logical unit number (LUN), from the cal- ling routine, in R2. The LUN must be between 1 and 99. If it is not, $FCHNL generates error number 20. $FCHNL then searches for a valid RT-11 channel. If a channel is not ava- ilable, error number 21 is generated. Otherwise, the RT-11 channel number is entered in the file descriptor block (FDB), and $FCHNL returns to the calling program with the address of the FDB in R0. Defined in: $FCHNL Called by: $CLOSE ($CLOSE) $GETFILE ($GETFILE) $INITIO ($INITIO) Calls: None UTILITIES PAGE 4-6 4.12 FND$ ($FND) Function: FND$ is used in reading a direct access file. First, FND$ calls $INITIO to initialize I/O operations. When $INITIO is finished, FND$ makes sure that either a DEFINE FILE or an OPEN statement has been executed to associate the file with a logical unit number (LUN); if a LUN is not associated with the file, error number 37 is generated. FND$ then checks the device because random I/O cannot be performed on a line printer or terminal. If either of these devices is being used, error number 38 is generated. FND$ now searches for the desired block. If the desired block is the current block, FND$ passes control back to the calling program. If the desired block is not the current block, the current block is output, and FND$ returns to the calling program with the address of the desired block on the stack. Defined in: $FIND Called by: None Calls: $GETINF $INITIO $PUTBLK SAVR4$ 4.13 $GETBLK Function: $GETBLK gets a block from the file. If I/O fails, error number 23 is generated, unless ERR= was used; if ERR= was used, $GETBLK jumps to $IOEXIT. $IOEXIT recovers the program from the error and passes control to the next statement of the compiled code (JMP @(R4)+ for threaded code). Defined in: $RWBLK (see also $EOF2, $EOFIL, $PUTBLK) Called by: $BACKSPACE (BKS$/$BKS) $CLOSE ($CLOSE, RSTS only) $GETREC ( $GETREC) $RIO (IRR$/$IRR, IRW$/$IRW) $UIO (IUR$/$IUR, IUW$/$IUW) Calls: $IOEXIT (conditionally called; see Function) UTILITIES PAGE 4-7 4.14 $GETFILE Function: $GETFILE is called to get the address of a file's descriptor block (FDB). First, $GETFILE checks to see if an I/O opera- tion is in progress. If I/O is in progress, error number 26 is generated; otherwise, $GETFILE calls $FCHNL. $FCHNL finds the address of the FDB and associates the file with an RT-11 channel. $FCHNL returns to $GETFILE, which saves the address of the FDB in the work area (see Appendix C.2) and returns to the calling program. Defined in: $GETFILE Called by: $ASSIGN (ASSIGN) $BACKSPACE (BKS$/$BKS) $CLOSTM ($CSTM, $CSTMI) $CLS (CLOSE, RT-11 and RSTS/E) $EOF (EOF$/$EOF) OPNSTM ($OSTM, $OSTMI) $REWIND (RWD$/$RWD) $RIO (DEF$/$DEF) Calls: $FCHNL 4.15 $GETINF Function: $GETINF performs random access I/O. $GETINF gets the number of a requested record. If the number of records in the file is given, $GETINF checks to see if the requested record is in the file. If the record number is higher than allowed in the file, error number 24 is generated. $GETINF then passes pro- gram control to $SETINF which finds the length of the record and passes control to the routine that called $GETINF. Defined in: $RIO (see also DEF$, IRR$/IRW$, $SETINF) Called by: $FIND (FND$/$FND) Calls: None 4.16 $GETREC Function: $GETREC is used for reading formatted files; it gets a re- cord from a file. If the record is too long, error number 22 UTILITIES PAGE 4-8 is generated. Defined in: $GETREC Called by: $IFR (IFR$$/$$IFR, IFR$/$IFR) $LISTI (ILR$/$ILR) Calls: $EOF2 $GETBLK 4.17 $INITIO Function: $INITIO initializes all I/O operations. If the file to be used is not open, $INITIO opens a default file. $INITIO then checks to see if an I/O operation is already in progress. If it is, error 26 is generated because recursive I/O is not al- lowed; otherwise, $INITIO gets the address of the file des- criptor block (FDB) by calling $FCHNL. $FCHNL returns the address of the FDB in R0. $INITIO then passes control back to the calling program. The calling program now sets the read/write bit. If a read is being attempted after a write, error number 25 is generat- ed, unless the device being used is a terminal. If no error is generated, the calling program passes control back to $INITIO. $INITIO then calls $OPEN to open the file; after opening the file, $OPEN returns control to $INITIO which passes control back to the calling program for the last time. Defined in: $INITIO Called by: $FIND (FND$/$FND) $IBR (IBR$/$IBR) $IBW (IBW$/$IBW) $IFR (IFR$/$IFR, $$IFR) $IFW (IFW$/$IFW, $$IFW) $LISTI (ILR$/$ILR) $LISTO (ILW$/$ILW) $RIO (IRR$/$IRR, IRW$/$IRW) $UIO (IUR$/$IUR, IUW$/$IUW) Calls: $FCHNL $OPEN (conditionally called; see Function) UTILITIES PAGE 4-9 4.18 ISN$ Function: ISN$ increments the internal statement number. Defined in: $ISNLS (see also $ISNTRC, LSN$, $LSNTRC) Called by: None Calls: None 4.19 $ISNTRC Function: $ISNTRC is the section of ISN$ that jumps to the next state- ment of the compiled code (JMP @(R4)+ for threaded code); it also keeps track of the necessary information if DEBUG is being used. Defined in: ISNLS (see also ISN$, LSN$, $LSNTRC) Called by: None Calls: None 4.20 LSN$ Function: LSN$ increments the labeled statement number. Defined in: $ISNLS (ISN$, $ISNTRC, $LSNTRC) Called by: None Calls: None 4.21 $LSNTRC Function: $LSNTRC is the section of LSN$ that jumps to the next state- ment of the compiled code (JMP @(R4)+ for threaded code); it also keeps track of the necessary information if DEBUG is being used. UTILITIES PAGE 4-10 Defined in: ISNLS (ISN$, $ISNTRC, LSN$) Called by: None Calls: None 4.22 $$OPCL Function: $$OPCL enters all of the given keywords in the work area; it also contains the code that generates the inconsistent OPEN/CLOSE specification error (error number 51). Defined in: OPNCLO (see also $$$DIS, $$$ERR) Called by: CLOSTM ($CSTM, $CSTMI) OPNSTM ($OSTM, $OSTMI) Calls: None 4.23 $OPEN Function: $OPEN associates the file with a device, assigns the file an RT-11 channel, and then checks for the following errors: 1. bad device (error number 27) 2. no RT-11 channel available (error number 31) 3. open failure (error number 28) 4. not enough room for the device handler (error number 29) If no error is generated, $OPEN associates the file with a format mode, either the one specified by the user or a de- fault. Finally, $OPEN sets the "open" bit in the status word (see Appendix C.4) and passes program control back to the calling routine. Defined in: $OPEN Called by: $INITI ($INITIO) OPNSTM ($OSTM, $OSTMI) UTILITIES PAGE 4-11 Calls: $CLOSE $OPNER $WAIT 4.24 $OSTM ($OSTMI) Function: $OSTM checks the keywords for the OPEN statement and then calls $OPEN to open the file. Defined in: OPNSTM Called by: None Calls: $CHKER $CLOSE $$$DIS $$$ERR $GETFILE $$OPCL $OPEN $SETINF 4.25 $OTI ($$OTI) Function: $OTI initializes the work area of the FORTRAN OTS. If an error occurs during initialization an RT-11 or RSTS/E system will generate the message "?ERR 62 FORTRAN start fail," an IAS, RSX-11 or VMS system will generate error number 130. The first statement of $OTI places a nonzero number in R1 to indicate that threaded code is being used; the first state- ment of $$OTI places a zero in R1 to indicate that inline code is being used. Defined in: OTINIT Called by: None Calls: $ERRTB $EXIT $IOEXIT $VIRINT UTILITIES PAGE 4-12 4.26 $POPR3 Function: $POPR3 is called when a function needs two words taken from the stack and put in R0 and R1. Called by: $AMIN0 (AMAX0, AMIN0) $AMOD (AMOD) $ATAN (ATAN, ATAN2) $FLOAT (FLOAT) Calls: None 4.27 $POPR4, $POPR5 Function: $POPR4 and $POPR5 reference the same routine, $POPR4 is more commonly used. This routine is called when a function needs four words taken from the stack and put in R0 through R3. Called by: $CEXP (CEXP) $DATAN (DATAN, DATAN2) $DEXP (DEXP) $DLOG (DLOG, DLOG10) $DMOD (DMOD) $DSIN (DSIN) Calls: None 4.28 PSE$ ($PSE) These routines are used for RSX-11 only; see BAH$ for the RSTS/E and the RT-11 equivalents. Function: PSE$ performs a PAUSE statement. This routine prints the user's message, if one is given, and then waits for the user's response before continuing program execution. Defined in: $PAUSE Called by: None Calls: None UTILITIES PAGE 4-13 4.29 $PUTBLK Function: $PUTBLK is used to write a block to a file. If the file is readonly, $PUTBLK generates error number 35. If I/O fails during the write operation error number 23 is generated, un- less ERR= was used; if ERR= was used, $PUTBLK jumps to $IOEXIT. $IOEXIT recovers the program from the error and passes control to the next statement of the compiled code (JMP @(R4)+ for threaded code). Defined in: $RWBLK (See also $EOF2, $EOFIL, $GETBLK) Called by: $CLOSE (CLOSE) $DUMPLAST ($DUMPL) $FIND (FND$/$FND) $PUTREC ($PUTREC) $RIO (IRR$/$IRR, IRW$/$IRW) $UIO (IUW$/$IUW) Calls: $IOEXIT (conditionally called; see Function) 4.30 $PUTREC Function: $PUTREC is used for writing formatted files; it outputs a record to a file. Defined in: $PUTREC Called by: EOF ($EOF; if file is formatted) $IFW (IFW$/$IFW, $$IFW/IFW$$) $LISTO (ILW$/$ILW; RT-11 and RSTS/E only) $UIO (IUR$/$IUR, IUW$/$IUW; if file is unformatted) Calls: $PUTBLK (unless output is to the terminal) 4.31 RET$ Function: This routine passes program control to the next statement of the compiled code (JMP @(R4)+ for threaded code). Defined in: $RETS Called by: $ASFRE (STK$F, STK$I, STK$L) $RETD (RET$D) UTILITIES PAGE 4-14 $RETDS (STK$D) Calls: None 4.32 RET$D, RET$F, RET$I, RET$L Function: These routines are called to return to OTS code from a user-defined function. The result of the function is re- turned in registers R0 through R3. The last character of the entry point name represents the data type of the function: D - REAL*8 F - REAL*4 I - INTEGER L - LOGICAL Defined in: $RETS NOTE RET$D is not defined in $RETS but in $RETD. Called by: None Calls: RET$ STP$ (RET$D only) 4.33 RWD$ ($RWD) Function: RWD$ performs a REWIND statement. This statement involves the record processing level of I/O (see I/O Chapter of this manual) so this routine's performance depends on which system you are using. RT-11, RSTS/E: RWD$ first calls $GETFILE to get the FDB ad- dress. If the file is not open or is random access the po- inter to the FDB and LUN are cleared to indicate that there is no longer an active file attached to the LUN and RWD$ passes control to the calling routine. Otherwise, RWD$ calls $DUMPLAST to output the last block of the file and then checks the format of file. If the file is not formatted the FDB and LUN are cleared and RWD$ passes control to the cal- UTILITIES PAGE 4-15 ling routine; otherwise the file pointer is reset to the be- ginning of the file before RWD$ passes control back to the calling routine. IAS, RSX-11, VMS: RWD$ first calls $GETFILE to ge the FDB address. If the file is not open the pointer to the FDB is cleared and RWD$ passes control back to the calling program. If the file is random access error number 148 is generated. If no error is generated RWD$ clears a special bit, DV.RW (see Table C-8) to indicate that a read operation is being performed on the file, and then jumps to .POINT to perform the rewind. If no error occurs, the pointer to the FDB is cleared and RWD$ passes control back to the calling routine, otherwise, error number 148 is generated. (See the PDP-11 FORTRAN Language Reference Manual for more information on REWIND.) Defined in: $REWIND Called by: None Calls: $DUMPLAST $GETFILE SAVR4$ 4.34 SAVRG$ Function: SAVRG$ serves as a register save/unsave co-routine for six registers. It receives two arguments on the stack. Defined in: $SAVRE Called by: $ENCODE (ENC$/$ENC, DEC$/$DEC) $IBR (IBR$/$IBR) $IBW (IBW$/$IBW) $IFR (IFR$/$IFR) $IFW (IFW$/$IFW) $LISTI (ILR$/$ILR) $LISTO (ILW$/$ILW) $RIO (IRR$/$IRR, IRW$/$IRW) $UIO (IUR$/$IUR, IUW$/$IUW) Calls: None UTILITIES PAGE 4-16 4.35 SAVR4$ Function: SAVR4$ serves as a register save/unsave co-routine for four registers. It receives four arguments on the stack. Defined in: $SAV4R Called by: $BACKSPACE (BKS$/$BKS) $EOF (EOF$/$EOF) $FIND (FND$/$FND) $REWIND (RWD$/$RWD) $RIO (DEF$/$DEF) Calls: None 4.36 $$SET Function: $$SET is called when an error occurs. First $$SET enters the error number and the logical unit number (LUN) associated with the error in the work area, then $$SET enters the error in the error table (see Appendix C). Warning: All errors trap to this routine; therefore, it must be in the root. Defined in: OTINIT Called by: $EOL ($CHKER) Calls: None 4.37 $SETINF Function: $SETINF is used only for random access files. First, $SETINF finds the length of a requested record. If the the record is too long, $SETINF generates error number 40; otherwise, $SETINF enters the length of the record into the file des- criptor block (FDB). $SETINF then enters the number of the next random block in the work area (see Appendix C.2). Defined in: $RIO (see also DEF$, $GETINF, IRR$/IRW$) Called by: $OPNSTM ($OSTM, $OSTMI; $SETINF is called only if a file is random access. Therefore, to save space, a dummy $SETINF UTILITIES PAGE 4-17 entry point may be used if the program being run has no ran- dom access I/O.) Calls: None 4.38 STK$D, STK$F, STK$I, STK$L Function: These routines are called to return to the OTS from an arith- metic statement function. The result of the function is re- turned in registers R0 through R3. The last character of the entry point name represents the data type of the function: D - REAL*8 F - REAL*4 I - INTEGER L - LOGICAL Defined in: $ASFRE NOTE STK$D is not defined in $ASFRE but in $RETDS. Called by: None Calls: RET$ 4.39 THRD$ Function: THRD$ is an entry point to one instruction: JMP @(R4)+ . When a routine performs both threaded and inline code, this instruction is pushed onto the stack by MOV THRD$,-(SP). At the end of the routine the address of the next instruction is on the stack for the inline code, and the address of the JMP @(R4)+ command is on the stack for threaded code. (See Sec- tion 1.4 for a discussion on threaded code.) The following example is taken from module $ENCODE: ENC$: MOV THRD$,-(SP) ;RETURN ADDRESS $ENC: MOV WRITEY,-(SP) ;SET ENCODE FLAG BR COMMON UTILITIES PAGE 4-18 DEC$: MOV THRD$,-(SP) ;RETURN ADDRESS $DEC: MOV READY,-(SP) ;SET DECODE FLAG COMMON: XXX ;COMMON CODE . . . RTS PC ;RETURN When module $ENCODE is entered via the threaded code entry points, ENC$ or DEC$, the MOV THRD$,-(SP) instruction is exe- cuted to push THRD$ onto the stack. If $ENCODE is entered via the inline entry points, $ENC or $DEC, the MOV THRD$,-(SP) instruction is not executed. Therefore, after the common code has been executed, the RTS PC instruction causes the instruction on the stack to be executed. If $ENCODE was entered by threaded code entry points, that in- struction will be JMP @(R4)+ ; if $ENCODE was entered by in- line entry points, that instruction will be the next inline instruction. Defined in: $SAVRE Called by: $ENCODE (DEC$/ENC$) $IBR (IBR$) $IBW (IBW$) $IFR (IFR$) $IFW (IFW$) $LISTI (ILR$) $LISTO (ILW$) $UIO (IUR$, IUW$) $OBJENC (DEO$/ENO$) $RIO (IRR$, IRW$, DEF$) Calls: None 4.40 $WAIT Function: $WAIT temporarily stops all I/O while a file is being opened or closed. Defined in: WAIT Called by: $CLOSE ($CLOSE) $OPEN ($OPEN) Calls: None CHAPTER 5 FILE HANDLING This chapter discusses I/O initialization, I/O list transfer calls, I/O ex- iting, and error processing. Each subsection is arranged alphabetically by the entry points which reference the routines. If the routine being des- cribed performs both threaded and inline code, the threaded code entry point is first, followed by the inline entry point in parentheses. "Function"- tells what the routine does. "Defined in"- gives the name of the module in which the entry point is de- fined. Where a module defines more than one entry point, a "see also" note directs the reader to the other entry point(s). "Called by"- lists the modules that call the routine being described. The entry points in parentheses, following the module names, are the entry points in the module that call the routine. "Calls"- lists the entry points that are called by the routine being described. All routines are called by JSR PC,xxx and returned via RTS PC, unless oth- erwise noted at the beginning of the section. 5.1 I/O INITIALIZATION 5.1.1 DEC$ ($DEC)/ENC$ ($ENC) Function: DEC$ performs a DECODE statement; ENC$ performs an ENCODE statement. (The PDP-11 FORTRAN Language Reference Manual describes these DECODE and ENCODE). The two entry points share much of their code. DEC$/ENC$ first checks to see if I/O is in progress. If it is, error number 26 is generated because recursive I/O is not allowed. The routine then calls FILE HANDLING PAGE 5-2 the formatted I/O processor, $$FIO (RT-11 and RSTS/W) or $FIO (RSX-11). If an attempt is made to process more than one re- cord, DEC$/ENC$ generates error number 44 (error number 155 for RSX-11). Defined in: $ENCODE Called by: None Calls: $$FIO (RT-11 and RSTS/E) $FIO (RSX-11 only) $SAVRG THRD$ (DEC$ and ENC$ only) 5.1.2 DEF$ ($DEF) Function: DEF$ performs a DEFINE FILE statement which defines a random access file. If the file is already open, error number 41 is generated. If the file is not open, DEF$ puts the following information in the file descriptor block (FDB): 1. The address of the associated variable 2. The record size (in words) 3. The number of records in the file (see Appendix C.3) DEF$ also sets the random access bit in the status word (see Appendix C.4). When this routine is finished, the file has been defined, but not opened. Defined in: $RIO (see also $GETINF, IRR$/IRW$, $SETINF) Called by: None Calls: $GETFILE SAVR4$ THRD$ (DEF$ only) FILE HANDLING PAGE 5-3 5.1.3 DEO$ ($DEO)/ENO$ ($ENO) Function: DEO$ performs run time formatting. DEO$ and ENO$ share much of their code. They are used for reading and writing, res- pectively. DEO$/ENO$ finds the address of the format string and then calls $OBJFMT to compile it. DEO$ then passes con- trol to DEC$ to process the format string. ENO$ then passes control to ENC$ to process the format string. Defined in: $OBJENC Called by: None Calls: $OBJFMT THRD$ (DEO$ and ENO$ only) 5.1.4 $FIO Function: $FIO executes the compiled format statement. $FIO first clears the dollar format flag, then the P scale factor. It is now ready for the first data item. To get the first item, $FIO returns to the calling program which returns control to $FIO; $FIO completes the compilation. $FIO uses a loop structure to perform compilation. The for- mat character is put into R0 and then sent to a dispatch table. The dispatch table checks the format character and passes control to the appropriate routine. In some cases, the routine is in $FIO; in other cases, one of the I/O conversion routines is called (see Section 5.1). When fin- ished, the routine passes control back to the loop, which gets the next format character and repeats the process. Defined in: $FIO (see also $$FIO) Called by: $ENCODE (DEC$/$DEC, ENC$/$ENC; RSX-11 only) $IFR (IFR$$/$$IFR, IFR$/$IFR) $IFW (IFW$$/$$IFW, IFW$/$IFW) $VCTRAN (TVC$/$TVC) $VTRAN (TV?$/$TV?) Calls: $CHKER FILE HANDLING PAGE 5-4 5.1.5 $$FIO Function: $$FIO is the internal version of $FIO; it is called only by other OTS modules. $$FIO and $FIO as shown in the diagram of module $FIO below: ________ | | |$FIO : $ | | F | | I | | O | | | | | |$$FIO: C | | O | | M | | M | | O | | N | | | |_______| Diagram 4-1 Module $FIO The code between the two routines becomes common after $FIO clears the dollar format flag. The $FIO routine is described in Section 4.1.4. Defined in: $FIO (see also $FIO) Called by: $ENCODE (DEC$/$DEC, ENC$/$ENC; RT-11 and RSTS/E) Calls: $CHKER 5.1.6 IBR$ ($IBR) Function: IBR$ performs read operations in run time formatting. First, IBR$ initializes I/O operations by a call to $INITIO. IBR$ then compiles the format string by calling $OBJFMT. After the string is compiled, IBR$ passes control to IFR$$ which initializes the read operation for formatted files. Defined in: $IBR Called by: None Calls: IFR$$ FILE HANDLING PAGE 5-5 $INITIO $OBJFMT SAVRG$ THRD$ (IBR$ only) 5.1.7 IBW$ ($IBW) Function: IBW$ performs write operations in run time formatting. First, IBW$ initializes I/O operations by a call to $INITIO. IBW$ then prepares the file for a write operation and calls $OBJFMT to compile the format string. After the string is compiled, IBW$ passes control to IFW$$, the routine that ini- tializes the write operation for a formatted file. Defined in: $IBW Called by: None Calls: IFW$$ $INITIO $OBJFMT SAVRG$ THRD$ (IBW$ only) 5.1.8 IFR$ ($IFR) Function: IFR$ prepares a file for a formatted read operation. IFR$ initializes I/O operations by calling $INITIO. From this point on this routine's performance depends on which system you are using. RT-11, RSTS/E: IFR$ checks to see which operation was last performed on the file, a read operation or a write operation generating error number 25 if a read operation is being at- tempted after a write operation, unless the device being used is a terminal. The file is now initialized. IFR$ then puts the address of $GETREC in the OTS work area (see Table C-3, the address is put in RECIO). IFR$ now checks the format of the file; if the file is unformatted error number 32 is generated, otherwise, IFR$ passes program control to $FIO, the formatted I/O processor. FILE HANDLING PAGE 5-6 IAS, RSX-11, VMS: IFR$ sets bits in the status word to indi- cate that the file is formatted and that the last operation performed was a read operation. Then IFR$ puts the address of GFMTRC (described below) in the OTS work area (see Table C-4, the address is put in RECIO). IFR$ now checks the for- mat of the file; if the file is unformatted error number 159 is generated, otherwise, IFR$ passes program control to $FIO, the formatted I/O processor. $FIO looks in RECIO to find the address of the routine that will read the first record in the file; if RT-11 or RSTS/E is used the routine is $GETREC and IFR$ is not affected, however, if IAS, RSX-11 or VMS is used the routine is GFMTRC and $FIO returns control module IFR$. GFMTRC calls $GETREC to get the first record from the file, and passes control back to $FIO. Defined in: IFR$ Called by: None Calls: $FIO $GETREC (RSX-11 only) $INITIO SAVRG$ THRD$ (IFR$ only) 5.1.9 $$IFR, IFR$$ Function: $$IFR and IFR$$ are internal entry points to IFR$; they are referenced only by OTS routines. The routine referenced by $$IFR contains almost the same code as IFR$ and $IFR; IFR$, being the threaded code entry point contains the MOV #THRD$, -(SP) instruction (see Section 3.41), and both IFR$ and $IFR contain a call to the SAVRG$ routine which saves certain re- gisters for the calling routine, but other than these two ex- ceptions $$IFR is the same as IFR$ ($IFR) (see Section 4.1.8). IFR$$ is only used with RT-11 and RSTS/E. It shares code with IFR$ ($IFR) once the initialization of the file is com- plete, that is the code described in Section 4.1.8, the sec- ond paragraph under RT-11, RSTS/E. Defined in: $IFR Called by: $IBR (IBR$/$IBR) Calls: $FIO $GETREC (IAS, RSX-11 and VMS only) FILE HANDLING PAGE 5-7 $INITIO ($$IFR only) SAVRG$ ($$IFR only) 5.1.10 IFW$ ($IFW) Function: IFW$ prepares a file for a formatted write operation. IFW$ initializes I/O operations by calling $INITIO, then checks to see which was the last operation performed on the file, a read operation or a write operation. If it was a read opera- tion, IFW$ resets the pointer in the file to the beginning of the file. The file is now initialized. Once file initialization is complete, IFW$ puts the address of the $FIO routine on the stack so that when IFW$ is fin- ished program control will pass to $FIO. IFW$ then checks to see if the file is formatted; if the file is unformatted error number 32 is generated because you cannot mix formats, otherwise, IFW$ calls $PUTREC to output the first record. IFW$ passes program control to $FIO. Defined in: $IFW Called by: None Calls: $FIO $INITIO $PUTREC SAVRG$ THRD$ (IFW$ only) 5.1.11 $$IFW, IFW$$ Function: $$IFW and IFW$$ are internal entry points to IFW$; they are referenced only be OTS routines. _____________ |IFW$ : MOV THRD,-(SP) | |$IFW : JSR R3,SAVRG$ | |$$IFW: JSR PC, $INITIO | | C | | O | | M | | M | | O | | N | FILE HANDLING PAGE 5-8 |IFW$$: A | | L | | L | |____________| Diagram 4-3 Module $IFW The routine referenced by $$IFW contains almost the same code as IFW$ and $IFW; IFW$, being the threaded code entry point contains the MOV #THRD$, -(SP) instruction and both IFW$ and $IFW contain a call to the SAVRG$ routine which saves certain registers for the calling routine, but other than these two exceptions $$IFW is the same as IFW$ ($IFW) (see Diagram 4.3). IFW$$, however, is called only if the file is already initialized; therefore, IFW$$ shares code with IFW$ ($IFW) and $$IFW after the initialization code used by the other three entry points (the initialization code is the section marked COMMON in Diagram 4-3). The code referenced by IFW$$ is described in the second paragraph of Section 4.1.10. Defined in: $IFW Called by: $IBW (IBW$/$IBW; IFW$$ only) Calls: $FIO $INITIO ($$IFW only) $PUTREC SAVRG$ ($$IFW only) 5.1.12 ILR$ ($ILR) Function: ILR$ performs a list-directed read operation. First ILR$ calls $INITIO to initialize I/O operations. When program control returns from $INITIO, the routine's performance de- pends on which system you are using. RT-11, RSTS/E: First, ILR$ sets the bits in the status word to indicate that the file is formatted and that a read opera- tion is being performed. Then, ILR$ checks to see which op- eration was performed last, read or write generating error number 25 if an attempt is made to read after a write opera- tion, unless the device is a terminal. Next, ILR$ checks to see which I/O formats have been used in previous I/O opera- tions; if an unformatted read operation has been executed on the file, error number 32 is generated because I/O formats cannot be mixed. IAS, RSX-11, VMS: First, ILR$ sets the bits in the status word to indicate that the file is formatted and that a read FILE HANDLING PAGE 5-9 operation is being performed. Then, ILR$ checks to see which I/O formats have been used in previous I/O operations; if an unformatted read operation has been executed on the file, error number 159 is generated because I/O formats cannot be mixed. ILR$ is now ready to start processing the list elements. This is done the same way on all of the systems. ILR$ uses a series of co-routine calls in a loop to read the list ele- ments. Through these co-routine calls ILR$ reads each list element, calling the appropriate input conversion, and, if necessary, type conversion routines. Because all conversion routines are referenced regardless of whether or not they are called, this type of I/O should be avoided if possible, in order to save space. If a syntax error occurs in list-directed I/O, RT-11 or RSTS/E generates error number 53; IAS, RSX-11 or VMS generates error number 197. Defined in: $LISTI Called by: None Calls: $CVTDI $CVTID DCO$ ECO$ FCO$ GCO$ $GETREC ICI$ ICO$ $INITIO LCI$ LCO$ OCI$ OCO$ RCI$ SAVRG$ THRD$ (ILR$ only) RSX-11 only: $FLDEF RT-11 and RSTS/E only: $CHKER 5.1.13 ILW$ ($ILW) Function: ILW$ performs a list-directed write operation. First ILW$ FILE HANDLING PAGE 5-10 calls $INITIO initialize I/O operations. When program con- trol returns from $INITIO, the routine's performance depends on which system you are using. RT-11, RSTS/E: ILW$ sets the bits of the status word to in- dicate that the file is formatted and that a write operation is being performed. ILW$ then checks to see which I/O opera- tion was last performed on the file. If it was a read opera- tion, the file is "rewound," that is, the block number is reset to the beginning of the file. ILW$ now places the ad- dress of the $FIO routine on the stack so that when ILW$ is finished control will pass to $FIO. Finally, ILW$ check the format of the file, if the file is unformatted, error number 32 is generated because I/O formats cannot be mixed. If no error is generated, ILW$ calls $PUTREC to output the first record of the file (allowing only 133 characters) and passes control to $FIO. IAS, RSX-11, VMS: ILW$ checks which I/O operation was last performed on the file; if it was a read operation <>. ILW$ then sets the bits in the status word to indicate that the file is formatted and that a write operation is being performed. ILW$ nnow places the address of the $FIO routine on the stack so that when ILW$ is finished control will pass to $FIO. Finally, ILW$ checks the format of the file, generating error number 159 if the file is unformatted. If no error is generated, ILW$ calls $PUTREC to output the first record of the file and passes control to $FIO. Defined in: $LISTO (see also $TVS) Called by: None Calls: $INITIO SAVRG$ THRD$ (ILW$ only) RT-11 and RSTS/E: $CHKER $CLOSE $PUTREC RSX-11 only: DCO$ ECO$ FCO$ $FLDEF GCO$ ICI$ ICO$ LCI$ LCO$ OCI$ OCO$ FILE HANDLING PAGE 5-11 RCI$ 5.1.14 IRR$ ($IRR)/IRW$ ($IRW) Function: IRR$ performs random access read operations; IRW$ performs random access write operations. These two routines share much of their code; therefore, the following discussion ap- plies to both routines. IRR$/IRW$ initializes I/O by calling $INITIO. When $INITIO is finished, IRR$/IRW$ makes sure that either a DEFINE FILE or an OPEN statement (with ACCESS="DIRECT") has been executed to associate the file with a logical unit number (LUN); if a LUN is not associated with the file, error number 37 is generated. IRR$/IRW$ then checks the device because random I/O cannot be performed on a line printer or terminal. If either of these devices is used, error number 38 is generated. IRR$/IRW$ then gets the information needed for the data transfer. Read/write opera- tions are done until the data transfer is complete or the re- cord size is exceeded; if the record size is exceeded, error number 39 is generated. Defined in: $RIO (see also DEF$, $GETINF, $SETINF) Called by: None Calls: $GETBLK $INITIO $PUTBLK SAVRG$ THRD$ (IRR$, IRW$ only) 5.1.15 IUR$ ($IUR) Function: IUR$ performs unformatted read operations. IUR$ initializes I/O by calling $INITIO, then checks for the following errors: 1. Read after write (error number 25); you cannot per- form a read operation after a write operation, un- less the device is a terminal 2. Mixed I/O formats (error number 32); if a formatted read operation has been executed on the file, you FILE HANDLING PAGE 5-12 cannot perform an unformatted read operation 3. Illegal device (error number 34); unformatted I/O cannot performed on a terminal or line printer If no errors are generated IUR$ uses a series of co-routine calls in a loop to read the list elements generating error number 33 if an attempt is made to read past the end of a re- cord. Defined in: $UIO (see also IUW$) Called by: None Calls: $EOF $EOF2 $EOFILE $GETBLK $INITIO $SAVRG THRD$ (IUR$ only) 5.1.16 IUW$ ($IUW) Function: IUW$ performs an unformatted write operation. IUW$ first checks to see which I/O operation was last performed on the file. If it was a read operation, the file is "rewound," that is, the block number is reset to the previous block of the file. IUW$ now checks the format of the file, if it is formatted error number 32 is generated because format I/O cannot be mixed. Finally IUW$ uses series of co-routine calls in a loop to write the I/O elements. Defined in: $UIO (see also IUR$) Called by: None Calls: $CLOSE $EOF $EOF2 $EOFILE $GETBLK $INITIO $PUTBLK SAVRG$ THRD$ (IUW$ only) FILE HANDLING PAGE 5-13 5.1.17 $OBJFMT Function: $OBJFMT compiles run time format statements; the address of the statement to be compiled is passed to $OBJFMT in R0. In case of an error during compilation of the line, $OBJFMT gen- erates errors 42 or 43, memory overflow and syntax errors, respectively. After compiling the format statement, $OBJFMT passes program control back to the calling program. Defined in: $OBJFMT Called by: $IBR (IBR$/$IBR) $IBW (IBW$/$IBW) $OBJENC (DEO$/$DEO, ENO$/$ENO) Calls: None 5.2 I/O LIST TRANSFER CALLS 5.2.1 EOL$ ($EOL) Function: EOL$ terminates the I/O list by executing a co-routine call to FIO/RIO/ILR/ILW/IUR/IUW. Defined in: $EOL (see $CHKER, $IOEXIT, $OPNER) Called by: None Calls: None 5.2.2 TAC$, TAD$, TAF$, TAI$, TAL$, TAP$, TAQ$ Function: These routines execute a co-routine call to FIO/RIO/ILR/ILW/IUR/IUW to prepare for the transfer of an I/O list element which is an array. The last letter of the entry point name represents the data type of the array: C for COMPLEX FILE HANDLING PAGE 5-14 D for REAL*8 F for REAL*4 I for INTEGER*2, L for LOGICAL*1 P for LOGICAL*4 Q for INTEGER*4 The threaded code entry points are listed in the heading; the inline entry points are similar, except the dollar sign ($) is at the beginning of the entry point name instead of at the end. Defined in: $TRARY NOTE TAC$ ($TAC) is not defined in $TRARY but in $TCMPLX. Called by: None Calls: None 5.2.3 TVC$, TVD$, TVF$, TVI$, TVL$, TVP$, TVQ$ Function: These routines execute a co-routine call to FIO/RIO/ILR/ILW/IUR/IUW to prepare for the transfer for an I/O list element which is a variable or constant. The last letter of the entry point name represents the data type of the element: C for COMPLEX D for REAL*8 F for REAL*4 I for INTEGER*2, L for LOGICAL*1 P for LOGICAL*4 Q for INTEGER*4 The threaded code entry points are listed in the heading; the inline entry points are similar, except the dollar sign ($) is at the beginning of the entry point name instead of the end. Defined in: $VTRAN FILE HANDLING PAGE 5-15 NOTE TVC$ ($TVC) is not defined in $VTRAN but in $VCTRAN. Called by: None Calls: $FIO 5.2.4 TVS$ ($TVS) FUNCTION: $TVS executes a co-routine call to FIO/RIO/ILW/IUW to prepare for the transfer of an I/O list element which is a string li- teral. When you use formatted I/O, a string in the I/O list causes the list-directed output module to be called. Therefore, if possible, place the string in the format state- ment. Defined in: $LISTO (see also ILW$) Called by: None Calls: $CHKER (RT-11 and RSTS/E) RSX-11 only: DCO$ ECO$ FCO$ $FLDEF GCO$ ICI$ ICO$ LCI$ LCO$ OCI$ OCO$ RCI$ 5.3 I/O EXITING FILE HANDLING PAGE 5-16 5.3.1 $$$DIS Function: $$$DIS handles the keyword DISPOSE. If you attempt to PRINT or DELETE a read-only file, or to PRINT or SAVE a scratch file, error number 51 is generated. If SPOOL is used on a system other then RSTS/E, error number 67 is generated as a warning that the keyword is unsupported. Defined in: OPNCLO (see also $$$ERR, $$OPCL) Called by: CLOSTM ($CSTM, $CSTMI) OPNSTM ($OSTM, $OSTMI) Calls: None 5.3.2 $$$ERR Function: $$$ERR handles the keyword ERR. $$$ERR saves the transfer address and passes control back to the calling routine. Defined in: OPNCLO (see also $$$DIS, $$OPCL) Ca lled by: CLOSTM ($CSTM, $CSTMI) OPNSTM ($OSTM, $OSTMI) Calls: None 5.3.3 $EXIT Function: $EXIT exits from the program using the user's exit routine. If there is no user-exit routine, $EXIT uses .EXIT., the sys- tem-exit routine. Defined in: $STOP (see also FOO$, STP$) Called by: $CEXIT (EXIT) OTINIT ($OTI, $$OTI) Calls: $CLOSE FILE HANDLING PAGE 5-17 5.3.4 FOO$ ($STPS) Function: FOO$ is called when the FORTRAN STOP command is used with a message. FOO$ prints the message and calls $CLOSE to close the file. FOO$ then looks for the user's exit routine; if there is no user-exit routine, then FOO$ uses .EXIT., the system-exit routine. Defined in: $STOP (see also $EXIT, STP$) Called by: None Calls: None 5.3.5 STP$ ($STP) Function: STP$ is called when the FORTRAN STOP command is used without a message. FOO$ calls $CLOSE to close the file and then looks for the user's exit routine; if there is no user-exit routine, FOO$ uses .EXIT., the system-exit routine. Defined in: $STOP (see also $EXIT, FOO$) Called by: $RETD (RET$D; STP$ only) Calls: None 5.4 ERROR PROCESSING 5.4.1 $CHKER This routine is called with JSR R5,$CHKER. Function: This routine is called when an I/O error is generated. $CHKER first checks to see if ERR= was used. If it was not, program control is returned to the location of the error by way of RTS R5. If ERR= was used, $CHKER puts the ERR= transfer address in R4, the threaded code virtual program counter (see Section 1.4), and then calls $$SET to enter the FILE HANDLING PAGE 5-18 error information in the work area. Finally, $CHKER passes control to $IOEXIT. $IOEXIT recovers the program from the error and passes control to the next statement of the com- piled code (JMP @(R4)+ for threaded code). Defined in: $EOL (see also $EOL, $IOEXIT, $OPNER) Called by: $CLOSE ($CLOSE) CLOSTM ($CSTM, $CSTMI) $FIO ($FIO, $$FIO) $LISTI (ILR$/$ILR; RT-11 and RSTS/E only) $LISTO (ILW$/$ILW, TVS$/$TVS; RT-11 and RSTS/E only) OPNSTM ($OSTM, $OSTMI) Calls: The following routines are called only if ERR= was used: $CLOSE $$SET 5.4.2 END$ ($END) Function: END$ causes program execution to continue at the statement given by the keyword END. Defined in: $ENDERR (see also ERR$) Called by: None Calls: None 5.4.3 EOF$ ($EOF) Function: EOF$ performs the ENDFILE statement. If the file is not open, EOF$ returns to the calling program. If the file is random access, EOF$ generates error number 49 and returns to the calling program. If the file is unformatted, EOF$ calls $UIO to create the end-of-file record and calls $PUTREC to put it in the file. If the file is formatted, EOF$ creates the end-of-file record and calls $PUTREC to put it in the file. Defined in: EOF Called by: None FILE HANDLING PAGE 5-19 Calls: $GETFILE $PUTREC (not called unless the file is formatted) SAVR4$ $UIO (not called unless the file is unformatted) 5.4.4 $EOF2 Function: $EOF2 handles end-of-file errors. If END= was used, $EOF2 saves the transfer address and jumps to $IOEXIT. $IOEXIT re- covers the program from the error and continues program exe- cution at the transfer address. If END= was not used, the fatal end-of-file error, number 24, is generated. Defined in: $RWBLK (see also $EOFIL, $GETBLK, $PUTBLK) Called by: $GETREC ($GETREC) $UIO (IUR$/$IUR, IUW$/$IUW) Calls: $IOEXIT (called if END= is used) 5.4.5 $EOFILE Function: $EOFILE may simulate an end-of-file condition for unformatted I/O. $EOFILE first checks to see is a read operation is being attempted before a write operation; if it is, the block pointer is set to the next block and program control returns to the program that called the routine that called $EOFILE. If a read operation is not being attempted before a write operation, $EOFILE sets the end-of-file bit in the status word and falls through to $EOF2 which follows $EOFILE in module $RWBLK. Defined in: $RWBLK (see also $EOF2, $GETBLK, $PUTBLK) Called by: $UIO (IUR$/$IUR, IUW$/$IUW) Calls: $IOEXIT (called if END= is used) FILE HANDLING PAGE 5-20 5.4.6 ERR$ ($ERR) Function: ERR$ causes program execution to continue at the statement given by the keyword ERR. Defined in: $ENDERR (see also END$) Called by: None Calls: None 5.4.7 FUD$ ($ERROR) Function: FUD$ handles compiler errors, first generating error number 3 and then returning to the calling program. Defined in: $FUD Called by: None Calls: None 5.4.8 $IOEXIT This routine is called by JMP $IOEXIT. Function: $IOEXIT is called when an I/O error or end-of-file condition is encountered, provided that ERR= or END= was used. $IOEXIT resets the stack pointer and R4 to point to next statement of the compiled code (JMP @(R4)+ for threaded code), removes the ERR= transfer address and the END= transfer address, restores the registers, and resets various words in the OTS work area to recover the program from the error. After everything is reset, $IOEXIT passes program control to the statement given by ERR= or END=. Defined in: $EOL (see also $CHKER, $EOL, $OPNER) Called by: $GETBLK ($GETBLK; calls $IOEXIT conditionally, see $GETBLK) OTINIT ($OTI, $$OTI) $RWBLK ($EOF2, $EOFILE, $PUTBLK) FILE HANDLING PAGE 5-21 Calls: None 5.4.9 $OPNER Function: This routine is called if an error occurs during the $OPEN routine. $OPNER closes the file that generated the error by freeing the RT-11 channel, disassociating the logical unit number (LUN), and then calling $CLOSE to close the file. Defined in: $EOL (see also $CHKER, $EOL, $IOEXIT) Called by: $OPEN ($OPEN) Calls: $CLOSE CHAPTER 6 CONVERSIONS The first section in this chapter discusses I/O conversions; the second section discusses data conversions. 6.1 I/O CONVERSIONS I/O conversions are internal routines called by I/O modules to convert internal representation to external representation and vice-versa. The I/O routines are defined in three modules: $CONVF, $CONVI, and $CONVL. The conversions not performed by these I/O conversion modules are performed in $FIO. The routines in $CONVF are used to convert real and floating-point numbers. The input routine, RCI$, receives format information and the the address of the number to be converted on the stack. RCI$ fetches the digits of the number to be converted one by one. As each digit is fetched, it is con- verted to an internal format. If an exponent is encountered, RCI$ passes control to $ECI (Exponent conversion - input); $ECI returns the result to $CONVF on the stack. After all the digits are converted, RCI$ scales the number to agree with the I/O format chosen. When a $CONVF output routine is called, flags are set to indicate which I/O format is being used. These flags are necessary because all of the output routines merge into common code. First, if formats E, D, or G are used, the width of the field is reduced by four to save room for the exponent. The output routine then converts the number to decimal, scales it, and con- verts it to ASCII code. The $CONVI routines receive the address of the number on the stack. The routine checks the number for agreement with the radix, performs the conversion, puts the result on the stack, and then returns to the calling program. The $CONVL input routine receives the address of the variable on the stack and sets the default to false by clearing the SP. If the variable is found to be true, the input routine decrements the SP. The $CONVL output routine receives the width of the output field in R1 and returns the output field in R0. The output routine first places blank characters into R0 until the output field is one character short of the correct width, then checks the variable and places a 'T' or 'F' in R0 as CONVERSIONS PAGE 6-2 the final character of the output field. The naming convention used for the entry points in I/O conversion routines is: fCt where f is the format used. The following list shows the formats and their symbols: D Double E Exponential F Floating G General I Integer L Logical O Octal R Real t is either I or O depending on whether the format statement is input or output Table 5-1 lists the conversion modules, their entry points, and the modules that call each entry point. CONVERSIONS PAGE 6-3 Table 5-1 I/O Conversion Modules --------------------------------------------------------------------------- | | | | | Module | Entry | Calling Modules | | | Point | | --------------------------------------------------------------------------- | | | | | $CONVF | DCO$ | $FIO, $$FIO, $ILR, $ILW, $IBR, $OBJFMT | | | ECO$ | $FIO, $$FIO, $ILR, $ILW, $IBR | | | FCO$ | $FIO, $$FIO, $ILR, $ILW, $IBR | | | GCO$ | $FIO, $$FIO, $ILR, $ILW, $IBR | | | RCI$ | $FIO, $$FIO, $ILR, $ILW, $IBR, DEO$/ENO$, $OBJFMT | | | | | --------------------------------------------------------------------------- | | | | | $CONVI | $ECI | $IBW | | | ICI$ | $FIO, $$FIO, $ILR, $ILW, $IBR, DEO$/ENO$, $OBJFMT| | | ICO$ | $FIO, $$FIO, $ILR, $ILW, $IBR, $OBJFMT | | | OCI$ | $FIO, $$FIO, $ILR, $ILW, $IBR, $OBJENC | | | OCO$ | $FIO, $$FIO, $ILR, $ILW, $IBR | | | | | --------------------------------------------------------------------------- | | | | | $CONVL | LCI$ | $FIO, $$FIO, $ILR, $ILW, $IBR, $OBJFMT | | | LCO$ | $FIO, $$FIO, $ILR, $ILW, $IBR, $OBJFMT | | | | | --------------------------------------------------------------------------- Look at the calling modules. In most cases, if an I/O module calls one conversion routine it calls almost all of the other ones. To prevent the linker from including all of the I/O conversion routines in the task image, the I/O modules are written with a blank word where the address of the conversion routine is to go. When the program is compiled, the compiler enters the address of the conversion needed; unless the compiler does not know which conversion routine is needed. When you use run time or list formatting in your program, the compiler does not know which conversion routine is needed and, therefore, will call all of the I/O conversions. However, if you know which conversion is needed, you can save space by creating dummy entry points for those conversions not needed (see Section 2.1). 6.2 DATA TYPE CONVERSIONS There are three naming conventions for data conversion routines: $xy (internal entry point) $CVTxy (inline entry point) CONVERSIONS PAGE 6-4 Cyx$ (threaded code entry point) where x is the data type of the argument y is the data type the argument is to become Below is a list of data types and their symbols: SYMBOL DATA TYPE B LOGICAL*1 (byte) C COMPLEX D REAL*8 (double-precision) F REAL*4 I INTEGER (*2 or *4) L LOGICAL*4 Q INTEGER*4 R REAL*4 The three entry points share their conversioncode. Cyx$ and $xy have identical code and $CVTxy shares this code after preparing for a return to inline code (see Figure 5-1). $xy is internal to the OTS, it is called by routines within the OTS; $CVTxy is used for inline code; and Cyx$ is used for threaded code. _______________ | $CVTxy: PREPARE FOR A RETURN | | TO INLINE CODE. | | | | Cyx$: | | $xy: COMMON | | CONVERSION | | CODE | | | |_______________| Figure 5-1 Data Conversion Entry Points The following is a list of the data type conversion modules and their entry points. $CONV1 - $RC $CVTFD $RD CCF$ $CVTFC CDF$ $CONV2 - $DI CIC$ $RI CID$ $CVTCB DIF$ $CVTCI CIL$ $CVTDB CLD$ $CVTDI CLD$ $CVTFB CLF$ $CVTFI CLI$ CONVERSIONS PAGE 6-5 $CONV3 - $IC $CVTIF $ID CCI$ $IR CDI$ $CVTIC CFI$ $CVTID $CONV4 - $DR $CVTDF CFD$ $CONV5 - $CVTBC CCL$ $CVTDB CDL$ $CVTDF CFL$ $CONV6 - $CVTCD CCD$ $CVTCF CDC$ $CVTDC CFC$ CHAPTER 7 ARITHMETIC FUNCTIONS The first section of this chapter describes the entry point naming conven- tion used for the arithmetic function routines. The rest of the chapter divides the arithmetic routines into nine sections: 1. Move Operators 2. Multiplication/Division 3. Addition/Subtraction 4. Exponentiation 5. Subscript Operators 6. Relational Operators 7. Logical Operators 8. Branch Operators 9. Do Statements The modules containing the arithmetic routines are listed in the appropri- ate section followed by the entry points defined in that module. The variable names in the sample statements used in this chapter indicate data types as follows: B - LOGICAL*1 (byte) C - COMPLEX D - REAL*8 (double-precision) I - INTEGER L - LOGICAL*4 R - REAL*4 The letter P following any of the above letters means that the variable of that type is a subroutine parameter. In the arithmetic routines, the code for LOGICAL*1 variables (byte variables) is also applicable for LOGICAL*4 variables; however, only the first byte of the LOGICAL*4 variable is af- fected. 7.1 ENTRY POINT NAMING CONVENTIONS Because the entry points follow a naming convention, the threaded code gen- erated by the arithmetic routines is easily read. The format for these entry points is: ARITHMETIC FUNCTIONS PAGE 7-2 mmt$xx where mm the operation code (see Table 6-1) t the data type (see Table 6-2) xx the address code (see Table 6-3) Most of the arithmetic entry points have two arguments. The location of the arguments is specified by the address code part of the symbolic name. Operands may: reside on the stack (S), follow immediately in memory (I), reside in memory (M), be a subroutine parameter (P), or be an intermediate result stored at a particular temporary address (A). Table 6-3 shows all combinations that occur in the OTS; not all combinations are permitted with every operation code and data type. Note that special entry points exist for commonly occurring statements involving the constants 0 and 1. Table 6-1 Operation Codes CODE OPERATION AD Addition CC Convert to complex CD Convert to double CF Convert to floating-point CI Convert to integer CL Convert to logical CM Compare CO Logical complement CP Copy DE Decrement DI Divide IC Increment JM Jump MO Move MU Multiply NG Negate the argument NM DO loop NP DO loop using a parameter for a control value SA Subscript calculations SU Subtract SV Subscript calculations TA Transfer array operators TS Logical tests (compare against zero) TV Variable transfer X? Raise to a power Table 6-2 DATA TYPE SYMBOL DATA TYPE C COMPLEX D REAL*8 (double-precision) F REAL*4 ARITHMETIC FUNCTIONS PAGE 7-3 I INTEGER (*2 or *4) L LOGICAL (*1 or *4 unless noted) Q INTEGER*4 R REAL*4 Table 6-3 ADDRESS CODES ------------------------------------------------------------------ | | SECOND ARGUMENT | | FIRST |------------------------------------------------------ | | Argument Argument Address Parameter Address | | ARGUMENT | on stack in next in next in next on stack| | | word word word | ------------------------------------------------------------------ |Argument | SS | SI | SM | SP | SA | |on stack | | | | | | ------------------------------------------------------------------ |Argument | IS | II | IM | IP | IA | |in next | | | | | | |word | | | | | | ------------------------------------------------------------------ |Address | MS | MI | MM | MP | MA | |in next | | | | | | |word | | | | | | ------------------------------------------------------------------ |Parameter*| PS | PI | PM | PP | PA | |in next | | | | | | |word | | | | | | ------------------------------------------------------------------ |Moves 0 | 0S | -- | 0M | 0P | 0A | |into 2nd | | | | | | |argument | | | | | | ------------------------------------------------------------------ |Moves R0 | RS | -- | RM | RP | RA | |into 2nd | | | | | | |argument | | | | | | ------------------------------------------------------------------ |Increments| 1S | 1I | 1M | 1P | 1A | |or decre- | | | | | | |ments 2nd | | | | | | |argument | | | | | | ------------------------------------------------------------------ |Address | VS | -- | -- | -- | -- | |in R0 | | | | | | ------------------------------------------------------------------ <> ARITHMETIC FUNCTIONS PAGE 7-4 7.2 MOVE OPERATIONS Move operations typically account for a major part of the code generated by a FORTRAN program. Therefore, significantly more modularity and code op- timization exists within the modules for move operations. For example, a special copy operation exists for duplicating an argument on the stack. Special routines also exist for commonly used constant values. The modules containing the move routines are listed below. Each module name is followed by the entry points to the routines defined in that mo- dule. Following each entry point, is a statement which generates the entry point; any number in parentheses following the statement refers to a note at the end of the section. $COPY - Create copy of argument CPI$SM I1=(I+3)*(I+3) CPL$SM B1=(B+3)*(B+3) CPF$SM R1=(R+3)*(R+3) CPD$SM D1=(D+3)*(D+3) $DMOV1 - Move double-precision immediate to stack MOD$IS D=10.D1+10.D2 $DMOV2 - Move double-precision from R0 to stack MOD$0S $DMOV3 - Move double-precis ion zero or immediate to second argument MOD$0P MOD$0A D(J)=0 MOD$0M D=0 MOD$IP DP=1. MOD$IA D(J)=10.D1 MOD$IM D=1. $DMOV4 - Move double-precision from stack by way of address MOD$SA D(J)=D(I) $DMOV5 - Move double-precision to stack MOD$MS D=D+1. (1) MOD$SS MOD$PS DP=DP-1 ARITHMETIC FUNCTIONS PAGE 7-5 MOD$VS $DMOV6 - Move double-precision from memory and parameter MOD$MA D(J)=D2 MOD$MM D=D1 MOD$MP MOD$PA MOD$PM MOD$PP DP=DP2 $DMOV7 - Move double-precision from stack MOD$SP DP=DP+1 MOD$SM D=D+1. (1) $DMOVR - Move double-precision from R0 through R3 MOD$RS MOD$RM MOD$RP MOD$RA $FMOV1 - Move real stack to stack MOF$SS $FMOV2 - Move real to stack MOF$IS MOF$0S $FMOV3 - Move real to stack MOF$MS I=.1 (2) MOF$PS R=(RP*2)+1 $FMOV4 - Move real from stack MOF$SA RP(J)=RP(I) $FMOV5 - Move real from immediate MOF$IA R(J)=1 ARITHMETIC FUNCTIONS PAGE 7-6 $FMOV6 - Move real from stack MOF$SM R=I (3) MOF$SP RP=RP/R $FMOV7 - Move real from immediate MOF$IM R=1. MOF$IP RP=1. $FMOV8 - Move real zero to second argument MOF$0M R=0 MOF$0A R(J)=0 MOF$0P RP=0 $FMOV9 - Move real from memory and parameter MOF$MM R=R1 MOF$MA R(J)=R(2) MOF$MP MOF$PM R=RP-1 MOF$PA RP=RP2 MOF$PP RP=RP2 $FMOVR - Move real from R0-R1 MOF$RS R(J)=ROOT(R) (4) MOF$RM MOF$RA MOF$RP $IMOVR - Move integer from R0 MOI$RS R=R2-ROOT(I) (4) MOI$RM R=ROOT(M) (4) MOI$RA MOI$RP MOL$RS $IMOVS - Integer move MOI$SS (5) MOI$SM I=.1 (6) ARITHMETIC FUNCTIONS PAGE 7-7 MOI$SA I(I1)=I(I2) (7) MOI$IS (8) MOI$IM J=I+5 MOI$IA I(J)=1 MOI$MS R=I (3) MOI$MM I=I1 MOI$MA I(J)=K MOI$0S MOI$0M I=0 MOI$0A I(J)=0 MOI$1S MOI$1M I=1 MOI$1A MOL$IS (8) MOL$SS (5) REL$ - Same as MOL$IS $IPMOV - Integer and parameter moves MOI$SP IP=IP+1 MOI$IP IP=1 MOI$MP IP=I MOI$PS IP=IP+1 MOI$PM I=IP MOI$PA IP(I)=IP2 MOI$PP IP=IP2 MOI$0P IP=0 MOI$1P IP=1 $LMOVR - Move logical*1 from R0 MOL$RA MOL$RP MOL$RM $LMOVS - Logical*1 moves MOL$SM B=B+1 MOL$SA B(I)=B(I2) MOL$SP BP=BP+1 MOL$IM B=.true. MOL$IP BP=I MOL$IA B(J)=0 ARITHMETIC FUNCTIONS PAGE 7-8 MOL$MP MOL$MM B=B1 MOL$MA B(J)=B2 MOL$MP MOL$MS MOL$PM MOL$PA MOL$PP BP=BP2 MOL$PS BP=BP+1 (1) The 1. has been converted to a double-precision number so is on the stack; D is in memory. (2) The .1 is being put on the stack for conversion to integer. (3) The I was on the stack for conversion to real and is now being moved into R which is in memory. (4) ROOT is a function. (5) MOL$SS and MOI$SS are the same entry point. (6) The .1 was on the stack for conversion to integer and is now being moved into memory. (7) The value of I(I2) is on the stack and the address of I(I1) is on the stack. (8) MOI$IS,MOL$IS and REL$ are the same entry point. 7.3 MULTIPLICATION AND DIVISION. The modules containing the multiplication and division routines are listed below. Each module name is followed by the entry points to the routines defined in that module. Following each entry point, is a statement which generates the entry point; any number in parentheses following the state- ment refers to a note at the end of the section. In the example state- ments, the values in parentheses are on the stack. Occasionally a number in parentheses follows the statement; it refers to a note at the end of the section. In this section the address codes in the entry point names work as follows: 1. For division, the first letter of the address code is the location of the denominator; the second letter is the location of the num- erator. 2. For multiplication, the first and second letters correspond to the second and first factors of the multiplication, respectively. ARITHMETIC FUNCTIONS PAGE 7-9 There are a number of entry points in the following modules that do not fit the naming convention; they are not used for threaded code. $CDIV - Complex divide DIC$SS C=(C-2)/(C1-3) DIC$IS C=C/2 DIC$MS C=(C-3)/C1 DIC$PS C=(C-3)/CP $DVC - this entry point is the same as DIC$SS. $DVC performs calls to this location that are made from within the OTS. $DIVC - this is the inline entry point to the code at location DIC$SS. NOTE $CDIV uses $ADR, $DVR, $MLR, and $SBR if there is no FPU hardware. Therefore, when you perform complex div- ision ($CDIV), modules $FADD, $FDIV, and $FMUL may be needed. $CMUL - Complex multiply MUC$SS C=(C-2)*(C1-3) MUC$IS C=C*3 MUC$MS C=C*(C1-3) MUC$PS C=(C-3)*CP $MLC - this entry point is the same as MUC$SS. $MLC performs calls to this location that are made from within the OTS. $MULC - this is the inline entry point to the code at location MUC$SS. NOTE $CMUL uses $ADR, $MLR AND $SBR if there is no FPU hardware. Therefore, when you perform complex multi- plication ($CMUL), modules $FADD and $FMUL may be need- ed. $DDIV - Double-precision divide DID$SS D=(D-2.)/(D1-3.) DID$IS D=D/2. DID$MS D=(D-3.)/D1 ARITHMETIC FUNCTIONS PAGE 7-10 DID$PS D=(D-3.)/CP $DVD - this entry point is the same as DID$SS. $DVD performs calls to this location that are made from within the OTS. $DIVD - this is the inline entry point to the code at location DID$SS. $DMUL - Double-precision multiply MUD$SS D=(D-2)*(D1-3) MUD$IS D=D*3 MUD$MS D=D*(D1-3) MUD$PS D=(D-3)*DP $MLD - this entry point is the same as MUD$SS. $MLD performs calls to this location that are made from within the OTS. $MULD - this is the inline entry point to the code at location MUD$SS. $FDIV - Real divide DIF$SS R=(R-2.)/(R1-3.) DIF$IS R=R/2. DIF$MS R=(R-3.)/R1 DIF$PS R=(R-3.)/RP $DVR - this entry point is the same as DIF$SS. $DVR performs calls to this location that are made from within the OTS. $DIVF - this is the inline entry point to the code at location DIF$SS. $FMULS - Real multiply MUF$SS R=(R-2.)*(R1-3.) MUF$IS R=R*3. MUF$MS R=R*(R1-3.) MUF$PS R=(R-3.)*RP $MLR - this entry point is the same as MUF$SS. $MLR performs calls to this location that are made from within the OTS. $MULF - this is the inline entry point to the code at location MUF$SS. $IDIVS - Integer divide DII$SS I=(I-2)/(I1-3) DII$IS I=I/2 DII$MS I=(I-3)/I1 ARITHMETIC FUNCTIONS PAGE 7-11 DII$PS I=(I-3)/IP $DVI - this entry point is the same as DII$SS. $DVI performs calls to this location that are made from within the OTS. $IMUL - Integer multiply MUI$SS I=(I-2)*(I1-3) MUI$IS I=I*3 MUI$MS I=I*(I1-3) MUI$PS I=(I-3)*IP $MLI - this entry point is the same as MUI$SS. $MLI performs calls to this location that are made from within the OTS. 7.4 ADDITION AND SUBTRACTION The modules containing the addition and subtraction routines are listed below. Each module name is followed by the entry points to the routines defined in that module. Following each entry point, is a statement which generates the entry point; any number in parentheses following the state- ment refers to a note at the end of the section. In this section the address codes in the entry point names work as follows: the first letter of the address code refers to the second operand; the second letter, to the first operand. 7.4.1 Negation, Increments and Decrements $CNEG - Negate complex value NGC$M C=-C NGC$S C=-C+C2 (1) NGC$P CP1=-CP2 NGC$A $FNEG - Negate real value NGF$S R=-R+R2 NGF$M R=-R NGF$A NGF$P RP1=-RP2 NGD$S D=-D+D2 ARITHMETIC FUNCTIONS PAGE 7-12 NGD$M D=-D NGD$A NGD$P DP1=-DP2 $INEG - Negate integer value NGI$S I=-I+I2 NGI$M I=-I NGI$A NGI$P IP1=-IP2 $INCR - Increment and decrement integer values ICI$S I=(I+1)*8 ICI$M I=I+1 ICI$A ICI$P IP1=IP1+1 DCI$S I=(I-1)*8 DCI$M I=I-1 DCI$A DCI$P IP2=IP2-1 $LNOTS - Logical .NOT. operators COI$S I=.NOT.(I+I1) COI$M I=.NOT.I COI$P COI$A COL$S B=.NOT.(B.OR.B1) COL$M B=.NOT.B COL$P COL$A (1) The variable C is moved to the stack for later addition to C2. 7.4.2 General Addition and Subtraction There are a number of entry points in the following modules that do not fit the naming convention; they are not used for threaded code. In these examples, the value in parentheses is on the stack. ARITHMETIC FUNCTIONS PAGE 7-13 $ADDA - Real add to memory via address ADF$IA ADF$SA ADF$MA ADF$PA SUF$IA SUF$SA SUF$MA SUF$PA NOTE $ADDA uses ADD$ unless there is FIS or FPU hardware. Therefore, when you use $ADDA mo- dule $FADD may be needed. $ADDM - Real add to memory ADF$IM R=R+2. ADF$SM R=R+I (1) ADF$MM R=R1+R ADF$PM R=R+RP SUF$IM R=R-2 SUF$SM SUF$MM R=R-R1 SUF$PM NOTE $ADDM uses ADD$ unless there is FIS or FPP hardware. Therefore, when you use $ADDM, mo- dule $FADD may be needed. $ADDP - Real add to parameter ADF$IP RP=RP+3 ADF$SP RP=(R+1.0)+RP ADF$MP RP=RP+R1 ADF$PP RP=RP+RP1 SUF$IP RP=RP-3 SUF$SP ARITHMETIC FUNCTIONS PAGE 7-14 SUF$MP RP=RP-R1 SUF$PP RP=RP-RP1 NOTE $ADDP uses ADD$ unless there is FIS or FPP hardware. Therefore, when you use $ADDP, mo- dule $FADD may be needed. $CADD - Complex add and subtract ADC$IS C=C+2. ADC$MS C=C+.1 (2) ADC$SS C=(C1+C2)+(C3+C4) ADC$PS C=CP1+(C3+C4) SUC$IS C=C-2. SUC$MS SUC$SS C=(C+1)-5. (5) SUC$PS $ADC - this entry point is the same as ADC$SS. $ADC performs calls to this location that are made from within the OTS. $ADDC - this is the inline entry point to the code at location ADC$SS. $SBC - this entry point is the same as SUC$SS. $SBC is used for calls to this location that arae made from within the OTS. $SUBC - this is the inline entry point to the code at location SUC$SS. NOTE $CADD uses $ADR if there is no FPU hardware. Therefore, when you perform complex addition ($CADD), module $FADD may be needed. $DADD - Double-precision add and subtract ADD$IS D=D+2. ADD$MS D=D+.1 (3) ADD$SS D=(D1+D2)+(D3+D4) ADD$PS D=DP+(D1+D2) SUD$IS D=D-2. ARITHMETIC FUNCTIONS PAGE 7-15 SUD$MS D=D-D1 SUD$SS D=(D1+D2)-(D3+D4) SUD$PS $ADD - this entry point is the same as ADD$SS. $ADD performs calls to this location that are made from within the OTS. $ADDD - this is the inline entry point to the code at location ADD$SS. $SBD - this entry point is the same as SUD$SS. $SBD performs calls to this location that are made from within the OTS. $SUBD - this is the inline entry point to the code at location SUD$SS. $FADD - Real addition ADF$IS R=1.0+(R1+R2) ADF$MS R=R1+R2+(R3+R4) ADF$SS R=(R1+R2)+(R3+R4) ADF$PS R=RP+(R1+R2) SUF$IS R=(R+1)-5. SUF$MS SUF$SS R=(R1+R2)-(R3+R4) SUF$PS ADD$ - this is the entry point to the routine that performs a floating-point add of two single precision numbers. The oper- ands are taken from R0:R1 and R2:R3. The result is returned on the top of the stack. $ADR - this entry point is the same as ADF$SS. $ADR performs calls to this location that are made from within the OTS. $ADDF - this is the inline entry point to the code at location ADF$SS. $SBR - this entry point is the same as SUF$SS. $SBR performs calls to this location that are made from within the OTS. $SUBF - this is the inline entry point to the code at location SUF$SS. $IADDS - Integer add ADI$SS I=(I+2)+(I1+3) ADI$SA ADI$SM I=I+(I1+3) ADI$IS I=L+2 (4) ADI$IA ADI$IM I=I+2 ARITHMETIC FUNCTIONS PAGE 7-16 ADI$MS I=(I2+3)+I ADI$MA ADI$MM I=I+I1 $IPADD - Integer add with parameters ADI$SP IP=IP+(I+3) ADI$IP IP=IP+3 ADI$MP IP=IP+I ADI$PS I=IP+(I1+I2) ADI$PM I=IP+I ADI$PA ADI$PP IP1=IP1+IP2 $IPSUB - Integer subtract with parameters SUI$SP IP1=(I+I1)-IP1 SUI$IP IP1=3-IP1 SUI$MP IP1=I-IP1 SUI$PS I2=IP1-(I1+I2) SUI$PM I=IP1-I SUI$PA SUI$PP IP1=IP1-IP2 $ISUBS - Integer subtract SUI$SS I2=(I1+I2)-(I3-I4) SUI$SA SUI$SM I2=(I2+I3)-I4 SUI$IS I2=1-(I1+I2) SUI$IA SUI$IM I=I-2 SUI$MS I=I1-(I2-I4) SUI$MA SUI$MM I=I-I1 (1) The I has been converted to a real number, so is on the stack. R is in memory. (2) The .1 is converted to a complex number, so is on the stack. C is in memory. (3) The .1 has been converted to a double-precision number, so is on the ARITHMETIC FUNCTIONS PAGE 7-17 stack. D is in memory. (4) The L has been converted to an integer, so is on the stack. 2 is im- mediate. (5) The 5. is converted to a complex number, so is on the stack. 7.5 EXPONENTIATION The modules containing the exponentiation routines are listed below. Each module name is followed by the entry points to the routines defined in that module. Following each entry point, is a statement which generates the entry point; any number in parentheses following the statement refers to a note at the end of the section. The modules in this section are used for both threaded and inline code. The entry points listed are the threaded code entry points. The inline code entry points are generated by the same statements, but the name is slightly different; for the inline entry points, the dollar sign ($) is the first character instead of the last. $XCI - Complex raised to an integer power XCI$ C=C**I (1) $XDD - Double-precision raised to a double-precision power XDD$ D=D**D XFD$ R=R**D XDF$ D=D**R (2) $XDI - Double-precision raised to an integer power XDI$ D=D**I (1) $XFF - Real raised to a real power XFF$ R=R**R (1) $XFI - Real raised to an integer power XFI$ R=R**I (1) $XII - Integer raised to an integer power XII$ I=I**I (1) ARITHMETIC FUNCTIONS PAGE 7-18 (1) The exponent is pointed to by the top of the stack, and the base is second on the stack. (2) The exponent is on the top of the stack, and the base is second on the stack. 7.6 SUBSCRIPT OPERATORS Subscript calculations differ according to the dimension of the array, the use of subscript vectoring for multidimensional arrays, and the size of the data elements. In addition, module sizes vary slightly according to wheth- er or not bounds checking has been incorporated (see Table A-3). The modules containing the subscript routines are listed below. Each mo- dule name is followed by the entry points to the routines defined in that module. Following each entry point, is a statement which generates the entry point; any number in parentheses following the statement refers to a note at the end of the section. $DVEC - Double-precision subscript operators SAD$IM SAD$MM D(I)=D1 SAD$SM D(I+I1)=D1 SVD$IM SVD$MM D1=D(I) SVD$SM D1=D(I+I1) $FVEC - Real*4 subscript operators SAF$IM SAF$MM R(I)=R1 SAF$SM R(I+I1)=R1 SVF$IM SVF$MM R1=R(I) SVF$SM R1=R(I+I1) $IVEC - Integer subscript operators SAI$IM SAI$MM I(I1)=I2 SAI$SM I(I1+I2)=I3 SVI$IM SVI$MM I2=I(I1) SVI$SM I3=I(I1+I2) $LVEC - Logical*1 subscript operators ARITHMETIC FUNCTIONS PAGE 7-19 SAL$IM SAL$MM L(I)=L2 SAL$SM L(I1+I2)=L2 SVL$IM SVL$MM L2=L(I) SVL$SM L2=L(I1+I2) $DVECC - Double-precision subscript operators involving parameters SAD$IP DP(3)=D2 SAD$MP SAD$SP DP(I+I1)=D2 SVD$IP D2=DP(3) SVD$MP SVD$SP D2=DP(I+I1) $FVECC - Real subscript operators involving parameters SAF$IP RP(3)=R2 SAF$MP SAF$SP RP(I+I1)=R2 SVF$IP R2=RP(3) SVF$MP SVF$SP R2=RP(I+I1) $IVECC - Integer subscript operators involving parameters SAI$IP IP(3)=I2 SAI$MP SAI$SP IP(I+I1)=I2 SVI$IP I2=IP(I) SVI$MP SVI$SP I2=IP(I+I1) $LVECC - Logical*1 subscript operators involving parameters SAL$IP LP(3)=L2 SAL$MP SAL$SP LP(I+I2)=L2 SVL$IP L2=BP(3) SVL$MP SVL$SP L2=LP(I+I2) $DVECP - Double subscript operators involving parameters ARITHMETIC FUNCTIONS PAGE 7-20 SAD$PM D(IP)=D1 SAD$PP SVD$PM D1=D(IP) SVD$PP $FVECP - Real subscript operators involving parameters SAF$PM R(IP)=R2 SAF$PP SVF$PM R2=R(IP) SVF$PP $IVECP - Integer subscript operators involving parameters SAI$PM I(IP)=I2 SAI$PP SVI$PM I2=I(IP) SVI$PP $LVECP - Logical*1 subscript operators involving parameters SAL$PM L(IP)=L1 SAL$PP SVL$PM L1=L(IP) SVL$PP $QPVEC - Logical*4 and integer*4 subscript operators involving parameters SVQ$PM I=K(IP) (1) SVQ$PP $QVEC - Logical*4 and integer*4 subscript operators SVQ$IM SVQ$SM I=K(I1+I2) (1) SVQ$MM I=K(I1) (1) $QVECP - Logical*4 and integer*4 subscript operators involving parameters SVQ$IP I=KP(3) (1) SVQ$SP I=KP(I1+I2) (1) SVQ$MP ARITHMETIC FUNCTIONS PAGE 7-21 (1) The variable K is declared as an INTEGER*4 array. 7.7 RELATIONAL OPERATORS In the following routines, code produced for LOGICAL*1 (byte) variables would also be produced for LOGICAL*4 variables, because only the low-order byte of a LOGICAL*4 variable contains a value. Note that comparisons aga- inst the constants 0, 0.0, 0.0D0 and .FALSE. generate special code. However, this efficiency in execution is at the expense of loading another OTS module, which causes an increase in program size. The modules containing the relational routines are listed below. Each mo- dule name is followed by the entry points to the routines defined in that module. Following each entry point, is a statement which generates the entry point; any number in parentheses following the statement refers to a note at the end of the section. There are a number of entry points in the following modules that do not fit the naming convention; they are not used for threaded code. $CMPD - Double-precision comparisons CMD$SS B=(D1+D2).LT.(D3+D4) CMD$IS B=3.DO.LT.(D3+D4) CMD$MS B=D1.LT.(D3+D4) CMD$PS B=DP1.LT.(D3+D4) CMD$SI B=(D4+D5).LT.3.0 CMD$II B=3.DO.LT.2.DO CMD$MI B=D.LT.3.DO CMD$PI B=DP1.LT.3.DO CMD$SM B=(D1+D7).LT.D CMD$IM B=3.DO.LT.D CMD$MM B=D.LT.D1 CMD$PM B=DP1.LT.D CMD$SP B=(D1+D8).LT.DP1 CMD$IP B=3.DO.LT.DP1 CMD$MP B=D.LT.DP1 CMD$P P B=DP1.LT.DP2 $CMD - this entry point is the same as CMD$SS. $CMD performs calls to this location that are made from within the OTS. $CMPD - this is the inline entry point to the code at location CMD$SS. $CMPF - Real comparisons CMF$SS B=(R1+R2).LT.(R3+R4) ARITHMETIC FUNCTIONS PAGE 7-22 CMF$IS B=3.0.LT.(R3+R4) CMF$MS B=R1.LT.(R3+R4) CMF$PS B=RP1.LT.(R3+R4) CMF$SI B=(R4+R5).LT.3.0 CMF$II B=3.0.LT.2.0 CMF$MI B=R.LT.3.0 CMF$PI B=RP1.LT.3.0 CMF$SM B=(R1+R7).LT.R CMF$IM B=3.0.LT.R CMF$MM B=R.LT.R1 CMF$PM B=RP1.LT.R CMF$SP B=(R1+R8).LT.RP1 CMF$IP B=3.0.LT.RP1 CMF$MP B=R.LT.RP1 CMF$PP B=RP1.LT.RP2 $CMR - this entry point is the same as CMF$SS. $CMR performs calls to this location that are made from within the OTS. $CMPF - this is the inline entry point to the code at location CMF$SS. $ICMPS - Integer comparisons CMI$SS B=(I1+I2).LT.(I3+I4) CMI$SI B=(I4+I5).LT.3 CMI$SM B=(I1+I7).LTI CMI$IS B=3.LT.(D3+D5) CMI$II B=3.LT.2 CMI$IM B=3.LT.I CMI$MS B=D1.LT.(D3+D4) CMI$MI B=I.LT.3 CMI$MM B=I.LT.I1 $IPCMP - Integer parameter comparisons CMI$PI B=IP1.LT.3 CMI$PM B=IP1.LT.I CMI$PP B=IP1.LT.IP2 CMI$PS B=IP1.LT.(I3+I5) CMI$MP B=I.LT.IP1 CMI$IP B=3.LT.IP1 CMI$SP B=(I1+I8).LT.IP1 $LCMPI - Immediate logical*1 comparisons ARITHMETIC FUNCTIONS PAGE 7-23 CML$SI B=(B1.OR.B2).LT..TRUE. CML$MI B=B.LT..TRUE. $LCMPP - Logical*1 comparisons to parameter CML$SP B=(B1.OR.B2).LT.BP CML$IP B=.TRUE..LT.BP CML$MP B=B.LT.BP CML$PP B=BP1.LT.BP2 $LCMPS - Logical*1 comparisons to stack and memory CML$SS B=(B1.OR.B2).LT.(B3.OR.B4) CML$MS B=B1.LT.(B2.OR.B3) CML$IS B=.TRUE..LT.(B1.OR.B2) CML$SM B=(B1.OR.B2).LT.B CML$MM B=(B.LT.B1 CML$IM B=.TRUE..LT.B $LPCMPS - Logical*1 parameter comparisons CML$PS B=BP.LT.(B1.OR.B2) CML$PI B=BP.LT..TRUE. CML$PM B=BP.LT.B $LTEST - Logical*1 test operators TSL$S B=(B.OR.B1).EQ..FALSE. TSL$M B=B.EQ..FALSE. TSL$I B=.FALSE..EQ..FALSE. TSL$P B=BP.EQ..FALSE. $TESTC - Complex test operators TSC$S B=(C+C1).LT.(0.0,0.0) TSC$M B=C.LT.(0.0,0.0) TSC$I B=(0.0,0.0).LT.(0.0,0.0) TSC$P B=BP.LT.(0.0,0.0) $TESTS - Integer, real, and double-precision tests against 0 TSI$S B=(I+I1).LT.0 TSI$M B=I.LT.0 TSI$I B=0.LT.0 ARITHMETIC FUNCTIONS PAGE 7-24 TSI$P B=IP.LT.0 TSF$S B=(R+R1).LT.0.0 TSF$M B=R.LT.0.0 TSF$I B=0.0.LT.0. TSF$P B=RP.LT.0.0 TSD$S B=(D+D1).LT.0.0D0 TSD$M B=D.LT.0.0D0 TSD$I B=0.0 D0.LT.0.0D0 TSD$P B=DP.LT.0.0D0 7.8 LOGICAL OPERATORS The modules containing the logic routines are listed below. Each module name is followed by the entry points to the routines defined in that mo- dule. Following each entry point, is a statement which generates the entry point; any number in parentheses following the statement refers to a note at the end of the section. $BITDI - Logical Expressions AND$ L=L.AND.L1 EQV$ L=L.EQV.L1 IOR$ L=L.IOR.L1 XOR$ L=L.XOR.L1 $LOADS - Relational Expressions LEQ$ L=L.EQ.L1 LGE$ L=L.GE.L1 LGT$ L=L.GT.L1 LLE$ L=L.LE.L1 LLT$ L=L.LT.L1 LNE$ L=L.NE.L1 7.9 BRANCH OPERATORS The modules containing the branch routines are listed below. Each module name is followed by the entry points to the routines defined in that mo- dule. Following each entry point, is a statement which generates the entry point; any number in parentheses following the statement refers to a note at the end of the section. ARITHMETIC FUNCTIONS PAGE 7-25 $AIF - Arithmetic IF Statement AIF$ IF (I-I1) 10,20,30 $BRAS - Conditional GOTO Statements NOTE In the following examples, the appropriate relational operator from Section 6.6 evalu- ates the equation in parentheses; then the branch operator directs program control ac- cording to the results of that evaluation. BEQ$ IF (L.EQ.L1) GOTO 10 BGE$ IF (L.GE.L1) GOTO 10 BGT$ IF (L.GT.L1) GOTO 10 BLE$ IF (L.LE.L1) GOTO 10 BLT$ IF (L.LT.L1) GOTO 10 BNE$ IF (L.NE.L1) GOTO 10 BRA$ GOTO 10 $GOTO - Computed and Assigned GOTO Statements JMC$ GOTO (10,20),I JMI$M GOTO I,(10,20) JMI$P GOTO IP,(10,20) 7.10 DO STATEMENTS The modules containing the DO routines are listed below. Each module name is followed by the entry points to the routines defined in that module. Following each entry point, is a statement which generates the entry point; any number in parentheses following the statement refers to a note at the end of the section. In this section the address code of the entry point name works as follows: the first letter of the address code is the location of the increment value; the second letter is the location of the termination value. Special entry points are used when the increment value is one. Remember that the operation code NM is a DO loop in the main program. The operation code NP is a DO loop using a parameter for a control variable. $BRAS - Increment value is 1 ARITHMETIC FUNCTIONS PAGE 7-26 NMI$1I DO 10 I=2,8 (1) NMI$1M DO 10 I=2,I1 (1) $NXT1 - Termination value is immediate NMI$II DO 10 I=2,8,2 NMI$MI DO 10 I=2,8,I1 NMI$PI DO 10 I=2,8,IP NPI$II DO 10 IP=2,8,2 NPI$MI DO 10 IP=2,8,I NPI$PI DO 10 IP=2,8,IP1 $NXT2 - Termination value is in memory NMI$IM DO 10 I=2,I1,2 NMI$MM DO 10 I=2,I1,I2 NMI$PM DO 10 I=2,I1,IP NPI$IM DO 10 IP=2,I1,2 NPI$MM DO 10 IP=2,I1,I2 NPI$PM DO 10 IP=2,I1,IP1 $NXT3 - Termination value is a parameter NMI$IP DO 10 I=2,IP,2 NMI$MP DO 10 I=2,IP,I1 NMI$PP DO 10 I=2,IP,IP1 NPI$IP DO 10 IP=2,IP1,2 NPI$MP DO 10 IP=2,IP1,I NPI$PP DO 10 IP=2,IP1,IP2 $NXT4 - Increment value is 1 NMI$1P DO 10 I=2,IP (1) NPI$1I DO 10 IP=2,8 (1) NPI$1M DO 10 IP=2,I (1) NPI$1P DO 10 IP=2,IP1 (1) (1) The default increment is 1. CHAPTER 8 SUBROUTINE SUPPORT The first section of this chapter describes the routine that passes control to the subroutines. The other ten sections describe the routines that per- form the library subroutines and are arranged alphabetically by the entry points which reference the routines. See the appropriate FORTRAN IV User's Guide for more information on the library subroutines. If the routine being described performs both threaded and inline code the threaded code entry point is first followed by the inline entry point in parentheses. "Function" tells what the routine does. "Defined in" gives the name of the module in which the entry point is de- fined. Where a module defines more than one entry point, a "see also" note directs the reader to the other entry point(s). "Called by" lists the modules that call the routine being described. The entry points in parentheses, following the module names, are the entry points in the module that call the routine. "Calls" lists the entry points that are called by the routine being des- cribed. All subroutines are called by a JSR PC,xxx instruction. 8.1 $OTIS ($$OTIS) Function: $OTIS sets the stack before passing program control to the subroutine. First, two words from the OTS work area (see Ap- pendix C.2) are put on the stack: THREAD, which tells if the code is threaded or inline; and ENMLNK, which points to the last name in the queue (see Table C-3, offset 14). Then the internal line number of the calling function is put on the SUBROUTINE SUPPORT PAGE 8-2 stack, followed by the name of the subroutine (in RAD50) and the arguments, if there are any. $OTIS then passes control to the subroutine. When the subroutine is finished, it passes control to the next statement of the compiled code (JMP @(R4)+ for threaded code). $$OTIS (inline code) is a little different. Control is passed to the subroutine in the same way; however, when the subroutine is finished, control returns to $$OTIS. $$OTIS removes the information that was put on the stack and then moves to the next instruction. Defined in: $SUBR Called by: None Calls: None 8.2 ASSIGN Function: The subroutine ASSIGN, like the OPEN statement, opens a file. The OPEN statement is preferred because the code is more ef- ficient. For more information on this subroutine, see the appropriate FORTRAN IV User's Guide. For more information on the statement, see the FORTRAN Language Reference Manual. Defined in: $ASSIGN Called by: None Calls: $GETFILE 8.3 CLOSE Function: The subroutine CLOSE, like the CLOSE statement, closes a file. The CLOSE statement is preferred because the code is more efficient. For more information on this subroutine, see the appropriate FORTRAN IV User's Guide. For more informa- tion on the statement, see the FORTRAN Language Reference Manual. Defined in: $CLS Called by: None SUBROUTINE SUPPORT PAGE 8-3 Calls: $CLOSE $GETFILE (RT-11 and RSTS/E) 8.4 DATE Function: DATE is passed an array name or an array element and returns the date, as set by the system. The month is given as a three letter abreviation. If no argument is passed to the subroutine, error number 16 is generated. Defined in: $DATE Called by: None Calls: None 8.5 ERRSNS Function: ERRSNS can be passed zero, one, or two arguments. ERRSNS goes to the work area (see Appendix C.2) and finds the last error number and the associated logical unit number (LUN). If no arguments were passed, ERRSNS clears these two bytes of information. If one argument was passed, the last error number is returned in the argument. If two arguments were passed, both bytes of information are returned. Defined in: ERRSNS Called by: None Calls: None 8.6 ERRTST Function: ERRTST receives two arguments. ERRTST takes the error number passed in the first argument and tries to find it in the error table (see Appendix C.2). If the error has occured and is in the error table, ERRTST returns a 1 in the second argu- ment. If the error has not occured, ERRTST returns a 0 in the second argument. SUBROUTINE SUPPORT PAGE 8-4 Defined in: ERRTST Called by: None Calls: None 8.7 EXIT Function: EXIT causes a jump to $EXIT. This call performs as a STOP command but does not print any message. Defined in: $CEXIT Called by: None Calls: $EXIT 8.8 IDATE Function: IDATE receives three integer variables. These variables re- turn the month, day and year, as set by the system. If less than three arguments are passed, error number 16 is generat- ed. Defined in: $IDATE Called by: None Calls: None 8.9 RANDU Function: RANDU is a random number generator, it receives three argu- ments. The first two are the generator base, the third is the variable name in which the random number is returned. If less then three variables are passed, error number 16 is gen- erated. Defined in: $RANDU SUBROUTINE SUPPORT PAGE 8-5 Called by: None Calls: None 8.10 SETERR Function: SETERR receives two variables. The first variable is an error number, the second a value that tells the compiler how to treat the error. If less then two variables are passed, error number 16 is generated. Defined in: $SETERR Called by: None Calls: None 8.11 USEREX Function: The instruction, CALL USEREX [routine name], at the beginning of a Fortran program, causes any exit statement to jump to the routine named before exiting the program. USEREX saves the address of the routine named in the instruction. Defined in: $USERE Called by: None Calls: None CHAPTER 9 FORTRAN LIBRARY FUNCTIONS This chapter discusses the routines that perform the FORTRAN library func- tions. All FORTRAN library functions assume that R5 points to an argument block containing the number of arguments passed, followed by their ad- dresses. Functions are returned by way of the RTS PC instruction with the results in R0 through R3. The compiler sets up the argument block by generating a series of REL$ calls to put arguments onto the stack; it then generates a CAL$ call, fol- lowed by the number of arguments given and the name of the desired function (function names are global). After the function is performed, a move is generated to move the result out of the register(s). Table 8-1 lists the FORTRAN functions. MODULE gives the name of the module in which the function is defined; CALLS lists the entry points, external to the module, that the module calls. In some cases the external entry po- ints are called only under certain hardware configurations; these are noted by a conditional statement such as "If no FPU:". Table 8-1 FORTRAN Functions FUNCTION MODULE CALLS ABS $ABS None AIMAG $AIMAG None AINT* $AINT None ALOG $ALOG If no FPU: $ADR,$DVR,$IR,$MLR,$SBR ALOG10 $ALOG If no FPU: $ADR,$DVR,$IR,$MLR,$SBR AMAX0 $AMIN0 $IR,$POPR3 AMAX1 $AMAX1 $CMR,$RI AMIN0 $AMIN0 $IR,$POPR3 AMIN1 $AMAX1 $CMR,$RI AMOD $AMOD $DVR,$INTR,$MLR,$POPR3,$SBR ATAN $ATAN If no FPU: $ADR,$DVR,$MLR,$POPR3,$SBR ATAN2 $ATAN If no FPU: $ADR,$DVR,$MLR,$POPR3,$SBR CABS $CABS $ADR,$DVR,$FCALL,$MLR CCOS $CSIN COS,EXP,SIN,$ADR,$DVR,$FCALL,$MLR,$SBR CEXP $CEXP COS,EXP,MOF$RS,SIN,$FCALL,$MLC,$MLR,$POPR4,$SBR CLOG $CLOG ALOG,ATAN2,CABS,$FCALL CMPLX $CMPLX None CONJC $CONJC None FORTRAN LIBRARY FUNCTIONS PAGE 9-2 COS $SIN If no FPU: $ADR,$DVR,$INTR,$MLR,$SBR CSIN $CSIN COS,EXP,SIN,$ADR,$DVR,$FCALL,$MLR,$SBR CSQRT $CSQRT $ABS,$ADR,$IVR,$FCALL DABS $DABS SQR,$ADR,$DVR,$FCALL,$MLR DATAN $DATAN If no FPU: $ADD,$DVD,$MLD,$POPR4,$SBD DATAN2 $DATAN If no FPU: $ADD,$DVD,$MLD,$POPR4,$SBD DBLE** $DBLE None DCOS $DSIN If no FPU: $ADD,$DINT,$DVD,$MLD,$POPR4,$SBD DEXP $DEXP If no FPU: $ADD,$DI,$DVD,$ID,$MLD,$POPR4,$SBD DIM $DIM $SBR DLOG $DLOG If no FPU: $ADD,$DVD,$ID,$MLD,$POPR4,$SBD DLOG10 $DLOG If no FPU: $ADD,$DVD,$ID,$MLD,$POPR4,$SBD DMAX1 $DMIN1 $CMD DMIN1 $DMIN1 $CMD DMOD $DMOD $DVD,$DINT,$MLD,$SBD DSIGN $DSIGN None DSIN $DSIN If no FPU: $ADD,$DINT,$DVD,$MLD,$POPR4,4SBD DSQRT $DSQRT If no FPU: $ADD,$DVD EXP $EXP If no FPU: $ADR,$DVR,$IR,$MLR,$RI,$SBR FLOAT** $FLOAT $IR,$POPR3 IABS $IABS None IDIM $IDIM None IDINT*** $INT $RI IFIX** $IFIX $RI INT*** $INT $RI ISIGN $ISIGN None MAX0 $MAX0 None MAX1 $AMAX1 $CMR,$RI MIN0 $MIN0 None MIN1 $AMAX1 $CMR,$RI MOD $MOD $DVI,$MLI RAN $RAN None REAL $REAL None SIGN $SIGN None SIN $SIN If no FPU: $ADR,$DVR,$INTR,$MLR,$SBR SNGLE $SNGLE None SQRT $SQRT If FIS: $ADR,$DVR TANH $TANH EXP,MOF$RS,$ADR,$DVR,$FCALL,$MLR,$SBR * $INTR is like the AINT function. However, the result is returned on the stack instead of in R0:R1. ** These routines exist but are never called. Instead the compiler calls the appropriate conversion routine directly. *** These functions generate blocks of code that can be avoided by direct conversions. For example, FORTRAN programs should use I=R instead of I=INT(R), or in MACRO simply call $RI. APPENDIX A OTS MODULE SIZES The first section of this appendix deals with the RT-11/RSTS/E modules. The second section deals with the RSX-11 modules. A.1 RT-11/RSTS/E MODULE SIZES Tables A-1, A-2 and A-3 list the RT-11/RSTS/E modules, followed by the PSECT(s) that contain the module, and the size of the module. In Tables A-1 and A-2 the module sizes are divided into the contributions to each PSECT. In these tables the total module size is obtained by adding the mo- dule's contributions to each PSECT. The sizes are in decimal words. Table A-1 OTSCOM (Hardware Independent Modules) Mod Psect Size Mod Psect Size Mod Psect Size $ABS OTS$I 7 $AIF OTS$I 6 $AIMAG OTS$I 6 $AMAX1 OTS$I 60 $AMIN0 OTS$I 24 $AMOD OTS$I 23 $ASFRE OTS$I 8 $ASSIG OTS$I 138 $AOTS OTS$S 1 $BACKS OTS$I 100 $BITDI OTS$I 12 $BRAS OTS$I 22 $CABS OTS$I 74 $CALL OTS$I 15 $CEXIT OTS$I 2 $CEXP OTS$I 36 $CLOG OTS$I 34 $CLOSE OTS$I 178 OTS$P 20 CLOSTM OTS$I 39 $CLS OTS$I 10 $CMPD OTS$I 88 OTS$D 4 $CMPF OTS$I 67 $CMPLX OTS$I 9 $CNEG OTS$I 16 $CONJG OTS$I 10 $CONV5 OTS$I 18 $CONV6 OTS$I 31 $CONVI OTS$I 131 $CONVL OTS$I 35 OTS$P 20 OTS$P 20 $COPY OTS$I 14 $CSIN OTS$I 120 $CSQRT OTS$I 69 $DABS OTS$I 9 $DATE OTS$I 65 $DBLE OTS$I 7 $DIM OTS$I 20 $DMIN1 OTS$I 46 $DMOD OTS$I 31 $DMOV1 OTS$I 5 $DMOV2 OTS$I 5 $DMOV3 OTS$I 19 $DMOV4 OTS$I 8 $DMOV5 OTS$I 12 $DMOV6 OTS$I 19 $DMOV7 OTS$I 8 $DMOVR OTS$I 16 $DSIGN OTS$I 14 $DUMPL OTS$I 43 $ENCOD OTS$I 65 $ENDER OTS$I 26 EOF OTS$I 56 $EOL OTS$I 83 ERRS OTS$I 960 OTS$P 19 $ERRSN OTS$I 16 ERRSS OTS$I 139 $ERRTS OTS$I 35 EXTEND OTS$P 21 $FCALL OTS$I 7 OTS$I 40 $FCHNL OTS$I 33 $FIND OTS$I 69 $FIO OTS$I 484 $FLOAT OTS$I 8 OTS$P 20 $FMOV1 OTS$I 5 OTS MODULE SIZES PAGE A-2 Mod Psect Size Mod Psect Size Mod Psect Size $FMOV2 OTS$I 6 $FMOV3 OTS$I 7 $FMOV4 OTS$I 6 $FMOV5 OTS$I 4 $FMOV6 OTS$I 6 $FMOV7 OTS$I 8 $FMOV8 OTS$I 8 $FMOV9 OTS$I 17 $FMOVR OTS$I 11 $FNEG OTS$I 15 $FUD OTS$I 5 $GETFI OTS$I 15 $GETRE OTS$I 68 $GOTO OTS$I 16 $IABS OTS$I 8 $IADDS OTS$I 18 $IBR OTS$I 25 $IBW OTS$I 27 $ICMPS OTS$I 18 $IDATE OTS$I 37 $IDIM OTS$I 10 $IFIX OTS$I 11 $IFR OTS$I 26 $IFW OTS$I 39 $LISTI OTS$I 361 $LISTO OTS$I 240 $IMOVR OTS$I 7 OTS$P 20 OTS$P 20 $IMOVR OTS$I 7 $IMOVS OTS$I 33 $INCR OTS$I 14 $INEG OTS$I 7 $INITI OTS$I 37 $INT OTS$I 11 $IPADD OTS$I 19 $IPCMP OTS$I 19 $IPMOV OTS$I 26 $IPSUB OTS$I 19 $ISIGN OTS$I 12 $ISNLS OTS$I 56 $ISUBS OTS$I 18 $LCMPS OTS$I 13 $LCMPI OTS$I 4 $LCMPP OTS$I 9 $LMOVR OTS$I 5 $LMOVS OTS$I 39 $LNOTS OTS$I 16 $LOADS OTS$I 12 $LPCMP OTS$I 10 $LTEST OTS$I 10 $MAX0 OTS$I 10 $MIN0 OTS$I 10 $MOD OTS$I 15 $NOVIR OTS$I 1 $NXT1 OTS$I 28 $NXT2 OTS$I 28 $NXT3 OTS$I 30 $NXT4 OTS$I 24 $OBJEN OTS$I 31 $OBJFM OTS$I 339 $OPEN OTS$O 271 OPNCLO OTS$I 77 OPNSTM OTS$I 299 $PAUSE OTS$I 50 $POPR OTS$I 8 OTS$D 18 $PSHD1 OTS$I 28 $PSHD2 OTS$I 18 $PSHD3 OTS$I 20 $PSHF1 OTS$I 20 $PSHF2 OTS$I 12 $PSHF3 OTS$I 14 $PUTRE OTS$I 97 $QPVEC OTS$I 14 OTS$P 20 $QVEC OTS$I 8 $QVECP OTS$I 8 $RAN OTS$I 42 $RANDU OTS$I 45 $REAL OTS$I 5 $RETD OTS$I 19 $RETDS OTS$I 13 $RETS OTS$I 20 $REWIN OTS$I 37 $RIO OTS$I 210 $RWBLK OTS$I 140 $SAVRE OTS$I 56 $SAV4R OTS$I 26 $SETER OTS$I 21 $SIGN OTS$I 12 SIMRT OTS$P 20 $SNGL OTS$I 14 $STOP OTS$I 55 $STACK 64 OTS$P 20 $STKST 0 OTS$S 97 $SUBR OTS$I 41 $TANH OTS$I 121 OTS$I 553 $TCMPL OTS$I 45 $TESTC OTS$I 14 $TESTS OTS$I 13 $TRARY OTS$I 88 $TVIRD OTS$I 86 $TVIRF OTS$I 85 $TVIRI OTS$I 78 $TVIRL OTS$I 78 $TVIRQ OTS$I 92 $TVIRC OTS$I 111 $UIO OTS$I 252 OTS$P 20 $UIO OTS$I 252 $USERE OTS$I 10 $VCTRA OTS$I 40 OTS$P 20 $VINTX OTS$I 1 $VINTN OTS$I 91 $VIRDN OTS$I 103 $VIRFN OTS$I 88 OTS$D 1 $VIRIN OTS$I 79 $VIRLN OTS$I 88 OTS$P 21 $VIRQN OTS$I 79 $VINTP OTS$I 65 $VIRDP OTS$I 116 $VIRFP OTS$I 100 OTS$D 1 $VIRIP OTS$I 88 $VIRLP OTS$I 87 $VIRQP OTS$I 90 $VTRAN OTS$I 61 WAIT OTS$I 17 $XCI OTS$I 138 $XDD OTS$I 95 $XFF OTS$I 54 Table A-2 list the hardware dependent modules. When you are determining the size of OTS modules for NHD/EAE/EIS hardware, it is usually necessary to include the modules which contain the emulation code for the arithmetic operations you are using. These modules, and the operations they are need- ed for, are listed below: OTS MODULE SIZES PAGE A-3 $DADD (REAL*8 additon/subtraction) $DDIV (REAL*8 division) $DMUL (REAL*8 multiplication) $FADD (REAL*4 addition/subtraction) $FDIV (REAL*4 divsion) $FMULS (REAL*4 multiplication) Table A-2 Hardware Dependent Modules Mod Psect Size for each hardware NHD EAE EIS FIS FPU $ADDA OTS$I 27 27 27 54 46 $ADDM OTS$I 28 28 28 46 46 $ADDP OTS$I 28 28 28 45 54 $AINT OTS$I 39 41 33 33 15 $ALOG OTS$I 120 120 120 120 59 $ATAN OTS$I 215 215 215 215 115 $CADD OTS$I 83 83 83 83 53 $CDIV OTS$I 129 129 129 129 46 $CMUL OTS$I 82 82 82 82 35 $CONV1 OTS$I 12 12 12 12 10 $CONV2 OTS$I 55 59 53 53 30 $CONV3 OTS$I 43 43 43 43 17 $CONV4 OTS$I 18 18 18 18 12 $CONVF OTS$I 485 485 503 503 503 OTS$P 20 20 20 20 20 $DADD OTS$I 326 371 323 323 49 $DATAN OTS$I 361 361 361 361 154 $DDIV OTS$I 247 247 247 247 24 $DEXP OTS$I 226 226 226 226 114 $DINT OTS$I 53 55 41 41 11 $DLOG OTS$I 194 194 194 194 92 $DMUL OTS$I 222 296 289 289 23 $DSIN OTS$I 184 184 184 184 97 $DSQRT OTS$I 66 66 66 66 41 $EXP OTS$I 112 112 112 112 74 $FADD OTS$I 176 176 176 36 49 $FDIV OTS$I 105 145 138 17 18 $FMULS OTS$I 114 142 127 17 17 $IDIVS OTS$I 42 19 15 15 15 $IMUL OTS$I 30 19 14 14 14 OTINIT . ABS. 16 16 16 16 16 OTS$I 582 591 582 614 633 OTS$D 3 3 3 3 3 OTS$P 21 21 21 21 21 $SIN OTS$I 125 125 125 125 66 $SQRT OTS$I 62 62 62 44 30 $XDI OTS$I 132 132 132 132 40 $XFI OTS$I 92 92 92 92 38 $XII OTS$I 67 67 49 49 49 OTS MODULE SIZES PAGE A-4 Table A-3 lists the modules used in subscript operations. The column la- beled "Bounds" is the module size if you are using bounds checking; that is, if the subscript is being checked to see if it is in the array. Table A-3 Subscript Calculations Mod Psect Size Mod Psect Size Bounds No Bounds Bounds No Bounds $DPVEC OTS$I 32 30 $DVEC OTS$I 19 18 $DVECP OTS$I 19 18 $FPVEC OTS$I 29 27 $FVEC OTS$I 19 18 $FVECP OTS$I 19 18 $IPVEC OTS$I 24 22 $IVEC OTS$I 22 13 $IVECP OTS$I 14 13 $LPVEC OTS$I 20 18 $LVEC OTS$I 12 11 $LVECP OTS$I 12 11 A.2 RSX-11 MODULE SIZES Table A-4 lists the RSX-11 modules, followed by the PSECT that contains the module, and the size of the module. The RSX-11 PSECTs are different than the RT-11/RSTS/E PSECTs. Mod PSECT Size Mod PSECT Size Mod PSECT Size $ABS OTS$I 61 $DEXP OTS$I 442 $FMOV8 OTS$I 70 $ADDA OTS$I 123 $DIM OTS$I 88 $FMOV9 OTS$I 93 $ADDM OTS$I 124 $DINT OTS$I 101 $FMULS OTS$I 230 $ADDP OTS$I 124 $DLOG OTS$I 415 $FNBST OTS$I 184 $AIF OTS$I $DMIN1 OTS$I 121 $FNEG OTS$I 99 $AIMAG OTS$I 60 $DMOD OTS$I 129 $FPVEC OTS$I 96 $AINT OTS$I 94 $DMOVR OTS$I 82 $FUD OTS$I 62 $ALOG OTS$I 306 $DMOV1 OTS$I 59 $FVEC OTS$I 94 $AMAX1 OTS$I 159 $DMOV2 OTS$I 59 $FVECP OTS$I 94 $AMIN0 OTS$I 105 $DMOV3 OTS$I 95 $GETFI OTS$I 82 $ASFRE OTS$I 79 $DMOV4 OTS$I 62 $GETRE OTS$I 109 $ASSIG OTS$I 137 $DMOV5 OTS$I 78 $GOTO OTS$I 78 $ATAN OTS$I 419 $DMOV6 OTS$I 95 $IABS OTS$I 62 $BACKS OTS$I 191 $DMOV7 OTS$I 66 $IADDS OTS$I 106 $BITDI OTS$I 78 $DMUL OTS$I 419 $IBR OTS$I 185 $BRAS OTS$I 113 $DPVEC OTS$I 115 $IBW OTS$I 149 $CABS OTS$I 191 $DSIGN OTS$I 68 $ICMPS OTS$I 106 $CADD OTS$I 227 $DSIN OTS$I 430 $IDATE OTS$I 95 $CALL OTS$I 73 $DSQRT OTS$I 147 $IDIM OTS$I 64 $CDIV OTS$I 308 $DVEC OTS$I 103 $IDIVS OTS$I 87 $CEXP OTS$I 166 $DVECP OTS$I 103 $IFIX OTS$I 76 $CLOG OTS$I 128 $ENCOD OTS$I 203 $IFR OTS$I 173 $CLOSE OTS$I 143 $ENDER OTS$I 117 $IFW OTS$I 190 CLOSTM OTS$I 160 $EOF OTS$I 140 $IMOVR OTS$I 79 $CLS OTS$I 79 $EOL OTS$I 149 $IMOVS OTS$I 164 $CMPD OTS$I 237 $ERMOP OTS$I 226 $IMUL OTS$I 86 $CMPF OTS$I 213 $ERQIO OTS$I 177 $INCR OTS$I 98 $CMPLX OTS$I 63 $ERRPT OTS$I 896 $INEG OTS$I 73 $CMUL OTS$I 225 $ERRSE OTS$I 148 $INITI OTS$I 109 $CNEG OTS$I 82 $ERRSN OTS$I 98 $INT OTS$I 80 OTS MODULE SIZES PAGE A-5 $CONJG OTS$I 64 $ERRTS OTS$I 88 $IPADD OTS$I 99 $CONVF CV$$F 728 $ERTXT OTS$I 1018 $IPCMP OTS$I 99 $CONVI CV$$I $EXIT OTS$I 65 $IPMOV OTS$I 117 $CONVL CV$$L 128 $EXP OTS$I 269 $IPSUB OTS$I 99 $CONV1 OTS$I 97 $FADD OTS$I 321 $IPVEC OTS$I 91 $CONV2 OTS$I 191 $FCALL OTS$I 61 $IRAD5 OTS$I 78 $CONV3 OTS$I 151 $FCHNL OTS$I 69 $IRR OTS$I 191 $CONV4 OTS$I 89 $FDBSE OTS$I 155 $IRW OTS$I 222 $CONV5 OTS$I 120 $FDIV OTS$I 244 $ISIGN OTS$I 66 $CONV6 OTS$I 125 $FIND OTS$I 113 $ISNLS OTS$I 76 $COPY OTS$I 80 $FIO OTS$F 797 $ISUBS OTS$I 106 $CSIN OTS$I 297 $FLOAT OTS$I 80 $IUR OTS$I 217 $CSQRT OTS$I 182 $FMOVR OTS$I 77 $IUW OTS$I 230 $DABS OTS$I 63 $FMOV1 OTS$I 59 $IVEC OTS$I 89 $DADD OTS$I 485 $FMOV2 OTS$I 64 $IVECP OTS$I 89 $DATAN OTS$I 627 $FMOV3 OTS$I 65 $LCMPI OTS$I 62 $DATIM OTS$I 173 $FMOV4 OTS$I 60 $LCMPP OTS$I 75 $DBLE OTS$I 61 $FMOV5 OTS$I 58 $LCMPS OTS$I 89 $DDIV OTS$I 368 $FMOV6 OTS$I 64 $LISTI OTS$F 699 $DEFIN OTS$I 132 $FMOV7 OTS$I 66 $LISTO OTS$F 501 OTS MODULE SIZES PAGE A-6 Mod PSECT Size Mod PSECT Size Mod PSECT Size $LMOVR OTS$I 67 $R50WD OTS$I 108 $LMOVS OTS$I 155 $SAVRE OTS$I 133 $LOADS OTS$I 88 $SAVRG OTS$I 140 $LPCMP OTS$I 725 $SAV4R OTS$I 87 $LPVEC OTS$I 84 $SECND OTS$I 263 $LTEST OTS$I 76 $SHORT OTS$I 135 $LVEC OTS$I 87 $SIGN OTS$I 66 $LVECP OTS$I 87 $SIN OTS$I 315 $MAX0 OTS$I 64 $SNGL OTS$I $MIN0 OTS$I 64 $SQRT OTS$I 125 $MOD OTS$I 87 $STPPA OTS$I 281 $NXT1 OTS$I 123 $SUBR OTS$I 119 $NXT2 OTS$I 123 $TANH OTS$I 301 $LNOTS OTS$I 100 $NXT3 OTS$I 12 $TESTC OTS$I 80 $NXT4 OTS$I 11 $TESTS OTS$I 112 $OBJEN OTS$I 15 $TRARY OTS$I 2201 $OBJFM OTS$I 57 $TVIRC OTS$I 2290 $OPEN OTS$I 30 $TVIRD OTS$I 1966 OPNCLO OTS$I 17 $TVIRF OTS$I 1955 OPNSTM OTS$I 71 $TVIRI OTS$I 1881 $OTI OTS$I 22 $TVIRL OTS$I 1889 $OTV OTS$I 36 $TVIRQ OTS$I 2170 $POPR OTS$I 70 $USERE OTS$I 73 $PUTRE OTS$I 80 $VCTRA OTS$I 12 $QPVEC OTS$I 72 $VINIT OTS$I 122 $QVEC OTS$I 70 $VIRDP OTS$I 298 $QVECP OTS$I 70 $VIRFP OTS$I 260 $RAD50 OTS$I 77 $VIRIP OTS$I 253 $RAN OTS$I 70 $VIRLP OTS$I 253 $RANDO OTS$I 95 $VIRQP OTS$I 253 $RANDU OTS$I 74 $VTRAN OTS$I 181 $REAL OTS$I 59 $XCI OTS$I 257 $RETD OTS$I 89 $XDD OTS$I 237 $RETDS OTS$I 76 $XDI OTS$I 252 $RETS OTS$I 109 $XFF OTS$I 166 $REWIN OTS$I 133 $XFI OTS$I 204 $R50 OTS$I 99 $XII OTS$I 126 $R50AS OTS$I 69 APPENDIX B CROSS-REFERENCE LISTING OF ENTRY POINTS AND MODULES In the following table, the entry points of the FORTRAN IV OTS are listed al- phabetically. Following each entry point is the name of the module in which it is defined. ENTRY MODULE ENTRY MODULE ENTRY MODULE $$$DIS OPNCLO $DEO $OBJEN $IRR $RIO $$$ERR OPNCLO $DI $CONV2 $IRW $RIO $$FIO $FIO $DINT $DINT $ISNTR $ISNLS $$IFR $IFR $DIVC $CDIV $IUR $UIO $$IFW $IFW $DIVD $DDIV $IUW $UIO $$OPCL OPNCLO $DIVF $FDIV $LSNTR $ISNLS $$OTI OTINIT $DR $CONV4 $MLC $CMUL $$OTIS $SUBR $DUMPL $DUMPL $MLD $DMUL $$SET OTINIT $DVC $CDIV $MLI $IMUL $ADC $CADD $DVD $DDIV $MLR $FMULS $ADD $DADD $DVI $IDIVS $MULC $CMUL $ADDC $CADD $DVR $FDIV $MULD $DMUL $ADDD $DADD $ECI $CONVI $MULF $FMULS $ADDF $FADD $ENC $ENCOD $OBJFM $OBJFM $ADR $FADD $END $ENDER $ODF1 OHANDL $AOTS $AOTS $ENO $OBJEN $ODF2 OHANDL $BKS $BACKS $EOF EOF $OPEN $OPEN $OPNER $OPEN $CHKER $EOL $EOF2 $RWBLK $OSTM OPNSTM $CLOSE $CLOSE $EOFIL $RWBLK $OSTMI OPNSTM $CMD $CMPD $EOL $EOL $OTI OTINIT $CMPD $CMPD $ERR $ENDER $OTIS $SUBR $CMPF $CMPF $ERROR $FUD $OVRH OHANDL $CMR $CMPF $ERRS ERRSS $OVTAB OHANDL $CSTM CLOSTM $ERRTB ERRSS $CSTMI CLOSTM $EXIT $STOP $CVTBC $CONV5 $FCALL $FCALL $CVTBD $CONV5 $FCHNL $FCHNL $CVTBF $CONV5 $FIO $FIO $POPR3 $POPR $CVTCB $CONV2 $FND $FIND $POPR4 $POPR $CVTCD $CONV6 $GETBL $RWBLK $POPR5 $POPR $CVTCF $CONV6 $GETFI $GETFI $PSE $PAUSE $CVTCI $CONV2 $GETIN $RIO $PSES $PAUSE $CVTDB $CONV2 $GETRE $GETRE $CVTDC $CONV6 $IBR $IBR CROSS-REFERENCE LISTING OF ENTRY POINTS AND MODULES PAGE B-2 $CVTDF $CONV4 $IBW $IBW $CVTDI $CONV2 $IC $CONV3 $CVTFB $CONV2 $ID $CONV3 $CVTFC $CONV1 $IFR $IFR $CVTFD $CONV1 $IFW $IFW $CVTFI $CONV2 $ILR $LISTI $CVTIC $CONV3 $ILW $LISTO $CVTID $CONV3 $INITI $INITI $CVTIF $CONV3 $INTR $AINT $DEC $ENCOD $IOEXI $EOL $DEF $RIO $IR $CONV3 CROSS-REFERENCE LISTING OF ENTRY POINTS AND MODULES PAGE B-3 ENTRY MODULE ENTRY MODULE ENTRY MODULE ADC$PS $CADD ATAN $ATAN $PUTBL $RWBLK ADC$SS $CADD ATAN2 $ATAN $PUTRE $PUTRE ADD$IS $DADD BAH$ $PAUSE ADD$MS $DADD BEQ$ $BRAS ADD$PS $DADD BGE$ $BRAS ADD$SS $DADD BGT$ $BRAS $RC $CONV1 ADF$IA $ADDA BKS$ $BACKS $RD $CONV1 ADF$IM $ADDM BLE$ $BRAS $RI $CONV2 ADF$IP $ADDP BLT$ $BRAS $RWD $REWIN ADF$IS $FADD BNE$ $BRAS $SBC $CADD ADF$MA $ADDA BRA$ $BRAS $SBD $DADD ADF$MM $ADDM CABS $CABS $SBR $FADD ADF$MP $ADDP CAI$ $CALL $SETIN $RIO ADF$MS $FADD CAL$ $CALL $SHORT ERRSS ADF$PA $ADDA CCD$ $CONV6 $STP $STOP ADF$PM $ADDM CCF$ $CONV1 $STPS $STOP ADF$PP $ADDP CCI$ $CONV3 $SUBC $CADD ADF$PS $FADD CCL$ $CONV5 $SUBD $DADD ADF$SA $ADDA CCOS $CSIN $SUBF $FADD ADF$SM $ADDM CDC$ $CONV6 $TAC $TCMPL ADF$SP $ADDP CDF$ $CONV1 $TAD $TRARY ADF$SS $FADD CDI$ $CONV3 $TAF $TRARY ADI$IA $IADDS CDL$ $CONV5 $TAI $TRARY ADI$IM $IADDS CEXP $CEXP $TAL $TRARY ADI$IP $IPADD CFC$ $CONV6 $TAP $TRARY ADI$IS $IADDS CFD$ $CONV4 $TAQ $TRARY ADI$MA $IADDS CFI$ $CONV3 $TTYIN $GETRE ADI$MM $IADDS CFL$ $CONV5 $TVC $VCTRA ADI$MP $IPADD CIC$ $CONV2 $TVD $VTRAN ADI$MS $IADDS CID$ $CONV2 $TVF $VTRAN ADI$PA $IPADD CIF$ $CONV2 $TVI $VTRAN ADI$PM $IPADD CIL$ $CONV2 $TVL $VTRAN ADI$PP $IPADD CLC$ $CONV2 $TVP $VTRAN ADI$PS $IPADD CLD$ $CONV2 $TVQ $VTRAN ADI$SA $IADDS CLF$ $CONV2 $TVS $LISTO ADI$SM $IADDS CLI$ $CONV2 ?? $VINTX ADI$SP $IPADD CLOG $CLOG $VRINT $NOVIR ADI$SS $IADDS CLOSE $CLS $WAIT WAIT AIF$ $AIF CMD$II $CMPD $XCI $XCI AIMAG $AIMAG CMD$IM $CMPD $XDD $XDD AINT $AINT CMD$IP $CMPD $XDF $XDD ALOG $ALOG CMD$IS $CMPD $XDI $XDI ALOG10 $ALOG CMD$MI $CMPD $XFD $XDD AMAX0 $AMIN0 CMD$MM $CMPD $XFF $XFF AMAX1 $AMAX1 CMD$MP $CMPD $XFI $XFI AMIN0 $AMIN0 CMD$MS $CMPD $XII $XII AMIN1 $AMAX1 CMD$PI $CMPD ABS $ABS AMOD $AMOD CMD$PM $CMPD ADC$IS $CADD AND$ $BITDI CMD$PP $CMPD ADC$MS $CADD ASSIGN $ASSIG CMD$PS $CMPD CROSS-REFERENCE LISTING OF ENTRY POINTS AND MODULES PAGE B-4 ENTRY MODULE ENTRY MODULE ENTRY MODULE CMD$SI $CMPD CML$SS $LCMPS DLOG $DLOG CMD$SM $CMPD CMPLX $CMPLX DLOG10 $DLOG CMD$SP $CMPD COI$A $LNOTS DMAX1 $DMIN1 CMD$SS $CMPD COI$M $LNOTS DMIN1 $DMIN1 CMF$II $CMPF COI$P $LNOTS DMOD $DMOD CMF$IM $CMPF COI$S $LNOTS DSIGN $DSIGN CMF$IP $CMPF COL$A $LNOTS DSIN $DSIN CMF$IS $CMPF COL$M $LNOTS DSQRT $DSQRT CMF$MI $CMPF COL$P $LNOTS ECO$ $CONVF CMF$MM $CMPF COL$S $LNOTS ENC$ $ENCOD CMF$MP $CMPF CONJG $CONJG END$ $ENDER CMF$MS $CMPF COS $SIN ENO$ $OBJEN CMF$PI $CMPF CPD$SM $COPY EOF$ EOF CMF$PM $CMPF CPF$SM $COPY EOL$ $EOL CMF$PP $CMPF CPI$SM $COPY EQV$ $BITDI CMF$PS $CMPF CPL$SM $COPY ERR$ $ENDER CMF$SI $CMPF CSIN $CSIN ?? ERRS CMF$SM $CMPF CSQRT $CSQRT ERRSNS $ERRSN CMF$SP $CMPF DABS $DABS ERRTST $ERRTS CMF$SS $CMPF DATAN $DATAN EXIT $CEXIT CMI$II $ICMPS DATAN2 $DATAN EXP $EXP CMI$IM $ICMPS DATE $DATE FCO$ $CONVF CMI$IP $IPCMP DBLE $DBLE FLOAT $FLOAT CMI$IS $ICMPS DCI$A $INCR FND$ $FIND CMI$MI $ICMPS DCI$M $INCR FOO$ $STOP CMI$MM $ICMPS DCI$P $INCR FUD$ $FUD CMI$MP $IPCMP DCI$S $INCR GCO$ $CONVF CMI$MS $ICMPS DCO$ $CONVF IABS $IABS CMI$PI $IPCMP DCOS $DSIN IBR$ $IBR CMI$PM $IPCMP DEC$ $ENCOD IBW$ $IBW CMI$PP $IPCMP DEF$ $RIO ICI$ $CONVI CMI$PS $IPCMP DEO$ $OBJEN ICI$A $INCR CMI$SI $ICMPS DEXP $DEXP ICI$M $INCR CMI$SM $ICMPS DIC$IS $CDIV ICI$P $INCR CMI$SP $IPCMP DIC$MS $CDIV ICI$S $INCR CMI$SS $ICMPS DIC$PS $CDIV ICO$ $CONVI CML$IM $LCMPS DIC$SS $CDIV IDATE $IDATE CML$IP $LCMPP DID$IS $DDIV IDIM $IDIM CML$IS $LCMPS DID$MS $DDIV IDINT $INT CML$MI $LCMPI DID$PS $DDIV IFIX $IFIX CML$MM $LCMPS DID$SS $DDIV IFR$ $IFR CML$MP $LCMPP DIF$IS $FDIV IFR$$ $IFR CML$MS $LCMPS DIF$MS $FDIV IFW$ $IFW CML$PI $LPCMP DIF$PS $FDIV IFW$$ $IFW CML$PM $LPCMP DIF$SS $FDIV ILR$ $LISTI CML$PP $LCMPP DII$IS $IDIVS ILW$ $LISTO CML$PS $LPCMP DII$MS $IDIVS INT $INT CML$SI $LCMPI DII$PS $IDIVS IOR$ $BITDI CML$SM $LCMPS DII$SS $IDIVS IRR$ $RIO CML$SP $LCMPP DIM $DIM IRW$ $RIO CROSS-REFERENCE LISTING OF ENTRY POINTS AND MODULES PAGE B-5 ENTRY MODULE ENTRY MODULE ENTRY MODULE ISIGN $ISIGN MOF$IA $FMOV5 MOL$IP $LMOVS ISN$ $ISNLS MOF$IM $FMOV7 MOL$IS $IMOVS IUR$ $UIO MOF$IP $FMOV7 MOL$MA $LMOVS IUW$ $UIO MOF$IS $FMOV2 MOL$MM $LMOVS JMC$ $GOTO MOF$MA $FMOV9 MOL$MP $LMOVS JMI$M $GOTO MOF$MM $FMOV9 MOL$MS $LMOVS JMI$P $GOTO MOF$MP $FMOV9 MOL$PA $LMOVS LCI$ $CONVL MOF$MS $FMOV3 MOL$PM $LMOVS LCO$ $CONVL MOF$PA $FMOV9 MOL$PP $LMOVS LEQ$ $LOADS MOF$PM $FMOV9 MOL$PS $LMOVS LGE$ $LOADS MOF$PP $FMOV9 MOL$RA $LMOVR LGT$ $LOADS MOF$PS $FMOV3 MOL$RM $LMOVR LLE$ $LOADS MOF$RA $FMOVR MOL$RP $LMOVR LLT$ $LOADS MOF$RM $FMOVR MOL$RS $IMOVR LNE$ $LOADS MOF$RP $FMOVR MOL$SA $LMOVS LSN$ $ISNLS MOF$RS $FMOVR MOL$SM $LMOVS MAX0 $MAX0 MOF$SA $FMOV4 MOL$SP $LMOVS MAX1 $AMAX1 MOF$SM $FMOV6 MOL$SS $IMOVS MIN0 $MIN0 MOF$SP $FMOV6 MUC$IS $CMUL MIN1 $AMAX1 MOF$SS $FMOV1 MUC$MS $CMUL MOD $MOD MOI$0A $IMOVS MUC$PS $CMUL MOD$0A $DMOV3 MOI$0M $IMOVS MUC$SS $CMUL MOD$0M $DMOV3 MOI$0P $IPMOV MUD$IS $DMUL MOD$0P $DMOV3 MOI$0S $IMOVS MUD$MS $DMUL MOD$0S $DMOV2 MOI$1A $IMOVS MUD$PS $DMUL MOD$IA $DMOV3 MOI$1M $IMOVS MUD$SS $DMUL MOD$IM $DMOV3 MOI$1P $IPMOV MUF$IS $FMULS MOD$IP $DMOV3 MOI$1S $IMOVS MUF$MS $FMULS MOD$IS $DMOV1 MOI$IA $IMOVS MUF$PS $FMULS MOD$MA $DMOV6 MOI$IM $IMOVS MUF$SS $FMULS MOD$MM $DMOV6 MOI$IP $IPMOV MUI$IS $IMUL MOD$MP $DMOV6 MOI$IS $IMOVS MUI$MS $IMUL MOD$MS $DMOV5 MOI$MA $IMOVS MUI$PS $IMUL MOD$PA $DMOV6 MOI$MM $IMOVS MUI$SS $IMUL MOD$PM $DMOV6 MOI$MP $IPMOV NGC$A $CNEG MOD$PP $DMOV6 MOI$MS $IMOVS NGC$M $CNEG MOD$PS $DMOV5 MOI$PA $IPMOV NGC$P $CNEG MOD$RA $DMOVR MOI$PM $IPMOV NGC$S $CNEG MOD$RM $DMOVR MOI$PP $IPMOV NGD$A $FNEG MOD$RP $DMOVR MOI$PS $IPMOV NGD$M $FNEG MOD$RS $DMOVR MOI$RA $IMOVR NGD$P $FNEG MOD$SA $DMOV4 MOI$RM $IMOVR NGD$S $FNEG MOD$SM $DMOV7 MOI$RP $IMOVR NGF$A $FNEG MOD$SP $DMOV7 MOI$RS $IMOVR NGF$M $FNEG MOD$SS $DMOV5 MOI$SA $IMOVS NGF$P $FNEG MOD$VS $DMOV5 MOI$SM $IMOVS NGF$S $FNEG MOF$0A $FMOV8 MOI$SP $IPMOV NGI$A $INEG MOF$0M $FMOV8 MOI$SS $IMOVS NGI$M $INEG MOF$0P $FMOV8 MOL$IA $LMOVS NGI$P $INEG MOF$0S $FMOV2 MOL$IM $LMOVS NGI$S $INEG CROSS-REFERENCE LISTING OF ENTRY POINTS AND MODULES PAGE B-6 ENTRY MODULE ENTRY MODULE ENTRY MODULE NMI$1I $BRAS SAF$IP $FVECP SUF$MS $FADD NMI$1M $BRAS SAF$MM $FVEC SUF$PA $ADDA NMI$1P $NXT4 SAF$MP $FVECP SUF$PM $ADDM NMI$II $NXT1 SAF$PM $FPVEC SUF$PP $ADDP NMI$IM $NXT2 SAF$PP $FPVEC SUF$PS $FADD NMI$IP $NXT3 SAF$SM $FVEC SUF$SA $ADDA NMI$MI $NXT1 SAF$SP $FVECP SUF$SM $ADDM NMI$MM $NXT2 SAI$IM $IVEC SUF$SP $ADDP NMI$MP $NXT3 SAI$IP $IVECP SUF$SS $FADD NMI$PI $NXT1 SAI$MM $IVEC SUI$IA $ISUBS NMI$PM $NXT2 SAI$MP $IVECP SUI$IM $ISUBS NMI$PP $NXT3 SAI$PM $IPVEC SUI$IP $IPSUB NPI$1I $NXT4 SAI$PP $IPVEC SUI$IS $ISUBS NPI$1M $NXT4 SAI$SM $IVEC SUI$MA $ISUBS NPI$1P $NXT4 SAI$SP $IVECP SUI$MM $ISUBS NPI$II $NXT1 SAL$IM $LVEC SUI$MP $IPSUB NPI$IM $NXT2 SAL$IP $LVECP SUI$MS $ISUBS NPI$IP $NXT3 SAL$MM $LVEC SUI$PA $IPSUB NPI$MI $NXT1 SAL$MP $LVECP SUI$PM $IPSUB NPI$MM $NXT2 SAL$PM $LPVEC SUI$PP $IPSUB NPI$MP $NXT3 SAL$PP $LPVEC SUI$PS $IP SUB NPI$PI $NXT1 SAL$SM $LVEC SUI$SA $ISUBS NPI$PM $NXT2 SAL$SP $LVECP SUI$SM $ISUBS NPI$PP $NXT3 SAVR4$ $SAV4R SUI$SP $IPSUB O$DONE OHANDL SAVRG$ $SAVRE SUI$SS $ISUBS O$READ OHANDL SETERR $SETER SVD$IM $DVEC OCI$ $CONVI SIGN $SIGN SVD$IP $DVECP OCO$ $CONVI SIN $SIN SVD$MM $DVEC OPEN $ROPEN SNGL $SNGL SVD$MP $DVECP PSE$ $PAUSE SQRT $SQRT SVD$PM $DPVEC RAN $RAN STK$D $RETDS SVD$PP $DPVEC RANDU $RANDU STK$F $ASFRE SVD$SM $DVEC RCI$ $CONVF STK$I $ASFRE SVD$SP $DVECP REAL $REAL STK$L $ASFRE SVF$IM $FVEC REL$ $IMOVS STP$ $STOP SVF$IP $FVECP RET$ $RETS SUC$IS $CADD SVF$MM $FVEC RET$D $RETD SUC$MS $CADD SVF$MP $FVECP RET$F $RETS SUC$PS $CADD SVF$PM $FPVEC RET$I $RETS SUC$SS $CADD SVF$PP $FPVEC RET$L $RETS SUD$IS $DADD SVF$SM $FVEC RWD$ $REWIN SUD$MS $DADD SVF$SP $FVECP SAD$IM $DVEC SUD$PS $DADD SVI$IM $IVEC SAD$IP $DVECP SUD$SS $DADD SVI$IP $IVECP SAD$MM $DVEC SUF$IA $ADDA SVI$MM $IVEC SAD$MP $DVECP SUF$IM $ADDM SVI$MP $IVECP SAD$PM $DPVEC SUF$IP $ADDP SVI$PM $IPVEC SAD$PP $DPVEC SUF$IS $FADD SVI$PP $IPVEC SAD$SM $DVEC SUF$MA $ADDA SVI$SM $IVEC SAD$SP $DVECP SUF$MM $ADDM SVI$SP $IVECP SAF$IM $FVEC SUF$MP $ADDP SVL$IM $LVEC CROSS-REFERENCE LISTING OF ENTRY POINTS AND MODULES PAGE B-7 ENTRY MODULE ENTRY MODULE ENTRY MODULE SVL$IP $LVECP TAP$ $TRARY TSL$P $LTEST SVL$MM $LVEC TAQ$ $TRARY TSL$S $LTEST SVL$MP $LVECP THRD$ $SAVRE TVC$ $VCTRA SVL$PM $LPVEC TSC$I $TESTC TVD$ $VTRAN SVL$PP $LPVEC TSC$M $TESTC TVF$ $VTRAN SVL$SM $LVEC TSC$P $TESTC TVI$ $VTRAN SVL$SP $LVECP TSC$S $TESTC TVL$ $VTRAN SVQ$IM $QVEC TSD$I $TESTS TVP$ $VTRAN SVQ$IP $QVECP TSD$M $TESTS TVQ$ $VTRAN SVQ$MM $QVEC TSD$P $TESTS TVS$ $LISTO SVQ$MP $QVECP TSD$S $TESTS USEREX $USERE SVQ$PM $QPVEC TSF$I $TESTS XCI$ $XCI SVQ$PP $QPVEC TSF$M $TESTS XDD$ $XDD SVQ$SM $QVEC TSF$P $TESTS XDF$ $XDD SVQ$SP $QVECP TSF$S $TESTS XDI$ $XDI TAC$ $TCMPL TSI$I $TESTS XFD$ $XDD TAD$ $TRARY TSI$M $TESTS XFF$ $XFF TAF$ $TRARY TSI$P $TESTS XFI$ $XFI TAI$ $TRARY TSI$S $TESTS XII$ $XII TAL$ $TRARY TSL$I $LTEST XOR$ $BITDI TANH $TANH TSL$M $LTEST APPENDIX C STORAGE AREAS OF THE FORTRAN IV OTS Although RT-11/RSTS and RSX-11 perform in much the same way, their storage areas are very different. In each of the following sections both the RT-11/RSTS areas and the RSX-11 areas are described. C.1 THE PSECTS The names and attributes of the OTS PSECTs are listed in the two tables below. Table C-1 gives the information for RT-11 and RSTS; Table C-2 gives the information for RSX-11. Table C-1 RT-11/RSTS PSECT Attributes PSECT Attributes .ABS. OTS$D RW,D,LCL,REL,CON OTS$I RW,I,LCL,REL,CON OTS$O RW,I,LCL,REL,CON OTS$P RW,D,GBL,REL,OVR OTS$S RW,D,LCL,REL,CON $STACK RW,D,LCL,REL $STKST RW,D,LCL,REL Table C-2 RSX-11 PSECT Attributes PSECT Attributes OTS$P RW, D, GBL, REL, OVR OTS$I RW, I, LCL, REL, CON OTS$D RW, D, LCL, REL, CON STS$S RW, I, LCL, REL, CON OTS$F RW, I, LCL, REL, CON STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-2 C.2 THE OTS WORK AREA The two tables in this section describe the OTS work area. Table C-3 gives the information for RT-11 and RSTS; Table C-4 gives the information for RSX-11. All numbers in the tables are decimal. Table C-3 RT-11/RSTS OTS Work Area Offset Name Description 0 SEQNO Internal statement sequence number. 2 PLNBUF Address of the line buffer. 4 CHNATB Address of the beginning of the channel address table. 6 FILETB Address of the beginning of the file information table. 8 QELEM Flag - indicates that a queue element is avilable. All RT-11 I/O transfers are done through the queue. If a queue element is not available, the program issuing the I/O request can be blocked until an element becomes available. (see .QSET in the RT-11 Advanced Programmer's Guide.) 10 DEVHDR Address of the lowest device handler. 12 FREESP Pointer to free space. 14 ENMLNK Pointer to the last name in the queue (see QELEM, offset 8). 16 RTCNLS Zeroed bits in this word indicate open RT-11 channels. 18 FMTAD Current pointer into the format string. 20 FILPTR Address of the file descriptor block (FDB). 22 RECAD Address of the data in the current record. 24 EOLBUF Address of the end of the data in the line buffer. 26 LNBUF Address of the line buffer; used in module $FIO. 28 BLBUF Current address of the data in the line buffer. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-3 30 PSCALE P scale factor; used for the P format. 32 FSTKP* Pointer to the format pushdown list. 34 FSTK* Format pushdown list, uses 16 words. OPEN also uses this area for scratch FSTK NOARG Number of arguments that the format item expects. FSTK+2 PARLVL Parentheses level. FSTK+4 NUMFLG Flag - Indicates to the format processor that a number is available and whether the number is negative. FSTK+6 DELIM When set to zero DELIM indicates that a delimiter is required. FSTK+8 RETADR FSTK+10 V.VTYP Holds the data type for list input. FSTK+12 V.W1 Holds the data for list input. FSTK+14 V.W2 FSTK+16 V.W3 FSTK+16 V.W4 66 FMTRET Address of the last top level parentheses. 68 VARAD Address of the data item to be transferred. 70 TSPECP Highest pointer into the line buffer. 72 TYPE Flag - Used for A,L,O,I,F,E,G,D conversions. 74 REPCNT Repeat count for A,L,O,I,F,E,G,D conversions. 76 LENGTH Format specification - external field width. 78 D Format specification - number of char- acters to the right of the decimal point. 80 DSTATS Address of the work area used by OPEN (see FSTK, offset 34). 82 ITEMSZ Size of the list variable to be trans- STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-4 ferred. 84 TTYFWF Flag - Indicates that read/write was the last I/O operation to the terminal. 86 DOLFLG Flag - Indicates that the dollar ($) format character was encountered. 88 OBJFRE Address of the free space for run time formatting. 90 COUNT Number of items to transfer for array I/O. 92 RACNT Count of the number of bytes remaining in a random record. RACNT FMTLP Flag - Indicates infinite format loops. This flag can never be used with RACNT. 94 NBLOCK Next random block number. 96 RECIO Address of current I/O routine. 98 DENCWD Used for the fake FDB address in module ENCODE. 100 FMTCLN Contents of SP on entry to read/write routines. 102 INITSP Flag - Indicates a recursive error call. 104 THPTR Initial value of the threaded pointer; used for restarts. 106 SAVTOP Initial upper limit of the program. 108 UERRTB Address of the user error table. 110 EXADDR Address of user EXIT routine. 112 ENDEXA END= transfer address. 114 ERREXA ERR= transfer address. 116 THREAD Indicates threaded or inline code: zero means inline, non-zero means threaded; the low byte refers to I/O, the high byte refers to the main program. 118 HGHLIM High limit of the partition. 120 LOWLIM Low limit of the partition. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-5 122 LONAME Low name of the program. 124 HINAME High name of the program. 126 IORET Return address is stored here while the OTS is in I/O code. 130 WINDOW Used for extended memory; this word tells where the window is (see the RT-11 Advanced Programmer's Guide for a discus- sion of extended memory). 144 WINMAP Address of the parameter block for .MAP requests. 148 MAPADR Pointer to WINMAP .AREA. 150 ERBITS Error test bit table, uses five words. Errors 0-15 are mapped here. 152 Errors 16-31. 154 Errors 32-47. 156 Errors 48-63. 158 Errors 64-79. 160 LASTER Number of the last error. 162 LASTLN Last logical unit number (LUN) associated with an error. 164 V.TYPE Variable type; set by TV?,TX?,TA?. 166 V.TEMP Temporary storage area for TX? variable. This area is four words long. 168 See V.TEMP. 170 See V.TEMP. 172 See V.TEMP. 174 V.ARRY Address of stored array, for TX?. 176 V.IDX Index of stored array, for TX?. 178 O.FLG1 First flagword; for OPEN. 180 O.FLG2 Second flagword; for OPEN. 182 O.UNIT Keyword, UNIT. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-6 184 O.ACCS Keyword, ACCESS. 186 O.ASSO Keyword, ASSOCIATEVARIABLE. 188 O.BLKS Keyword, BLOCKSIZE. 190 O.BUFF Keyword, BUFFERCOUNT. 192 O.CARR Keyword, CARRIAGECONTROL. 194 O.DISP Keyword, DISPOSE. 196 O.ERR Keyword, ERR. 198 O.EXTE Keyword, EXTENDSIZE. 200 O.FORM Keyword, FORM. 202 O.INIT Keyword, INITIALSIZE. 204 O.MAXR Keyword, MAXREC. 206 O.NAME Keyword, NAME. 208 O.RECZ Keyword, RECORDSIZE. 210 O.TYPE Keyword, TYPE. O.TYPE+2 AOTSZ Highest address name. Table C-4 RSX-11 OTS Work Area Offset Name Description 0 W.SEQC Internal statement number. 2 W.NAMC Name chain pointer. 4 W.LUNS Number of logical units. 6 W.MO Last logical unit number (LUN) associated with an error. 8 W.BFAD Address of the I/O buffer. 10 W.BLEN Length of the I/O buffer. 12 W.BEND Address of the first word after the I/O buffer. 14 LNBUF Address of the line buffer. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-7 16 W.IOST Address of QIO status. 18 W.DEV Address of the device table. 20 RECIO Address of the current I/O routine. 22 FMTAD Current pointer into the format string. 24 FILPTR Address of the file descriptor block (FDB). 26 EOLBUF Address of the end of the data in the line buffer. 28 FMTCLN Contents of SP on entry to read/write routines. 30 BLBUF Current address of the data in the line buffer. 32 PSCALE P scale factor; used for the P format. 34 FSTKP Pointer to the format pushdown list. 36 FSTK Format pushdown list; uses 16 words. FSTK NOARG Number of arguments that the last format item expects. FSTK+2 PARLVL Parentheses level. FSTK+4 NUMFLG Flag - indicates to the format processor that a number is available and whether the number is negative. FSTK+6 DELIM When set to zero DELIM indicates that a delimiter is required. FSTK+8 RETADR Temporary address holder used in assembler callable arithmetic routines. FSTK+10 V.VTYP Holds the data type for list input. FSTK+12 V.W1 See V.VTYP, offset FSTK+8. FSTK+14 V.W2 See V.VTYP, offset FSTK+8. FSTK+16 V.W3 See V.VTYP, offset FSTK+8. FSTK+16 V.W4 See V.VTYP, offset FSTK+8. 70 FMTRET Address of the last top level parentheses. 72 VARAD Address of the data item to be transferred. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-8 74 TSPECP Highest pointer into the line buffer. 76 TYPE Flag - Used for A,L,O,I,F,E,G,D conversions. 78 REPCNT Repeat count for A,L,O,I,F,E,G,D conversions. REPCNT UNFLGS Flag - Indicates unformatted I/O. 80 LENGTH Format specification - external field width. 82 D Format specification - number of char- acters to the right of the decimal point. 84 ITEMSZ Size of the list variable to be trans- ferred. 86 DOLFLG Flag - Indicates that the dollar ($) format character was encoutered. 88 COUNT Number of items to transfer for array I/O. 90 RACNT Count of the number of bytes remaining in a random record. RACNT FMTLP Flag - Indicates infinite format loops. RACNT UNCNT Count of the number of bytes in an unformatted read. 92 DENCWD Used for the fake FDB address in module ENCODE. 94 W.PC Saves the PC if a fatal trap occurs. 96 EXADDR Address of user EXIT routine. 98 ENDEXA END= transfer address. 100 ERREXA ERR= transfer address. 102 ENDOTS Address of the END= return for the OTS. 104 W.ECNT Error count. 106 W.ERNM Error number. 108 W.ERFL 110 W.OPFL Flag - Used for the OPEN statement. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-9 112 W.ERLN 114 W.ERLE 116 W.TKNP Address of the task name. 118 W.ERTB Address of the error table. 120 W.FERR 122 W.FER1 124 W.SST Address of the synchronous trap table. 126 W.OBFL Address of the OBJFMT buffer. 128 W.OBFH Address of the first word after the OBJFMT buffer. 130 W.ERUN Error number saved for SNSERR. 132 THREAD Indicates threaded or inline code: zero means inline, non-zero means threaded; the low byte refers to I/O, the high byte refers to the main program. 134 HGHLIM High limit of the partition. 136 LOWLIM Low limit of the partition. 138 LONAME Low name of the program. 140 HINAME High name of the program. 142 IORET Return address is stored here while the OTS is in I/O code. 144 WINDOW Used for extended memory; this word tells where the window is (see the RSX-11 Advanced Programmer's Gude for a discussion of extended memory). 160 WINMAP Address of the parameter block for .MAP requests. 166 MAPADR Pointer to WINMAP .AREA. 168 V.TYPE Variable type; set by TV?, TX?, TA?. 170 V.ARRY Address of stored array, for TX?. 172 V.IDX Index of stored array, for TX?. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-10 174 V.TEMP Temporary storage area for TX? variable. 184 O.FLG1 First flagword. 186 O.FLG2 Second flagword. 188 O.UNIT Keyword, UNIT. 190 O.ACCS Keyword, ACCESS. 192 O.ASSO Keyword, ASSOCIATEVARIABLE. 194 O.BLKS Keyword, BLOCKSIZE. 196 O.BUFF Keyword, BUFFERCOUNT. 198 O.CARR Keyword, CARRIAGECONTROL. 200 O.DISP Keyword, DISPOSE. 202 O.ERR Keyword, ERR. 204 O.EXTE Keyword, EXTENDSIZE. 206 O.FORM Keyword, FORM. 208 O.INIT Keyword, INITIALSIZE. 210 O.MAXR Keyword, MAXREC. 212 O.NAME Keyword, NAME. 214 O.RECZ Keyword, RECORDSIZE. 216 O.TYPE Keyword, TYPE. 218 W.TSKP Pointer to the virtual array size. Expansion area. 260 W.EXST Exit status. 262 W.END End of the OTS work area. C.3 THE FILE DESCRIPTOR BLOCK (FDB) The two tables in this section describe the File Descriptor Block (FDB). Table C-5 gives the information for RT-11 and RSTS; Table C-6 gives the informa- tion for RSX-11. All numbers in the tables are decimal. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-11 Table C-5 RT-11/RSTS File Descriptor Block Offset Name Description 0 STATUS Status word; the bits are described in Table C-7. 2 BUFRAD Address of the beginning of the buffer. 4 BUFRSZ Size of the buffer, in words. 6 DEVNM Device name, in RAD50. 8 FILNM File name, in RAD50; uses two words. 12 EXTEN RAD50 extension. 14 DATAD Address of the data pointer. 16 BUFNO Number of buffers; uses one byte. 17 CHNLNO RT-11 channel number associated with the file. 18 ASSOCV Address of the associated variable. ASSOCV STPWD High limit for data in an unformatted block. STPWD and ASSOCV cannot be used at the same time. 20 RECSZ Record size. RECSZ CPOS Relative pointer in an unformatted block. Points to the last used pointer word at the top of the block. CPOS and RECSZ cannot be used at the same time. 22 BLKNO Block number. 24 FILSZ Number of blocks in the file. FILSZ LASTBLK Block number of the last block written. LASTBLK and FILSZ cannot be used at the same time. 26 HIGHBL Block number of the highest block written. 28 STAT2 Another status word. 30 FILPPN Project-Programmer Number (PPN), for RSTS. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-12 32 RECMAX Number of records in the file. 34 FILESZ Size of the file descriptor block. Table C-6 RSX-11 Logical Unit Control Block (LUB) Offset Name Description 0 D.STAT Status word 1; the bits are described in Table C-8. 2 D.STA2 Status word 2; the bits are described in Table C-9. D.STA2 STAT2 Status word 2 for the OPEN statement. 4 D.RCNM Number of records in the file. D.RCNM D.RCCT Record count; used for BACKSPACE. 6 D.RCN2 Number of records in the file; second word. D.RCN2 D.RCC2 Record count; second word. 8 D.AVAD Address of the associated variable. D.AVAD ASSOCV Address of the associated variable. 10 D.SPAR Spare word. 12 D.FDB Start of the RSX-11 FDB. C.4 STATUS WORD Both RT-11/RSTS and RSX-11 have two status words. For RT-11/RSTS both status words are described in Table C-7. For RSX-11 the first status word is in Table C-8, the second in Table C-9. All numbers in the table are in deci- mal notation. Table C-7 RT-11/RSTS Status Words Bit Name Description 16 WRITE Set if the file has been written to. 15 RA Set if the file is Random Access. 14 KB Set if the file is open to the keyboard. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-13 13 EOF Set when the end of the file is reached. 12 OPNBIT Set when the file is opened. 11 LP Set if the file is open to the line printer. 10 FMTD Set if the file is formatted. 9 OLD Set if the file is opened with LOOKUP. 8 TT Set if the file is open to a terminal. 7 RDO Set if the file is read only. 6 LSTFMT Set if the file is opened for listing format. 5 LISTMD Output listing format; in other words, use an automatic combination. 4 UNLIST Output FORTRAN format; in other words, interpret the first character as a carriage control character. 3 SCR Set if the file is a SCRATCH file. If set the file is deleted after it is closed. 2 MWRB Set if the random block being looked at is modified. 1 BUFBIT Set if double buffering occurs. *4 RDBFWT Set if a read is done to the file before a write. *3 UNKNOW Set if the file is opened with an unknown attribute. *2 APPND Set if the file is opened with ACCESS='APPEND'. *1 SPOOL Set if the file is to be spooled when closed. * These bits are in the second status word, location 28 in the FDB. Table C-8 RSX-11 Status Word 1 Bit Name Description DV.DFD Set if the file is random access. DV.DFD RA Set if the file is random access. Used for the OPEN statement. DV.WRT Set if a write is allowed. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-14 DV.FACC Used for file attributes. If set, means call FDBSET; if not set, use the default. DV.OPN Set if the unit is open. DV.ENCD DV.FMP Set if the file is formatted. DV.FMP FMTD Set if the file is formatted. Used for the OPEN statement. DV.UFP Set if the file is unformatted. DV.ASGN Used for the file specification. If set, call ASSIGN; if not set, use default. DV.CLO Set if the file is being closed. DV.FRE Set if free format is allowed. DV.RW Used to specify the current operation. Table C-9 RSX-11 Status Word 2 Bit Name Description DV.AI4 Used to specify the type of the associated variable. If set, the type is I*4; if not set, the type is I*2. DV.CC Set if explicit carriage control is specified. DV.SPL Set if the file is to be spooled when closed. DV.SPL SPOOL Set if the file is to be spooled when closed. Used for the OPEN statement. DV.DEL Set if the file is to be deleted when closed. DV.RDO Set if the file is read-only. DV.RDO RDO Set if the file is read-only. Used for the OPEN statement. DV.UNK Set if the file is opened with TYPE='UNKNOWN'. STORAGE AREAS OF THE FORTRAN IV OTS PAGE C-15 DV.UNK UNKNOW Set if the file is opened with TYPE='UNKNOWN'. Used for the OPEN statement. DV.OLD Set if the file is opened with TYPE='OLD'. DV.OLD OLD Set if the file is opened with TYPE='OLD'. Used for the OPEN statement. DV.NEW Set if the file is opened with TYPE='NEW'. DV.SCR Set if the file is opened with TYPE='SCRATCH'. DV.SCR SCR Set if the file is opened with TYPE='SCRATCH'. Used for the OPEN statement. DV.APD Set if the file is opened with TYPE='APPEND'. DV.APD APPND Set if the file is opened with TYPE='SCRATCH'. Used for the OPEN statement. DV.SAV Set if the file is opened with TYPE='SAVE'.