More FORTRAN/PDP11/Dungeon/Zork fun

Thanks to the countless comments on the SIMH list, and the final missing step from Peter Schorn One of the source copies of Dungeon now builds.

If you want to follow along, you’ll need the pdp11 emulator from SIMH, and the following disk images (local mirror):

Then create an ini file like this:

set cpu 256k
set rq0 rx50
set rq1 rx50
set rq2 rx50
set rq3 rx50

att rk0 rtv4_rk.dsk
att rk1 dunsrc.dsk

boot rk0

Then go ahead and run it:

PDP-11 simulator V3.8-1
Disabling CR

RT-11SJ V04.00C

.D 56=5015

.TYPE V4USER.TXT
Welcome to RT-11 Version 4. RT-11 V04 provides new hardware support
and some major enhancements over Version 3B.

Please use the HELP command; it describes the new options in many
of the utilities.

If you are using a terminal that requires fill characters,
modify location 56 with a Deposit command before proceeding with
system installation. LA36 DECwriter II and VT52 DECscope terminals
do NOT require such modification.

.D 56=0

.

Hit Control+E and “insert” the first Fortran disk

Simulation stopped, PC: 156070 (MOV (SP)+,R2)
sim> att rx0 fortran-iv-v021-compiler-files.img
RX: buffering file in memory
sim> c

Then we are going to do the following:

.ASSIGN RK0: OUP

.ASSIGN DX0 INP

.R PIP
*SY:*.*=INP:FORTRA.HLP,DEMO.FOR
*^C

.RUN INP:FORGEN
Answer questions with:
“?” or carriage return (<CR>) for information,
YES(Y) for affirmation, anything else for NO.

A maximum of 56 lines are allowed per listing page.
Is this acceptable? Y
A maximum of 136 characters are allowed in a formatted
(ASCII) record. Is this acceptable? Y
A maximum of 6 channels may be open at a given time.
Is this acceptable? Y
The FORTRAN compiler can compile system-specific OPEN and CLOSE
statement keywords for RT-11, RSX-11, and RSTS/E systems. These
statements are currently compiled for the following system: RT-11
Is this acceptable? Y
FORTRAN can produce inline code for EAE, EIS or FIS hardware,
or it can produce threaded (THR) code which is hardware independent.
Should the compiler produce EAE code? N
Should the compiler produce EIS code? N
Should the compiler produce FIS code? N
Should the compiler produce THR code? Y
The inline compiler can optimize for SPEED or for SIZE. These
optimizations are mutually exclusive. Do you want
the optimization to be for SPEED? N
Do you wish a threaded only compiler? Y
Compiler options selection complete.

.@INP:F4LTHR

.R LINK
*OUP:FORTRA=INP:FROOT///S
*INP:F0,INLINE,OUP:DEFLTS/O:1
*INP:F1/O:1
*INP:F2/O:1
*INP:F3/O:1
*INP:F4/O:1
*INP:F5/O:1
*INP:F6/O:1
*INP:F7/O:1
*INP:F8/O:1
*INP:F9/O:1
*INP:F10/O:1
*INP:LOOP/O:1
*INP:F11/O:1
*INP:F12/O:1
*INP:F13/O:1
*INP:F14/O:1
*INP:F15/O:1
*INP:F16/O:1
*INP:F17/O:1
*INP:CDUMP/O:1//
*^C

.

Ok, now the compiler should be created. We next need to interrupt the emulator again (control+e) and insert the objecttime diskette. We will now build our Fortran library.

Simulation stopped, PC: 151412 (ASL R3)
sim> att rx0 fortran-iv-v021-objecttime-system.img
RX: writing buffer to file
RX: buffering file in memory
sim> c


.R LIBR

*OUP:FORLIB=INP:NHD,OTSCOM,NOVIR,V2NS/G
Global? $ERRS
Global? $ERRTB
Global? $VRINT
Global?
*^C

Now with that out of the way, we build a test program to make sure our compiler & library are working.

.COMPILE DEMO.FOR
.MAIN.

.LINK DEMO,FORLIB

.RUN DEMO
***** RT11 FORTRAN IV V2 DEMONSTRATION TEST *****

INSTALLATION SUCCESSFUL IF NO ERROR MESSAGES
WERE PRINTED ABOVE.

**** FORTRAN DEMONSTRATION TEST COMPLETE *****

Ok everything looks fine! Now onward to Dungeon! First we copy everything to the RK0 disk…

