Sunday, May 17, 2020

Open Source FORTRAN for DOS

As a physicist of trade, I mainly worked with FORTRAN during my science days. One of the most important factors for me in selecting an OS is therefore the availability of a FORTRAN compiler.
With DOS, or FreeDOS, we got lucky. The Waterloo Compilers are now available as Open Source under the Open Watcom Project.
On the download page, you will find that a C/C++ compiler, an ASSEMBLER and a FORTRAN compiler are now available as open source.
The FreeDOS project included the C/C++ compiler in the distribution. I figure, the ASSEMBLE is included too. However, the FORTRAN compiler is not. I got in contact with Jim Hall asking him to include Watcom FORTRAN in the next distribution of FreeDOS.
In the meanwhile, I installed Watcom FORTRAN to the same tree as Watcom C/C++ in FreeDOS.

Here is how to do it:
Download open-watcom-f77-dos-1.9.exe as provided by the Open Watcom webpage.
Run the installer and select "\DEVEL\OW\" as install directory. This will install the FORTRAN compiler into the same environment as the C/C++ compiler provided in the FreeDOS distribution.

To use the compiler, first run the BATCH-scrip "\DEVEL\OW\OWSETENC.BAT", which will set the correct PATH and LIBRARY variables. This script is part of the FreeDOS installation.
In order to compile a simple FORTRAN program, call "wfl".

When I was taught FORTRAN in University, a system called WATFOR-77 was used in the classroom. This was an integrated system having an editor and a compiler. Same origin as Open Watcom, however, WATFOR-77 is not available as open source by today. If the authors are reading, it would be great if you would turn the DOS version of WATFOR-77 including the editor into open source!