Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile 1981 Zork sources #832

Closed
larsbrinkhoff opened this issue Apr 24, 2018 · 82 comments
Closed

Compile 1981 Zork sources #832

larsbrinkhoff opened this issue Apr 24, 2018 · 82 comments
Assignees
Labels

Comments

@larsbrinkhoff
Copy link
Member

larsbrinkhoff commented Apr 24, 2018

Use the MDL interpreter and Zork source code to make a runnable Zork.

@larsbrinkhoff
Copy link
Member Author

larsbrinkhoff commented Apr 24, 2018

Random notes:

  • I believe there should be a SYSn; TS ZORK. (Historically, n ∈ { 1, 2, 3 })
  • Maybe the source code should be moved to CFS or LCF.
  • The default location for the Zork save file in ITS is CFS; MADADV SAVE.
  • Zork seems to prefer MDL 104 (and 54?); there could be incompatible differences in 106/56.
  • The TOPS-20 build script starts with loading M104UNI. What's that, maybe a pre-built "universe" populated with libraries?
  • Next, it loads LITLPK.GBIN. What is that?

@larsbrinkhoff
Copy link
Member Author

I think we could use some Muddle eyeballs on build.cmd and rooms.394. @36bit?

@larsbrinkhoff
Copy link
Member Author

larsbrinkhoff commented Apr 24, 2018

  • ITS-GET-NAME retrieves information from the INQUIR database (or DM equivalent?). We probably don't have that library.
  • Funny symbols: REMARKABLY-DISGUSTING-CODE, EXCRUCIATINGLY-UNTASTEFUL-CODE, etc.
  • TELL 152 is mostly written in assembly language. Do we have that assembler?

@larsbrinkhoff
Copy link
Member Author

larsbrinkhoff commented Apr 24, 2018

  • Make CFS directory invisible?!? ;-)
  • build.cmd loads a few BIN files which we recognize from Zork. Are those compiled?
  • It also loads a ZORK.XGBIN. What's that? In the end, it's deleted.

@larsbrinkhoff
Copy link
Member Author

  • SYS1; TS ZORK has timestamps from 1979-08-07 to 1979-11-24.
  • SYS2; TS ZORK has timestamps from 1979-11-24 to 1981-11-27.
  • SYS3; TS ZORK has timestamps from 1979-11-24 to 1987-11-13.
  • KMP; AR9: ZORK 19 has timestamp 1979-11-24. "The only MIT machine supporting Zork is MIT-DMS"
  • KMP; AR9: ZORK 20 has timestamp 1981-11-27. "No MIT machine supports Zork any longer."
  • KMP; AR9: ZORK 21 has timestamp 1987-11-13. "No MIT supports DM any longer."

@larsbrinkhoff
Copy link
Member Author

larsbrinkhoff commented Apr 24, 2018

@eswenson1, was there ever a playable Zork on MIT-MC? Given your comment about the Z option in NGAME, I guess not. And all files above are KMP's dummies.

I have a tiny shread of hope that the earliest one from August 1979 could be the real thing.

I do see plenty of Zork save files! Ranging from 1977-12-10 to 1981-06-21.

@eswenson1
Copy link
Member

I don’t ever recall zork’s being available on MC, AI, or ML — only DM. Can’t rationalize those zork save files.

@atsampson
Copy link
Contributor

The SRI-NIC games directory contains ZORK.EXE, ZORK.DOC, ZORK.LOG and MDL105.EXE. ZORK.EXE contains the strings:

SRC:<GAMES>MDLXXX.EXE
SRC:<GAMES>ZORK.SAV
Can't find SAVE file?
Can't OPENF SAVE file?
No Muddle Interpreter?

So it sounds like we should also have a ZORK.SAV, and ZORK.EXE is a stub that starts MDL and loads it.

ZORK.DOC has the interesting comment:

I. Getting a ZORK
a. ITS: Say ZORK^K to DDT rather than :ZORK to get a zork.

@larsbrinkhoff
Copy link
Member Author

larsbrinkhoff commented Apr 24, 2018

I looked at DDTORD, by I didn't find any thing to explain that difference between ^K and :. ^K always loads a file, whilst : can run a built-in DDT command. But that should not be the case here. Unless DM patched their DDT?

So I went to the source code. ACTRLK has the comment "HERE WE HANDLE FOO^H, FOO^K, :FOO ..., :NEW FOO ..., :RETRY FOO ... " But as far as I can see :FOO goes to ACTRLK too so I think " ..." can be empty.

@atsampson
Copy link
Contributor

atsampson commented Apr 24, 2018

I don't think we have the assembler (although maybe some of the MIM PDP-10 code is derived from it?). The Confusion MDL interpreter's mdlzork.tgz has pure-MDL versions of some of the stuff in TELL.

FLOAD-ing the files in the order Confusion uses (PRIM DEFS MAKSTR (TELL) ACT1 ACT2 ACT3 ACT4 DISP1 PARSER MELEE ROOMS DUNG IMPL SR SYNTAX TYPHAK UTIL), a couple of immediate problems...

  • DEFS loads LSRTNS if it's not being compiled, whatever that is. Removing this gets further.

  • ROOMS defines XUNAME, which is a builtin with MDL 56. Renaming this fixes it, but since it calls GXUNAME from TELL which is a wrapper around .SUSET .RXUNAM, it looks like it could use the builtin instead.

  • DUNG fails with UNBOUND-VARIABLE PSTRING. Which is odd, since that's a type defined in PRIM...

