forked from devshane/zork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
History
338 lines (313 loc) · 23.8 KB
/
History
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
This is an upward revision based on the public domain source code to the original DUNGEON game (Zork I),
which was released to the public domain by Infocom.
It includes the source files, headers, and information.
History of the C and Unix f77 Implementations of Dungeon
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
This version of Zork is a translation from the original, written in MDL, initially into DEC FORTRAN.
The original documentation, not included here, was in a file named ‟dungeon.doc”.
Notes on the Unix/pdp implementation were in a file named ‟PDP.doc”, which is reflected by the summary to follow.
It was modified from this source so that it would compile and execute on Unix[TM] Systems using the f77 FORTRAN Compiler.
It was later translated from FORTRAN to C, with the help of f2c, the FORTRAN to C translator written by
David Gay (AT&T Bell Labs), Stu Feldman (Bellcore), Mark Maimone (Carnegie-Mellon University), and Norm Schryer (AT&T Bell Labs).
The f77 FORTRAN version was later modified to work with g77, before being included in this repository,
and has now been modified to work with gfortran and made compatible with Fortran 2018.
The original translation to C, included in a separate repository, and now also linked to here,
has been used to guide a new, independent, translation here to C99, which the earlier translation has also been upgraded to.
Both C translations are bring progressively merged into one.
History Log
━━━━━━━━━━━
MDL
───
1978/03/04 V1.0A Debugging version.
1978/06/14 V1.1A Public version with parser.
1978/08/10 V1.1B DECUS version.
1978/09/10 V2.0A Endgame.
1978/10/10 V2.1A Puzzle Room.
1979/01/18 V2.2A Revised DECUS version.
1979/11/15 V2.3A Bug fixes.
1980/02/28 V2.4A Compressed text file.
1980/07/18 V2.5A Transportable data base file.
Fortran
───────
1980/10/08 DEC Fortran version (announced in 1980 in the RT-11 SIG newsletter)
1981/11/17 DEC Fortran to f77 Conversion for PDP-11 machines
1985/12 Converted from PDP to Vax
1986/12/11 Cleanup I (common declarations extracted to include files, comments added)
1987/02/09 Cleanup II, the PDP and Vax versions were merged.
A shell escape and wizard mode (for gdt) were added.
A man page was produced, based on ‟dungeon.doc”.
1987/02/11 V2.6A Converted to f77/Unix.
1987/09/14 V2.6B Converted to f77/Unix for pdps and Vaxen.
1990/01/01 V3.0A
1994/02/01 V3.1A
1994/10/01 V3.2A
1994/12/08 V3.2B
ANSI C (C1991)
──────────────
1991/03/11 V2.7A Converted to C (based on V2.6B).
The ‟f2c” library generated by the translator was nativized, internalized, reduced and eliminated.
The database and index files were reformatted and combined.
2021/10/12 V2.8A Converted to C99 (based partly on V2.6A, with some V2.6B-specific code modified or retracted).
C99 (C2021)
───────────
2021/09/27 V2.8A Converted to C99 (based on V2.6A and partly also on V2.7A).
History Summary
━━━━━━━━━━━━━━━
I. 1980/10/08: From the original documentation ...
──────────────────────────────────────────────────
To: Dungeon Players
From: ‟The Translator”
Subj: Game Information
Date: 8-OCT-80
This is the first (and last) source release of the PDP-11 version of Dungeon.
Please note that Dungeon has been superceded by the game ZORK(tm).
The following is an extract from the new product announcement for ZORK in the September, 1980 issue of the RT-11 SIG newsletter:
‟‛ZORK: The Great Underground Empire - Part I’ ...
was developed by the original authors based on their ZORK (Dungeon) game for the PDP-10.
It features a greatly improved parser; command input and transcript output files;
SAVEs to any device and file name; and adaptation to different terminal types, including a status line on VT100s.
Note: this is not the FORTRAN version that has been available through DECUS.
This version has been completely rewritten to run efficiently on small machines -
up to 10 times as fast as the DECUS version.
... ZORK runs under RT-11, HT-11, or RSTS/E and requires as little as 20K words of memory and a single floppy disk drive.
The game package, consisting of an RX01-format diskette and an instruction booklet,
is available from Infocom, Inc., P.O. Box 120, Kendall Station, Cambridge, Ma. 02142.”
ZORK(tm) is a trademark of Infocom, Inc.
It is available for several popular personal computers as well as for the PDP-11.
Summary
⋯⋯⋯⋯⋯⋯⋯
Welcome to Dungeon!
Dungeon is a game of adventure, danger, and low cunning.
In it you will explore some of the most amazing territory ever seen by mortal man.
Hardened adventurers have run screaming from the terrors contained within.
In Dungeon, the intrepid explorer delves into the forgotten secrets of a lost labyrinth deep in the bowels of the earth,
searching for vast treasures long hidden from prying eyes, treasures guarded by fearsome monsters and diabolical traps!
No DECsystem should be without one!
Dungeon was created at the Programming Technology Division of the MIT Laboratory for Computer Science
by Tim Anderson, Marc Blank, Bruce Daniels, and Dave Lebling.
It was inspired by the Adventure game of Crowther and Woods, and the Dungeons and Dragons game of Gygax and Arneson.
The original version was written in MDL (alias MUDDLE).
The current version was translated from MDL into FORTRAN IV by a somewhat paranoid DEC engineer who prefers to remain anonymous.
On-line information may be obtained with the commands HELP and INFO.
II. 1981/11/17: DEC FORTRAN to f77 Conversion
─────────────────────────────────────────────
The conversion from DEC FORTRAN to Unix f77 was done by Randy Dietrich, Lynn Cochran and Sig Peterson.
Much hacking was done to get it to fit in the limited address space of a PDP-11/44 (split I/D).
Suffice it to say that by leaving out the debugging package and not linking in the f77 I/O library they managed to get it to run.
III. 1985/12: PDP to VAX
────────────────────────
Based on the work of Randy, Lynn and Sig, Bill Randle folded in the full save/restore functions
and the game debugging package (gdt) into the pdp version to create a Vax/Unix version.
This version also uses f77 I/O, thus eliminating the extra speak and listen processes needed on the pdp.
IV. 1986/12/11: Cleanup I
─────────────────────────
John Gilmore (hoptoad!gnu) cleaned up the source files by moving most of the common declarations into include files
and added comments from the original (FORTRAN or MDL?) source.
His efforts are greatly appreciated.
V. 1987/02/09: Cleanup II
─────────────────────────
Bill Randle ([email protected]) added the pdp dependencies back into the Vax source files with #ifdefs
in order to have just one set of sources.
Previously, there were two sets of source: one for the pdp and one for the Vax.
In addition, a shell escape of the form !cmd was added and the wizard can enter the gdt without having to recompile the source.
Finally, a man page was generated, based on the dungeon.doc file.
VI. 1991/03/11: f77 to C
────────────────────────
Ian Lance Taylor ([email protected] or uunet!airs!ian) used the f2c translator to generate C source code.
The resulting code was modified to remove the FORTRAN I/O library, to add more simple processing,
and to change the format of the database file.
Andre Srinivasan ([email protected]) help test it.
Jonathan Mark (uunet!microsoft!jonm) made it work under MS-DOS and Microsoft C.
C99 (C2021) Translation & Upgrades
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2021/09/14 The raw translation of the Fortran source into C, using f2c (version 20190311).
Common Blocks are translated incorrectly and #include's are inserted in-line.
All of that has to be fixed and undone.
The file ‟Translate.log” contains some of the details provided by the translator.
2021/09/14 A first Makefile has been added.
This assumes that the f2c library and the include file ‟f2c.h” have been installed
The file ‟Compile.log” contains some of the details provided by the first run of ‟make”.
2021/09/14 The undefined function itime() has been resolved with a ‟fallback” function ITime().
2021/09/14 The ‟f2c.h” file has been internalized as ‟F2C.h”.
Additional normalization has been done on the source code layout.
2021/09/14 Most of ‟F2C.h” has been nativized to C and eliminated.
2021/09/14 Move the declarations of ‟built-in” functions (defined in the f2c library) to "F2C.h".
Further information on the f2c library and utility may be found in https://www.netlib.org/f2c/f2c.pdf.
2021/09/15 Collating the definitions of the common blocks into ‟common.c”.
2021/09/15 Eliminated the duplicate common block definitions from ‟common.c”.
Compilation is now possible, but no baseline has yet been established.
Hidden size-dependencies for data I/O exist, which crash the file I/O.
2021/09/15 Added the data/configuration files d{indx,text}.dat as symbolic links (for now).
2021/09/15 Normalized the layout of the comments.
2021/09/15 Strength reduction:
∙ lifted input-only function parameters to value parameters.
∙ lifted output-only parameters to return values, when singular.
∙ commented out unused parameters.
∙ eliminated ‟Void”, after reducing it to ‟void”.
No effect on the compile-time or run-time baselines.
2021/09/16 Encapsulation of the f2c library in F2C.c; as a first step to nativizing and replacing it.
The program crashes occur in the f2c library functions, and these need to be replaced and fixed.
2021/09/16 Elimination of static constant parameters.
2021/09/16 Collating the in-line inserted ‟include” files; in preparation of removing them back to include files.
2021/09/16 Regularized the translated copies of the ‟include” files and their common block and equivalence definitions.
2021/09/17 The in-line versions of ‟parser.h” have been regularized and extracted, first.
2021/09/17 The in-line versions of ‟vocab.h” have been regularized and extracted, next,
and combined with ‟parser.h” into ‟parse.h”.
2021/09/17 The initializations and comments in blkdata.c have been realigned to the form they had originally in Fortran.
The extraneous includes in blkdata.c have been removed both here and in the Fortran version.
2021/09/17 Documented the translation error in the original Fortran and C versions ‟blkdata.{f,c}” in ‟Translate.log”.
2021/09/17 Collated the remaining in-line includes into ‟parse.h” and renamed the file ‟common.h”.
In the 1991 version of the C program, most of the role of its ‟parse.h” is played, here, by ‟blkdata.c”,
while its ‟vars.h” corresponds, here, to ‟common.h”.
2021/09/18 Extracted the in-line include files out into ‟common.h”.
Regularized the names of the common block types.
2021/09/18 Separated the external function declarations and the function list in ‟Translate.log” out to ‟extern.h”.
2021/09/18 Correcting errors in blkdata.{c,f} (round 1 of 2).
2021/09/18 Strength reduction:
∙ uninitialized ‟static” locals to ‟auto”
∙ initialized ‟static” scalar locals to ‟auto const”
∙ initialized ‟static” array locals to ‟static const”
2021/09/18 Lifting constant common blocks to enum types (round 1 of 2).
2021/09/19 Various other minor cleanups and repairs both here and in the 1991 C translation to bring them closer together.
Their only significant difference, at this point, is the I/O and the formats of the black-box *.dat file(s).
2021/09/19 All the final ‟_”'s produced for globals by the translator were removed, except where names conflict.
That includes any references to the names listed in this and other log and documentation files.
2021/09/19-20 Regularizing the file and function header comments - in both the old and new C translations and Fortran original.
2021/09/20 Fix up the ‟debug” statements and translate their I/O statements into ‟pidgin-C”.
2021/09/20-21 Aligning the file I/O between the C translations and Fortran original: file open, close and read.
2021/09/21 Aligning the file I/O between the C translations and Fortran original: file write.
2021/09/21-22 Reconciling the *.{c,h} files between the 1991 and 2021 translations (the first round).
1991: The remnant of the ‟f2c.h” declarations present in ‟extern.h” are specially marked.
2021: The include of ‟F2C.h” is (mostly) internalized in ‟extern.h”.
The corresponding Makefiles brought closer in line.
1991: A missing print statement for ‟cevent” has been added into the debug routine in gdt.c.
2021: The pv union has been remade a struct, with the elimination of pv_2 from sverbs.c.
1991: Initialized definitions in ‟common.c” have been put back into ‟dmain.c”.
2021/09/23 Reconciling differences in the order and layout of I/O statements (but not yet their actual coding).
Reconciling differences between the order and initializations of declarations between the two.
Reconciling the *.{c,h} files between the 1991 and 2021 translations (the second round).
The segment in dsub.{c,f} responsible for producing variations in text output has been marked.
This is the reason that ‟Test.in” will produce different results on different runs
for the Fortran version (and the 2021 C translation, once a run-time baseline is established).
1991: Missing comments from the Fortran original have been restored.
2021: Extra comments from the Fortran original and translator have been removed.
2021: Removed a bug in rooms.{c,f} arising from ‟TCHBT” being mistyped as ‟CHBT” in rooms.f and mistranslated.
2021/09/23 Reconciling differences between the adventurer, object and villain tables.
The Fortran original split the large arrays {a,o,v}voc[] into tables bundled into common blocks,
probably to overcome limitations on table sizes.
The 1991 C translation reintegrated the tables and translated them as such, instead of as common blocks.
2021/09/23 Lifting the common blocks {dir,prp,buz}voc, respectively, to constant integer arrays {d,p,b}voc[].
This is a bona fide upgrade: it goes beyond the Fortran original and 1991 C translation.
2021/09/23 Reconciling the remaining differences between the translations of the common blocks (/vers/).
Changing vedit, in /vers/ (back) to character, from integer.
2021/09/23 Simplifying the translations of the common blocks:
∙ removing excess "#defines"-s and de-mangling names/aliases,
∙ lifting constant common blocks to enums, constant arrays or constants, wherever possible.
2021/09/24 Recoding of the (translations of the) Arithmetic IF statements
2021/09/24 Further simplification and reduction of the I/O-related f2c library routines.
2021/09/24 Most of the file I/O from ‟F2C.h” has been nativized and eliminated.
The I/O for the index and save files is now operational.
The I/O for the story file is partially operational.
2021/09/25 Elimination of the remaining non-I/O functions from ‟F2C.h”.
Elimination of the remainder of ‟F2C.h”, with its merger into ‟extern.h”.
2021/09/25-26 The rest of the file output I/O from ‟F2C.h” has been nativized and eliminated.
The I/O for the story file is now operational.
2021/09/26 The rest of the file input I/O from ‟F2C.h” has been nativized and eliminated.
The libf2c dependency has been eliminated.
The I/O for the user input is now operational, but not yet validated (and repaired, if need be).
2021/09/27 The I/O for the user input is now validated.
‟make test” requires modification, because output for the Fortran original and 2021 C translation can vary.
This feature was present, by design, in the Fortran version but was removed by the 1991 C translation.
2021/09/27 The 2021 C translation is now operational.
2021/09/27 Version change provisionally to 2.8; pending final decisions to be made on future version numbering.
2021/09/27 Removing the leading spaces put on each line of the game output; to bring it in line with the 1991 C translation.
2021/09/28 Reconciliation between the two C translations with minor recoding in various places.
Reconciliation involving recoding that requires structural changes is being deferred.
2021/09/29 Removal of the translation-related comments.
(Belatedly) removing redundant arithmetic generated originally by the f2c translator.
Reconciliation involving minor structural changes.
2021/09/30 The remaining bugs in the data block initialization were repaired in both the C99 and Fortran 2018 versions.
The remaining inconsistencies affected words that start in ‟INTO⋯”, ‟CLAY⋯”, ‟CRIMIN⋯”.
The other inconsistencies that affected words starting in ‟HOURS⋯” and ‟PAPER⋯” were already repaired (2021/09/17).
C1991 and Fortran/C2021 disagree on handling words starting in ‟PILE⋯”: resolved in favor of C1991.
2021/10/01 Simplifications to ‟dinit.{c,f}” (‟dirmax”/‟DIRMAX” and ‟recno”/‟RECNO” are unused and were removed).
2021/10/02 Recompilation of the history log.
2021/10/03 Lifting type ‟Bool” to ‟bool”, except for the parameters and global variables involved in I/O:
∙ /play/ Bool telflg;
∙ /cevent/ Bool cflag[25];
∙ /hack/ Bool thfflg, thfact, swdact;
∙ /findex/ Bool flags[46];
∙ void GetFlags(int Lim, Bool *FlagP, FILE *InF);
2021/10/03 Split /findex/ into /findex_0/ for Bool and /findex_1/ for int.
Reduced /findex/ flags to findex_0, and /findex/ switch_ to findex_1
Reduced /curxt/ xflag to curxt.xobj and /rooms/ rrand to rooms.rval
The other equivalences cannot be directly translated into C, but only into C++, using reference types.
2021/10/05 Minor bug fix in rooms.{f,c}.
2021/10/06 Reconciling the Makefiles between the 1991 and 2021 translations.
2021/10/06 Upgrading ‟readit.c” to a decompiler for both ‟dindx.dat” and ‟dtext.dat”,
as a precursor to reconciling the database files with the ‟dtextc.dat” from the 1991 translation
and making a compiler for the database files.
2021/10/07 Adding ‟readit.c” to the 1991 C translation and reconciling with the 2021 translation.
This might be remade into a run-time compiler to make possible dynamic databases and worlds.
2021/10/07 Trimmed the excess data from ‟dindx.dat” in the Fortran and C2021 versions.
2021/10/08 Removing unused parameters and variables: in both C translations and in the Fortran version.
2021/10/08 Revising documentation: README files (and the file manifest contained in one of them) and manual pages.
Further reconciling the Makefiles between the 1991 and 2021 translations.
2021/10/09 Rolling back the database file format in C1991 to the format in the Fortran version:
‟dtextc.dat” is being split back into ‟dindx.dat” and ‟dtext.dat”.
This will break compatibility with the version of Zork distributed by Linux,
but it requires only splitting the files at the location given by ‟mrloc” originally in the 1991 C translation.
2021/10/12 Reformatting dindx.txt in the Fortran and 2021 C translation to more closely match the 1991 C translation.
The rdesc2 pointer to an array of messages in the room table has been changed into an array of message pointers.
2021/10/12 Resizing the message table rtext[] and formatting dindx.txt (in the 2021 C translation and Fortran version).
This will be re-visited later, when the strings table is re-formatted.
2021/10/12 Normalized the format of the database index file dindx.dat.
Moved the version number for the 1991 C translation up to 2.8A.
2021/10/13 Reconciling conditional code.
2021/10/13 Updating the database decompiler: to bring out the references to absolute locations in the story file.
2021/10/14 Reconciling the randomizer (the first of two rounds).
This will introduce variability of output in the 1991 translation, which arises, in part, from the use of srand().
Therefore, ‟make test” will not always produce an exact match for test outputs anymore.
This will be fixed for both C translations and the Fortran version later, when they are fully reconciled.
2021/10/14-15 Normalizing the record format in the story file (the first of two rounds).
2021/10/21 Revising the database decompiler to better reflect the structure of the exit table.
2021/10/23 Reconciling and upgrading the random number generator.
2021/10/24-25 Reconciling and upgrading the time-related functions and reseeding the random number generator with it.
This changes the format of the ‟dsave.dat” game-state file.
2021/10/25 Add command-line arguments and use this to control the randomizer for the test routines.
‟make test” is now fully operational.
2021/10/26 Removed absolute references to the strings file in the index file to the message table, rtext[].
This undoes the resizing of rtext[] in the 2021 version in 2021/10/12, and resizes it in the 1991 version instead.
2021/10/28 Reindexed the message table rtext[] in dindx.dat and the string table in dtext.dat such that:
∙ duplicate relative indexes to rtext[] from the tables in ‟dindx.dat” are removed,
there are 149 duplicates in the 2021 version,
and
∙ duplicate strings in the string table are removed,
there are 158 duplicates in the 2021 version.
The ideal is to allow all duplicate indices in rtext[] to ‟dtext.dat”, there are 9 in the 1991 version.
They cannot be eliminated without analyzing the source code to find all the places where rtext[] indices occur.
2021/10/30-31 Reindexed the string table in the story file; revised the version history contained in it.
This is now version 2.8B
2021/10/31 Added the Zork.6 man page, from C1991, to C2021.
2021/11/01 Reconciling more of the remaining differences in the Story file buffering & routines: dsub.c, dgame.c.
Further changes and simplifications made to dsub.c in C1991.
2021/11/02 Reconciling the Makefiles and ‟make test”, and sorting out the test files.
2021/11/04 Updating the story file ‟dtext.dat” and reconciling the C1991 and C2021/Fortran versions with each other.
The dates in the story file have been changed to 2021-10-31, the timestamp for version 2.8B.
References for contact and maintenance were changed, for now, to the github repository site.
A reference to the Zork Library https://www.thezorklibrary.com/history/us_news_dungeon.html was added.
2021/11/04 Reconciling the objects table in the index file ‟dindx.dat”, arbitrating with version 3.2B of the Fortran source.
Objects 67 (Wooden Door), 68 (Front Door), 69 (Stone Door), 164 (Pine Door): resolved in favor of the 1991 version.
Objects 172 (ODoor (Scorr-To-Cell)): resolved in favor of the 2021 version.
Set the door bit (0x1000) in oflag1 of objects 67, 68, 69, 164 and 172.
Clear the take bit (0x2000) in oflag1 of object 172.
2021/11/05 Incremental modifications of the message output routine to bring both C translations into line.
2021/11/05 Fully reconciled the ‟README” files of the 1991 and 2021 C translations.
2021/11/05-06 Reformatted and reconciled the decoding/encoding and layout of the story file ‟dtext.dat”.
Experimented with different formats and routines, before deciding on the resolution.
2021/11/07 Reconciled the messaging routine in dsub.{c,f}.
Resolved partly in favor of the 1991 C translation: replaced record-based I/O by streaming I/O.
Resolved partly in favor of the 2021 C translation and Fortran version: replaced character I/O by buffered I/O.
2021/11/09 Upgraded the type of absolute references (e.g. in rtext[]/RTEXT and PutMsg()/PUTMSG) to long integer/INTEGER*4.
2021/11/11 Completion of the Fortran version of the database decompiler.
Minor revisions in the C version of the database decompiler and output.