.COPY RK1:*.* *.*
Files copied:
RK1:ACTORS.FTN to DK:ACTORS.FTN
RK1:CLOCKR.FTN to DK:CLOCKR.FTN
RK1:DEMONS.FTN to DK:DEMONS.FTN
RK1:DGAME.FTN to DK:DGAME.FTN
RK1:DINIT.FTN to DK:DINIT.FTN
RK1:DMAIN.FTN to DK:DMAIN.FTN
RK1:DSUB.FTN to DK:DSUB.FTN
RK1:DUNGEO.DOC to DK:DUNGEO.DOC
RK1:DVERB1.FTN to DK:DVERB1.FTN
RK1:DVERB2.FTN to DK:DVERB2.FTN
RK1:GDT.FTN to DK:GDT.FTN
RK1:OBJCTS.FTN to DK:OBJCTS.FTN
RK1:RRND.MAC to DK:RRND.MAC
RK1:RSXTIM.MAC to DK:RSXTIM.MAC
RK1:SVERBS.FTN to DK:SVERBS.FTN
RK1:VERBS.FTN to DK:VERBS.FTN
RK1:VMSRND.MAC to DK:VMSRND.MAC
RK1:BALLOP.FOR to DK:BALLOP.FOR
RK1:DINDX.DAT to DK:DINDX.DAT
RK1:DSO1.FOR to DK:DSO1.FOR
RK1:DSO2.FOR to DK:DSO2.FOR
RK1:DSO3.FOR to DK:DSO3.FOR
RK1:DSO4.FOR to DK:DSO4.FOR
RK1:DSO5.FOR to DK:DSO5.FOR
RK1:DSO6.FOR to DK:DSO6.FOR
RK1:DSO7.FOR to DK:DSO7.FOR
RK1:LIGHTP.FOR to DK:LIGHTP.FOR
RK1:NOBJS.FOR to DK:NOBJS.FOR
RK1:NP.FOR to DK:NP.FOR
RK1:NP1.FOR to DK:NP1.FOR
RK1:NP2.FOR to DK:NP2.FOR
RK1:NP3.FOR to DK:NP3.FOR
RK1:NROOMS.FOR to DK:NROOMS.FOR
RK1:ROOMS.FOR to DK:ROOMS.FOR
RK1:RTTIM.FOR to DK:RTTIM.FOR
RK1:SOBJS.FOR to DK:SOBJS.FOR
RK1:VILLNS.FOR to DK:VILLNS.FOR
RK1:VMSTIM.FOR to DK:VMSTIM.FOR
RK1:D.ODL to DK:D.ODL
RK1:DTEXT.DAT to DK:DTEXT.DAT
RK1:RSTSCB.CTL to DK:RSTSCB.CTL
RK1:RSXBLD.CMD to DK:RSXBLD.CMD
RK1:RSXCMP.CMD to DK:RSXCMP.CMD
RK1:RTBLD.COM to DK:RTBLD.COM
RK1:RTCMP.COM to DK:RTCMP.COM
RK1:VMSBLD.COM to DK:VMSBLD.COM
RK1:VMSCMP.COM to DK:VMSCMP.COM

Then we need to make some space…

.DELETE *.DAT
Files deleted:
DK:DINDX.DAT ? Y
DK:DTEXT.DAT ? Y

Now we can compile the fortran

.@RTCMP

.COM/NOLINE DMAIN.FTN,DGAME.FTN,DSUB.FTN
DUNGEO
GAME
XENDMV
XVEHIC
RSPEAK
RSPSUB
RSPSB2
OBJACT
BUG
NEWSTA
QHERE
QEMPTY
JIGSUP
?FORTRAN-I-[JIGSUP] Errors: 0, Warnings: 4
OACTOR
PROB
RMDESC
RAPPLI

.COM/NOLINE DINIT.FTN
INIT
PROTCT

.COM/NOLINE NP,NP1,NP2,NP3
RDLINE
PARSE
ORPHAN
LEX
SPARSE
?FORTRAN-I-[SPARSE] Errors: 0, Warnings: 1
GETOBJ
?FORTRAN-I-[GETOBJ] Errors: 0, Warnings: 1
SCHLST
?FORTRAN-I-[SCHLST] Errors: 0, Warnings: 2
THISIT
SYNMCH
UNPACK
SYNEQL
TAKEIT
GWIM

.COM/NOLINE/NOVEC GDT.FTN
GDT

.COM/NOLINE VERBS.FTN,OBJCTS.FTN
VAPPLI
?FORTRAN-I-[VAPPLI] Errors: 0, Warnings: 1
CLOCKD
OAPPLI

.COM/NOLINE SVERBS.FTN,DVERB1.FTN,DVERB2.FTN,ACTORS.FTN,DEMONS.FTN,CLOCKR.FTN
SVERBS
TAKE
DROP
PUT
VALUAC
SAVEGM
RSTRGM
WALK
CXAPPL
AAPPLI
THIEFD
?FORTRAN-I-[THIEFD] Errors: 0, Warnings: 3
FIGHTD
BLOW
SWORDD
?FORTRAN-I-[SWORDD] Errors: 0, Warnings: 1
INFEST
CEVAPP
?FORTRAN-I-[CEVAPP] Errors: 0, Warnings: 4
LITINT