@larsbrinkhoff
Copy link
Member Author

LSRTNS sounds like it could be a library to access the INQUIR database. The database contains information about registered users. It's what you enter when you apply for an ITS account using PANDA.

@eswenson1
Copy link
Member

There is an INQUIR library called LSRRTN (INQUIR; LSRRTN 31) which is the LISP variant of this library. It includes SYSENG; LSRTNS >, which is the MIDAS implementation of the code that knows how to map in the iNQUIR database, and search/update/delete/etc entries in that database.

@rmaldersoniii
Copy link

Regarding the need for a stub to run ZORK on TOPS-20, I have the following in my personal directory on the XKL Toad-2 at LCM+l:

LS:
ZORK.MAC.2;P775200 1 2002(7) 8-Jan-1983 10:50:23 ALDERSON

The timestamp indicates that it is from the public DEC-20 at UChicago, almost 2 years before I moved to Stanford. The text of the program is as follows:

        TITLE ZORK BOOTSTRAP
        SEARCH MONSYM,MACSYM
        .REQUIRE SYS:MACREL
        SALL

Z=0                     ;PASS JFN IN HERE
T1=1
T2=2
T3=3
T4=4
P=17

PSTRT==^D<9*3600>               ;0900
PEND==^D<18*3600>               ;1800

START:  RESET
        MOVE P,[IOWD 10,PDL]
        MOVEI T1,.FHSLF
        RPCAP
        TXNE T3,SC%WHL
        JRST OKGO               ;DONT HASSLE WHEELS
        SETO T2,
        SETZ T4,
        ODCNV                   ;GET CURRET DATE/TIME
        HRLZ T1,T2              ;GET MONTH
        HLR T1,T3               ;GET DAY
        AOBJN T1,.+1            ;INCR BOTH HALVES
        HRRZS T4                ;TIME SINCE MIDNITE
        HRRZS T3                ;DAY OF WEEK
        CAIE T3,5               ;SATURDAY
        CAIN T3,6               ; AND SUNDAYS
        JRST OKGO               ; ARE OK
        MOVEI T3,0              ;INIT LOOP
HLUP:   SKIPN HTBL(T3)          ;ENTRY?
        JRST CKTIM              ;DONE - CHECK TIME
        CAMN T1,HTBL(T3)        ;HOLIDAY MATCH?
        JRST OKGO               ;YES - OK
        AOJA T3,HLUP            ;NO - TRY NEXT

CKTIM:  CAIL T4,PSTRT           ;PRIME TIME START
        CAIL T4,PEND            ; OR PRIME END
        JRST OKGO               ; OFF PRIME - OK
        TMSG <
THE DUNGEON IS AVAILABLE FOR EXPLORING MON THRU FRI:
        00:00 - >
        MOVEI T4,PSTRT          ;START OF PRIME TIME
        CALL TIMOUT
        TMSG <
        >
        MOVEI T4,PEND           ;END OF PRIME TIME
        CALL TIMOUT
        TMSG < - 24:00

IT IS ALSO OPENED WEEKENDS AND HOLIDAYS.

>
        JRST    OKGO
        HALTF
        JRST .-1

TIMOUT: MOVEI T1,.PRIOU
        IDIVI T4,^D3600         ;GET HOURS
        MOVE T2,T4              ;SET TO OUTPUT
        MOVX T3,NO%LFL!NO%ZRO+^D10+2B17
        NOUT                    ;DUMP HOURS
         JSERR
        TMSG <:>
        MOVEI T1,.PRIOU
        IDIVI 5,^D60            ;GET MINUTES
        MOVE T2,5
        NOUT                    ;DUMP IT
         JSERR
        RET

OKGO: MOVX T1,GJ%OLD!GJ%SHT
        HRROI T2,[ASCIZ /MDL:MADADV.SAVE/]
        GTJFN           ;GET HANDLE ON GAME
         JSHLT
        MOVE Z,T1       ;SAVE JFN IN ZERO
        MOVX T2,44B5+OF%RD!OF%EX
        OPENF           ;OPEN FILE
         JSHLT
        MOVX T1,GJ%OLD!GJ%SHT
        HRROI T2,[ASCIZ /MDL:MDL104.EXE/]
        GTJFN           ;GET JFN ON MUDDLE
         JSHLT
        HRLI T1,.FHSLF          ;FOR GET JSYS
        MOVE 16,[ACPRG,,5]
        BLT 16,10               ;FILL ACS
        JRST 5                  ;CONTINUE IN ACS

ACPRG:  GET
        MOVEI T1,.FHSLF         ;GET E/V FOR SELF
        GEVEC
        JRST 1(T2)              ;START AT OFFSET 1

PDL:    BLOCK 10

        RADIX 10

HTBL:   1,,1                    ;NEW YEARS
        12,,25                  ;CHRISTMAS
        0                       ;END OF TABLE

        RADIX 8

        END <1,,START>

@eswenson1
Copy link
Member

eswenson1 commented Apr 24, 2018

