FORTRAN: Using FORTRAN 1.0 with Pascal 1.2

Many Apple II FORTRAN programers have purchased or upgraded their operating
system.  They have discovered that the new system, the current version of
Pascal 1.2, rejects the FORTRAN compiler because it has the wrong version
number.

Change the version ID in the FORTRAN Compiler the easy way.  Use this program,
FORTRANFIX, to modify an Apple II FORTRAN Compiler so that it can be run under
Apple II Pascal 1.2 without getting a version error.

Load this entire file into the Pascal Editor.  These paragraphs will
substitute for the 1K header the editor expects to see at the beginning of a
text file. Make NO changes.  Quit the editor by choosing "U(pdate the work
file and leave".  Select "R(un" from the main command line.  FORTRAN users, be
sure to do this using your Pascal system and not your FORTRAN system.

When the program prompts you, place your FORT2:  diskette in drive 1.  Upon
completion, the FORTRAN compiler will be accepted by the Pascal 1.2 system.

program FORTRAN_FIX;
type Byte     = 0..255;
     Seg_Info = packed record
                  Mach_Type: 0..9;
                  Filler: 0..1;

                  Major_Revision: 0..7;
end;

var  Num   : integer;
     ch    : char;
     Buffer: packed array [0..511] of byte;
     F     : file;
     Trix  : record case boolean of
             true : (Temp: packed array [0..0] of Byte);
             false: (SI  : Seg_Info);
end;

procedure RESET_FILE (File_Name: string);
  begin
    {$I-}
    reset (F, File_Name);
    {$I+}
    if (IORESULT <> 0) then begin
      Num:= IORESULT;
      writeln (chr (7));
      writeln ('I/O ERROR #', Num, ' in opening ', File_Name);
      exit (program)
    end
  end; {Reset_File}

procedure READ_BLOCK (Block_Num: integer);
  var Block_Xfer: integer;
  begin
    {$I-}
    Block_Xfer:= BLOCKREAD (F, Buffer, 1, Block_Num);
    {$I+}
    if (IORESULT <> 0) then begin
      Num:= IORESULT;
      writeln (chr (7));
      writeln ('I/O ERROR #', Num, ' in reading from file.');
      exit (program)
    end
  end; {Read_Block}

procedure WRITE_BLOCK (Block_Num: integer);
  var Block_Xfer: integer;

  begin
    {$I-}
    Block_Xfer:= BLOCKWRITE (F, Buffer, 1, Block_Num);
    {$I+}
    if (IORESULT <> 0) then begin
      Num:= IORESULT;
      writeln (chr (7));
      writeln ('I/O ERROR #', Num, ' in writing to file.');
      exit (program)
    end
  end; {Write_Block}

begin {Main Program}
 writeln (chr(12)); {Erase screen}
 writeln ('FORTRANFIX');
 writeln;
 writeln ('Copyright 1984 Apple Computer, Inc.');
 writeln;
 writeln;
 write ('This program will modify an Apple II');
 writeln (' FORTRAN compiler so that it can');
 write ('be run under Apple II Pascal 1.2');
 writeln ('  without getting a version error.');
 write ('This program expects the FORTRAN compiler');
 writeln (' to be named SYSTEM.COMPILER.');
 repeat
   gotoxy (0,10);
   write (chr(11)); {Erase to end of screen}
   writeln ('Put the disk with SYSTEM.COMPILER in drive 1.');
   write ('Press RETURN when ready, ESC to exit program. ');
   read (ch);
   if (ch = chr(27)) then begin
     write (chr(12)); {Erase screen}

     exit (program)
   end;
   readln;
   RESET_FILE ('#4:SYSTEM.COMPILER');
   READ_BLOCK (0);

   Trix.Temp [0]:= Buffer [259];
   Trix.SI.Major_Revision:= 5;
   Buffer [259]:= Trix.Temp [0];

   WRITE_BLOCK (0);
   close (F, lock);
   writeln;
   writeln;
   writeln;
   write ('MODIFICATION COMPLETE - Press RETURN to continue.');
   readln
 until false
end. {FORTRAN_Fix}

Published Date: Feb 19, 2012