While going through my stuff, I did manage to find some diskettes for Microsoft FORTRAN PowerStation 1.0 I recall using this under Windows 3.1 but there was some reason we never really used it under Windows 95 & NT (Found it 9 years later!)
So, I loaded it up on a VM with Windows 3.1 and quickly found out why: While it produces win32 exe’s they are built with pre-release tools, and will *NOT* work under any released version of Windows NT, (Yes, including Windows NT 3.1!!).
I’m sure others may find themselves down the path with failed exe’s that crash with:
RtlExAllocateHeap not found in ntdll.dll
Microsoft had a fix, named beta2fix. It renamed the references to ntdll.dll into beta2.dll. Which sounds fun, except the resulting exe’s DONT WORK. Nothing like a ‘solution’ that took missing references into exe’s that just crash.
Naturally the ‘fix’ is to upgrade to 4.0 which.. is impossible to find, or track down Compaq fortran, or even Intel fortran. Or just run it in a MS-DOS/Windows 3.1 VM and be happy for emulation.
But I figured what the hell, perhaps it’s possible to replace some of the key parts with old versions of Visual C++ and use HX DOS as an extender instead of an ancient Phar Lap TNT.
Googling around, the issue lies with the linker, link32.exe.
Now on my Visual C++ 1.0 cd there is a link32.exe that just calls link.exe. On the Visual C++ 2.0 & 4.0 CD’s there is no link32.exe. Seeing that Visual C++ 1.0 just calls through I just made a ‘stub’ program to call link.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main(int argc,char* argv[])
{
char command[255];
int rc;
int j;memset(command,0x0,sizeof(command));
sprintf(command,”link “);
j=1;
while(j<argc)
{
sprintf(command,”%s %s”,command,argv[j]);
j++;
}
printf(“running [%s]\n”,command);
rc=system(command);
printf(“return code was %d\n”,rc);
if(rc==-1)
{printf(“I think it’s too many nested DPMI things between TNT & whatnot\n”);}
}
Ok, it’s not work of art, but it’ll get the job done. You’ll need some kind of MS-DOS 16 bit real mode compiler to build this thing. I would imagine Watcom’s C++ compiler can still build 16bit dos realmode exe’s, or Borland has something in their museum thing. I’m using QuickC for Windows in a Windows 3.0 VM
Ok so now with our ‘link32.exe’ replacement, copy it into the f32\bin directory overwriting the existing one.
Next we will need the link.exe from Visual C++ 2.0 (or higher I figure), and copy that into the f32\bin directory, along with its needed files dbi.dll & msvcrt20.dll.
Next, download and unzip the HX runtime And you can either place it’s bin directory onto the fl32\bin, or unzip it to it’s own directory, and add a statement in your autoexec.bat adding it’s bin directory to the path.
Reboot to pick up the hxrt’s bin directory, unless you copied its bin into fl32\bin
Now we need to alter Visual C++ 2.0’s linker to run under MS-DOS. Simply run:
pestub \f32\bin\link.exe
And now you should be able to run link.exe under MS-DOS.
Finally replace the libc.lib & kernel32.lib with ones from your Visual C++. Naturally these are in the \f32\lib directory. Visual C++ 2.0 will link without complaining, 4.0 gives some weird messages, but it still works. I never did test Visual C++ 6.0 & beyond.
So, building a simple ‘hello.for’ (mention in the prior blog post)
c:\F32>fl32 hello.for
Microsoft (R) FORTRAN PowerStation Optimizing Compiler Version 1.0
Copyright (c) Microsoft Corp 1984-1993. All rights reserved.hello.for
Microsoft (R) 32-Bit Incremental Linker Version 2.50
Copyright (C) Microsoft Corp 1992-94. All rights reserved.-out:hello.exe
-debug:none
-machine:i386
-base:0x00010000
-subsystem:console
-entry:mainCRTStartup
-stack:32768,4096
-defaultlib:libf.lib,libc.lib,kernel32.lib,ntdll.lib
hello.obj
running [link -link @C:\TEMP\003635lk]
return code was 0
The only caveat here, is that because of HXDOS it *thinks* it’s running on Windows NT, (beta 2!) and will not run the bindmsf.exe program Not that it mattered as it was broken. I suppose if I were braver, I could read the link file, and scan for a ‘-out’ and run pestub on the output.. But I don’t so you will have to. Otherwise, when you run hello.exe you’ll get:
This program cannot be run in DOS mode.
But running pestub.exe:
c:\F32>pestub hello.exe
pestub: hello.exe modified successfullyC:\F32>hello
HELLO!
Ok, so with all this work, we’ve managed to restore the basic functionality of Microsoft Fortran here. Now the bigger question, will hello.exe run on say Windows Vista x64?
C:\Users\neozeed\dos\F32>ver
Microsoft Windows [Version 6.0.6002]
C:\Users\neozeed\dos\F32>hello
HELLO!
Not too bad, eh?
Oh, and onto zork:
c:\F32\DUNGEON>fl32 *.for
Microsoft (R) FORTRAN PowerStation Optimizing Compiler Version 1.0
Copyright (c) Microsoft Corp 1984-1993. All rights reserved.ACTORS.FOR
BALLOP.FOR
CLOCKR.FOR
DEMONS.FOR
DEMONS.FOR(520) : warning F4999: RLIGHT : variable declared but not used
DEMONS.FOR(520) : warning F4999: RSER : variable declared but not used
DGAME.FOR
DGAME.FOR(781) : warning F4999: PROTCT : variable declared but not used
DMAIN.FOR
DSO.FOR
DSUB.FOR
DVERB1.FOR
DVERB2.FOR
GDT.FOR
MACHDEP.FOR
NOBJS.FOR
NP.FOR
NP.FOR(397) : warning F4999: DFLAG : variable declared but not used
NP.FOR(397) : warning F4999: QHERE : variable declared but not used
NP.FOR(507) : warning F4999: DFLAG : variable declared but not used
NP.FOR(780) : warning F4999: DFLAG : variable declared but not used
NP.FOR(1154) : warning F4999: DFLAG : variable declared but not used
NP.FOR(1277) : warning F4999: DFLAG : variable declared but not used
NP2.FOR
OBJCTS.FOR
ROOMS.FOR
ROOMS.FOR(1195) : warning F4999: F : variable declared but not used
SVERBS.FOR
VERBS.FOR
VILLNS.FOR
Microsoft (R) 32-Bit Incremental Linker Version 2.50
Copyright (C) Microsoft Corp 1992-94. All rights reserved.-out:ACTORS.exe
-debug:none
-machine:i386
-base:0x00010000
-subsystem:console
-entry:mainCRTStartup
-stack:32768,4096
-defaultlib:libf.lib,libc.lib,kernel32.lib,ntdll.lib
ACTORS.obj
BALLOP.obj
CLOCKR.obj
DEMONS.obj
DGAME.obj
DMAIN.obj
DSO.obj
DSUB.obj
DVERB1.obj
DVERB2.obj
GDT.obj
MACHDEP.obj
NOBJS.obj
NP.obj
NP2.obj
OBJCTS.obj
ROOMS.obj
SVERBS.obj
VERBS.obj
VILLNS.obj
running [link -link @C:\TEMP\000731lk]
return code was 0
The exe works fine on Vista, and pestub will allow it to run on MS-DOS.
*NOTE that the fortran compiler will *NOT* run on Vista/XP/NT. The compiler was also linked with bad libraries & linker and it just won’t work. I doubt forcedos would help for 32bit NT systems as the phar lap stuff is all out of date. However DOSBox will happy run the compiler.
I haven’t even tried to debug anything, as I figure the best environment would have been a virgin copy of PowerStation 1.0 running under Windows 1.0 I did say keep a copy right!!!