Here is one version of an ITS launcher that I had in my (EJS;) directory on MC:

TITLE TRIVIA startup

.MLLIT==1

TTYCHN==1
SAVCHN==2
MUDCHN==3
DSKCHN==4



O=0
A=1
B=2
C=3
TIME=3
NOW=4
XUNAME=5
P=17
VBPTR:	440700,,A
VSBPTR:	140600,,B
DSKDEV:	SIXBIT	/DSK/
SXUNAM:	BLOCK	2

START:	MOVE	P,[-30,,PDL-1]
	.OPEN	TTYCHN,[SIXBIT /  !TTY/]
	 .LOSE	1000
WIN:	.CALL	SAVOPN
	 .VALUE	[ASCIZ /�:�� No SAVE file?
��
�/]
	.IOT	SAVCHN,[-1,,A]
	MOVSI	B,SIXBIT /   MUD/
	ILDB	C,VBPTR
	SUBI	C,40
	DPB	C,VSBPTR
	ILDB	C,VBPTR
	SUBI	C,40
	IDPB	C,VSBPTR
	.ACCES	SAVCHN,[0]

	.CALL	MUDOPN
	 .VALUE	[ASCIZ /�:�� No TS MUDDLE ?
��
�/]
	MOVSI 17,STUFF
	BLT 17,17
	JRST 1

	SQUOZE	0,MSUSER
MSUSER:	0
	SQUOZE	0,MSRED2
MSRED2:	0

INIT:	MOVE	B,[-200,,200]
	MOVEI	A,0
	.CALL	[SETZ
		 SIXBIT	/CORBLK/
		 MOVEI	%CBRED
		 MOVEI	%JSELF
		 B
		 MOVEI	%JSABS
		 SETZ	A]
	 .LOSE	1000
	MOVE	A,MSUSER-1
	.EVAL	A,
	 .LOSE	1000
	ADD	A,[B,,400000]
	MOVEM	A,MSUSER
	MOVE	A,MSRED2-1
	.EVAL	A,
	 .LOSE	1000
	ADD	A,[B,,400000]
	MOVEM	A,MSRED2
	.VALUE	[ASCIZ	/��K
:PDUMP SYS2;TS ZORK
:KILL
/]


DIROPN:	SETZ
	SIXBIT /OPEN/
	MOVSI	.BII
	MOVEI	DSKCHN
	DSKDEV
	[SIXBIT /.FILE./]
	[SIXBIT /(DIR)/]
	SETZ	XUNAME


MUDOPN:	SETZ
	SIXBIT /OPEN/
	MOVSI	4
	MOVEI	MUDCHN
	DSKDEV
	[SIXBIT /TS/]
	B
	SETZ [SIXBIT /SYS1/]

SAVOPN:	SETZ
	SIXBIT /OPEN/
	MOVSI	6
	MOVEI	SAVCHN
	DSKDEV
	[SIXBIT /MADADV/]
	[SIXBIT /SAVE/]
	SETZ [SIXBIT /MADMAN/]

STUFF:	OFFSET -.
	2
	.CALL LOAD
	.VALUE
	.IOT MUDCHN,A
	.CLOSE MUDCHN,
	ADDI	A,1
	JRST @A

LOAD:	SETZ
	SIXBIT /LOAD/
	1000,,-1
	SETZI MUDCHN

	OFFSET 0

BUF:	BLOCK	200
BUFPTR:	BUF-.,,BUF

PDL:	BLOCK 30

END	START

@eswenson1
Copy link
Member

eswenson1 commented Apr 24, 2018

And here is another:

TITLE TRIVIA startup

.MLLIT==1

TTYCHN==1
SAVCHN==2
MUDCHN==3
DSKCHN==4

O=0
A=1
B=2
C=3
TIME=3
NOW=4
XUNAME=5
P=17
VBPTR:	440700,,A
VSBPTR:	140600,,B
DSKDEV:	SIXBIT	/DSK/
MSGDIR:	SIXBIT	/_MSGS_/
BADNAM:	SIXBIT	/ABADBO/
BADDIR:	SIXBIT	/VANISH/
SXUNAM:	BLOCK	2

START:	MOVE	P,[-30,,PDL-1]
	.OPEN	TTYCHN,[SIXBIT /  !TTY/]
	 .LOSE	1000
	.SUSET	[.RJNAME,,A]
	CAMN	A,[SIXBIT /ZORK/]
	 JRST	START1
	MOVE	B,[440700,,TWOZK]
	PUSHJ	P,OUTMSG
	.BREAK	16,160000
START1:	.SUSET	[.RXUNAME,,XUNAME]
	HLRZ	A,XUNAME
	CAIN	A,777777
	 JRST	LOGIN
	.CALL	DEATH
	 JRST	CKUSER
	.CALL	[SETZ				; GET FILE LENGTH IN A
		 SIXBIT /FILLEN/
		 MOVEI	DSKCHN
		 SETZM	A]
	 JRST	FAKMSG
	CAIN	A,
	 JRST	FAKMSG
	MOVE	B,BUFPTR
	.IOT	DSKCHN,B
	.CLOSE	DSKCHN,
	MOVE	B,[440700,,BUF]
