This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
tutorials:fortran [2014/01/10 06:09] papa |
tutorials:fortran [2022/03/19 09:52] (current) papa [CPU/Elapsed time report on program termination] |
||
|---|---|---|---|
| Line 8: | Line 8: | ||
| ===== Peculiarities ===== | ===== Peculiarities ===== | ||
| + | |||
| + | ==== CPU/Elapsed time report on program termination ==== | ||
| + | |||
| + | The FORTRAN compiler adds a report on CPU and elapsed time used by the program that prints at the end of every program run, like: | ||
| + | |||
| + | CPU time 0.08 Elapsed time 0.09 | ||
| + | |||
| + | This message can be suppressed by adding the following line to your program source: | ||
| + | |||
| + | CALL QUIETX | ||
| + | |||
| + | ==== DATE subroutine bug ==== | ||
| + | |||
| + | Although the TOPS-20 operating system as a whole survived the Y2K crisis, the FORTRAN DATE subroutine did not fare as well. | ||
| + | |||
| + | DATE is supposed to return a ten-character string representing the current system date with the format: | ||
| + | |||
| + | '' | ||
| + | |||
| + | Where: | ||
| + | |||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | | '' | ||
| + | |||
| + | However, since the year 2000, the DATE has set the '' | ||
| + | |||
| + | This renders the year portion of DATE's output useless for most purposes. A work-around is to program a date subroutine in another language that correctly processes the TOPS-20 system date (such as MACRO assembly language) and call that subroutine from your FORTRAN program instead of the FORTRAN DATE subroutine. | ||
| ==== Input/ | ==== Input/ | ||
| - | ^ Unit ^Device^Usage^Default filename^ | + | FORTRAN uses logical device numbers for transmitting data to and from various input and output devices. In FORTRAN-20, some of these logical unit numbers were assigned to specific equipment that was common in the computer rooms of the 1970s and '80s but are not available in TWENEX.ORG' |
| - | | 0 |DSK|Disk|FOR00.DAT| | + | |
| - | | 1 |DSK|Disk|FOR01.DAT| | + | When you are coding input/ |
| - | | 2 |CDR|Card reader|FOR02.DAT| | + | |
| - | | 3 |LPT|Line printer|FOR03.DAT| | + | The default logical unit (specified by " |
| - | | 4 |CTY|Console teletype|FOR04.DAT| | + | |
| - | | 5 |TTY|User teletype|FOR05.DAT| | + | ^ Statement |
| - | | 6 |PTR|Paper tape reader|FOR06.DAT| | + | | ACCEPT |
| - | | 7 |PTP|Paper tape punch|FOR07.DAT| | + | | PRINT |3 (Line printer)|Not available. Do not use.| |
| - | | 8 |DIS|Display|FOR08.DAT| | + | | PUNCH |7 (Paper tape punch)|Not available. Do not use.| |
| - | | 9 |DTA1|DECtape|FOR09.DAT| | + | | READ |2 (Card reader)|Do not use default. Specify unit 5 for user keyboard input or other unit for file input.| |
| - | | 10-15 |DTA2-7| " | + | | TYPE |5 (User teletype)|Recommended for user terminal output.| |
| - | | 16-18 |MTA0-2|Magnetic tape|FOR16 - 18.DAT| | + | | WRITE |3 (Line printer)|Do not use default. Specify unit 5 for user terminal output or other unit for file output.| |
| - | | 19 |FORTR|Assignable device|FOR19.DAT| | + | |
| - | | 20-24 |DSK|Disk|FOR20 - 24.DAT| | + | Below is a list of FORTRAN-20 logical unit assignments. For file input or output, you may use any of the units assigned to disk (0, 1, 20-24, 30-99). If you do not specify a file name when you open the logical unit, FORTRAN-20 will use the default file name (in your currently connected directory) corresponding to the unit you are opening as shown in the table. |
| - | | 25-29 |DEV1-5|Assignable devices|FOR25 - 29.DAT| | + | |
| - | | 30-99 |DSK|Disk|FOR30 - 99.DAT| | + | ^ Unit ^Device^Default filename^Usage^ |
| + | | 0 |DSK|FOR00.DAT|Disk| | ||
| + | | 1 |DSK|FOR01.DAT|Disk| | ||
| + | | 2 |CDR|FOR02.DAT|Card reader| | ||
| + | | 3 |LPT|FOR03.DAT|Line printer| | ||
| + | | 4 |CTY|FOR04.DAT|Console teletype| | ||
| + | | 5 |TTY|FOR05.DAT|User teletype| | ||
| + | | 6 |PTR|FOR06.DAT|Paper tape reader| | ||
| + | | 7 |PTP|FOR07.DAT|Paper tape punch| | ||
| + | | 8 |DIS|FOR08.DAT|Display| | ||
| + | | 9 |DTA1|FOR09.DAT|DECtape| | ||
| + | | 10-15 |DTA2-7|FOR10 - 15.DAT| " | ||
| + | | 16-18 |MTA0-2|FOR16 - 18.DAT|Magnetic tape| NO | ||
| + | | 19 |FORTR|FOR19.DAT|Assignable device| | ||
| + | | 20-24 |DSK|FOR20 - 24.DAT|Disk| | ||
| + | | 25-29 |DEV1-5|FOR25 - 29.DAT|Assignable devices| | ||
| + | | 30-99 |DSK|FOR30 - 99.DAT|Disk| | ||
| ===== Extensions and additions ===== | ===== Extensions and additions ===== | ||
| + | |||
| + | This section introduces potentially useful features that are unique to FORTRAN-20 and not included in the FORTRAN-77 standard. | ||
| + | |||
| + | //(More to come: structured programming statements, in-line comments, ...)// | ||
| ===== FORTRAN overview ===== | ===== FORTRAN overview ===== | ||
| This section gives an brief overview of the FORTRAN-77 programming language for programmers with at least some experience with one or more other programming languages. It is not intended to be a comprehensive description or tutorial. Readers desiring a more complete introduction to FORTRAN are recommended to read the //Fortran 77 Tutorial// linked in the References section below. | This section gives an brief overview of the FORTRAN-77 programming language for programmers with at least some experience with one or more other programming languages. It is not intended to be a comprehensive description or tutorial. Readers desiring a more complete introduction to FORTRAN are recommended to read the //Fortran 77 Tutorial// linked in the References section below. | ||
| + | |||
| + | //(More to come: FORTRAN-77 cheat sheet, idiosyncracies (line layout, ...).)// | ||
| ===== Hello World ===== | ===== Hello World ===== | ||
| Line 41: | Line 92: | ||
| < | < | ||
| program hello | program hello | ||
| - | | + | |
| stop | stop | ||
| end | end | ||
| Line 52: | Line 103: | ||
| [[http:// | [[http:// | ||
| - | [[http:// | + | [[http:// |