.COM/NOLINE ROOMS.FOR,NROOMS.FOR
RAPPL1
?FORTRAN-I-[RAPPL1] Errors: 0, Warnings: 2
RAPPL2
?FORTRAN-I-[RAPPL2] Errors: 0, Warnings: 1
LOOKTO
EWTELL

.COM/NOLINE SOBJS.FOR,NOBJS.FOR,BALLOP.FOR,LIGHTP.FOR,VILLNS.FOR
SOBJS
?FORTRAN-I-[SOBJS ] Errors: 0, Warnings: 1
NOBJS
?FORTRAN-I-[NOBJS ] Errors: 0, Warnings: 2
MIRPAN
BALLOP
LIGHTP
TROLLP
CYCLOP
THIEFP
?FORTRAN-I-[THIEFP] Errors: 0, Warnings: 2

.COM/NOLINE DSO1.FOR,DSO2.FOR,DSO3.FOR,DSO4.FOR,DSO5.FOR,DSO6.FOR,DSO7.FOR
PRINCR
?FORTRAN-I-[PRINCR] Errors: 0, Warnings: 2
INVENT
?FORTRAN-I-[INVENT] Errors: 0, Warnings: 1
PRINCO
MOVETO
SCORE
SCRUPD
FINDXT
FWIM
YESNO
ROBADV
?FORTRAN-I-[ROBADV] Errors: 0, Warnings: 1
ROBRM
?FORTRAN-I-[ROBRM ] Errors: 0, Warnings: 1
WINNIN
FIGHTS
VILSTR
GTTIME
OPNCLS
LIT
?FORTRAN-I-[LIT ] Errors: 0, Warnings: 1
WEIGHT
?FORTRAN-I-[WEIGHT] Errors: 0, Warnings: 1
GHERE
MRHERE
ENCRYP
CPGOTO
?FORTRAN-I-[CPGOTO] Errors: 0, Warnings: 1
CPINFO

.COM/NOLINE RTTIM.FOR
ITIME

.COM RRND.MAC
ERRORS DETECTED: 0

So far so good. Now we can delete the source from our primary disk, take note that we don’t delete the demo program:

.DELETE *.FOR
Files deleted:
DK:DEMO.FOR ? N
DK:BALLOP.FOR ? Y
DK:RTTIM.FOR ? Y
DK:VMSTIM.FOR ? Y
DK:DEMOF1.FOR ? Y
DK:DSO3.FOR ? Y
DK:TEST55.FOR ? Y
DK:GETSTR.FOR ? Y
DK:PUTSTR.FOR ? Y
DK:DSO1.FOR ? Y
DK:DSO2.FOR ? Y
DK:DSO4.FOR ? Y
DK:DSO5.FOR ? Y
DK:DSO6.FOR ? Y
DK:DSO7.FOR ? Y
DK:LIGHTP.FOR ? Y
DK:NOBJS.FOR ? Y
DK:NP.FOR ? Y
DK:NP1.FOR ? Y
DK:NP2.FOR ? Y
DK:NP3.FOR ? Y
DK:NROOMS.FOR ? Y
DK:ROOMS.FOR ? Y
DK:SOBJS.FOR ? Y
DK:VILLNS.FOR ? Y

Next we need to remove the ftn files:

.DEL *.FTN
Files deleted:
DK:ACTORS.FTN ? Y
DK:CLOCKR.FTN ? Y
DK:DEMONS.FTN ? Y
DK:DGAME.FTN ? Y
DK:DINIT.FTN ? Y
DK:DMAIN.FTN ? Y
DK:DSUB.FTN ? Y
DK:DVERB1.FTN ? Y
DK:DVERB2.FTN ? Y
DK:GDT.FTN ? Y
DK:OBJCTS.FTN ? Y
DK:SVERBS.FTN ? Y
DK:VERBS.FTN ? Y

Now we are going to link our executable dungeo.sav . However the default link procedures will not work for us, it’s just easier to paste this entire thing into the console.

.LINK/INCLU/PRO/MAP:NL:/BOT:1200/EXE:DUNGEO DMAIN,DGAME,DSUB,RRND,RTTIM
*DINIT,GDT/O:1
*NP,NP1,NP2,NP3/O:1
*VERBS,OBJCTS/O:1
*SVERBS/O:2
*DVERB1/O:2
*DVERB2/O:2
*ACTORS/O:2
*DEMONS/O:2
*CLOCKR/O:2
*ROOMS/O:3
*NROOMS/O:3
*SOBJS/O:3
*NOBJS/O:3
*BALLOP,LIGHTP,VILLNS/O:3
*DSO1/O:4
*DSO2/O:4
*DSO3/O:4
*DSO4/O:4
*DSO5/O:4
*DSO6/O:4
*DSO7/O:4
*SY:FORLIB//
Library search? $SHORT
Library search?

