Intel fortran-80 manual

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

Ir a la página of

Buen manual de instrucciones

Las leyes obligan al vendedor a entregarle al comprador, junto con el producto, el manual de instrucciones Intel fortran-80. La falta del manual o facilitar información incorrecta al consumidor constituyen una base de reclamación por no estar de acuerdo el producto con el contrato. Según la ley, está permitido adjuntar un manual de otra forma que no sea en papel, lo cual últimamente es bastante común y los fabricantes nos facilitan un manual gráfico, su versión electrónica Intel fortran-80 o vídeos de instrucciones para usuarios. La condición es que tenga una forma legible y entendible.

¿Qué es un manual de instrucciones?

El nombre proviene de la palabra latina “instructio”, es decir, ordenar. Por lo tanto, en un manual Intel fortran-80 se puede encontrar la descripción de las etapas de actuación. El propósito de un manual es enseñar, facilitar el encendido o el uso de un dispositivo o la realización de acciones concretas. Un manual de instrucciones también es una fuente de información acerca de un objeto o un servicio, es una pista.

Desafortunadamente pocos usuarios destinan su tiempo a leer manuales Intel fortran-80, sin embargo, un buen manual nos permite, no solo conocer una cantidad de funcionalidades adicionales del dispositivo comprado, sino también evitar la mayoría de fallos.

Entonces, ¿qué debe contener el manual de instrucciones perfecto?

Sobre todo, un manual de instrucciones Intel fortran-80 debe contener:
- información acerca de las especificaciones técnicas del dispositivo Intel fortran-80
- nombre de fabricante y año de fabricación del dispositivo Intel fortran-80
- condiciones de uso, configuración y mantenimiento del dispositivo Intel fortran-80
- marcas de seguridad y certificados que confirmen su concordancia con determinadas normativas

¿Por qué no leemos los manuales de instrucciones?

Normalmente es por la falta de tiempo y seguridad acerca de las funcionalidades determinadas de los dispositivos comprados. Desafortunadamente la conexión y el encendido de Intel fortran-80 no es suficiente. El manual de instrucciones siempre contiene una serie de indicaciones acerca de determinadas funcionalidades, normas de seguridad, consejos de mantenimiento (incluso qué productos usar), fallos eventuales de Intel fortran-80 y maneras de solucionar los problemas que puedan ocurrir durante su uso. Al final, en un manual se pueden encontrar los detalles de servicio técnico Intel en caso de que las soluciones propuestas no hayan funcionado. Actualmente gozan de éxito manuales de instrucciones en forma de animaciones interesantes o vídeo manuales que llegan al usuario mucho mejor que en forma de un folleto. Este tipo de manual ayuda a que el usuario vea el vídeo entero sin saltarse las especificaciones y las descripciones técnicas complicadas de Intel fortran-80, como se suele hacer teniendo una versión en papel.

¿Por qué vale la pena leer los manuales de instrucciones?

Sobre todo es en ellos donde encontraremos las respuestas acerca de la construcción, las posibilidades del dispositivo Intel fortran-80, el uso de determinados accesorios y una serie de informaciones que permiten aprovechar completamente sus funciones y comodidades.

Tras una compra exitosa de un equipo o un dispositivo, vale la pena dedicar un momento para familiarizarse con cada parte del manual Intel fortran-80. Actualmente se preparan y traducen con dedicación, para que no solo sean comprensibles para los usuarios, sino que también cumplan su función básica de información y ayuda.