MSGDTH:	PUSHJ	P,OUTMSG
MSGEND:	PUSHJ	P,WINNER
	 JRST	WIN
	.BREAK	16,140000
FAKMSG:	MOVE	B,[440700,,MSG]
	.CLOSE	DSKCHN,
	JRST	MSGDTH

CKUSER:;	PUSHJ	P,WINNER
;	 JRST	WIN
;	LDB	A,[063600,,XUNAME]
;	CAMN	A,[SIXBIT / GUEST/]
	 JRST	CKTIME
;	.CALL	DIROPN				; REAL PERSON?
;	 JRST	CKTIME				; NOPE
;	.CALL	MSGOPN				; REALLY A REAL PERSON?
;	 JRST	LOSNAM
;	.CLOSE	DSKCHN,
CKNUM:	PUSHJ	P,ZKCNT
	 JRST	TOOMNY

WIN:	.CALL	SAVOPN
	 .VALUE	[ASCIZ /�:�� No SAVE file?
��
�/]
	.IOT	SAVCHN,[-1,,A]
	MOVSI	B,SIXBIT /   MUD/
	ILDB	C,VBPTR
	SUBI	C,40
	DPB	C,VSBPTR
	ILDB	C,VBPTR
	SUBI	C,40
	IDPB	C,VSBPTR
	.ACCES	SAVCHN,[0]

	.CALL	MUDOPN
	 .VALUE	[ASCIZ /�:�� No TS MUDDLE ?
��
�/]
	MOVSI 17,STUFF
	BLT 17,17
	JRST 1

LOSNAM:	MOVE	B,[440700,,NAMMSG]
	PUSHJ	P,OUTMSG
	MOVE	B,[440600,,XUNAME]
	MOVE	C,[440700,,SXUNAM]
SIXLOP:	ILDB	A,B
	JUMPE	A,SIXTOO
	ADDI	A,40
	IDPB	A,C
	JRST	SIXLOP
SIXTOO:	MOVE	B,[440700,,SXUNAM]
	PUSHJ	P,OUTMSG
	MOVE	B,[440700,,NAMEND]
	PUSHJ	P,OUTMSG
	.BREAK	16,160000

LOGIN:	MOVE	B,[440700,,LOGMSG]
	PUSHJ	P,OUTMSG
	.BREAK	16,160000

OFFHOR:	MOVE	B,[440700,,OFFMSG]
	PUSHJ	P,OUTMSG
	.BREAK	16,160000
TOOMNY:	MOVE	B,[440700,,TOOMSG]
	PUSHJ	P,OUTMSG
	.BREAK	16,160000

CKTIME:	.RYEAR	A,
	 LDB	A,[320300,,A]			; IS IT A WEEKEND?
	JUMPE	A,CURFCK
	CAIN	A,6
	 JRST	CURFCK
	.RTIME	A,
	LDB	A,[301400,,A]			; IS IT OFFICE HOURS?
	CAIGE	A,'20
	 CAIGE	A,'09
	  JRST	CURFCK
	.RDATE	A,
	.CALL	HOLOPN				; IS IT A HOLIDAY?
	 JRST	FLUSH

CURFCK:	.CALL	CURFEW
	 JRST	CKNUM
	.CALL	[SETZ
  		 SIXBIT	/RAUTH/
		 MOVEI	DSKCHN
		 SETZM	B]
	 .LOSE	%LSSYS
	.CLOSE	DSKCHN,
	JUMPE	B,CKNUM
	CAMN	B,[-1]
	 JRST	CKNUM
	MOVE	B,[440700,,CURMSG]
	PUSHJ	P,OUTMSG
	.BREAK	16,160000

FLUSH:	.CALL	BADBOY
	 JRST	NEWBAD
	.CALL	RFDATE
	 JFCL
	.CALL	RQDATE
	 JFCL	
	.CALL	SFDATE
	 JFCL
	.CLOSE	DSKCHN,
	HLRZ	A,TIME				; DID THE TURKEY TRY <1/2 HR AGO?
	HLRZ	B,NOW
	CAME	A,B
	 JRST	OFFHOR
	SUB	NOW,TIME
	CAIGE	NOW,2400.
	 JRST	LOGOUT
	JRST	OFFHOR

NEWBAD:	.CALL	MAKBAD
	 .LOSE	1000
	.CLOSE	DSKCHN,
	JRST	OFFHOR

LOGOUT:	.VALUE	[ASCIZ /�:��You don't believe me, eh?  That makes me MAD!�!�!����
��0U
/]
	.BREAK	16,160000

ZKCNT:	MOVEI	B,40
	MOVEI	O,2
ZKLOP:	SOJL	B,[AOS	(P)
		   POPJ	P,]
	SKIPN	@MSUSER
	 JRST	ZKLOP
	MOVE	A,@MSRED2
	CAME	A,[SIXBIT /ZORK/]
	 JRST	ZKLOP
	SOJG	O,ZKLOP
	POPJ	P,

	SQUOZE	0,MSUSER
MSUSER:	0
	SQUOZE	0,MSRED2
