If you have access to the 1401 version of SIMH you can compile and run 1401 FORTRAN programs. SIMH is a multi-target emulator. The usual name for the 1401 version is i1401.

The files here include:

You might want to start really simply, with HELLO.txt. ( All FORTRAN source files on this page have a .txt extension, hoping to avoid issues with webserver and browser expectations about file types. ) Notice the first line, which starts out with PARAM. This is how options are passed to the compiler. The PARAM card is (partially) explained Here, The most useful options are probably the length in decimal digits (1-20) of integers (default 5) and floating point mantissa (default 8). A masochist, might want to reduce the memory size (default 16K) of the machine you want the code to run on.

The sources include EXAMPLE1B.txt a modified version EXAMPLE1. That original version has some, shall we say, idiosyncratic constructs (aka Unwarranted Chumminess with the Compiler), apparently to fit in 8K. When these are changed, as in EXAMPLE1B, the resulting output is the same, but you will need more memory to run the result. I suspect that EXAMPLE1 was originally written straightforwardly, but since IBM advertised that FORTRAN would run in 8K, it had to be made to fit in the smaller memory, with the resulting oddness.

As an example of compiling and running under SIMH, I often use the following as a SIMH script:


attach mt1 v3m0.simh.mt1
attach cdr %1
attach cdp %2
set LPT 48 FORTRAN
attach lpt %3
boot mt1
cont
quit
where %1, %2, %3 are positional parameters. When SIMH is run with arguments on the command line:

i1401 runftn src obj lst
the parameters following script name are substituted in order.

Let's break that down (including parameter substitution):


attach mt1 v3m0.simh.mt1 Attach emulated tape v3m0.simh.mt1 to tape unit 1 (mt1).
attach cdr src Attach the source "deck" to the Card Reader (cdr)
attach cdp obj Output to the card punch (cdp)
set lpt 48 FORTRAN Select the printed output character set.
There are many versions of 1401 SIMH where this is broken in various ways. Beyond the scope of this page. What we are asking for is a (typical) 48 character print chain, with the characters that change between the Business and Scientific set selected to be the Scientifc (FORTRAN) set.

attach lpt lst "printed" output goes here.
Output will be appended if lst exists. Similarly for output to cdp.
boot mt1
  Boot from Mag Tape unit 1

cont Continue after halt that asks if you want to run the newly compiled code.
If there were errors in compilation, you won't be offered this option, and the "Continue" will attempt to compile the (non existent) next program. This will cause another error but is otherwise harmless.
Before continuing, you could attach a data deck to CDR, if your program needs to read data.
quit