Índice de manuales de instrucciones

  • Página 1

    FORTRAN-SO PROGRAMMING MANUAL Manual Order Number: 9800481 A I Copyright © 1978 Intel Corporation Intel Corporation, 3065 Bowers Avenue, Santa Clara, California 95051 . I[...]

  • Página 2

    ii The information in this document is subject to change without notice. Intel Corporation makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Intel Corporation assumes no responsibility for any errors that may appear in this docum[...]

  • Página 3

    PREFACE This manual describes the Intel-developed FORTRAN language (FORTRAN-80) for programming the 8080 and 8085 microcomputers. FORTRAN-80 is based on the ANSI FORTRAN 77 subset. In some instances, it incorporates features from the FORTRAN 77 full language; FORTRAN-80 also has features that exceed both ver- sions of FORTRAN 77. Appendix D lists F[...]

  • Página 4

    [...]

  • Página 5

    PREF'ACE GLOSSARY CHAPTER 1 INTRODUCTION TO FORTRAN 1.1 An Introductory Example ................ , 1-1 1.1.1 Comment Lines .................... 1-1 1.1.2 Type Statement ................... , 1-2 1.1.3 Input Statement ................... , 1-2 1.1.4 Value Assignment .................. 1-2 1.1.5 Output Statements. . . . . . . . . . . . . . . . .[...]

  • Página 6

    6.2 File-Handling Statements. . . . . . . . . . . . . . . .. 6-4 6.2.1 OPEN Statement. . . . . . . . . . . . . . . . . .. 6-4 6.2.2 CLOSE Statement. ............... " 6-8 6.2.3 BACKSPACE Statement. . . . . . . . . . . .. 6-9 6.2.4 REWIND Statement ............... 6-10 6.2.S ENDFILE Statement. . . . . . . . . . . . . .. 6-10 6.3 Data-Transfer 1[...]

  • Página 7

    GLOSSARY Argument(s) - A collection of values and variables on which a computation is per- formed. Functions and subroutines are usually defined with dummy arguments that are replaced with actual values when the functions or subroutines are referenced. Array - An ordered set of data that can be referenced collectively (by array name) or selectively[...]

  • Página 8

    Glossary viii Program Unit - Another name for a main program or a subprogram. Every program unit must be terminated by an END statement. Record - A sequence of values or characters. Statement - A sequence of syntactic items: statement label, keyword, arguments, ex- pressions, etc. A statement has an 'initial' line and up to nine 'con[...]

  • Página 9

    CHAPTER 11 INTRODUCTION TO FORTRAN This chapter opens with a short example intended to give the newcomer to FOR- TRAN a feel for the language. The example is discussed in some d.etail. The chapter also includes a summary of FORTRAN-80 statements and their proper coding se- quence. 1.1 An Introductory Example A FORTRAN program generally performs thr[...]

  • Página 10

    Introduction To FORTRAN 1-2 1.1.2 Type Statement Every variable used in a FORTRAN program has a type - integer, real, logical, character, or Hollerith. The CHARACTER type statement says that the variable PNAME represents character data and may have up to 12 characters. No type statement is needed for the other variables listed (AB, HITS, AVO). The [...]

  • Página 11

    FORTRAN-SO Introduction To FORTRAN Statement 20, the FORMAT statement, indicates the 'PNAME' field will be a string of characters of variable length, as in the FORMAT statement labeled 10. The name will be followed by five blanks (5X) and then the batting average will be printed. The 'A VG' field consists of four floating-point [...]

  • Página 12

    Introduction To FORTRAN 1-4 1.2.3 Order of Statements The following order must be observed in coding FORTRAN statements lines: 1. Comment lines can appear before or between statements. They cannot appear after the END statement. 2. The PROGRAM statement can appear only as the first statement of a main program. FUNCTION, SUBROUTINE, and BLOCK DATA c[...]

  • Página 13

    CHAPTER 2 FORTRAN CONCEPTS The chapter discusses the concepts and terminology used to describe the structure and elements of a FORTRAN program. 2.1 FORTRAN Program Structure 2.1.1 Program U nits and Procedures The scope of many FORTRAN operations is defined to be a program unit. A pro- gram unit is either a main program or a subprogram. A main prog[...]

  • Página 14

    FORTRAN Concepts 2-2 2.1.2 The PROG RAM Statement The PROGRAM statement is used to name a program. This statement is optional, but when present must be the first statement of a main program. It has the format PROGRAM name where 'name' is the symbolic name of the program. Only one PROGRAM statement is allowed per program. The main program [...]

  • Página 15

    FORTRAN-80 FORTRAN Concepts 2.2 FORTRAN Statement Elements A FORTRAN statement can include the following elements: • Statement identifier (keyword), such as PROGRAM or INTEGER • Function identifiers, such as SQRT(A) or FLOA T(I) • Constants, such as 3.142857 or 'STRING' • Variables, such as A or AB • Operators, such as * or .AND[...]

  • Página 16

    :FORTRAN Concepts 2-4 2.2.2 Constants and Variables The value of a constant does not change from one execution of a program to the next. The value of a variable, on the other hand, is subject to change during pro- gram execution or between runnings of the program. For example, in the statement C=A**2+B the '2' is constant, whereas A, B, a[...]

  • Página 17

    FORTRAN-80 FORTRAN Concepts Character data is a string of any characters representable in the processor. The blank character is valid and significant in a character constant. A character constant has the form of a string of characters surrounded by apostrophes. An apostrophe within the string is represented by a double apostrophe. A character const[...]

  • Página 18

    FORTRAN Concepts 2-6 The possibleJorms of aninteger constant are: [s]d" . or [sl#d ... b where: s is an optional + or -. sign d is a digitor.one of the letters A~F b designates the number base and is one of the letters D,B,O; Q, or H lfthe numher base specjfier is absent or is the letter >'D/thecharacler string 'd ... ' can c[...]

  • Página 19

    FORTRAN-80 FORTRAN Concepts 2.2.4 Expressions and Operators An expression is a combination of numbers, symbols, and operators. It may include parentheses and may also include functions (discussed in Chapter 5). Expressions appear in assignment statements (e.g., A = B + C) as controls in certain data pro- cessing statements (e.g., IF FLAG .NE. 3 GO [...]

  • Página 20

    FORTRAN Concepts 2-8 Fig. 2w$ ·.type,. Length, andJnterpretatbin o~(O~1**QP2) As these figures indicate, mixed-mode arithmetic is done by converting both operands to the same type (the type of the result) before performing the operation. This conversion is unnecessary when a real number is raised to an integer power. In the case of an integer divi[...]

  • Página 21

    FORTRAN-SO f'ORTRAN Concepts Relational expressions are commonly used in the IF statement (Chapter 4). IF (NUMB .GT. 99) STOP IF (PNAME .EO. 'GEHRIG') PRINT 20, PNAME, AVG 2.2.4.3.2 Interpretation of Arithmetic Relational Expressions. An arithmetic rela- tional expression is TRUE if the values of the operands satisfy the relational c[...]

  • Página 22

    FORTRAN Concepts 2-10 The following example passes control to line 10 if the logical variable DONE is not true. Otherwise, execution stops. 10 FLAG = FLAG + 1 DONE = (FLAG .GT. 99) IF (.NOT. DONE) THEN GOTO 10 ELSE STOP ENDIF The value when two logical operands are combined by .AND. is as follows: OP1 OP2 OP1 .AND. OP2 TRUE TRUE TRUE TRUE FALSE FAL[...]

  • Página 23

    FORTRAN-80 FORTRAN Concepts The following statement returns whenever the two logical operands are logically equivalent. IF (FLAG1 .EQV. FLAG2) RETURN The value when two logical operands are combined by .NEQV. is as follows: OP1 OP2 OP1 .NEQV. OP2 TRUE TRUE FALSE TRUE FALSE TRUE FALSE TRUE TRUE FALSE FALSE FALSE If both operands are logically differ[...]

  • Página 24

    .FORTRAN Concepts 2-12 Parentheses can be used to override normal rules of precedence. The part of an ex- pression enclosed in parentheses is evaluated first. If parentheses are nested, the in- nermost are evaluated first. 15/3 + 18/9 = 5 + 2 = 7 15/(3 + 18/9) = 15/(3 + 2) = 15/5 = 3 The following lists the precedence of operators in descending ord[...]

  • Página 25

    FORTRAN-80 FORTRAN Concepts • Statement function names • Intrinsic function names • Dummy procedure names Variables appearing as dummy arguments in a statement function have a scope of that statement only. Common block names are generally global, but do admit exceptions. A common block name in a program unit may also be the name of any local [...]

  • Página 26

    [...]

  • Página 27

    CHAPTER 3 DEFINING VARIABLES, ARRAYS, AND MEMORY This chapter describes the statements used to specify the types and lengths associated with symbolic names, how to assign values to these symbols, .how to structure memory, and how to assign values to a block of memory. The statements described are: • Type statements: REAL, INTEGER, LOGICAL, CHARAC[...]

  • Página 28

    Defining Variables, Arrays, And Memory 3-2 where 'name' is one of the forms and v[*/en} ary[(d)][* len] v is an integer variable, function, or dummy procedure name ary is an array name ary( d) is an array declarator lenj.i~~~~l~9:!~~i*~~f¢~;0;(<trl·.ii)t~g~rV(l~i&l?1~·9t .·~rp~y¢l~w~#t, ••••. ~t$ • va,luernustuei{A, [...]

  • Página 29

    FORTRAN-SO Defining Variables t Arrayst And Memory Examples: LOGICAL *2 FLAG LOGICAL* 1 FLAGS(10) LOGICAL *4 FLAG1, FLAG2, SWITCH(5)*1 3.1.4 CHARACTER Type Statement The CHARACTER type statement has the format: CHARACTER [* len[,]] name [,name] ... where 'name' is one of the forms: and v[* len] ary[(d)][* len] v ary ary(d) len is a variab[...]

  • Página 30

    Defining Variables, Arrays, And Memory 3-4 The IMPLICIT statement has the format: IMPLICIT typ (let [,/et] ... ) [,typ (let [,let]. .. )]. .. where typ is INTEGERf*bml , REAL, LOGICALt~lejz], or CHARACTER[* len] let is a single letter or a range of letters in alphabetical order (e.g., C, I-M, N-Z) The IMPLICIT statement applies only to the program [...]

  • Página 31

    FORTRAN-80 Defining Variables, Arrays, And Memory By 'array element name' we mean an array name qualified by a subscript in paren- theses as shown in the example above. An array name not qualified by a sUbscript identifies the entire array, with one exception. In an EQUIVALENCE statement, an array name not qualified by a subscript identif[...]

  • Página 32

    Defining Variables, Arrays, And Memory 3-6 3.2.3 Properties of Arrays The examples following the description of the DIMENSION statement specify the types of the array names and, by implication, the types of the elements in the ar- rays. They also specify (by default) the lengths of the elements. The remaining properties of the array are determined [...]

  • Página 33

    FORTRAN-80 Defining Variables, Arrays, And Memory where 'ary' is an array name and's' is a subscript. The number of subscripts must equal the number of dimensions in the array declarator. Each subscript is an integer expression in the range 1 :5 s:5 upper-bound. If the upper dimension bound of a dummy array is an asterisk, the v[...]

  • Página 34

    Defining Variables, Arrays, And Memory 3-8 3.3.1 Arithmetic Assignment Statement The arithmetic assignment statement closely resembles a conventional arithmetic formula. Its format is: v = exp where v is the name of a variable or array element of type integer or real I exp is an arithmetic expression The' =' in FORTRAN has the sense &apos[...]

  • Página 35

    FORTRAN-SO Defining Variables, Arrays, And Memory 3.3.2 Logical Assignment Statement The logical assignment statement assigns the value. TRUE. or .FALSE. to a logical variable or array element. It has the format v = exp where v is the name of a logical variable or logical array element exp is a logical expression Examples: LOGICAL FLAG, TABLE(3,3) [...]

  • Página 36

    Defining Variables, Arrays, And Memory 3-10 The ASSIGN statement has the format: ASSIGN stlTO name where stl is a statement label (1-5 digits) name is an integer variable name The statement label must be the label of an executable statement or a FORMA T statement in the same program unit as the ASSIGN statement. The variable 'name' must n[...]

  • Página 37

    FORTRAN-80 Defining Variables, Arrays, And Memory Items in DATA lists must agree in number, type, and length. 'Nlist' and 'elist' must have the same number of items, as the lists correspond one- to-one. If 'nlist' contains an array name without a subscript, 'elist' must have one constant for each element of t[...]

  • Página 38

    Defining Variables, Arrays, And Memory 3-12 where 'nlist' is a list of variable names, array names or array element names. The lat- ter may only be subscripted by integer constants. The use of an array name un- qualified by a subscript is the same as a reference to the first element of the array. Function names and the names of dummy argu[...]

  • Página 39

    FORTRAN-80 Defining Variables, Arrays, And Memory The items in 'nlist' following a common block name (or omitted name) are declared to be in that block (or in blank common). If a common block name is omitted, the statement refers to the blank common block. If the first common block name is omitted in the above format, the slashes may be o[...]

  • Página 40

    Defining Variables, Arrays, And Memory 3-14 3.4.4 BLOCK DATA Statement The format of the BLOCK DATA statement is: BLOCK DATA [name] where 'name' is the symbolic name of the BLOCK DATA subprogram. Since 'name' is global, it must not be the same as the name of an external procedure, main program, common block, or another BLOCK DAT[...]

  • Página 41

    CHAPTER 4 PROGRAM EXECUTION CONTROLS FORTRAN includes 16 statements, or statement variations, for controlling program execution. These are statements that transfer control (GO TO, IF, and their varia- tions), regulate execution loops (DO, CONTINUE), and terminate program execu- tion (PAUSE, STOP, END). 4.1 Transferring Program Oontrol The statement[...]

  • Página 42

    Program Execution Controls 4-2 Examples: GO TO (1010,1020,1030) K C IF K = 2, FOR EXAMPLE, CONTROL PASSES TO STATEMENT C 1020 INTEGER*1 SWITCH SWITCH = K/J GO TO (10,500,500,10,10) SWITCH C NOTE THAT 'J' MUST BE .LE. 'K' IN THIS EXAMPLE GO TO (10, 500, 600, 500) K * L + 1 4.1.3 Assigned GO TO Statement The assigned GO TO stateme[...]

  • Página 43

    FORTRAN-SO Program Execution Controls Examples: IF(A + 8)1010,1020,1030 SWITCH = A**2 - 8**2 IF (SWITCH) 100,200,300 4.1.5 Logical I F Statement We have given several examples of logical IF statements already in this manual. In effect, if the logical expression evaluated is TRUE, a specified statement is executed next. If the logical expression is [...]

  • Página 44

    Program Execution Controls 4-4 An ELSE block consists of all the executable statements after the ELSE statement up to, but not including, the next END IF statement that has the same nesting level as the ELSE statement. For each block IF statement, there must be a corresponding END IF statement in the same program unit. IF ... ELSE IF ... IIF BLOCK [...]

  • Página 45

    FORTRAN-80 Program Execution Controls If 'exp' is TRUE, normal execution continues with the first statement of the ELSE IF block. If 'exp' is FALSE, control passes to the next ELSE IF, ELSE, or END IF statement having the same level as the ELSE IF statement. Control cannot 'be transferred into an ELSE IF block from outside [...]

  • Página 46

    Program Execution Controls 4-6 4.2 Loop Control Statements Frequently, a series of operations must be repeated several times (for example, reading a series of entries from an input device and extracting information selective- ly). Rather than repeat the statements to perform these operations for each entry, one can create a loop that causes the sam[...]

  • Página 47

    FORTRAN-80 Program Execution Controls DO loops may be nested, that is, a DO loop can contain another DO loop, etc. If a DO statement appears within the range of another DO loop, the loop specified by the second DO statement must be within the range of the outer DO loop. DO loops can share the same last statement. I f a DO statement lies within an I[...]

  • Página 48

    Program Execution Controls 4-8 4.3.1 PAUSE Statement The format of the PAUSE statement is PAUSE [msg] where 'msg' is a string of not more than five digits, or is a character constant. At the time the PAUSE is executed and program execution ceases, 'msg' is displayed on the console terminal. Program execution must be resumable fo[...]

  • Página 49

    CHAPTER 5 FUNCTIONS AND SUBROUTINES Functions and subroutines reduce coding, break programs into readily-visible logical structures, conserve storage, avoid the tedium and increased probability of error in repetitive coding, and eliminate the coding of commonly-used mathematical functions. The term 'function' refers to a statement or subp[...]

  • Página 50

    Functions And Subroutines 5-2 I f the name of an intrinsic function appears in the dummy argument list of a FUNC- TION or SUBROUTINE subprogram, the name is considered to have no relation to the intrinsic function within the scope of the program unit and the name itself loses its intrinsic quality. The data type associated with the symbolic name is[...]

  • Página 51

    FORTRAN-80 Functions And Subroutines The statement function name and the expression 'exp' may be of different types. The type of the value returned is as shown in Figure 3-2. The dummy argument list indicates the order, number and type of arguments for the statement function. The names of dummy arguments have a scope of the statement func[...]

  • Página 52

    Functions And Subroutines 5-4 A statement function may be referenced only in the program unit where it is defined. The statement function may not reference another statement function if that other function is defined later in the program unit. Furthermore, a statement function in a FUNCTION subprogram must not reference the name of the subprogram. [...]

  • Página 53

    FORTRAN-SO Functions And Subroutines An actual argument may also be a dummy argument as long as the dummy is part of a dummy argument list within the subprogram containing the external function reference. 5.2.1.2 FUNCTION Subprogram Limitations A FUNCTION statement may be used only as the first statement of a FUNCTION subprogram. The subprogram its[...]

  • Página 54

    Functions And Subroutines 5-6 The subroutine is called by the CALL statement. PROGRAM CALL .. SUBROUTINE .~RETURN CA.~END END Subroutines, being external procedures, can be defined outside the program. By the time a program containing a CALL to the subroutine is executed, however, the subroutine must be part of the calling program, either by SUBROU[...]

  • Página 55

    FORTRAN-SO Functions And Subroutines When a RETURN is executed in a FUNCTION subprogram, the value of the func- tion must be available to the referencing program unit. Whenever RETURN is executed, the association between the dummy arguments of an external procedure and the current actual arguments is terminated (but see sec- tion 5.2.5, the SA VE s[...]

  • Página 56

    Functions And Subroutines 5-8 5.2.7 CALL Statement The CALL statement is used to reference a subroutine. A subroutine can be refer- enced within any other external procedure or in the main program. A subprogram must not reference itself either directly or indirectly (but see the description of the REENTRANT compiler control in section F.2.3). The f[...]

  • Página 57

    FORTRAN-80 Functions And Subroutines 5.3.1 Common Blocks Common blocks reduce storage requirements by allowing two or more subprograms to share the same memory. This sharing may be limited by the rules for defining and referencing data. The variables and arrays in a common block can be defined and referenced in all subprograms that contain a declar[...]

  • Página 58

    Functions And Subroutines 5-10 NOTE The subscript value remains constant as long as the arguments are associated, even if the subscript contains variables redefined during the association. Argument association can be carried through more than one level of procedure reference. A valid association exists at the last level, however, only if the associ[...]

  • Página 59

    FORTRAN-SO Functions And Subroutines NOTE In a given program unit, det~rmining whether a dummy procedure is associated with a function or a subroutine may not be possible. If a pro- cedure name appears only in a dummy argument list, an EXTERNAL statement, and an actual argument list, examining the subprogram is not enough to determine whether the s[...]

  • Página 60

    [...]

  • Página 61

    CHAPTER 61 INPUT/OUTPUT The FORTRAN input/output (I/O) statements transfer data between a processor and external units or within the processor itself. These statements can specify the ex- ternal units to be used, the variables whose values are being entered or output, and the format of I/O data. The first group of I/O statements are the file-handli[...]

  • Página 62

    Input/Output 6-2 6.1.2.1 File Existence At the time an executable program is running, a certain set of files is available. These files are said to exist, and the particular files that exist are determined by the operating system or environment in which the program is running. A file may exist without containing any data; an example would be a newly[...]

  • Página 63

    FORTRAN-SO 6.1.2.5 File Access An external file can be accessed sequentially or directly. An internal file can only be accessed sequentially. Some external files may be allowed more than one access method, depending on the operating environment. The access method is determined when the file is connected to a unit. 6.1.2.5.1 Sequential Access File. [...]

  • Página 64

    Input/Output 6-4 6.2 File-Handling Statements 6.2.1 OPEN Statement The OPEN statement can be used to connect an existing file to a unit, create a preconnected file, create a file and connect it to a unit, or change certain specifiers in the file/unit connection. The format of the OPEN statement is OPEN (open-list) where 'open-list' is a l[...]

  • Página 65

    FORTRAN-80 Executing an OPEN statement containing this specifier causes 'stname' to become defined with a zero value if no error condition exists, or with a processor-dependent positive integer value if an error condition does exist. Example: OPEN (4, IOSTAT = ERRFLG) 6.2.1.3 Error Specifier The format of the error specifier is ERR = stl [...]

  • Página 66

    Input/Output 6-6 If 'OLD' or 'NEW' is specified, the FILE specifier must be present also. An 'OLD' file must exist already; a 'NEW' file cannot exist already. The 'SCRATCH' option must not be specified with a named file. When it is specified with an unnamed file, the file is connected to the specifi[...]

  • Página 67

    FORTRAN-80 If the file is being connected for formatted 110, 'reclen' is the number of characters. If the file is being connected for unformatted 110, the length is measured in bytes. If the file already exists, the length specified must be that used when the file was created. In the case of a new file, the processor creates a file with t[...]

  • Página 68

    Input/Output 6-8 6.2.1.11 Opening A Connected Unit The OPEN statement can be specified for a unit already connected to an existing file. That existing file is assumed to be the value of 'fname' if the FILE specifier is not included in the OPEN 'open-list.' I f the file to be connected is the same as the connected file, the effec[...]

  • Página 69

    FORTRAN-80 6.2.2.2 File Disposition Specifier The format of the file disposition specifier is STATUS = stat where 'stat' is a character expression evaluating to 'KEEP' or 'DELETE'. If this specifier is omitted, the default value is 'DELETE' for a file that previously had a status of 'SCRATCH', and &[...]

  • Página 70

    Input/Output 6-10 where 'unit' is an external unit specifier and 'arg-list' is a list of arguments as described for the BACKSPACE statement (section 6.2.3). If the specified file is already positioned at its initial point, or if the file is connected but does not exist, the REWIND statement has no effect. If an end-of-file condi[...]

  • Página 71

    FORTRAN-SO The list of control information specifiers is: [UNIT =] unit [FMT =] f REC = recno IOSTAT = stname ERR = stl END = stl 6.3.1.1 Control Information List U nit specifier Format specifier Record number specifier I/O status specifier Error specifier End-of-file specifier The control information list must contain a unit specifier. If the seco[...]

  • Página 72

    Input/Output 6-12 I f the asterisk option is selected, 'ctl-list' must not include a record number specifier. If the unit specifier is an internal file, the format specifier must be present, but can- not be an asterisk. Examples: READ (2,25) PNAME, AS, HITS 25 FORMAT ... READ 25, PNAM E, AS, HITS 25 FpRMAT ... ASSIGN 25 TO INFMT READ (2,I[...]

  • Página 73

    FORTRAN-SO 6.3.1.2 Input List The list 'in-list' in the READ statement identifies the items whose values are to be read. An item in an input list must be a variable name, array name, or array element name. If an array name is listed, the entire array is read in normal array element ordering sequence. The name of an assumed-size dummy arra[...]

  • Página 74

    Input/Output 6-14 6.3.3 PRINT Statement The PRINT statement outputs formatted data to the default write unit. It has the format PRI NT f [,out-list] where f is a format identifier out-list is a list of the data to be written Note that the keyword 'PRINT' does not necessarily imply the default unit is a line printer or other print device. [...]

  • Página 75

    FORTRAN-80 6.4.2 Formatted Data Transfer During formatted data transfer, data is transferred with editing between the file and the 110 list. The editing is directed by some kind of format specification. Format specifications can be given: • In FORMAT statements; • As values of character arrays, character variables, or other character expression[...]

  • Página 76

    Input/Output 6-16 6.4.3 FORMAT Statement The form of the FORMAT statement is stl FORMAT ([flist]) where stl is a 1-5 digit statement label JUst is a format specification list whose items are separated by commas Each item in 'flist' must be a repeatable edit descriptor, a nonrepeatable edit descriptor, or a parenthesized 'flist.'[...]

  • Página 77

    FORTRAN-80 Certain general remarks apply to all three of these numeric editing descriptors. • On input, leading blanks are not significant. Other blanks are treated according to the setting of the non repeatable descriptors BN and BZ and the value of the BLANK sp~cifier in the OPEN statement (section 6.2.1.9). • A decimal point in input data ov[...]

  • Página 78

    Input/Output 6-18 'E' Descriptor Editing An I/O list item matched with an 'Ew.d' or 'Ew.dEe' descriptor must be a real variable. The exponent 'e' has no effect on input data. On output, the format of the output field for a scale factor (section 6.4.3.1.2) of zero is: [±] [0].x1 x2··· x d ex P where ± sig[...]

  • Página 79

    FORTRAN-80 A /phanumeric Editing An 110 item matched with an 'A' or 'Aw' descriptor must have type character or be defined with Hollerith data. If the field width 'w' is specified, the field consists of 'w' characters. Otherwise, the number of characters in the field is the length of the 110 list item. On inp[...]

  • Página 80

    Input/Output 6-20 The width of the field is the length of the character string. Example: WRITE (7,100) ITSTNO 100 FORMAT ('THIS IS THE TEST NUMBER', 2X, 12) 'H' Descriptor Editing The Hollerith field descriptor is an alternate way to perform the same operation as apostrophe editing. Like apostrophe editing, it is used only for o[...]

  • Página 81

    FORTRAN-80 Scale Factor (P) Editing A scale factor is established by the' kP' edit descriptor, where' k' represents the scale factor. It is used with the 'F' and 'E' descriptors to edit real numbers. No comma is needed between the 'P' descriptor and an immediately following 'F' or 'E.[...]

  • Página 82

    Input/Output 6-22 scanner encounters a dollarsign at the end of a format specification list, format con;. trol terminates without positioning the file to the beginning of the next record. The donar sign .edit descriptor has no effect on direct~accessfil¢s. Example: PAINT 25, PNAME 25 FORMAT (A20, $) 6.4.4 List·Directed Formatting I List-directed [...]

  • Página 83

    FORTRAN-80 6.4.4.2 List-Directed Output The form of the values produced by list-directed output agrees in type with their cor- responding output list items. The processor separates records as necessary, so long as the end of a record does not fall within a constant (except a character constant) and blanks are not embedded within constants. Integer [...]

  • Página 84

    [...]

  • Página 85

    CHAPTER 7 PROGRAMMING GUIDELINES This chapter is by no means intended as an exhaustive discussion of programming techniques. It is intended simply as a guideline, primarily for the novice program- mer. For those who wish to go more deeply into the science of FORTRAN program- ming, a number of references are listed in the bibliography at the end of [...]

  • Página 86

    Programming Guidelines 7-2 As the development of a program becomes more detailed, the documentation should become correspondingly detailed. The ultimate documentation is, of course, the final program code, which should include numerous useful comments, have mean- ingful mnemonic names for symbols, and make good use of blanks in statement lines to i[...]

  • Página 87

    FORTRAN-SO Programming Guidelines The next pass is a more formal description of level two, introducing FORTRAN statements for English sentences. Level Three C INITIALIZE VARIABLES NEEDED FOR TOTALS DATA TOTEMP, TOTHRS, TOTPAY / 3*0.0/ C OPEN INPUT/OUTPUT FILES, READ EMPLOYEE RECORD OPEN (input file) OPEN (output file) 10 READ (unit, 20) EMP, HRS, G[...]

  • Página 88

    Programming Guidelines 7-4 This is just a 'starter' list. Certainly, any experienced programmer could add to this checklist. Rereading such a list frequently, like rereading programming manuals, is a good way to refresh or reconfirm programming knowledge. 7.2 FORTRAN Coding Section 7.1 lists some general programming considerations. When c[...]

  • Página 89

    FORTRAN-SO Programming Guidelines When calculating a value for use in a DO loop, be sure the value is computed before the loop is entered. Otherwise, the program could compute the value again for each iteration of the loop. Consider the following short Examples: C EXAMPLE OF RECOMPUTED CONSTANT INTEGER*1 R DO 25 R = 1,60 X = (2217)*(r* *2) WRITE (4[...]

  • Página 90

    Programming Guidelines 7-6 McCracken, Daniel A., A Simplified Guide to FORTRAN Programming, John Wiley & Sons, New York, 1974. Mills, Harlan B., Mathematical Foundations for Structured Programming, Technical Report, FSC 72-6012, IBM Federal Systems Division, Gaithersburg, Md., 1972. Ogdin, Carol A., 'Software Design Course,' EDN, June[...]

  • Página 91

    APPENDIX A FORTRAN-80 STATEMENT SUMMARY A.1 Statement Sequence The following order of statements and lines must be observed when coding a FORTRAN program. 1. Comment lines can appear before or between statements, but cannot appear after an END statement. 2. The PROGRAM statement, if used, must be the first statement of a main program. The first sta[...]

  • Página 92

    FORTRAN-80 Statement Summary A-2 BACKSP ACE Statement Category: Executable Text Reference: Section 6.2.3 Formats BACKSPACE unit BACKSPACE (arg-list) Notes: 'unit' is unit specifier 'arg-list' is following argument list: [UNIT =] unit IOSTAT = stname ERR = stl Function Position file connected before preceding record. unit specifi[...]

  • Página 93

    FORTRAN-SO FORTRAN-80 Statement Summary CLOSE Statement Category: Executable Text Reference:' Section 6.2.2 Format Function CLOSE (close-list) Close file (disconnect unit) described by 'close-list.' Notes: 'close-list' can be following fields: [UNIT =] unit IOSTAT = stname ERR = stl STATUS = stat unit specifier 110 status s[...]

  • Página 94

    f'ORTRAN-80 Statement Summary FORTRAN-SO DATA Statement Category: Nonexecutable Text Reference: Section 3.3.5 Format Function DATA nlist/ clist/[[,) nlist/ elist/) ... Assign values in 'elist' to items in 'nlist.' DIMENSION Statement Category: Nonexecutable, specification Text Reference: Section 3.2.1 Format Function DIMENS[...]

  • Página 95

    FORTRAN-80 FORTRAN-80 Statement Summary ELSE IF Statement Category: Executable, Block IF Text Reference: 'Section 4.1.8 Format Function ELSE IF (exp) THEN Continue execution if expression 'exp' is TRUE END Statement Category: Executable Text Reference: 4.3.1 Format Function END Terminate main program; return from subprogram; mark end[...]

  • Página 96

    FORTRAN-80 Statement Summary FORTRAN-80 EQUIVALENCE Statement Category: Nonexecutable, specification Text Reference: Section 3.4.1 Format Function EQUIV ALENCE (nlist) [,(nlist)] ... Allow entities in 'nlist' to share the same storage area. EXTERNAL Statement Category: Nonexecutable, specification Text Reference: Section 5.2.6 Format Func[...]

  • Página 97

    FORTRAN-80 FORTRAN-80 Statement Summary FUNCTION Statement Category: Nonexecutable Text Reference: Section 5.2.1 Format Function [type] FUNCTION func ([d[,d] ... J) Name the FUNCTION subprogram 'func,' define its type and dummy parameter(s) 'd.' GO TO Statements Category: Executable Text Reference: Section 4.1.1,4.1.2,4.1.3 Form[...]

  • Página 98

    FORTRAN-80 Statement Summary FORTRAN-SO IMPLICIT Statement Category: Nonexecutable, specification Text Reference: Section 3.1.5 Format Function IMPLICIT type (1[, 1] ... )[,type(1[,I] ... )] ... Define implicit typing for variable names whose first letter is '1' or in range '1,1.' INTEGER Statement Category: Nonexecutable, speci[...]

  • Página 99

    FORTRAN-80 F'ORTRAN-80 Statement Summary OPEN Statement Category: Executable Text Reference: Section 6.2.1 Format Function OPEN (open-list) Open the specified file (connect file to unit). Notes: 'open-list' consists of the following specifiers: [UNIT =] unit IOSTAT = stname ERR = stl FILE = fname STATUS = stat ACCESS = acc FORM = fma[...]

  • Página 100

    f'ORTRAN-80 Statement Summary A-tO PROGRAM Statement Category: Nonexecutable Text Reference: Section 2.1.2 Format Function PROGRAM name Name main program 'name;' must be first statement if used. READ Statement Category: Executable Text Reference: Section 6.3.1 Formats Function READ (ctl-list) [in list] Input items in 'inlist&apo[...]

  • Página 101

    FORTRAN-80 FORTRAN-SO Statement Summary REWIND Statement Category: Executable Text Reference: Section 6.2.4 Formats Function REWIND unit Reposition file connected to 'unit' REWIND (arg-list) at its initial point. Notes: 'arg-list' includes the following specifiers: [UNIT =] unit lOST A T = stname ERR = stl unit specifier 110 sta[...]

  • Página 102

    FORTRAN-80 Statement Summary A-12 SUBROUTINE Statement Category: Executable Text Reference: Section 5.2.2, 5.2.3 .~ormat Function SUBROUTINE sub [([d[,d] ... ])] Define SUBROUTINE subprogram 'sub' with dummy argument(s) 'd.' WRITE Statement Category: Executable Text Reference: Section 6.3.2 Format WRITE (ctl-list) [outlist] Note[...]

  • Página 103

    APPENDIX B I INTRINSIC FUNCTIONS The following table lists the intrinsic (or predefined) functions available with FORTRAN-SO. An intrinsic function is executed in an expression by referencing its name followed by some argument in parentheses. If more than one argument is needed, they are separated by commas and all arguments must be of the same typ[...]

  • Página 104

    Intrinsic Functions FORTRAN-80 TYPE OF }<'ORM CATEGORY FUNCTION ARGUMENTS FUNCTION SIGN (aI, a2) Sign transfer Transfer sign of a2 to al Real Real (note 5) 101M (ai, a2) Positive difference Return al-a2 if >0; Integer Integer otherwise 0 DIM (ai, a2) Positive difference Return al-a2 if >0; Real Real otherwise 0 MAXO Laigest value Sele[...]

  • Página 105

    FORTRAN-SO Intrinsic Functions B.2 Notes On Intrinsic Functions I. For an integer argument, 'int(a) = a.' For a real argument, two possibilities exist. If lal < I, int(a) = 0; if lal ~ I, 'int(a)' is the integer whose magnitude is the largest Integer that does not exceed the magnitude of 'a' and whose sign is the sa[...]

  • Página 106

    [...]

  • Página 107

    APPENDIX C HOLLERITH DATA TYPE The Hollerith data type is a carryover from FORTRAN 66. Generally speaking, the character data type provides a superior processing capability, and Hollerith has been retained in FORTRAN-80 primarily for compatibility with the earlier standard. C.1 Hollerith As A Data Type Although Hollerith is a data type, a symbolic [...]

  • Página 108

    Hollerith Data Type C-2 C.3 Hollerith Format Specification A format specification may be an array name of type integer, real, or logical. In this case, the leftmost characters of the specified entity must contain Hollerith data con- stituting a legal format specification. Blank characters may precede the format specification and data may follow the[...]

  • Página 109

    APPENDIX D EXTENSIONS TO ANSI FORTRAN This appendix lists differences between FORTRAN-80 and ANSI FORTRAN 77. Some of these are extensions to the FORTRAN 77 subset which are included in the FORTRAN 77 full language. Other extensions go beyond both versions of the ANSI standard. In two cases, the differences merely represent a tighter definition of [...]

  • Página 110

    Extensions To ANSI Fortran D-2 0.3 More Specific Semantics Than 1977 FORTRAN In the following areas, the definition of FORTRAN-80 is more explicit than the AN- SI standard. 1. The character set and its collating sequence include the ASCII character set. 2. The standard length for real, integer, and logical type data is four bytes, but a particular [...]

  • Página 111

    FORTRAN-80 Extensions To ANSI Fortran Miscellaneous extensions: Seven-dimensional arrays Unsubscripted array names in DATA and EQUIVALENCE statements Optional commas in COMMON, DO, assigned GOTO, and computed GOTO statements Character constant in a PAUSE or STOP statement BLOCK DATA subprogram names in EXTERNAL statement Integer expressions in a co[...]

  • Página 112

    [...]

  • Página 113

    APPENDIX E I ASCII CODES The following table lists the ASCII characters representable on Intel processors and their collating sequence. GRA CO PHICOR NTROL JL NL SO ST ET EO EN AC 8E 8S HT LF VT FF CR SO SI DL DC DC DC DC NA SY ET CA EM SU ES FS GS RS US SP # $ 0/0 & H X X T Q K L E 1 (X-ON) 2 (TAPE) 3 (X-OFF) 4 (TAPE) K N B N 8 C ASCII (HEXADE[...]

  • Página 114

    [...]

  • Página 115

    APPENDIX F 8080/8085 PROCESSOR DEPENDENCIES Throughout this manual, aspects of the FORTRAN language have been said to be 'processor dependent' or 'compiler dependent.' This appendix summarizes the limitations and extensions to the FORTRAN language assumed by the 8080/8085 processors and compiler. See the ISIS-II FORTRAN-80 Compi[...]

  • Página 116

    SOSO/SOS5 Processor Dependencies F-2 F .2.1 Lowercase Letters Except within Hollerith and character constants, a lowercase letter is considered to be identical to its corresponding uppercase letter. F.2.2 Port Input/Output The compiler provides two intrinsic subroutines for handling input/ output through SOSO/SOS5 110 ports. When these subroutines [...]

  • Página 117

    FORTRAN-SO SOSO/SOS5 Processor Dependencies If the FREEFORM compiler control is set, column 1 is interpreted as follows: Column 1 Cor * 0-9 Space or TAB & $ Meaning Comment line (same as standard) Label followed by statement Unlabeled initial line of statement Continuation line of statement Compiler control line Note in this format that a state[...]

  • Página 118

    SOSO/SOS5 Processor Dependencies F-4 The included file may itself contain INCLUDE controls, up to a total of six files. An included file cannot contain an END statement, however. An INCLUDE control must be the rightmost control when specified in a list of controls. F.2.8 REel Specification For Sequential Files To simplify terminal I/O, the FORTRAN-[...]

  • Página 119

    INDEX I The page numbers shown in italics in this index denote primary references. ABS Intrinsic Function, B-1 ACCESS I/O Specifier, 6-6 Access Method Specifier, 6-6 ACOS Intrinsic Function, B-2 Actual Arguments, (see 'Arguments') 'A' Edit Descriptor, 6-16, 6-19, C-2 AINT Intrinsic Function, B-1 ALOG Intrinsic Function, B-2 ALOG[...]

  • Página 120

    Index Index-2 FREEFORM Compiler Control, F-2 Functions, 2-1, 5-1 ff FUNCTION Statement, 5-4, A-7 FUNCTION Subprograms, 5-4 GO TO Statements, Assigned, 4-2, A-7 Computed, 4-1, A-7 Unconditional, 4-1, A-7 'H' Edit Descriptor, 6-19, 6-20 Hollerith Data Type, C-1 lABS Intrinsic Function, B-1 ICHAR Intrinsic Function, B-1 IDIM Intrinsic Functi[...]

  • Página 121

    FORTRAN-SO Subroutines, 2-1, 5-5 SUBROUTINE Statement, 5-6, A-12 SUBROUTINE Subprograms, 5-5 Symbols, 2-4, 2-12 TANH Intrinsic Function, B-2 TAN Intrinsic Function, B-2 Type Statements, 1-2, 3-1 Unformatted I/O, 6-1, 6-6, 6-14 Unit Connection/Preconnection, 6-8, F-4 UNIT I/O Specifier, Input, 6-4, 6-11 Output, 6-8, 6-13 UNIT Run-Time Control, F-4 U[...]

  • Página 122

    [...]

  • Página 123

    NOTES[...]

  • Página 124

    NOTES[...]

  • Página 125

    inter SOFTWARE SUBMITTED BY: Name Company Address Phone Date CHECK ONE ITEM IN EACH CATEGORY Product Product Type o Software o Monitor o Simulator o Manual o Assembler o Editor o Compiler o Utility 0 ___ _ Exact Product/Manual Name PROBLEM REPORT FOR INTERNAL USE ONLY No. Date Notes Machine Line 04004/4040 0800S 08OS0 03000 0 ___ _ Fix Date Vers/Sy[...]

  • Página 126

    WE'D LIKE YOUR COMMENTS ... This document is one of a lieries describing Intel products. Your comments on the back of this form will help us produce better manuals. Each reply will be carefully reviewed by the responsible person. All comments and suggestions become the property of Intel Corporation. BUSINESS REPLY CARD FIRST CLASS PERMIT NO. 6[...]

  • Página 127

    FORTRAN·80 PROGRAMMING MANUAL 9800481 A REQUEST FOR READER'S COMMENTS The Microcomputer Division Technical Publications Department attempts to provide documents that meet the needs of all Intel product users. This form lets you participate directly in the documentation process. Please restrict your comments to the usability, accuracy, readabi[...]

  • Página 128

    :'0 LIKE YOUR COMMENTS ... is document is one of a series describing Intel software products. Your comments on the back of this m will help us produce better software and manuals. Each reply will be carefully reviewed by the respon- Ie person. All comments and suggestions become the property of Intel Corporation. BUSINESS REPLY CARD FIRST CLAS[...]

  • Página 129

    [...]

  • Página 130

    inter INTEL CORPORATION, 3065 Bowers Avenue, Santa Clara, California 95051 (408) 987-8080 Printed in U.S.A.[...]