MSRED2:	0
INIT:	MOVE	B,[-200,,200]
	MOVEI	A,0
	.CALL	[SETZ
		 SIXBIT	/CORBLK/
		 MOVEI	%CBRED
		 MOVEI	%JSELF
		 B
		 MOVEI	%JSABS
		 SETZ	A]
	 .LOSE	1000
	MOVE	A,MSUSER-1
	.EVAL	A,
	 .LOSE	1000
	ADD	A,[B,,400000]
	MOVEM	A,MSUSER
	MOVE	A,MSRED2-1
	.EVAL	A,
	 .LOSE	1000
	ADD	A,[B,,400000]
	MOVEM	A,MSRED2
	.VALUE	[ASCIZ	/��K
:PDUMP SYS2;TS ZORK
:KILL
/]

OUTMSG:	PUSH	P,A			; GIVEN BYTE POINTER, PRINT FROB OUT
	PUSH	P,C
	PUSH	P,B
	MOVEI	C,
OUTLOP:	ILDB	A,B			; LIKES BYTE POINTER TO FROB IN B
	CAIE	A,0
	 CAIN	A,3
	  JRST	OUTEND
	AOJA	C,OUTLOP
OUTEND:	POP	P,B			; GET BYTE POINTER IN B, COUNT IS IN C
	.CALL	[SETZ
		 SIXBIT	/SIOT/
		 MOVEI	TTYCHN
		 B
		 SETZ	C]
	 .LOSE	1000
	POP	P,C
	POP	P,A
	POPJ	P,

WINNER:	CAME	XUNAME,[SIXBIT	/TAA/]
	 CAMN	XUNAME,[SIXBIT	/MARC/]
	  POPJ	P,
	CAME	XUNAME,[SIXBIT	/PDL/]
	 CAMN	XUNAME,[SIXBIT	/SEC/]
	  POPJ	P,
	CAME	XUNAME,[SIXBIT	/BKD/]
	 CAMN	XUNAME,[SIXBIT	/ELBOW/]
	  POPJ	P,
	AOS	(P)
	POPJ	P,

DEATH:	SETZ
	SIXBIT /OPEN/
	MOVSI	.BII
	MOVEI	DSKCHN
	DSKDEV
	[SIXBIT /ZORK/]
	[SIXBIT /DEATH/]
	SETZ	MSGDIR

DIROPN:	SETZ
	SIXBIT /OPEN/
	MOVSI	.BII
	MOVEI	DSKCHN
	DSKDEV
	[SIXBIT /.FILE./]
	[SIXBIT /(DIR)/]
	SETZ	XUNAME

MSGOPN:	SETZ
	SIXBIT /OPEN/
	MOVSI	.BII
	MOVEI	DSKCHN
	DSKDEV
	MSGDIR
	XUNAME
	SETZ	XUNAME

MUDOPN:	SETZ
	SIXBIT /OPEN/
	MOVSI	4
	MOVEI	MUDCHN
	DSKDEV
	[SIXBIT /TS/]
	B
	SETZ [SIXBIT /SYS1/]

SAVOPN:	SETZ
	SIXBIT /OPEN/
	MOVSI	6
	MOVEI	SAVCHN
	DSKDEV
	[SIXBIT /MADADV/]
	[SIXBIT /SAVE/]
	SETZ [SIXBIT /MADMAN/]

HOLOPN:	SETZ
	SIXBIT /OPEN/
	MOVSI	.BII
	MOVEI	DSKCHN
	DSKDEV
	[SIXBIT /HLIDAY/]
	A
	SETZ [SIXBIT /COMBAT/]

CURFEW:	SETZ
	SIXBIT /OPEN/
	[.BII+20,,DSKCHN]	; DON'T CHASE LINKS
	DSKDEV
	[SIXBIT /TRIVIA/]
	[SIXBIT /CURFEW/]
	SETZ MSGDIR

BADBOY:	SETZ
	SIXBIT /OPEN/
	MOVSI	.BII
	MOVEI	DSKCHN
	DSKDEV
	BADNAM
	XUNAME
	SETZ	BADDIR

RFDATE:	SETZ
	SIXBIT /RFDATE/
	MOVEI	DSKCHN
	SETZM	TIME

RQDATE:	SETZ
	SIXBIT /RQDATE/
	SETZM	NOW

SFDATE:	SETZ
	SIXBIT /SFDATE/
	MOVEI	DSKCHN
	SETZ	NOW

MAKBAD:	SETZ
	SIXBIT /OPEN/
	MOVSI	1
	MOVEI	DSKCHN
	DSKDEV
	BADNAM
	XUNAME
	SETZ	BADDIR

STUFF:	OFFSET -.
	2
	.CALL LOAD
	.VALUE
	.IOT MUDCHN,A
	.CLOSE MUDCHN,
	ADDI	A,1
	JRST @A

LOAD:	SETZ
	SIXBIT /LOAD/
	1000,,-1
	SETZI MUDCHN

	OFFSET 0

TWOZK:	ASCIZ	/
You already have a zork.  Please kill it before getting a new one (the
easiest way is to say ZORK� instead of :ZORK).
/
MSG:	ASCIZ	/
ZORK is down for repairs.  Sigh.
/
OFFMSG:	ASCIZ	/
ZORK is not available during office hours (9 AM to 8 PM, Eastern time.)
/
TOOMSG:	ASCIZ	/
There appears before you a threatening figure clad all over
in heavy black armor.  His legs seem like the massive trunk
of the oak tree.  His broad shoulders and helmeted head loom
high over your own puny frame and you realize that his powerful
arms could easily crush the very life from your body.  There
hangs from his belt a veritable arsenal of deadly weapons:
sword, mace, ball and chain, dagger, lance, and trident.
He speaks with a commanding voice:

		"YOU SHALL NOT PASS "

