PDP-10 / its

Incompatible Timesharing System
Other
850 stars 80 forks source link

Compile 1981 Zork sources #832

Closed larsbrinkhoff closed 1 year ago

larsbrinkhoff commented 6 years ago

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

larsbrinkhoff commented 6 years ago

Random notes:

larsbrinkhoff commented 6 years ago

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

larsbrinkhoff commented 6 years ago
larsbrinkhoff commented 6 years ago
larsbrinkhoff commented 6 years ago
larsbrinkhoff commented 6 years ago

@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 commented 6 years ago

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

atsampson commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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...

larsbrinkhoff commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

larsbrinkhoff commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

Some thoughts on how to proceed with the GC crash:

atsampson commented 6 years ago

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:

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 commented 6 years ago

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 commented 6 years ago

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.

atsampson commented 6 years ago

Yes, MDL's SAVE and RESTORE seem to work OK, at least from the test above -- and are much faster than loading the source files the first time. I expect there's still other stuff broken about the game that we'll find when we get input working and can play through a walkthrough. (When we eventually add this to build.tcl, playing through the first few moves automatically would be a good test for MDL!)

It would obviously save a lot of effort if the compiler (and assembler, which it depends on) can be found. I don't particularly fancy rewriting the assembler in Muddle, so I'm leaning towards some kind of MIDAS-based hack to get TELL working at the moment...

eswenson1 commented 6 years ago

@larsbrinkhoff Where (in the above discussion) do you see (of infer) that Adam loaded the game files and created MADADV.SAVE without the endgame? Is that implied by something (that I'm just not aware of)?

larsbrinkhoff commented 6 years ago

Eric, it's in a commit comment in the ats/zork branch.

Apparently, loading Zork source files make them fill up the entire memory space. The TOPS-20 build.cmd script loads NBIN files, presumably compiled.

larsbrinkhoff commented 6 years ago

Maybe this can be of use:
https://github.com/PDP-10/muddle/tree/master/%3Cmdl.comp%3E

atsampson commented 6 years ago

Excellent! From a quick look, that's definitely the compiler; it will need some of the Muddle library (e.g. USE) but at least some of that is in the MIM source tree.

larsbrinkhoff commented 5 years ago

playing through the first few moves automatically would be a good test for MDL!

I'm sure Eric would be happy to make a script to play through the full game -- just for testing, of course!

larsbrinkhoff commented 5 years ago

I made a comment elsewhere about making a runnable version, but I see here it's not quite there yet.

Better keep looking for that assembler and other important libraries.

eswenson1 commented 5 years ago

As soon as we got a version running on Multics, I played all the way through (including endgame) -- just to make sure it worked! I didn't have any fun playing (uhuh, sure).

larsbrinkhoff commented 5 years ago

That's what I call dedication to thorough testing!

larsbrinkhoff commented 5 years ago

By the way, who is ELBOW?!? (See above.)

larsbrinkhoff commented 5 years ago

@eswenson1, can you send me those two "TRIVIA files"?

Speaking of TRIVIA, maybe they are derived from PDL's trivia game.

larsbrinkhoff commented 5 years ago

We now have a TS RBYE which wants to load CFS; MADADV SAVE.

eswenson1 commented 5 years ago

And what is RBYE supposed to do?

larsbrinkhoff commented 5 years ago

It starts Zork. It looks close to the second "TRIVIA startup" you posted above. Except it uses the CFS directory instead of MADMAN. I believe CFS originally held the Zork source code, right?

eswenson1 commented 5 years ago

Right.

larsbrinkhoff commented 5 years ago

Some interesting files we may need to make progress:

larsbrinkhoff commented 5 years ago

USE'd by \:

larsbrinkhoff commented 5 years ago

ZIL related, all from \:

larsbrinkhoff commented 5 years ago

Got a few more files:


<mdl.comp>getord.mud.1
<mdl>m104uni.save.1
<mdllib>lsrtns.mud.20
<mimc.mim>em.mud.1
<clr>parse-definitions.mud.1
larsbrinkhoff commented 5 years ago

@atsampson Do you know how to use USE? It's not pre defined in our current Muddle 56.

atsampson commented 5 years ago

USE isn't built in to the language, it's part of the library - this is why I've been asking about the library source (and I suspect the next question after that will be figuring out how to bootstrap it). In MIM, it's defined in npck.mud.

taradinoc commented 5 years ago

USE's functionality is described in The MDL Programming Environment: https://archive.org/details/LCSTR294Lebling/page/n15.

Also implemented in ZILF: https://bitbucket.org/jmcgrew/zilf/src/default/Zilf/Interpreter/Subrs.Packages.cs

larsbrinkhoff commented 5 years ago

Remember this from above?

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,

There's a similar list in the Muddle source file ROOMS:

<PSETG WINNERS '["HESS" "BKD" "TAA" "MARC" "PDL" "MDL"]>

And also this:

              <OR <MEMBER ,XUNM ,WINNERS>
              <=? ,XUNM "SEC">
              <=? ,XUNM "ELBOW">

Once again, the mysterious Elbow appears.