Now we don’t need the object files anymore they can be deleted. However we are NOT going to delete the system objects so this isn’t a wholesale deletion.

.DEL *.OBJ
Files deleted:
DK:SYSLIB.OBJ ? N
DK:ODT.OBJ ? N
DK:VDT.OBJ ? N
DK:VTHDLR.OBJ ? N
DK:PLOT55.OBJ ? N
DK:DEFLTS.OBJ ? N
DK:FORLIB.OBJ ? N
DK:DEMO.OBJ ? Y
DK:DMAIN.OBJ ? Y
DK:DGAME.OBJ ? Y
DK:DSUB.OBJ ? Y
DK:DINIT.OBJ ? Y
DK:NP.OBJ ? Y
DK:NP1.OBJ ? Y
DK:NP2.OBJ ? Y
DK:NP3.OBJ ? Y
DK:GDT.OBJ ? Y
DK:VERBS.OBJ ? Y
DK:OBJCTS.OBJ ? Y
DK:SVERBS.OBJ ? Y
DK:DVERB1.OBJ ? Y
DK:DVERB2.OBJ ? Y
DK:ACTORS.OBJ ? Y
DK:DEMONS.OBJ ? Y
DK:CLOCKR.OBJ ? Y
DK:ROOMS.OBJ ? Y
DK:NROOMS.OBJ ? Y
DK:SOBJS.OBJ ? Y
DK:NOBJS.OBJ ? Y
DK:BALLOP.OBJ ? Y
DK:LIGHTP.OBJ ? Y
DK:VILLNS.OBJ ? Y
DK:DSO1.OBJ ? Y
DK:DSO2.OBJ ? Y
DK:DSO3.OBJ ? Y
DK:DSO4.OBJ ? Y
DK:DSO5.OBJ ? Y
DK:DSO6.OBJ ? Y
DK:DSO7.OBJ ? Y
DK:RTTIM.OBJ ? Y
DK:RRND.OBJ ? Y

Now with enough disk space free’d we can copy back the database files needed

.COPY RK1:*.DAT *.*
Files copied:
RK1:DINDX.DAT to DK:DINDX.DAT
RK1:DTEXT.DAT to DK:DTEXT.DAT

And now we can run dungeon!

.R DUNGEO
Welcome to Dungeon. This version created 18-JUL-80.
You are in an open field west of a big white house with a boarded
front door.
There is a small mailbox here.
>HISTORY
Revision history:

18-JUL-80 Transportable data base file (V2.5A).
28-FEB-80 Compressed text file (V2.4A).
15-NOV-79 Bug fixes (V2.3A).
18-JAN-79 Revised DECUS version (V2.2A).
10-OCT-78 Puzzle Room (V2.1A).
10-SEP-78 Endgame (V2.0A).
10-AUG-78 DECUS version (V1.1B).
14-JUN-78 Public version with parser (V1.1A).
4-MAR-78 Debugging version (V1.0A).
>QUIT
Your score would be 0 [total of 585 points], in 2 moves.
This gives you the rank of Beginner.
Do you wish to leave the game?
Y

.

You can always hit control+e to exit SIMH.

Well there you have it, the Fortran installation, compilation, linking & execution of the oldest source version I can find at the moment of Dungeon/Zork. Who knows, maybe someday this may help someone revive other old programs.

This entry was posted in Fortran, pdp11, SIMH, Zork by neozeed. Bookmark the permalink.
avatar

About neozeed

What is there to tell? I’ve loved UNIX like things since I was first exposed to QNX in highschool (we had the Unisys ICONS!), and spent the better time of my teenage years trying to get my own UNIX… I should have bought Coherent in retrospect.. Anyways latched onto Linux in 1992, and then got some old BSD admin books and have been hooked on the VAX BSD & other big/ancient things since…!

One thought on “More FORTRAN/PDP11/Dungeon/Zork fun

  1. Thanks for this article – it was quite fascinating to watch the object files being built, and the finished game is fun to play. I slowed my SIMH down to 1M (‘set throttle 1M’) to give it that ‘big, important machine’ feeling – silly, I know, but I feel that a system is more powerful if it’s slow – it must be doing something seriously complex if it’s taking that long..
    It might be worth me pointing this out (I’m tired and not too bright anyway), but when the object files are linked in LIBR, you press Enter – or ‘RETURN’ as us old fogies still call it – and then press Control-C to exit. When I did this the first time, I just pressed Control-C and was a bit puzzled when the linker failed.

Leave a Reply

Your email address will not be published.

Notify me of followup comments via e-mail. You can also subscribe without commenting.