As he grabs you by the neck all grows dim about you./
NAMMSG:	ASCIZ	/
Losers with the name /
NAMEND:	ASCIZ	/ cannot play ZORK!
/
LOGMSG:	ASCIZ	/
Losers who are not logged in cannot play ZORK!
/
CURMSG:	ASCIZ	/
The system is VERY loaded.  Please try again later.
/
BUF:	BLOCK	200
BUFPTR:	BUF-.,,BUF

PDL:	BLOCK 30

END	START

@atsampson
Copy link
Contributor

Lots of interesting stuff to pick through in the launchers above - thanks!

Tried dropping in Confusion's tell-repl.mud instead of TELL (with the definition of NULL removed). This defines working versions of PSTRING/STRINGP, at least.

DUNG then fails in the <GOBJECT DWINDOW ...> definition with an OVERFLOW error; looks like that's the 36th object with a bit, and GOBJECT tried to multiply GLOHI=200000,,000000 by 2 to get the next bit. Wrapping it with <OVERFLOW #FALSE ()> and <OVERFLOW T> proceeds, but is probably not the right fix.

It then crashes somewhere in DUNG between the Riddle Room and Flood Control Dam # 3 with one of several errors from MDL's GC, e.g.

:$ FATAL ERROR AGC--UNRECOGNIZED SPECIAL VECTOR $                               

@larsbrinkhoff
Copy link
Member Author

I'm copying this TAA comment from #12:

The original Muddle compiler wasn't really specific to ITS (it didn't generate any system calls), but when we moved to XX there was a new implementation of the interpreter (primarily written in Muddle, rather than assembly language), and a more modern compiler to go with it. But I don't think we had to change source code much at all to get Zork running on XX.

So I'm guessing the BIN files mentioned in build.cmd could have been generated by a compiler.

@larsbrinkhoff
Copy link
Member Author

I see the Russotto files has a Y2K fix. Might as well apply that to our version.

@larsbrinkhoff
Copy link
Member Author

Another TAA comment:

The DEC20 Muddle runtime claims that it can run in either a single memory section, or in several (in the latter case, it had a few reserved sections--one for the program (vs. control) stack, for example--with everything else used for GC space). Would have to study it a bit more closely to see if that's actually a true statement: I know that we always ran in multi-section mode (we needed the memory), so the single-section configuration would not have been exercised a lot.

So there's reason to be suspicios of the garbage collector in ITS.

@eswenson1
Copy link
Member

Do we have a MDL compiler, or only the interpreter? Can you run source code through the interpreter, or does it have to be (byte-code) compiled first? In other words, do we actually have what we need to move forward with Zork, or are missing a compiler?

@larsbrinkhoff
Copy link
Member Author

We don't have a compiler at this point. It looks like MIM (in the separate muddle repo) has a TOPS-20 compiler target, but we haven't done anything with that.

Also, I believe (@36bit, please correct me) that when Zork was created, there was an older compiler in use. Maybe named COMBAT? It's unclear whether the MIM compiler would work with the MDL 106/56 runtime. I haven't seen any trace of COMBAT (if indeed that's the right name), but then I haven't looked.

@larsbrinkhoff
Copy link
Member Author

larsbrinkhoff commented Apr 25, 2018

TAA:

The original Muddle compiler wasn't really specific to ITS (it didn't generate any system calls), but when we moved to XX there was a new implementation of the interpreter (primarily written in Muddle, rather than assembly language), and a more modern compiler to go with it. But I don't think we had to change source code much at all to get Zork running on XX.

The new implementation would be MIM.

@atsampson
Copy link
Contributor

@eswenson1, the MDL interpreter we have can read source code. At the moment, we can get the interpreter to load quite a lot of Zork, and it's building data structures for objects/rooms correctly, but the interpreter crashes with a GC problem (probably not Zork's fault).

One file in the Zork source is a bunch of helper functions written in MDL's assembler, and we don't have the assembler, but we could either replace them with pure-MDL equivalents or translate to MIDAS and compile them into MDL as builtins, so I don't think that's a huge problem.

@atsampson
Copy link
Contributor

atsampson commented Apr 26, 2018

Some thoughts on how to proceed with the GC crash:

  • Instrument MDL so we know when the GCs run.

  • Is it a Zork problem or is the GC generally broken? Write a testcase that allocates lots of memory with identifiable contents (0, 1, 2, ...) and see if it triggers the crash. Moving BOT down to make the GC arena smaller would make it easier to read the core dump.

  • The memory map when it crashes looks odd, with the GC (presumably) loaded in, and GC variables (BOTNEW etc.) pointing into pure space. Where should the GC be loaded? What do those variables mean?

  • Try disabling AGC (the compacting GC) and only doing AMSGC (the fast mark-sweep-only GC).

  • I found at least one missed ITS/TENEX conditional in the GC (because it used a TENEX symbol). Are there more that we haven't found -- e.g. page size differences, extra stuff on the stack? At least check the existing conditionals to make sure that what they add is cleaned up.

  • Test MDL on TOPS-20.

  • Long shot: could SECGC be made to work with just one section?

