Wednesday, August 11, 2021

FORTRAN on the personal computer

For the last few months, I've been binging on FORTRAN.

FORTRAN was the first language I learned after BASIC.  I actually did a little FORTRAN in high school - before they kicked me off the school system's IBM mainframe.

FORTRAN was the first language that I did in college.  My year was actually the last that did FORTRAN for Computer Science.  But that FORTRAN "experience" got me a job at the GM Proving Grounds working on the FORTRAN programs that process data from crash tests.

Later, after some years of COBOL and then C, I went back to FORTRAN in GM on the HP 1000 at Powertrain (Systematic Engine Calibration).

So I've spent plenty of time with FORTRAN.

I picked up Microsoft FORTRAN 5.1 for the MS-DOS.  This is based on FORTRAN 77.  I was also able to locate Waterloo FORTRAN 77 too.

But I wanted to experiment with FORTRAN for CP/M and what I found was interesting.

I got Microsoft FORTRAN-80 for CP/M and LDOS (TRS-80) and it's based on FORTRAN ANSI standard from 1966 and there are "differences".

I'm going to call this version FORTRAN 66.

First, FORTRAN 66 has no character data type.  You store characters in other data types.  You can print a character type, but you are storing it in something else.

Print is another one.  FORTRAN 77 supports the PRINT statement - which is basically no more than a shortcut for WRITE to the console device.

Unformatted output doesn't work under FORTRAN-80 (I don't know if this is a FORTRAN 66 issue).  If you don't specify a FORMAT statement, the data is printed as a "character" type!

Compiling FORTRAN-80 is multiple steps:

1. Edit the source in the text editor of your choice.  I'm so glad that I have TE (a modern CP/M program) with a full screen editor.  But back in the day, they probably used Wordstar.

2. Then run the compiler, F80.  But you can't just pass a command line parameter.  It's run F80, wait.  Then enter <program rel>=<program source> and wait some more.  Control-C out of the compiler.

3. Optionally fix any compiler errors.

4. Run the linker, L80.  But, again, no command line parameters.  Run L80 and wait.  Since I just want to run the program, I just do <rel file>/g to link (and wait) and run.

Edit: F80 and L80 do take the commands as parameters.  They didn't under the TRS-80, but they do under CP/M.

It's no wonder FORTRAN never took off on the PC.  BASIC works so much better.  Then, after testing your program, you can compile it into an executable.

And keep in mind that, at this time, Microsoft was a premier software developer.  They usually did a great job compared to other companies.

Now, to get some time to test Nevada FORTRAN.

No comments: