User Tools

Site Tools


This is an old revision of the document!

FORTRAN-20 Compiler Tutorial

FORTRAN-20 is a FORTRAN compiler for TOPS-20. It supports the FORTRAN-77 standard (ANSI X3.9-1978 American National Standard Programming Language FORTRAN) with extensions and additions.

The purpose of this tutorial is to document the peculiarities of using FORTRAN-20 on TOPS-20 as opposed to other FORTRAN implementations on other operating systems; to highlight useful FORTRAN-20 extensions and additions that are not found in standard FORTRAN-77; and to briefly introduce the FORTRAN-77 programming language for those unfamiliar with it.

The order of presentation moves from more to less specialized and technical which runs counter to traditional organization, but the author feels this order is more convenient for the primary audience of programmers already familiar with FORTRAN but unfamiliar with the TOPS-20 operating system environment.


Input/Output Devices

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's simulated PDP-10 environment.

When you are coding input/output statements, be sure to use a logical unit number that is both valid and is associated with a device that is available on TWENEX.ORG.

The default logical unit (specified by “*” on READ and WRITE statements) varies according to the input/output statement:

Statement Default unitRemarks
ACCEPT 5 (User teletype)Recommended for user keyboard input.
PRINT 3 (Line printer)Not available. Do not use.
PUNCH 7 (Paper tape punch)Not available. Do not use.
READ 2 (Card reader)Do not use default. Specify unit 5 for user keyboard input or other unit for file input.
TYPE 5 (User teletype)Recommended for user terminal output.
WRITE 3 (Line printer)Do not use default. Specify unit 5 for user terminal output or other unit for file output.

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.

Unit DeviceDefault filenameUsage
2 CDRFOR02.DATCard reader
3 LPTFOR03.DATLine printer
4 CTYFOR04.DATConsole teletype
5 TTYFOR05.DATUser teletype
6 PTRFOR06.DATPaper tape reader
7 PTPFOR07.DATPaper tape punch
8 DISFOR08.DATDisplay
10-15 DTA2-7FOR10 - 15.DAT
16-18 MTA0-2FOR16 - 18.DATMagnetic tape
19 FORTRFOR19.DATAssignable device
20-24 DSKFOR20 - 24.DATDisk
25-29 DEV1-5FOR25 - 29.DATAssignable devices
30-99 DSKFOR30 - 99.DATDisk

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

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: introduce FORTRAN-77 idiosyncracies (line layout, …).)

Hello World

A sample program for the FORTRAN-20 compiler.

      program hello
      type *, ' Hello, World!'

(Text on each line is preceded by six spaces.)


tutorials/fortran.1389406744.txt.gz · Last modified: 2014/01/11 02:19 by papa