@larsbrinkhoff larsbrinkhoff added the muddle Muddle/MDL label Apr 26, 2018
@atsampson
Copy link
Contributor

Some progress, which you can find in very messy form on the ats/zork branch. With lots of GC debugging information removed:

*:mdl
MUDDLE 56 IN OPERATION.
LISTENING-AT-LEVEL 1 PROCESS 1
<RESTORE "MADADV SAVE">$
This Zork created January 1, 1980.
West of House
This is an open field west of a white house, with a boarded front door.
There is a small mailbox here.
A rubber mat saying 'Welcome to Zork!' lies by the door.

> [stub puts "open mailbox" into the input buffer]

Opening the mailbox reveals a leaflet.

This is still without the TELL assembly code; I'm using a bunch of pure-Muddle stubs based on the Confusion versions, hence the wrong date, lack of input, etc.

To answer some of the questions above:

  • When do the GCs run? <GC-MON T> makes MDL tell you, for both kinds of GC. There's also a <BLOAT-STAT> function which gives a variety of useful GC statistics.

  • Is the GC generally broken? I wrote some tests for vector memory allocation which seems to behave fine. But the GC is complex enough that it's hard to test everything Zork is doing.

  • Disabling the compacting GC? You can do this with extra args to the <GC> function. It seems happier with the mark-sweep GC only... but it then just runs out of memory at approximately the same point that it crashed before. (Even if I rebuild MDL so the high segment is nearly where it's supposed to be.) So the run above is without the functions for the endgame included, which frees up enough space to get the rest of the game engine loaded. If I'm reading build.cmd correctly, some of the functions were originally precompiled to NBIN files, which I guess would have made them more compact...

  • The memory map is fine, going by the description in the Muddle manuals.

I'm now wondering about trying to construct an NBIN file with one of the simpler assembly routines in (e.g. PSTRING). I did find a TOPS-20 ZORK.SAV in the PANDA distribution, which should include similar versions of these routines in assembled form. The manual has a good description of how registers are used in these routines, but the challenge will be figuring out how things like MQUOTE work.

@eswenson1
Copy link
Member

Way to go! That's fantastic news. I have to share a funny anecdote: just this morning, we got Zork (Dungeon) to run on Multics. We used the Fortran port and had to make lots of changes in order to get it to work -- Multics Fortran lacked some required functionality. So two zork-related news flashes on two obsolete operating systems in the same day. How weird is that?

@larsbrinkhoff
Copy link
Member Author

So loading the game files and writing out MADADV SAVE works fine when the endgame is excluded?

I wonder whether it would be easier to do some hack to create NBIN files, or resurrect a compiler if it could be found.

@larsbrinkhoff
Copy link
Member Author

We have two save files:

MADMAN; MADADV SAVE (1977-12-13)
MADMAN; OMADAD SAVE (1977-12-04)

@larsbrinkhoff
Copy link
Member Author

Of course I get this:

<RESTORE "MADMAN;MADADV SAVE">$

*ERROR*
MUDDLE-VERSIONS-DIFFER

@larsbrinkhoff
Copy link
Member Author

The LCF directory has what appears to be the December 1977 source code for Zork. At this point, it was renamed Dungeon.

<DEFINE ZORK ()
    <TELL "That word is replaced henceforth with DUNGEON.">>

@larsbrinkhoff
Copy link
Member Author

According to the loader code above (trivia startup) the very first word of the SAVE file is the Muddle version number as an ASCII string. It's 54.

@larsbrinkhoff
Copy link
Member Author

More of the Muddle compiler and libraries are appearing on ToTS tapes.

There are also ready built MADADV SAVE files, and a TS MUD54. I have tried to run them, but they don't work fully. I have a theory that Muddle also needs some of the SAV and/or FIX files from MUDSAV or MUDRST.

@atsampson
Copy link
Contributor

If you've got a TS MUD54, you could try Zork from the ats/zork branch and see if it loads the full game without running out of memory (revert the "Reduce the amount of code" comment, and possibly the XUNAME one as well since that was a MUD56-ism)...

@larsbrinkhoff
Copy link
Member Author

Various sources refer to Zork sorce code in either the LCF or CFS directory. Which one would be more appropriate here?

@larsbrinkhoff
Copy link
Member Author

@ZoBoRf tested the new Muddle, and confirms GC is much more stable!

@larsbrinkhoff
Copy link
Member Author

Two sets of Zork source and binary files from ToTS:

@larsbrinkhoff
Copy link
Member Author

ToTS tape 9004083 has a file <ZORK>MADADV.ITS-XXFILE:

MUDDLE^[^K
^^R
<RESTORE "MUDDLE;M55UNI">^[
<FLOAD "CFS;LITLPK FBIN">^[
<USE "CLEAN" "PURITY">^[
<SET CH <OPEN "READ" "CFS;ZORK DUNG">>^[
<RENAME "CFS;ZORK DUNG">^[
<FLOAD "LIBRM3;LSRTNS FBIN">^[
<SNAME "CFS">^[

...

<RENAME "ZORK GBIN">^[
<KILL:PURITY>^[
<FLUSH-CLEANUP>^[
<UNASSIGN X>^[
<REMOVE <GUNASSIGN PURE-LIST>>
<REMOVE <UNASSIGN FOO>>^[
<DEFINE F (BAR) <GUNASSIGN <REMOVE .BAR>>>^[
<F DROP>^[ <F L-UNUSE>^[ <F USE>^[ <F ENTRY>^[ <F PACKAGE>^[ <F ENDPACKAGE>^[ <F FIND/LOAD>^[
<F F>^[
%%<HANDLER <GET ERROR!-INTERRUPTS INTERRUPT> ,ERRH>^[
%%<SETG MUD-HAND <OFF <3 <GET ,INCHAN INTERRUPT>>>>^[
%%<SETG ZORK-HAND <OFF <HANDLER <GET ,INCHAN INTERRUPT> ,CTRL-S>>>^[
<GC 0 T>^[
<SETG DBG <>>^[
<GC-MON T>^[
<BLOAT 0 0 0 0 0 300>^[
<SAVE-IT "CFS;TEMP" <>>^[
^^J
<QUIT>^[

@larsbrinkhoff
Copy link
Member Author

Since #1951 provides a runnable Zork, I'd like to repurpose this issue for compiling the 1981 Zork.

@larsbrinkhoff larsbrinkhoff changed the title Make runnable Zork Compile 1981 Zork sources Sep 15, 2020
@larsbrinkhoff
Copy link
Member Author

@eswenson1 has made some progress compiling Zork with the Muddle 55 compiler.

@larsbrinkhoff
Copy link
Member Author

@eswenson1 confirmed the 1981 616-point Zork works and can be played to conclusion.

Users (well one: @hesam66) have been asking about getting this version. I think the binary can be put in this repository, even if the tools and build script can not. It can replace the 1978 binary in place now.

@eswenson1
Copy link
Member

Unfortunately, the binary (MADMAN;MADADV SAVE) is dependent on MDL 55. I compiled the sources with MDL 55, and it uses the MDL 55 interpreter and runtime. Therefore, before we can commit this version of Zork to the Git repository, we'll have to get a release from the MIT archives for its dependencies.

@eswenson1
Copy link
Member

I’m currently trying to tackle an issue getting the MDL 55 interpreter to run successfully when linked with the latest binaries from MIT. When NPCK (package manager) is loaded it loads LIB (the library system) and gets an error due to a broken implementation of OBLIST?. Taking a fix from MDL 106 (addition of a single HRLI instruction) fixes that problem and allows both NPCK and LIB to load. However, I’m currently only able to load NPCK NBIN and not NPCK FBIN. The latter is what the MUDSYS;NEWMUD > source tries to load when setting up a new MDL. I’m getting a FATAL ERROR ILLEGAL UUO. Trying to find the cause of that.

Note: I’ve successfully compiled, loaded, and dumped a ZORK with MDL 55 — but I was using interpreter, assembler, and compiler binaries from ToTS. Now I’m trying to build the interpreter, assembler, compiler, and libraries from source. This is proving difficult.

Note 2: Our MDL 56 (from MDL 106) is the bare bones interpreter — it does not include the package system, library system, pure library system, and all the runtime libraries. Before I integrate MDL 55, I’d like to have all that working from source (it works from ToTS binaries and a few recompilations).

@larsbrinkhoff
Copy link
Member Author

Thanks for the note, @eswenson1.

I suggest it would be worthwhile to do a half way pull request to build Zork using the binary versions. It's not that it's urgent, but I'm sure a few intfic fans would be curious to experiment with the game in its original form.

@larsbrinkhoff
Copy link
Member Author

@heasm66, maybe you want to keep an eye on this.

@heasm66
Copy link
Contributor

heasm66 commented Feb 21, 2023

Great progress! Are MDL 55 released by MIT now?

@eswenson1
Copy link
Member

Yes. I don’t know if MIT has prepared (yet) an actual release, but I’ve been given permission to release it as part of the “its” GitHub repo.

@heasm66
Copy link
Contributor

heasm66 commented Feb 21, 2023

Will both MDL54, 55 & 56 be on the platform at the same time (is that possible?)?

@eswenson1
Copy link
Member

Yes. I have all three running on my ITS system. However, when I make my update to the repo, it still will be the case that MDL 55 will be full-featured (interpreter, compiler, assembler, package and library system, pure library system, etc.), while MDL 54 and MDL will have their current minimal interpreter support.

MDL 54 won’t load NBINs created by the MDL 55 compiler (although MDL 56 will). And the runtime and pure library systems won’t offer support for MDL 54.

After getting MDL 55 “in” and working satisfactorily, I will try to get MDL 56 to have all the same functionality as MDL 55 — I may not be successful in this regard as I’ve had limited success so far.

I’ll probably be recommending people use MDL 55 for any MUDDLE development, as my MDL 55 on ES has been very functional for months. The other two are simply “toys” due to all the missing support.

@heasm66
Copy link
Contributor

heasm66 commented Feb 21, 2023

Sounds fantastic!

@larsbrinkhoff
Copy link
Member Author

I'm closing this since #2150 is almost there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants