The "original" Colossal Cave Adventure for DOS ============================================== A few days ago I stumbled upon Dan Nelson's port of the original PDP-10 FORTRAN source code by Crowther and Woods /1/ to ANSI FORTRAN 77 /2/ in the Interactive Fiction Archive. As I couldn't find a pre-compiled Windows binary for this port, I used gfortran 9.2.0 for building my own Windows executables. Please have a look at the content of advent-orig-nelson-win.zip for the executables, updated source files and further information. Then I thought, why not try building executables for DOS. Maybe sometime in the future I would reactivate my old computers and would like to play adventure in pure MS-DOS 5.0 environment. One should have a dream... On the internet I found a g77 implementation for DOS bundled with the EMX DOS-extender (GNU Fortran 0.5.19 (EMX)). It was possible to compile the port after commenting out one line in advent.for (line 3250) and the same line in wiz.for (line 41): C INTRINSIC TIME,LTIME During compilation of advent.for using the optimization parameter -O2, I did receive the error message: 'virtual memory exhausted'. Without optimization the compilation finished successfully. The final build required the EMX DOS-extender at runtime. Honestly, I did not like this build. Then I remembered from the 90s that there was DJGPP, a port of GCC by DJ Delorie, where I could possibly find a more suitable g77 implementation. What a surprise! The DJGPP project seems to be well alive /3/. I found a suitable version of g77 as well as several versions of gfortran. I tried only two of the available compilers: g77 : GNU Fortran (GCC) 3.4.6 gfortran: GNU Fortran (GCC) 9.2.0 I finally compiled the port using gfortran 9.2.0*. I copied cwsdpmi5 stub and coff files together**. The executables have been packed with UPX 3.95d /4/. Due to cwsdpmi at least a 80386 processor and DOS 3.0 or higher are required for running the executables. The executables have only been tested in DOSBox 0.74 /5/ as I was to lazy to reactivate my old machines just now. This archive contains following files: advent.dat data file converted by Dan Nelson advent.exe pre-compiled executable for advent advent.for updated source file for advent make.bat batch file for compiling advent and wiz (gfortran) make-g77.bat batch file for compiling advent and wiz (g77) README README by Dan Nelson README.dos this file wiz.exe pre-compiled executable for wiz wiz.for updated source file for wiz The included source files for advent and wiz are the same ones, which I used for compilation of the windows binaries. All credits for the source port of the original adventure and, again, big thanks go to Dan Nelson. Hartmut Kuehne Dec 15, 2019 Update: "You fell into a pit..." ================================ Of course, it had to happen: When compiling the sources with gfortran 9.2.0, I did fall, full of confidence, into a pit prepared only for me by the developers of the gfortran compiler. I did not break my neck, but the random number generator. No dwarfs, no pirate, no escape from Witt's End... According to the documentation of gfortran 9.2.0 /6/, the compiler does provide an intrinsic function RAN as alias for RAND for compatibility with HP FORTRAN 77/iX. This intrinsic function has been called instead of advent's own random number generator function RAN. After declaring RAN as external procedure (EXTERNAL RAN) the dwarfs did return! This archive contains now the updated sources and binaries. Jan 04, 2020. References: /1/ https://www.ifarchive.org/if-archive/games/source/advent-original.tar.gz /2/ https://www.ifarchive.org/if-archive/games/source/advent-orig-nelson.tar.gz /3/ http://www.delorie.com/djgpp/ /4/ https://upx.github.io/ /5/ https://www.dosbox.com/ /6/ https://gcc.gnu.org/onlinedocs/gfortran/RAN.html Notes below: *) I downloaded following files from DJGPP project: Base installation: v2gnu\bnu2331b.zip v2misc\csdpmi5b.zip v2\djdev205.zip v2\djtzn205.zip v2\faq230b.zip v2gnu\mak421b.zip v2\readme.1st v2gnu\txi413br3.zip g77: GNU Fortran (GCC) 3.4.6 v2gnu\g77346b.zip v2gnu\gcc346b.zip gfortran: GNU Fortran (GCC) 9.2.0 v2gnu\gcc920b.zip v2gnu\gfor920b.zip I did extract the zip archives into the directory C:\DJGPP using pkunzip -d *.zip After setting the default environment variables we are good to go: SET DJGPP=C:\DJGPP\DJGPP.ENV SET PATH=C:\DJGPP\BIN;%PATH% **) If you want to compile the game by yourself in DOSBox, a real DOS command shell (e.g. COMMAND.COM from original MS-DOS distribution) is necessary. The copy command of DOSBox does not support the /b parameter required for combining cwsdstub.exe and the coff files to standalone executables. You would compile the source files using gfortran issuing following command: c:\command.com /c make.bat