Revision 17 (Original Source)
authorhistoricalsource <historicalsoftware@textfiles.com>
Sun, 14 Apr 2019 02:03:05 +0000 (22:03 -0400)
committerhistoricalsource <historicalsoftware@textfiles.com>
Sun, 14 Apr 2019 02:03:05 +0000 (22:03 -0400)
32 files changed:
README.md [new file with mode: 0644]
actions.zap [new file with mode: 0644]
actions.zil [new file with mode: 0644]
clock.zap [new file with mode: 0644]
clock.zil [new file with mode: 0644]
demons.zap [new file with mode: 0644]
demons.zil [new file with mode: 0644]
dungeon.zap [new file with mode: 0644]
dungeon.zil [new file with mode: 0644]
gmain.cmp [new file with mode: 0644]
macros.zap [new file with mode: 0644]
macros.zil [new file with mode: 0644]
main.zap [new file with mode: 0644]
main.zil [new file with mode: 0644]
parser.zap [new file with mode: 0644]
parser.zil [new file with mode: 0644]
shadow.zap [new file with mode: 0644]
shadow.zil [new file with mode: 0644]
syntax.zap [new file with mode: 0644]
syntax.zil [new file with mode: 0644]
tm.zap [new file with mode: 0644]
tm.zil [new file with mode: 0644]
verbs.zap [new file with mode: 0644]
verbs.zil [new file with mode: 0644]
zork3.errors [new file with mode: 0644]
zork3.xzap [new file with mode: 0644]
zork3.zap [new file with mode: 0644]
zork3.zil [new file with mode: 0644]
zork3.zip [new file with mode: 0644]
zork3dat.zap [new file with mode: 0644]
zork3freq.xzap [new file with mode: 0644]
zork3str.zap [new file with mode: 0644]

diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..7666f36
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# zork3
diff --git a/actions.zap b/actions.zap
new file mode 100644 (file)
index 0000000..4771fb6
--- /dev/null
@@ -0,0 +1,1945 @@
+
+
+       .FUNCT  SWORD-FCN
+       ZERO?   SWORD-IN-STONE? /?ELS5
+       EQUAL?  PRSA,V?MOVE,V?TAKE \FALSE
+       RANDOM  100
+       GRTR?   10,STACK \?ELS16
+       PRINTR  "Who do you think you are? Arthur?"
+?ELS16:        PRINTR  "The sword is deeply imbedded within the rock. You can't even begin to budge it."
+?ELS5: EQUAL?  PRSA,V?TAKE \FALSE
+       EQUAL?  WINNER,ADVENTURER \FALSE
+       CALL    QUEUE,I-SWORD,-1
+       PUT     STACK,0,1
+       RFALSE  
+
+
+       .FUNCT  LANTERN
+       EQUAL?  PRSA,V?THROW \?ELS5
+       PRINTI  "The lamp has smashed into the floor, and the light has gone out."
+       CRLF    
+       CALL    INT,I-LANTERN
+       PUT     STACK,0,0
+       REMOVE  LAMP
+       SET     'CURRENT-LAMP,BROKEN-LAMP
+       MOVE    BROKEN-LAMP,HERE
+       RTRUE   
+?ELS5: EQUAL?  PRSA,V?LAMP-ON \?ELS9
+       FSET?   LAMP,LIGHTBIT /?ELS14
+       PRINTR  "A burned-out lamp won't light."
+?ELS14:        CALL    INT,I-LANTERN
+       PUT     STACK,0,1
+       RFALSE  
+?ELS9: EQUAL?  PRSA,V?LAMP-OFF \?ELS20
+       FSET?   LAMP,LIGHTBIT /?ELS25
+       PRINTR  "The lamp has already burned out."
+?ELS25:        CALL    INT,I-LANTERN
+       PUT     STACK,0,0
+       RFALSE  
+?ELS20:        EQUAL?  PRSA,V?EXAMINE \FALSE
+       FSET?   LAMP,LIGHTBIT /?ELS34
+       PRINTI  "The lamp has burned out."
+       JUMP    ?CND32
+?ELS34:        FSET?   LAMP,ONBIT \?ELS38
+       PRINTI  "The lamp is on."
+       JUMP    ?CND32
+?ELS38:        PRINTI  "The lamp is turned off."
+?CND32:        CRLF    
+       RTRUE   
+
+
+       .FUNCT  I-LANTERN,TICK,TBL
+       VALUE   'LAMP-TABLE >TBL
+       GET     TBL,0 >TICK
+       CALL    QUEUE,I-LANTERN,TICK
+       PUT     STACK,0,1
+       CALL    LIGHT-INT,LAMP,TBL,TICK
+       ZERO?   TICK /TRUE
+       ADD     TBL,4 >LAMP-TABLE
+       RTRUE   
+
+
+       .FUNCT  LIGHT-INT,OBJ,TBL,TICK
+       ZERO?   TICK \?CND1
+       FCLEAR  OBJ,LIGHTBIT
+       FCLEAR  OBJ,ONBIT
+?CND1: CALL    HELD?,OBJ
+       ZERO?   STACK \?THN9
+       IN?     OBJ,HERE \FALSE
+?THN9: ZERO?   TICK \?ELS15
+       PRINTI  "You'd better have more light than from the "
+       PRINTD  OBJ
+       PRINTR  "."
+?ELS15:        GET     TBL,1
+       PRINT   STACK
+       CRLF    
+       RTRUE   
+
+
+       .FUNCT  CRETIN
+       EQUAL?  PRSA,V?GIVE \?ELS5
+       CALL    PERFORM,V?TAKE,PRSO
+       RSTACK  
+?ELS5: EQUAL?  PRSA,V?EAT \?ELS7
+       PRINTR  "Auto-cannibalism is not the answer."
+?ELS7: EQUAL?  PRSA,V?MUNG,V?KILL \?ELS11
+       CALL    JIGS-UP,STR?65
+       RSTACK  
+?ELS11:        EQUAL?  PRSA,V?TAKE \?ELS13
+       PRINTR  "How romantic!"
+?ELS13:        EQUAL?  PRSA,V?DISEMBARK \?ELS17
+       PRINTR  "You'll have to do that on your own."
+?ELS17:        EQUAL?  PRSA,V?EXAMINE \?ELS21
+       PRINTR  "That's difficult unless your eyes are prehensile."
+?ELS21:        EQUAL?  PRSA,V?MAKE \FALSE
+       PRINTR  "Only you can do that."
+
+
+       .FUNCT  CHASM-FCN
+       EQUAL?  PRSA,V?LEAP /?THN6
+       EQUAL?  PRSA,V?PUT \?ELS5
+       EQUAL?  PRSO,ME \?ELS5
+?THN6: PRINTR  "You look before leaping and realize you would never survive."
+?ELS5: EQUAL?  PRSA,V?CROSS \?ELS13
+       PRINTR  "You'll have to find a bridge."
+?ELS13:        EQUAL?  PRSA,V?PUT \FALSE
+       EQUAL?  PRSI,PSEUDO-OBJECT \FALSE
+       PRINTI  "The "
+       PRINTD  PRSO
+       PRINTI  " drops out of sight into the chasm."
+       CRLF    
+       REMOVE  PRSO
+       RTRUE   
+
+
+       .FUNCT  PATH-OBJECT
+       EQUAL?  PRSA,V?FOLLOW,V?TAKE \?ELS5
+       PRINTR  "You must specify a direction to go."
+?ELS5: EQUAL?  PRSA,V?FIND \FALSE
+       PRINTR  "I can't help you there...."
+
+
+       .FUNCT  TUNNEL-OBJECT
+       EQUAL?  PRSA,V?THROUGH \?ELS5
+       GETP    HERE,P?IN
+       ZERO?   STACK /?ELS5
+       CALL    DO-WALK,P?IN
+       RTRUE   
+?ELS5: CALL    PATH-OBJECT
+       RSTACK  
+
+
+       .FUNCT  GROUND-FCN
+       EQUAL?  PRSA,V?PUT \?ELS5
+       EQUAL?  PRSI,GROUND \?ELS5
+       CALL    PERFORM,V?DROP,PRSO
+       RTRUE   
+?ELS5: EQUAL?  PRSA,V?DIG \FALSE
+       PRINTR  "The ground is too hard for digging here."
+
+
+       .FUNCT  GRUE-FUNCTION
+       EQUAL?  PRSA,V?EXAMINE \?ELS5
+       PRINTR  "The grue is a sinister, lurking presence in the dark places of the earth. Its favorite diet is adventurers, but its insatiable appetite is tempered by its fear of light. No grue has ever been seen by the light of day, and few have survived its fearsome jaws to tell the tale."
+?ELS5: EQUAL?  PRSA,V?FIND \?ELS9
+       PRINTR  "There is no grue here, but I'm sure there is at least one lurking in the darkness nearby. I wouldn't let my light go out if I were you!"
+?ELS9: EQUAL?  PRSA,V?LISTEN \FALSE
+       PRINTR  "It makes no sound but is always lurking in the darkness nearby."
+
+
+       .FUNCT  CPEXIT,FX,NFX,?TMP1
+       SET     'CP-MOVED,FALSE-VALUE
+       EQUAL?  PRSO,P?UP \?ELS5
+       EQUAL?  CPHERE,1 \?ELS10
+       GET     CPTABLE,2
+       EQUAL?  STACK,-2 \?ELS15
+       PRINTI  "With the help of the ladder, you exit the puzzle."
+       CRLF    
+       RETURN  CP-ANTE
+?ELS15:        PRINTI  "The exit is too far above your head."
+       CRLF    
+       RFALSE  
+?ELS10:        PRINTI  "There is no way up."
+       CRLF    
+       RFALSE  
+?ELS5: EQUAL?  CPHERE,33 \?ELS27
+       EQUAL?  PRSO,P?WEST \?ELS27
+       ZERO?   CP-FLAG /?ELS27
+       FCLEAR  CP,TOUCHBIT
+       RETURN  CP-OUT
+?ELS27:        EQUAL?  PRSO,P?DOWN \?ELS31
+       PRINTI  "There's no way down here."
+       CRLF    
+       RFALSE  
+?ELS31:        EQUAL?  CPHERE,33 \?ELS35
+       EQUAL?  PRSO,P?WEST \?ELS35
+       PRINTI  "The metal door bars the way."
+       CRLF    
+       RFALSE  
+?ELS35:        CALL    LKP,PRSO,CPEXITS >FX
+       ADD     FX,CPHERE >NFX
+       GRTR?   NFX,36 /?THN45
+       LESS?   NFX,0 /?THN45
+       CALL    ILLCP,CPHERE,FX
+       ZERO?   STACK /?ELS44
+?THN45:        PRINTI  "There is a wall there."
+       CRLF    
+       RFALSE  
+?ELS44:        LESS?   FX,0 \?ELS55
+       SUB     0,FX
+       JUMP    ?CND51
+?ELS55:        PUSH    FX
+?CND51:        EQUAL?  STACK,1,6 \?ELS50
+       CALL    CPMOVE,FX
+       RFALSE  
+?ELS50:        GRTR?   FX,0 \?ELS59
+       ADD     CPHERE,6
+       GET     CPTABLE,STACK >?TMP1
+       SUB     FX,6
+       ADD     CPHERE,STACK
+       GET     CPTABLE,STACK
+       EQUAL?  0,?TMP1,STACK \?ELS59
+       CALL    CPMOVE,FX
+       RFALSE  
+?ELS59:        LESS?   FX,0 \?ELS63
+       SUB     CPHERE,6
+       GET     CPTABLE,STACK >?TMP1
+       ADD     CPHERE,6
+       ADD     STACK,FX >STACK
+       GET     CPTABLE,STACK
+       EQUAL?  0,?TMP1,STACK \?ELS63
+       CALL    CPMOVE,FX
+       RFALSE  
+?ELS63:        PRINTI  "There is a wall there."
+       CRLF    
+       RFALSE  
+
+
+       .FUNCT  ILLCP,ONE,TWO
+       MOD     ONE,6
+       ZERO?   STACK \?ELS5
+       EQUAL?  TWO,MINUS-FIVE,1,7 /TRUE
+?ELS5: MOD     ONE,6
+       EQUAL?  STACK,1 \?ELS9
+       EQUAL?  TWO,MINUS-SEVEN,MINUS-ONE,5 /TRUE
+?ELS9: LESS?   ONE,7 \?ELS13
+       LESS?   TWO,MINUS-FOUR /TRUE
+?ELS13:        GRTR?   ONE,30 \FALSE
+       GRTR?   TWO,4 /TRUE
+       RFALSE
+
+
+       .FUNCT  CPMOVE,FX
+       ADD     CPHERE,FX >FX
+       GET     CPTABLE,FX
+       ZERO?   STACK \?ELS5
+       CALL    CPGOTO,FX
+       RSTACK  
+?ELS5: PRINTR  "There is a wall there."
+
+
+       .FUNCT  CPENTER
+       EQUAL?  YEAR,YEAR-PRESENT \?THN6
+       ZERO?   CPBLOCK-FLAG /?ELS5
+?THN6: PRINTI  "The hole is blocked by sandstone."
+       CRLF    
+       RFALSE  
+?ELS5: SET     'CPHERE,1
+       RETURN  CP
+
+
+       .FUNCT  CPANT-ROOM,RARG
+       EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "This is a small square room, in the middle of which is a perfectly round hole"
+       ZERO?   CPBLOCK-FLAG \?THN13
+       EQUAL?  YEAR,YEAR-PRESENT /?ELS12
+?THN13:        PRINTR  " which is blocked by smooth sandstone."
+?ELS12:        PRINTR  " through which you can discern the floor some ten feet below. The place under the hole is dark, but it appears to be completely enclosed in rock. In any event, it doesn't seem likely that you could climb back up. Exits are west and, up a few steps, north."
+
+
+       .FUNCT  CPLADDER-OBJECT,FLG=0
+       SUB     CPHERE,1
+       GET     CPTABLE,STACK
+       EQUAL?  STACK,-3 /?THN6
+       ADD     CPHERE,1
+       GET     CPTABLE,STACK
+       EQUAL?  STACK,-2 \?ELS5
+       SET     'FLG,TRUE-VALUE
+       ZERO?   FLG /?ELS5
+?THN6: EQUAL?  PRSA,V?CLIMB-FOO,V?CLIMB-UP \?ELS14
+       ZERO?   FLG /?ELS19
+       EQUAL?  CPHERE,1 \?ELS19
+       SET     'CPSOLVE-FLAG,TRUE-VALUE
+       CALL    GOTO,CP-ANTE
+       RSTACK  
+?ELS19:        PRINTR  "You hit your head on the ceiling and fall off the ladder."
+?ELS14:        PRINTR  "Come, come!"
+?ELS5: PRINTR  "I can't see any ladder here."
+
+
+       .FUNCT  CPWALL-OBJECT,WL,NWL,NXT,NNXT,CNT,TOP,SNAP=0
+       EQUAL?  PRSA,V?MOVE \?ELS5
+       PRINTR  "You can't grab the wall to pull it."
+?ELS5: EQUAL?  PRSA,V?PUSH \FALSE
+       CALL    CPNEXT,CPHERE,PRSO >NXT
+       ZERO?   NXT \?CND10
+       PRINTR  "The wall doesn't budge."
+?CND10:        GET     CPTABLE,NXT >WL
+       ZERO?   WL \?ELS19
+       PRINTR  "There is only a passage in that direction."
+?ELS19:        EQUAL?  WL,1 \?ELS23
+       PRINTR  "The wall doesn't budge."
+?ELS23:        CALL    CPNEXT,NXT,PRSO >NNXT
+       ZERO?   NNXT \?ELS27
+       PRINTR  "The wall barely gives."
+?ELS27:        GET     CPTABLE,NNXT >NWL
+       ZERO?   NWL /?ELS31
+       PRINTR  "The wall barely gives."
+?ELS31:        PRINTI  "The wall slides forward and you follow it"
+       ZERO?   CPPUSH-FLAG /?ELS40
+       PRINTI  " to this position:"
+       CRLF    
+       JUMP    ?CND38
+?ELS40:        INC     'SCORE
+       PRINTI  "....
+The architecture of this region is getting complex, so that further descriptions will be diagrams of the immediate vicinity in a 3x3 grid. The walls here are rock, but of two different types - sandstone and marble. The following notations will be used:
+"
+       GET     0,8
+       BOR     STACK,2
+       PUT     0,8,STACK
+       PRINTI  "
+  .. = your position (middle of grid)
+  MM  = marble wall
+  SS  = sandstone wall
+  ??  = unknown (blocked by walls)
+
+"
+       GET     0,8
+       BAND    STACK,-3
+       PUT     0,8,STACK
+?CND38:        SET     'CPPUSH-FLAG,TRUE-VALUE
+       PUT     CPTABLE,NXT,0
+       PUT     CPTABLE,NNXT,WL
+       ZERO?   NNXT /?CND50
+       SUB     NNXT,1
+       MUL     8,STACK >TOP
+       GET     CPOBJS,TOP >CNT
+?PRG53:        ZERO?   CNT \?ELS57
+       JUMP    ?CND50
+?ELS57:        INC     'TOP
+       GET     CPOBJS,TOP
+       MOVE    STACK,CP-OUT
+       ZERO?   SNAP \?CND60
+       SET     'SNAP,TRUE-VALUE
+       PRINTI  "You hear a soft ""snap"" from behind the wall you were pushing."
+       CRLF    
+?CND60:        DEC     'CNT
+       JUMP    ?PRG53
+?CND50:        EQUAL?  NNXT,1 \?CND65
+       SET     'CPBLOCK-FLAG,TRUE-VALUE
+?CND65:        CALL    CPGOTO,NXT
+       RSTACK  
+
+
+       .FUNCT  CPGOTO,FX,F,X,CNT,TOP
+       SET     'CP-MOVED,TRUE-VALUE
+       FCLEAR  HERE,TOUCHBIT
+       SUB     CPHERE,1
+       MUL     8,STACK >TOP
+       ADD     TOP,1 >CNT
+       FIRST?  CP >F /?KLU22
+?KLU22:        
+?PRG1: NEXT?   F >X /?KLU23
+?KLU23:        ZERO?   F \?ELS5
+       JUMP    ?REP2
+?ELS5: EQUAL?  F,ADVENTURER \?ELS7
+       JUMP    ?CND3
+?ELS7: PUT     CPOBJS,CNT,F
+       REMOVE  F
+       INC     'CNT
+?CND3: ZERO?   X \?ELS12
+       JUMP    ?REP2
+?ELS12:        SET     'F,X
+       JUMP    ?PRG1
+?REP2: SUB     CNT,TOP
+       SUB     STACK,1
+       PUT     CPOBJS,TOP,STACK
+       SET     'CPHERE,FX
+       SUB     CPHERE,1
+       MUL     8,STACK >TOP
+       GET     CPOBJS,TOP >CNT
+?PRG15:        ZERO?   CNT \?ELS19
+       JUMP    ?REP16
+?ELS19:        INC     'TOP
+       GET     CPOBJS,TOP
+       MOVE    STACK,CP
+       DEC     'CNT
+       JUMP    ?PRG15
+?REP16:        CALL    PERFORM,V?LOOK
+       RTRUE   
+
+
+       .FUNCT  CPNEXT,RM,OBJ,FX
+       CALL    LKP,OBJ,CPWALLS >FX
+       CALL    ILLCP,RM,FX
+       ZERO?   STACK \FALSE
+       ADD     RM,FX
+       RSTACK  
+
+
+       .FUNCT  CPDOOR-F
+       EQUAL?  HERE,CP \?ELS5
+       EQUAL?  CPHERE,33 /?ELS5
+       PRINTR  "I can't see any steel door here."
+?ELS5: EQUAL?  PRSA,V?OPEN \?ELS11
+       ZERO?   CP-FLAG /?ELS16
+       PRINTR  "The steel door has already opened."
+?ELS16:        PRINTR  "You can't force it open."
+?ELS11:        EQUAL?  PRSA,V?CLOSE \?ELS25
+       ZERO?   CP-FLAG /?ELS30
+       PRINTR  "There doesn't seem to be any way to close it."
+?ELS30:        PRINTR  "Do you think it isn't already?"
+?ELS25:        EQUAL?  PRSA,V?MUNG \?ELS39
+       PRINTR  "The door is, to a first approximation, indestructible."
+?ELS39:        EQUAL?  PRSA,V?KNOCK \FALSE
+       PRINTR  "Besides a great amount of reverberation, nothing happens."
+
+
+       .FUNCT  CP-ROOM,RARG
+       EQUAL?  RARG,M-ENTER \?ELS5
+       EQUAL?  PRSO,P?DOWN \?ELS10
+       PUSH    1
+       JUMP    ?CND6
+?ELS10:        PUSH    33
+?CND6: SET     'CPHERE,STACK
+       RETURN  CPHERE
+?ELS5: EQUAL?  RARG,M-LOOK \FALSE
+       ZERO?   CPPUSH-FLAG /?ELS19
+       CALL    CPWHERE
+       RSTACK  
+?ELS19:        PRINTR  "You are in a small square room bounded to the north and west with marble walls and to the east and south with sandstone walls."
+
+
+       .FUNCT  CPNS,NUM
+       GRTR?   NUM,36 /TRUE
+       LESS?   NUM,1 /TRUE
+       GET     CPTABLE,NUM
+       RSTACK  
+
+
+       .FUNCT  CPEW,NUM,FOO
+       MOD     NUM,6
+       EQUAL?  STACK,FOO /TRUE
+       GET     CPTABLE,NUM
+       RSTACK  
+
+
+       .FUNCT  CPWHERE,N,S,E,W
+       ADD     CPHERE,-6
+       CALL    CPNS,STACK >N
+       ADD     CPHERE,6
+       CALL    CPNS,STACK >S
+       ADD     CPHERE,1
+       CALL    CPEW,STACK,1 >E
+       ADD     CPHERE,-1
+       CALL    CPEW,STACK,0 >W
+       GET     0,8
+       BOR     STACK,2
+       PUT     0,8,STACK
+       PRINTI  "      +"
+       CALL    CP-CORNER,MINUS-SEVEN,N,W
+       PRINTI  " "
+       CALL    CP-ORTHO,N
+       PRINTI  " "
+       CALL    CP-CORNER,MINUS-FIVE,N,E
+       PRINTI  "+"
+       CRLF    
+       PRINTI  "West  +"
+       CALL    CP-ORTHO,W
+       PRINTI  " .. "
+       CALL    CP-ORTHO,E
+       PRINTI  "+  East"
+       CRLF    
+       PRINTI  "      +"
+       CALL    CP-CORNER,5,S,W
+       PRINTI  " "
+       CALL    CP-ORTHO,S
+       PRINTI  " "
+       CALL    CP-CORNER,7,S,E
+       PRINTI  "+"
+       CRLF    
+       GET     0,8
+       BAND    STACK,-3
+       PUT     0,8,STACK
+       EQUAL?  CPHERE,1 \?ELS25
+       PRINTI  "In the ceiling above you is a large circular opening."
+       CRLF    
+       JUMP    ?CND23
+?ELS25:        EQUAL?  CPHERE,22 \?ELS29
+       PRINTI  "The center of the floor here is noticeably depressed."
+       CRLF    
+       JUMP    ?CND23
+?ELS29:        EQUAL?  CPHERE,33 \?CND23
+       PRINTI  "In the center of the west wall is a steel door which is "
+       ZERO?   CP-FLAG /?ELS38
+       PRINTI  "open"
+       JUMP    ?CND36
+?ELS38:        PRINTI  "closed"
+?CND36:        PRINTI  ". On one side of the door is a narrow slot."
+       CRLF    
+?CND23:        EQUAL?  E,-2 \?CND48
+       PRINTI  "There is a ladder here, firmly attached to the east wall."
+       CRLF    
+?CND48:        EQUAL?  W,-3 \FALSE
+       PRINTR  "There is a ladder here, firmly attached to the west wall."
+
+
+       .FUNCT  CP-ORTHO,CONTENTS
+       ZERO?   CONTENTS \?ELS5
+       PRINTI  "  "
+       RTRUE   
+?ELS5: EQUAL?  CONTENTS,1 \?ELS9
+       PRINTI  "MM"
+       RTRUE   
+?ELS9: PRINTI  "SS"
+       RTRUE   
+
+
+       .FUNCT  CP-CORNER,DIR,COL,ROW,LOCN
+       ADD     CPHERE,DIR >LOCN
+       ZERO?   COL /?ELS5
+       ZERO?   ROW /?ELS5
+       PRINTI  "??"
+       RTRUE   
+?ELS5: CALL    ILLCP,CPHERE,DIR
+       ZERO?   STACK /?ELS11
+       PRINTI  "MM"
+       RTRUE   
+?ELS11:        LESS?   LOCN,1 /?THN21
+       GRTR?   LOCN,36 \?ELS20
+?THN21:        PUSH    1
+       JUMP    ?CND16
+?ELS20:        GET     CPTABLE,LOCN
+?CND16:        SET     'COL,STACK
+       ZERO?   COL \?ELS15
+       PRINTI  "  "
+       RTRUE   
+?ELS15:        EQUAL?  COL,1 \?ELS28
+       PRINTI  "MM"
+       RTRUE   
+?ELS28:        PRINTI  "SS"
+       RTRUE   
+
+
+       .FUNCT  CP-SLOT-FCN
+       EQUAL?  PRSA,V?PUT \FALSE
+       GETP    PRSO,P?SIZE
+       GRTR?   STACK,10 \?CND6
+       PRINTR  "It doesn't fit."
+?CND6: REMOVE  PRSO
+       EQUAL?  PRSO,LORE-BOOK \?ELS15
+       SET     'CP-FLAG,TRUE-VALUE
+       PRINTR  "The book drops easily into the slot and vanishes. The metal door slides open, revealing a passageway to the west, as a previously unseen sign flashes:
+    ""Royal Puzzle Exit Fee Paid
+          Item Confiscated"""
+?ELS15:        FSET?   PRSO,VICBIT /?THN20
+       FSET?   PRSO,VILLAIN \?ELS19
+?THN20:        CALL    PICK-ONE,YUKS
+       PRINT   STACK
+       CRLF    
+       RTRUE   
+?ELS19:        PRINTI  "The item vanishes into the slot. A moment later, a previously unseen sign flashes ""Garbage In, Garbage Out"" and spews the "
+       PRINTD  PRSO
+       PRINTR  " (now atomized) through the slot."
+
+
+       .FUNCT  CPOUT-ROOM,RARG
+       EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "You are in a narrow room, lit from above. A flight of steps leads up toward the north, and a "
+       ZERO?   CP-FLAG /?ELS10
+       PRINTI  "passage"
+       JUMP    ?CND8
+?ELS10:        PRINTI  "metal door"
+?CND8: PRINTR  " leads to the east."
+
+
+       .FUNCT  MRGO,TORM
+       EQUAL?  PRSO,P?NORTH,P?NW,P?NE \?ELS3
+       CALL    LKP,HERE,R-NORTHS >TORM
+       JUMP    ?CND1
+?ELS3: CALL    LKP,HERE,R-SOUTHS >TORM
+?CND1: EQUAL?  PRSO,P?NORTH,P?SOUTH \?ELS10
+       EQUAL?  MLOC,TORM \?ELS15
+       MOD     MDIR,180
+       ZERO?   STACK \?ELS20
+       PRINTI  "There is a wooden wall blocking your way."
+       CRLF    
+       RFALSE  
+?ELS20:        CALL    MIRIN,FALSE-VALUE
+       ZERO?   STACK /?ELS24
+       RETURN  IN-MIRROR
+?ELS24:        CALL    MIRBLOCK
+       RFALSE  
+?ELS15:        RETURN  TORM
+?ELS10:        EQUAL?  MLOC,TORM \?ELS30
+       MOD     MDIR,180
+       ZERO?   STACK \?ELS35
+       CALL    GO-E-W,TORM
+       RSTACK  
+?ELS35:        CALL    MIRBLOCK
+       RFALSE  
+?ELS30:        RETURN  TORM
+
+
+       .FUNCT  MIRBLOCK,MD
+       SET     'MD,MDIR
+       EQUAL?  PRSO,P?SOUTH \?CND1
+       ADD     MDIR,180
+       MOD     STACK,360 >MD
+?CND1: EQUAL?  MD,270 \?ELS12
+       ZERO?   MR1-FLAG /?THN9
+?ELS12:        EQUAL?  MD,90 \?ELS8
+       ZERO?   MR2-FLAG \?ELS8
+?THN9: PRINTR  "There is a large broken mirror blocking your way."
+?ELS8: PRINTR  "There is a large mirror blocking your way."
+
+
+       .FUNCT  GO-E-W,RM
+       EQUAL?  PRSO,P?NE,P?SE \?ELS5
+       CALL    LKP,RM,R-EASTS
+       RSTACK  
+?ELS5: CALL    LKP,RM,R-WESTS
+       RSTACK  
+
+
+       .FUNCT  EWTELL,RM,EAST?=0,M1?=0,MWIN
+       EQUAL?  RM,MRAE,MRBE,MRCE /?THN4
+       EQUAL?  RM,MRGE,MRCE \?CND1
+?THN4: SET     'EAST?,TRUE-VALUE
+?CND1: ZERO?   EAST? /?ELS13
+       PUSH    0
+       JUMP    ?CND9
+?ELS13:        PUSH    180
+?CND9: ADD     MDIR,STACK
+       EQUAL?  STACK,180 \?CND6
+       SET     'M1?,TRUE-VALUE
+?CND6: ZERO?   M1? /?ELS19
+       SET     'MWIN,MR1-FLAG
+       JUMP    ?CND17
+?ELS19:        SET     'MWIN,MR2-FLAG
+?CND17:        PRINTI  "You are in a narrow room, whose "
+       ZERO?   EAST? /?ELS29
+       PUSH    STR?66
+       JUMP    ?CND25
+?ELS29:        PUSH    STR?67
+?CND25:        PRINT   STACK
+       PRINTI  " wall is a large "
+       ZERO?   MWIN /?ELS37
+       PUSH    STR?68
+       JUMP    ?CND33
+?ELS37:        PUSH    STR?69
+?CND33:        PRINT   STACK
+       CRLF    
+       ZERO?   M1? /?CND41
+       ZERO?   MIRROR-OPEN-FLAG /?CND41
+       ZERO?   MWIN /?ELS52
+       PUSH    STR?70
+       JUMP    ?CND48
+?ELS52:        PUSH    STR?71
+?CND48:        PRINT   STACK
+       CRLF    
+?CND41:        PRINTR  "The opposite wall is solid rock."
+
+
+       .FUNCT  MRDEW,RARG=0
+       EQUAL?  RARG,M-LOOK \FALSE
+       CALL    EWTELL,HERE
+       SET     'GUARDIANS-SEEN,TRUE-VALUE
+       PRINTI  "Somewhat to the south"
+       PRINT   GUARDSTR
+       CRLF    
+       RTRUE   
+
+
+       .FUNCT  MRCEW,RARG=0
+       EQUAL?  RARG,M-LOOK \FALSE
+       CALL    EWTELL,HERE
+       SET     'GUARDIANS-SEEN,TRUE-VALUE
+       PRINTI  "Somewhat to the north"
+       PRINT   GUARDSTR
+       CRLF    
+       RTRUE   
+
+
+       .FUNCT  MRBEW,RARG=0
+       EQUAL?  RARG,M-LOOK \FALSE
+       CALL    EWTELL,HERE
+       PRINTR  "To the north and south are large hallways."
+
+
+       .FUNCT  MRAEW,RARG=0
+       EQUAL?  RARG,M-LOOK \FALSE
+       CALL    EWTELL,HERE
+       PRINTR  "To the north is a large hallway."
+
+
+       .FUNCT  LOOK-TO,RMN,RMS,NORTH?=0,NTELL=0,STELL=0,MIR?,M1?=0,DIR
+       EQUAL?  HERE,MREYE,FRONT-DOOR /?CND1
+       PRINTI  "This is a part of the long hallway. The east and west walls are dressed stone. In the center of the hall is a shallow stone channel. In the center of the room the channel widens into a large hole around which is engraved a compass rose."
+       CRLF    
+?CND1: EQUAL?  HERE,MRG \?ELS8
+       SET     'GUARDIANS-SEEN,TRUE-VALUE
+       PRINTI  "On either side of you are identical stone statues holding bludgeons. They appear ready to strike, though, for the moment, they remain impassive."
+       CRLF    
+       JUMP    ?CND6
+?ELS8: EQUAL?  HERE,MRC \?ELS12
+       SET     'GUARDIANS-SEEN,TRUE-VALUE
+       PRINTI  "Somewhat to the north"
+       PRINT   GUARDSTR
+       CRLF    
+       SET     'NTELL,TRUE-VALUE
+       JUMP    ?CND6
+?ELS12:        EQUAL?  HERE,FRONT-DOOR \?ELS16
+       PRINTI  "You are in a north-south hallway which ends, to the north, at a large wooden door."
+       CRLF    
+       SET     'NTELL,TRUE-VALUE
+       JUMP    ?CND6
+?ELS16:        EQUAL?  HERE,MRD \?ELS20
+       SET     'GUARDIANS-SEEN,TRUE-VALUE
+       PRINTI  "Somewhat to the south"
+       PRINT   GUARDSTR
+       CRLF    
+       SET     'STELL,TRUE-VALUE
+       JUMP    ?CND6
+?ELS20:        EQUAL?  HERE,MRA \?CND6
+       PRINTI  "The hallway continues to the south."
+       CRLF    
+       SET     'STELL,TRUE-VALUE
+?CND6: EQUAL?  MLOC,RMN,RMS \?CND27
+       EQUAL?  MLOC,RMN \?ELS32
+       SET     'NORTH?,TRUE-VALUE
+       SET     'NTELL,TRUE-VALUE
+       SET     'DIR,STR?73
+       JUMP    ?CND30
+?ELS32:        SET     'STELL,TRUE-VALUE
+       SET     'DIR,STR?74
+?CND30:        ZERO?   NORTH? /?ELS39
+       GRTR?   MDIR,180 \?ELS39
+       LESS?   MDIR,359 \?ELS39
+       SET     'M1?,TRUE-VALUE
+       PUSH    MR1-FLAG
+       JUMP    ?CND35
+?ELS39:        ZERO?   NORTH? \?ELS43
+       GRTR?   MDIR,0 \?ELS43
+       LESS?   MDIR,179 \?ELS43
+       SET     'M1?,TRUE-VALUE
+       PUSH    MR1-FLAG
+       JUMP    ?CND35
+?ELS43:        PUSH    MR2-FLAG
+?CND35:        SET     'MIR?,STACK
+       MOD     MDIR,180
+       ZERO?   STACK \?ELS50
+       PRINTI  "The "
+       PRINT   DIR
+       PRINTI  "th side of the room is divided by a wooden wall into small hallways to the "
+       PRINT   DIR
+       PRINTI  "theast and "
+       PRINT   DIR
+       PRINTI  "thwest."
+       CRLF    
+       JUMP    ?CND27
+?ELS50:        ZERO?   MIR? /?ELS65
+       PUSH    STR?75
+       JUMP    ?CND61
+?ELS65:        PUSH    STR?76
+?CND61:        PRINT   STACK
+       PRINT   DIR
+       PRINTI  "th side of the hallway."
+       CRLF    
+       ZERO?   M1? /?CND48
+       ZERO?   MIRROR-OPEN-FLAG /?CND48
+       ZERO?   MIR? /?ELS80
+       PUSH    STR?70
+       JUMP    ?CND76
+?ELS80:        PUSH    STR?71
+?CND76:        PRINT   STACK
+       CRLF    
+?CND48:        
+?CND27:        ZERO?   NTELL \?ELS86
+       ZERO?   STELL \?ELS86
+       PRINTR  "The corridor continues north and south."
+?ELS86:        ZERO?   NTELL \?ELS92
+       PRINTR  "The corridor continues north."
+?ELS92:        ZERO?   STELL \TRUE
+       PRINTR  "The corridor continues south."
+
+
+       .FUNCT  MRDF,RARG=0
+       EQUAL?  RARG,M-LOOK \FALSE
+       CALL    LOOK-TO,FRONT-DOOR,MRG
+       RSTACK  
+
+
+       .FUNCT  MRCF,RARG=0
+       EQUAL?  RARG,M-LOOK \FALSE
+       CALL    LOOK-TO,MRG,MRB
+       RSTACK  
+
+
+       .FUNCT  MRBF,RARG=0
+       EQUAL?  RARG,M-LOOK \FALSE
+       CALL    LOOK-TO,MRC,MRA
+       RSTACK  
+
+
+       .FUNCT  MRAF,RARG=0
+       EQUAL?  RARG,M-LOOK \FALSE
+       CALL    LOOK-TO,MRB,FALSE-VALUE
+       RSTACK  
+
+
+       .FUNCT  EG-INFESTED?,R
+       EQUAL?  MLOC,MRG \?ELS5
+       EQUAL?  R,IN-MIRROR /?THN1
+?ELS5: EQUAL?  R,MRGE,MRG,MRGW \FALSE
+       PUSH    1
+?THN1: RSTACK  
+
+
+       .FUNCT  GUARDIANS,RARG=0
+       EQUAL?  RARG,M-LOOK \?ELS5
+       EQUAL?  HERE,MRG \?ELS10
+       CALL    LOOK-TO,MRD,MRC
+       RSTACK  
+?ELS10:        CALL    EWTELL,HERE
+       PRINTR  "To the east and west are the Guardians of Zork, in perfect symmetry. From here, it's hard to tell which of the two is a reflection!"
+?ELS5: EQUAL?  RARG,M-ENTER \?ELS16
+       ZERO?   INVIS \?ELS16
+       CALL    JIGS-UP,STR?77
+       RSTACK  
+?ELS16:        EQUAL?  RARG,M-END \FALSE
+       EQUAL?  PRSA,V?EXAMINE \?ELS22
+       EQUAL?  HERE,IN-MIRROR \?ELS27
+       PRINTR  "You can't see them from here."
+?ELS27:        PRINTR  "The guardians are quite impressive. I wouldn't get in their way if I were you!"
+?ELS22:        EQUAL?  PRSA,V?THROW \?ELS35
+       EQUAL?  PRSI,GUARDIAN \?ELS35
+       PRINTI  "The "
+       PRINTD  PRSO
+       PRINTI  " flies within sight of the guardians, who, in perfect unison, destroy it utterly. Satisfied, they resume their posts."
+       CRLF    
+       REMOVE  PRSO
+       RTRUE   
+?ELS35:        EQUAL?  PRSA,V?ATTACK \?ELS41
+       PRINTR  "You aren't close enough to fight them and even if you were, the contest would be a bit one-sided."
+?ELS41:        EQUAL?  PRSA,V?HELLO \FALSE
+       PRINTR  "The statues are impassive."
+
+
+       .FUNCT  MIRROR-DIR?,DIR,RM,TBL
+       EQUAL?  DIR,P?NORTH \?ELS5
+       PUSH    R-NORTHS
+       JUMP    ?CND1
+?ELS5: PUSH    R-SOUTHS
+?CND1: SET     'TBL,STACK
+       GETPT   RM,DIR
+       ZERO?   STACK /FALSE
+       CALL    LKP,RM,TBL
+       EQUAL?  MLOC,STACK \FALSE
+       EQUAL?  DIR,P?NORTH \?ELS19
+       GRTR?   MDIR,180 \?ELS19
+       LESS?   MDIR,360 /TRUE
+?ELS19:        EQUAL?  DIR,P?SOUTH \?ELS23
+       GRTR?   MDIR,0 \?ELS23
+       LESS?   MDIR,180 /TRUE
+?ELS23:        RETURN  2
+
+
+       .FUNCT  WOODEN-WALL-F
+       MOD     MDIR,180
+       ZERO?   STACK \?ELS5
+       CALL    MIRROR-DIR?,P?NORTH,HERE
+       ZERO?   STACK \?THN8
+       CALL    MIRROR-DIR?,P?SOUTH,HERE
+       ZERO?   STACK /?ELS5
+?THN8: EQUAL?  PRSA,V?PUSH \FALSE
+       PRINTR  "The structure won't budge."
+?ELS5: PRINTR  "I can't see any wooden wall here."
+
+
+       .FUNCT  MIRROR-HERE?,RM,TMP
+       EQUAL?  HERE,MRAE,MRAW,MRBE /?THN6
+       EQUAL?  HERE,MRBW,MRCE,MRCW /?THN6
+       EQUAL?  HERE,MRGE,MRGW,MRDE /?THN6
+       EQUAL?  HERE,MRDW \?ELS5
+?THN6: EQUAL?  RM,MRAE,MRBE,MRCE /?THN18
+       EQUAL?  RM,MRGE,MRDE \?ELS17
+?THN18:        PUSH    0
+       JUMP    ?CND13
+?ELS17:        PUSH    180
+?CND13:        ADD     MDIR,STACK
+       EQUAL?  180,STACK /TRUE
+       RETURN  2
+?ELS5: MOD     MDIR,180
+       ZERO?   STACK /FALSE
+       CALL    MIRROR-DIR?,P?NORTH,RM >TMP
+       ZERO?   TMP /?ELS27
+       RETURN  TMP
+?ELS27:        CALL    MIRROR-DIR?,P?SOUTH,RM >TMP
+       ZERO?   TMP /FALSE
+       RETURN  TMP
+
+
+       .FUNCT  MIRROR-FUNCTION,MIRROR
+       CALL    MIRROR-HERE?,HERE >MIRROR
+       ZERO?   MIRROR \?ELS5
+       PRINTR  "I can't see any mirror here."
+?ELS5: EQUAL?  PRSA,V?MOVE,V?OPEN \?ELS9
+       PRINTR  "I don't see a way to open the mirror here."
+?ELS9: EQUAL?  PRSA,V?LOOK-INSIDE \?ELS13
+       EQUAL?  MIRROR,1 \?ELS22
+       ZERO?   MR1-FLAG \?THN19
+?ELS22:        ZERO?   MR2-FLAG /?ELS18
+?THN19:        ZERO?   INVIS /?ELS27
+       PRINTR  "Amazingly, you have no reflection!"
+?ELS27:        PRINTR  "A disheveled adventurer stares back at you."
+?ELS18:        PRINTR  "You have destroyed the mirror, or have you forgotten?"
+?ELS13:        EQUAL?  PRSA,V?MUNG \?ELS40
+       EQUAL?  MIRROR,1 \?ELS45
+       ZERO?   MR1-FLAG /?ELS50
+       SET     'MR1-FLAG,FALSE-VALUE
+       PRINTR  "The mirror breaks, revealing a wooden panel behind it. The glistening fragments of mirror quietly sparkle into nonexistance."
+?ELS50:        PRINTR  "The mirror has already been broken."
+?ELS45:        ZERO?   MR2-FLAG /?ELS59
+       SET     'MR2-FLAG,FALSE-VALUE
+       PRINTR  "The mirror breaks, revealing a wooden panel behind it. The glistening fragments of mirror quietly sparkle into nonexistance."
+?ELS59:        PRINTR  "The mirror has already been broken."
+?ELS40:        EQUAL?  MIRROR,1 \?ELS72
+       ZERO?   MR1-FLAG /?THN69
+?ELS72:        ZERO?   MR2-FLAG \?ELS68
+?THN69:        PRINTR  "There's no mirror left."
+?ELS68:        EQUAL?  PRSA,V?PUSH \FALSE
+       EQUAL?  MIRROR,1 \?ELS83
+       PUSH    STR?78
+       JUMP    ?CND79
+?ELS83:        PUSH    STR?79
+?CND79:        PRINT   STACK
+       CRLF    
+       RTRUE   
+
+
+       .FUNCT  PANEL-FUNCTION,MIRROR
+       CALL    MIRROR-HERE?,HERE >MIRROR
+       ZERO?   MIRROR \?ELS5
+       PRINTR  "I can't see any panel here."
+?ELS5: EQUAL?  PRSA,V?MOVE,V?OPEN \?ELS9
+       PRINTR  "I don't see a way to open the panel here."
+?ELS9: EQUAL?  PRSA,V?MUNG \?ELS13
+       EQUAL?  MIRROR,1 \?ELS18
+       ZERO?   MR1-FLAG /?ELS23
+       PRINTR  "To break the panel you would have to break the mirror first."
+?ELS23:        PRINTR  "The panel is not that easily destroyed."
+?ELS18:        ZERO?   MR2-FLAG /?ELS32
+       PRINTR  "To break the panel you would have to break the mirror first."
+?ELS32:        PRINTR  "The panel is not that easily destroyed."
+?ELS13:        EQUAL?  PRSA,V?PUSH \FALSE
+       EQUAL?  MIRROR,1 \?ELS48
+       PUSH    STR?80
+       JUMP    ?CND44
+?ELS48:        PUSH    STR?81
+?CND44:        PRINT   STACK
+       CRLF    
+       RTRUE   
+
+
+       .FUNCT  MIROUT,DIR,RM
+       EQUAL?  PRSO,P?OUT \?ELS3
+       SET     'DIR,1
+       JUMP    ?CND1
+?ELS3: CALL    LKP,PRSO,DIRVEC >DIR
+?CND1: ZERO?   MIRROR-OPEN-FLAG /?ELS10
+       EQUAL?  DIR,1 /?THN17
+       ADD     MDIR,270
+       MOD     STACK,360
+       EQUAL?  STACK,DIR \FALSE
+?THN17:        MOD     MDIR,180
+       ZERO?   STACK \?ELS23
+       CALL    MIREW
+       RSTACK  
+?ELS23:        LESS?   MDIR,180 /?PRD26
+       PUSH    0
+       JUMP    ?PRD27
+?PRD26:        PUSH    1
+?PRD27:        CALL    MIRNS,STACK,TRUE-VALUE
+       RSTACK  
+?ELS10:        ZERO?   WOOD-OPEN-FLAG /?ELS31
+       EQUAL?  DIR,1 /?THN38
+       ADD     MDIR,180
+       MOD     STACK,360
+       EQUAL?  STACK,DIR \?ELS37
+?THN38:        ZERO?   MDIR \?ELS42
+       SET     'RM,FALSE-VALUE
+       JUMP    ?CND40
+?ELS42:        SET     'RM,TRUE-VALUE
+?CND40:        CALL    MIRNS,RM,TRUE-VALUE >RM
+       ZERO?   RM /?ELS49
+       PRINTI  "As you leave, the door swings shut."
+       CRLF    
+       SET     'WOOD-OPEN-FLAG,FALSE-VALUE
+       RETURN  RM
+?ELS49:        PRINTI  "You can't go that way."
+       CRLF    
+       RFALSE  
+?ELS37:        PRINTI  "You would hit one of the panels."
+       CRLF    
+       RFALSE  
+?ELS31:        PRINTI  "You are inside a closed box!"
+       CRLF    
+       RFALSE  
+
+
+       .FUNCT  MIRNS,NORTH?,EXIT?=0,S,T
+       ZERO?   EXIT? \?CND1
+       ZERO?   NORTH? /?ELS6
+       EQUAL?  MLOC,MRD /FALSE
+?ELS6: ZERO?   NORTH? \?CND1
+       EQUAL?  MLOC,MRA /FALSE
+?CND1: ZERO?   NORTH? /?ELS22
+       PUSH    P?NORTH
+       JUMP    ?CND18
+?ELS22:        PUSH    P?SOUTH
+?CND18:        GETPT   MLOC,STACK >T
+       ZERO?   T /FALSE
+       PTSIZE  T >S
+       EQUAL?  S,UEXIT \?ELS30
+       GETB    T,0
+       RSTACK  
+?ELS30:        ZERO?   NORTH? /?ELS32
+       CALL    LKP,MLOC,R-NORTHS
+       RSTACK  
+?ELS32:        CALL    LKP,MLOC,R-SOUTHS
+       RSTACK  
+
+
+       .FUNCT  MIREW
+       ZERO?   MDIR \?ELS5
+       CALL    LKP,MLOC,R-WESTS
+       RSTACK  
+?ELS5: CALL    LKP,MLOC,R-EASTS
+       RSTACK  
+
+
+       .FUNCT  MIRIN,VRB=1
+       CALL    MIRROR-HERE?,HERE
+       EQUAL?  STACK,1 \?ELS5
+       ZERO?   MIRROR-OPEN-FLAG /?ELS5
+       RETURN  IN-MIRROR
+?ELS5: ZERO?   VRB /FALSE
+       CALL    MIRROR-HERE?,HERE
+       EQUAL?  STACK,1 \?ELS11
+       ZERO?   MIRROR-OPENED \?ELS16
+       ZERO?   MR1-FLAG /?ELS16
+       PRINTI  "A mirror blocks your way."
+       CRLF    
+       RFALSE  
+?ELS16:        PRINTI  "The panel is closed."
+       CRLF    
+       RFALSE  
+?ELS11:        PRINTI  "The structure blocks your way."
+       CRLF    
+       RFALSE  
+
+
+       .FUNCT  MREYE-ROOM,RARG=0,O
+       EQUAL?  RARG,M-BEG \?ELS5
+       EQUAL?  PRSA,V?DROP \?ELS5
+       IN?     PRSO,WINNER \?ELS5
+       CALL    BEAM-STOPPED?
+       ZERO?   STACK \?ELS5
+       MOVE    PRSO,HERE
+       PRINTI  "You conveniently drop the "
+       PRINTD  PRSO
+       PRINTR  " in position to block the beam of light."
+?ELS5: EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "You are in the middle of a long north-south corridor whose walls are polished stone. A narrow red beam of light crosses the room at the north end, inches above the floor."
+       CRLF    
+       CALL    BEAM-STOPPED? >O
+       ZERO?   O /?CND14
+       PRINTI  "The beam is stopped halfway across the room by a "
+       PRINTD  O
+       PRINTI  " lying on the floor."
+       CRLF    
+?CND14:        CALL    LOOK-TO,MRA,FALSE-VALUE
+       RSTACK  
+
+
+       .FUNCT  BEAM-STOPPED?,N
+       FIRST?  MREYE >N /?KLU8
+?KLU8: 
+?PRG1: EQUAL?  N,PLAYER,BEAM /?ELS5
+       SET     'BEAM-BREAKER,N
+       RETURN  N
+?ELS5: NEXT?   N >N /?PRG1
+       RFALSE  
+
+
+       .FUNCT  BEAM-FUNCTION,PRO,PRI
+       EQUAL?  PRSA,V?LEAP \?ELS5
+       PRINTI  "You jump over the beam and into the hallway."
+       CRLF    
+       CALL    GOTO,MRA
+       RTRUE   
+?ELS5: EQUAL?  PRSA,V?FOLLOW \?ELS9
+       PRINTR  "It simply crosses the northern end of the room, so there's nowhere to follow it."
+?ELS9: EQUAL?  PRSA,V?EXAMINE \?ELS13
+       PRINTI  "The red beam of light crosses the north end of the room only an inch or so above the floor."
+       CALL    BEAM-STOPPED?
+       ZERO?   STACK /?CND16
+       PRINTI  " The beam is broken by a "
+       PRINTD  BEAM-BREAKER
+       PRINTI  " lying on the ground."
+?CND16:        CRLF    
+       RTRUE   
+?ELS13:        EQUAL?  PRSA,V?MUNG,V?PUT \?ELS22
+       EQUAL?  PRSA,V?PUT \?ELS25
+       SET     'PRI,PRSO
+       SET     'PRO,PRSI
+       JUMP    ?CND23
+?ELS25:        SET     'PRI,PRSI
+       SET     'PRO,PRSO
+?CND23:        ZERO?   PRI /FALSE
+       EQUAL?  PRO,BEAM \FALSE
+       IN?     PRI,WINNER \?ELS36
+       MOVE    PRI,HERE
+       SET     'BEAM-BREAKER,PRI
+       PRINTI  "The beam is now interrupted by a "
+       PRINTD  PRI
+       PRINTR  " lying on the floor."
+?ELS36:        IN?     PRI,HERE \?ELS40
+       PRINTI  "The "
+       PRINTD  PRI
+       PRINTR  " already breaks the beam."
+?ELS40:        EQUAL?  PRI,HANDS \?ELS44
+       PRINTR  "The beam is broken briefly as it passes through."
+?ELS44:        PRINTI  "You're not holding the "
+       PRINTD  PRI
+       PRINTR  "."
+?ELS22:        EQUAL?  PRSA,V?TAKE \FALSE
+       EQUAL?  PRSO,BEAM \FALSE
+       PRINTR  "No doubt you have a bottle of moonbeams as well."
+
+
+       .FUNCT  MRSWITCH
+       EQUAL?  PRSA,V?PUSH \FALSE
+       ZERO?   MRSWPUSH-FLAG /?ELS10
+       PRINTR  "Click."
+?ELS10:        CALL    BEAM-STOPPED?
+       ZERO?   STACK /?ELS20
+       PRINTI  "Click. Snap!"
+       CRLF    
+       CALL    QUEUE,I-MRINT,7
+       PUT     STACK,0,1
+       SET     'MRSWPUSH-FLAG,TRUE-VALUE
+       SET     'MIRROR-OPEN-FLAG,TRUE-VALUE
+       SET     'MIRROR-OPENED,TRUE-VALUE
+       FCLEAR  MRA,TOUCHBIT
+       RTRUE   
+?ELS20:        PRINTR  "Click."
+
+
+       .FUNCT  I-MRINT
+       SET     'MRSWPUSH-FLAG,FALSE-VALUE
+       SET     'MIRROR-OPEN-FLAG,FALSE-VALUE
+       CALL    MIRROR-HERE?,HERE
+       EQUAL?  STACK,1 /?THN6
+       EQUAL?  HERE,IN-MIRROR \?ELS5
+?THN6: PRINTR  "The mirror quietly swings shut."
+?ELS5: EQUAL?  HERE,MR-ANTE \FALSE
+       PRINTR  "The button pops back to its original position."
+
+
+       .FUNCT  MAGIC-MIRROR,RARG=0
+       EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "You are inside a rectangular box of wood whose structure is rather complicated. Four sides and the roof are filled in, and the floor is open.
+
+As you face the side opposite the entrance, two short sides of carved and polished wood are to your left and right. The left panel is mahogany, the right pine. The wall you face is red on its left half and black on its right. On the entrance side, the wall is white opposite the red part of the wall it faces, and yellow opposite the black section. The painted walls are at least twice the length of the unpainted ones. The ceiling is painted blue.
+
+In the floor is a stone channel about six inches wide and a foot deep. The channel is oriented in a north-south direction. In the exact center of the room the channel widens into a circular depression perhaps two feet wide. Incised in the stone around this area is a compass rose.
+
+Running from one short wall to the other at about waist height is a wooden bar, carefully carved and drilled. This bar is pierced in two places. The first hole is in the center of the bar (and thus the center of the room). The second is at the left end of the room (as you face opposite the entrance). Through each hole runs a wooden pole.
+
+The pole at the left end of the bar is short, extending about a foot above the bar, and ends in a hand grip. The pole "
+       EQUAL?  MLOC,MRB \?ELS10
+       EQUAL?  MDIR,270 \?ELS10
+       ZERO?   POLEUP-FLAG /?ELS15
+       PRINTI  "has been lifted out of a hole carved in the stone floor. There is evidently enough friction to keep the pole from dropping back down."
+       JUMP    ?CND8
+?ELS15:        PRINTI  "has been dropped into a hole carved in the stone floor."
+       JUMP    ?CND8
+?ELS10:        EQUAL?  MDIR,0,180 \?ELS23
+       ZERO?   POLEUP-FLAG /?ELS26
+       PRINTI  "is positioned above the stone channel in the floor."
+       JUMP    ?CND8
+?ELS26:        PRINTI  "has been dropped into the stone channel incised in the floor."
+       JUMP    ?CND8
+?ELS23:        PRINTI  "is resting on the stone floor."
+?CND8: PRINTI  "
+
+The long pole at the center of the bar extends from the ceiling through the bar to the circular area in the stone channel. This bottom end of the pole has a T-bar a bit less than two feet long attached to it, and on the T-bar is carved an arrow. The arrow and T-bar are pointing "
+       DIV     MDIR,45
+       GET     LONGDIRS,STACK
+       PRINT   STACK
+       PRINTI  "."
+       ZERO?   WOOD-OPEN-FLAG /?CND39
+       PRINTI  "
+The pine panel has been opened outward."
+?CND39:        CRLF    
+       RTRUE   
+
+
+       .FUNCT  MPANELS,MD
+       EQUAL?  PRSA,V?PUSH \FALSE
+       ZERO?   POLEUP-FLAG /?ELS10
+       EQUAL?  MLOC,MRG \?CND11
+       ZERO?   GUARDIANS-SEEN /?ELS16
+       CALL    JIGS-UP,STR?77
+       RTRUE   
+?ELS16:        CALL    JIGS-UP,STR?88
+       RTRUE   
+?CND11:        EQUAL?  PRSO,RED-PANEL,YELLOW-PANEL \?ELS22
+       ADD     MDIR,45
+       MOD     STACK,360 >MD
+       PRINTI  "The structure rotates clockwise."
+       CRLF    
+       JUMP    ?CND20
+?ELS22:        ADD     MDIR,315
+       MOD     STACK,360 >MD
+       PRINTI  "The structure rotates counterclockwise."
+       CRLF    
+?CND20:        PRINTI  "The arrow on the compass rose now indicates "
+       DIV     MD,45
+       GET     LONGDIRS,STACK
+       PRINT   STACK
+       PRINTI  "."
+       CRLF    
+       ZERO?   WOOD-OPEN-FLAG /?CND31
+       SET     'WOOD-OPEN-FLAG,FALSE-VALUE
+       PRINTI  "The pine wall closes quietly."
+       CRLF    
+?CND31:        SET     'MDIR,MD
+       RETURN  MDIR
+?ELS10:        MOD     MDIR,180
+       ZERO?   STACK \?ELS38
+       PRINTR  "The short pole prevents the structure from rotating."
+?ELS38:        PRINTR  "The structure shakes slightly but doesn't move."
+
+
+       .FUNCT  MENDS,RM
+       EQUAL?  PRSA,V?CLOSE \?ELS5
+       PRINTR  "You can't do that to the panel."
+?ELS5: EQUAL?  PRSA,V?PUSH /?THN10
+       EQUAL?  PRSA,V?OPEN \FALSE
+       EQUAL?  PRSO,PINE-PANEL \FALSE
+?THN10:        MOD     MDIR,180
+       ZERO?   STACK /?ELS18
+       PRINTR  "The structure rocks back and forth slightly but doesn't move."
+?ELS18:        EQUAL?  PRSO,MAHOGANY-PANEL \?ELS22
+       LESS?   MDIR,180 /?PRD28
+       PUSH    0
+       JUMP    ?PRD29
+?PRD28:        PUSH    1
+?PRD29:        CALL    MIRNS,STACK >RM
+       ZERO?   RM /?ELS27
+       ZERO?   MDIR /?PRD30
+       PUSH    0
+       JUMP    ?PRD31
+?PRD30:        PUSH    1
+?PRD31:        CALL    MIRMOVE,STACK,RM
+       RSTACK  
+?ELS27:        PRINTR  "The structure has reached the end of the stone channel and won't budge."
+?ELS22:        PRINTI  "The pine wall swings open."
+       CRLF    
+       EQUAL?  MLOC,MRD \?ELS46
+       ZERO?   MDIR /?THN43
+?ELS46:        EQUAL?  MLOC,MRC \?ELS48
+       EQUAL?  MDIR,180 /?THN43
+?ELS48:        EQUAL?  MLOC,MRG \?CND40
+?THN43:        ZERO?   GUARDIANS-SEEN /?ELS51
+       PRINTI  "The pine door opens into the field of view of the Guardians."
+       CRLF    
+       JUMP    ?CND49
+?ELS51:        PRINTI  "The pine door opens into the field of view of the Guardians of Zork, represented by two identical stone statues carrying bludgeons."
+       CRLF    
+?CND49:        CALL    JIGS-UP,STR?77
+       RTRUE   
+?CND40:        SET     'WOOD-OPEN-FLAG,TRUE-VALUE
+       CALL    QUEUE,I-PININ,5
+       PUT     STACK,0,1
+       RTRUE   
+
+
+       .FUNCT  I-PININ
+       ZERO?   WOOD-OPEN-FLAG /FALSE
+       SET     'WOOD-OPEN-FLAG,FALSE-VALUE
+       PRINTR  "The pine wall closes quietly."
+
+
+       .FUNCT  MIRMOVE,NORTH?,RM,PU?=0,LOSE=0
+       ZERO?   POLEUP-FLAG /?CND1
+       SET     'PU?,TRUE-VALUE
+?CND1: ZERO?   PU? /?ELS10
+       PUSH    STR?89
+       JUMP    ?CND6
+?ELS10:        PUSH    STR?90
+?CND6: PRINT   STACK
+       ZERO?   NORTH? /?ELS18
+       PUSH    STR?82
+       JUMP    ?CND14
+?ELS18:        PUSH    STR?85
+?CND14:        PRINT   STACK
+       PRINTI  " and stops over another compass rose."
+       CRLF    
+       SET     'MLOC,RM
+       EQUAL?  RM,MRG \TRUE
+       EQUAL?  HERE,IN-MIRROR \TRUE
+       ZERO?   PU? /?ELS29
+       SET     'LOSE,TRUE-VALUE
+       JUMP    ?CND27
+?ELS29:        ZERO?   MR1-FLAG /?THN33
+       ZERO?   MR2-FLAG \?ELS32
+?THN33:        SET     'LOSE,TRUE-VALUE
+       JUMP    ?CND27
+?ELS32:        ZERO?   MIRROR-OPEN-FLAG \?THN37
+       ZERO?   WOOD-OPEN-FLAG /?CND27
+?THN37:        SET     'LOSE,TRUE-VALUE
+?CND27:        ZERO?   LOSE /TRUE
+       ZERO?   GUARDIANS-SEEN /?ELS45
+       CALL    JIGS-UP,STR?91
+       RTRUE   
+?ELS45:        CALL    JIGS-UP,STR?92
+       RTRUE   
+
+
+       .FUNCT  SHORT-POLE-F
+       EQUAL?  PRSA,V?RAISE \?ELS5
+       EQUAL?  POLEUP-FLAG,2 \?ELS10
+       PRINTR  "The pole cannot be raised further."
+?ELS10:        SET     'POLEUP-FLAG,2
+       PRINTR  "The pole is now slightly above the floor."
+?ELS5: EQUAL?  PRSA,V?PUT \?ELS22
+       EQUAL?  PRSI,CHANNEL /?THN19
+?ELS22:        EQUAL?  PRSA,V?LOWER,V?PUSH \FALSE
+?THN19:        ZERO?   POLEUP-FLAG \?ELS27
+       PRINTR  "The pole cannot be lowered further."
+?ELS27:        MOD     MDIR,180
+       ZERO?   STACK \?ELS31
+       PRINTI  "The pole is lowered into the channel."
+       CRLF    
+       SET     'POLEUP-FLAG,0
+       RTRUE   
+?ELS31:        EQUAL?  MDIR,270 \?ELS35
+       EQUAL?  MLOC,MRB \?ELS35
+       SET     'POLEUP-FLAG,0
+       PRINTR  "The pole is lowered into the stone hole."
+?ELS35:        EQUAL?  POLEUP-FLAG,1 \?ELS41
+       PRINTR  "The pole is already resting on the floor."
+?ELS41:        SET     'POLEUP-FLAG,1
+       PRINTR  "The pole now rests on the stone floor."
+
+
+       .FUNCT  DUNGEON-MASTER-F,RARG=0
+       EQUAL?  RARG,M-OBJDESC /FALSE
+       EQUAL?  WINNER,DUNGEON-MASTER \?ELS7
+       EQUAL?  PRSA,V?FOLLOW \?ELS12
+       IN?     DUNGEON-MASTER,HERE \?ELS17
+       CALL    QUEUE,I-FOLIN,-1
+       PUT     STACK,0,1
+       PRINTR  "The dungeon master answers, ""I will follow."""
+?ELS17:        PRINTR  "The dungeon master's voice replies, ""You must come here first!"""
+?ELS12:        EQUAL?  PRSA,V?WAIT,V?STAY \?ELS25
+       CALL    QUEUE,I-FOLIN,0
+       PRINTR  "The dungeon master answers, ""I will stay."""
+?ELS25:        EQUAL?  PRSA,V?WALK \?ELS29
+       EQUAL?  PRSO,P?SOUTH,P?ENTER \?ELS34
+       EQUAL?  HERE,NORTH-CORRIDOR \?ELS34
+       PRINTR  """I am not permitted to enter the prison cell."""
+?ELS34:        EQUAL?  PRSO,P?NORTH \?ELS40
+       EQUAL?  HERE,NORTH-CORRIDOR \?ELS40
+       MOVE    DUNGEON-MASTER,PARAPET
+       PRINTI  """Very well. I am at the parapet!"""
+       CRLF    
+       CALL    QUEUE,I-FOLIN,0
+       RSTACK  
+?ELS40:        EQUAL?  PRSO,P?NORTH,P?ENTER \?ELS46
+       EQUAL?  HERE,SOUTH-CORRIDOR \?ELS46
+       PRINTR  """I am not permitted to enter the prison cell."""
+?ELS46:        PRINTR  """I prefer to stay where I am, thank you."""
+?ELS29:        EQUAL?  PRSA,V?WALK-TO \?ELS56
+       EQUAL?  PRSO,PARAPET-OBJ \?ELS56
+       MOVE    DUNGEON-MASTER,PARAPET
+       CALL    QUEUE,I-FOLIN,0
+       PRINTR  """Very well!"""
+?ELS56:        EQUAL?  PRSA,V?TAKE \?ELS62
+       PRINTR  """I will have no use for that, I am afraid."""
+?ELS62:        EQUAL?  PRSA,V?OPEN \?ELS66
+       EQUAL?  PRSO,DUNGEON-DOOR \?ELS66
+       PRINTR  "The dungeon master appears angered. ""Do not run from your quest: you are nearing the end!"""
+?ELS66:        EQUAL?  PRSA,V?WALK-TO /?THN73
+       EQUAL?  PRSA,V?WAIT,V?KILL,V?CLOSE /?THN73
+       EQUAL?  PRSA,V?OPEN,V?STAY,V?FOLLOW /?THN73
+       EQUAL?  PRSA,V?SPIN,V?TURN,V?PUSH \?ELS72
+?THN73:        EQUAL?  PRSA,V?WAIT,V?FOLLOW,V?STAY /FALSE
+       PRINTI  """If you wish,"" he replies."
+       CRLF    
+       RFALSE  
+?ELS72:        PRINTR  """Do not be foolish! Consider the end of your quest!"""
+?ELS7: EQUAL?  PRSA,V?EXAMINE \?ELS87
+       PRINTR  "He is dressed simply in a hood and cloak, wearing an amulet and ring, carrying an old book under one arm, and leaning on a wooden staff. A single key, as if to a prison cell, hangs from his belt."
+?ELS87:        EQUAL?  PRSA,V?MUNG,V?KILL,V?ATTACK \?ELS91
+       CALL    REALLY-DEAD,STR?93
+       RSTACK  
+?ELS91:        EQUAL?  PRSA,V?TAKE \?ELS93
+       PRINTR  """I'm willing to accompany you, but not ride in your pocket!"""
+?ELS93:        EQUAL?  PRSA,V?GIVE \FALSE
+       EQUAL?  PRSI,DUNGEON-MASTER \FALSE
+       PRINTR  """I have no need for those things."""
+
+
+       .FUNCT  MASTER-F
+       EQUAL?  HERE,PRISON-CELL,GOOD-CELL \?ELS5
+       CALL    HELLO?,MASTER
+       ZERO?   STACK /?ELS10
+       PRINTR  "He can't hear you."
+?ELS10:        PRINTR  "He is not here."
+?ELS5: EQUAL?  PRSA,V?TELL \?ELS18
+       SET     'PRSO,DUNGEON-MASTER
+       RFALSE  
+?ELS18:        EQUAL?  PRSA,V?SGIVE,V?GIVE \?ELS20
+       IN?     DUNGEON-MASTER,HERE \?ELS20
+       PRINTR  "He politely refuses your offer."
+?ELS20:        EQUAL?  PRSA,V?EXAMINE \?ELS26
+       EQUAL?  HERE,CELL,NORTH-CORRIDOR \?ELS26
+       IN?     DUNGEON-MASTER,PARAPET \?ELS26
+       PRINTR  "The dungeon master is standing on the parapet."
+?ELS26:        PRINTR  "The dungeon master isn't here."
+
+
+       .FUNCT  BEHIND-DOOR-F,RARG=0
+       EQUAL?  RARG,M-ENTER \?ELS5
+       ZERO?   DM-SEEN \?ELS5
+       CALL    QUEUE,I-FOLIN,-1
+       PUT     STACK,0,1
+       SET     'DM-SEEN,TRUE-VALUE
+       RETURN  DM-SEEN
+?ELS5: EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "You are in a narrow north-south corridor. At the south end is a door and at the north end is an east-west corridor. The door is "
+       CALL    DPR,DUNGEON-DOOR
+       RSTACK  
+
+
+       .FUNCT  FRONT-DOOR-F,RARG=0
+       EQUAL?  RARG,M-ENTER \?ELS5
+       CALL    QUEUE,I-FOLIN,0
+       RSTACK  
+?ELS5: EQUAL?  RARG,M-LOOK \FALSE
+       CALL    LOOK-TO,FALSE-VALUE,MRD
+       PRINTI  "The wooden door has a barred panel in it at about head height. The door itself is "
+       CALL    DPR,DUNGEON-DOOR
+       RSTACK  
+
+
+       .FUNCT  LOOK-LIKE-DM?
+       IN?     CLOAK,WINNER \FALSE
+       IN?     HOOD,WINNER \FALSE
+       IN?     AMULET,WINNER \FALSE
+       IN?     STAFF,WINNER \FALSE
+       IN?     RING,WINNER \FALSE
+       IN?     LORE-BOOK,WINNER \FALSE
+       IN?     KEY,WINNER /TRUE
+       RFALSE  
+
+
+       .FUNCT  DUNGEON-DOOR-F
+       EQUAL?  PRSA,V?CLOSE,V?OPEN \?ELS5
+       PRINTR  "The door won't budge."
+?ELS5: EQUAL?  PRSA,V?KNOCK \FALSE
+       EQUAL?  HERE,FRONT-DOOR \FALSE
+       PRINTI  "The knock reverberates along the hall. For a time it seems there will be no answer. Then you hear someone unlatching the small wooden panel. Through the bars of the great door, the wrinkled face of an old man appears."
+       ZERO?   INVIS /?CND14
+       PRINTI  " He seems not to take notice of you for for a brief moment, then recovers."
+?CND14:        CALL    LOOK-LIKE-DM?
+       ZERO?   STACK /?ELS24
+       PRINTI  " After a moment, he starts to smile broadly. He disappears for an instant and the massive door opens without a sound. The old man motions and you feel yourself drawn toward him.
+""I am the Master of the Dungeon!"" he booms. ""I have been watching you closely during your journey through the Great Underground Empire. Yes!,"" he says, as if recalling some almost forgotten time, ""we have met before, although I may not appear as I did then.""  You look closely into his deeply lined face and see the faces of the old man by the secret door, your ""friend"" at the cliff, and the hooded figure. ""You have shown kindness to the old man, and compassion toward the hooded one. I have seen you display patience in the puzzle and trust at the cliff. You have demonstrated strength, ingenuity, and valor. However, one final test awaits you. Now!  Command me as you will, and complete your quest!""
+"
+       CRLF    
+       CALL    GOTO,BEHIND-DOOR
+       SET     'IN-DUNGEON,TRUE-VALUE
+       RETURN  IN-DUNGEON
+?ELS24:        PRINTI  " He looks you over with his keen, piercing gaze and then speaks gravely. ""I have been waiting a long time for you, "
+       CALL    DMISH
+       GET     DM-REASONS,STACK
+       PRINT   STACK
+       PRINTI  " I will remain here. When you feel you are ready, go to the secret door and 'SAY ""FROTZ OZMOO""'!  Go, now!"" He starts to leave but turns back briefly and wags his finger in warning. ""Do not forget the double quotes!"" A moment later, you find yourself in the Button Room."
+       CRLF    
+       CALL    GOTO,MR-ANTE,FALSE-VALUE
+       RTRUE   
+
+
+       .FUNCT  DMISH,CNT=0
+       IN?     AMULET,WINNER \?CND1
+       INC     'CNT
+?CND1: IN?     LORE-BOOK,WINNER \?CND4
+       INC     'CNT
+?CND4: IN?     HOOD,WINNER \?CND7
+       INC     'CNT
+?CND7: IN?     CLOAK,WINNER \?CND10
+       INC     'CNT
+?CND10:        IN?     RING,WINNER \?CND13
+       INC     'CNT
+?CND13:        IN?     KEY,WINNER \?CND16
+       INC     'CNT
+?CND16:        IN?     STAFF,WINNER \?CND19
+       INC     'CNT
+       RETURN  CNT
+?CND19:        RETURN  CNT
+
+
+       .FUNCT  I-FOLIN
+       IN?     DUNGEON-MASTER,HERE /FALSE
+       EQUAL?  HERE,PRISON-CELL,CELL \?ELS7
+       ZERO?   FOLFLAG /?ELS7
+       PRINTI  "You notice that the dungeon master doesn't follow you."
+       CRLF    
+       SET     'FOLFLAG,FALSE-VALUE
+       RTRUE   
+?ELS7: EQUAL?  HERE,PRISON-CELL,CELL /FALSE
+       ZERO?   FOLFLAG \?ELS15
+       SET     'FOLFLAG,TRUE-VALUE
+       PRINTI  "The dungeon master rejoins you."
+       CRLF    
+       MOVE    DUNGEON-MASTER,HERE
+       RTRUE   
+?ELS15:        PRINTI  "The dungeon master follows you."
+       CRLF    
+       MOVE    DUNGEON-MASTER,HERE
+       RTRUE   
+
+
+       .FUNCT  MOVE-CELL-OBJECTS,TOP,CNT,F,X
+       SUB     LCELL,1
+       MUL     8,STACK >TOP
+       ADD     TOP,1 >CNT
+       FIRST?  CELL >F /?KLU24
+?KLU24:        ZERO?   F /?CND1
+?PRG5: NEXT?   F >X /?KLU25
+?KLU25:        ZERO?   F \?ELS9
+       JUMP    ?CND1
+?ELS9: PUT     CELLOBJS,CNT,F
+       REMOVE  F
+       INC     'CNT
+?CND7: ZERO?   X \?ELS14
+       JUMP    ?CND1
+?ELS14:        SET     'F,X
+       JUMP    ?PRG5
+?CND1: SUB     CNT,TOP
+       SUB     STACK,1
+       PUT     CELLOBJS,TOP,STACK
+       SUB     PNUMB,1
+       MUL     8,STACK >TOP
+       GET     CELLOBJS,TOP >CNT
+?PRG17:        ZERO?   CNT /TRUE
+       INC     'TOP
+       GET     CELLOBJS,TOP
+       MOVE    STACK,CELL
+       DEC     'CNT
+       JUMP    ?PRG17
+
+
+       .FUNCT  CELL-MOVE,F,X
+       FCLEAR  CELL-DOOR,OPENBIT
+       FCLEAR  BRONZE-DOOR,OPENBIT
+       EQUAL?  PNUMB,LCELL /FALSE
+       EQUAL?  PNUMB,4 \?ELS8
+       FCLEAR  BRONZE-DOOR,INVISIBLE
+       JUMP    ?CND6
+?ELS8: FSET    BRONZE-DOOR,INVISIBLE
+?CND6: IN?     PLAYER,CELL \?ELS13
+       SET     'WINNER,PLAYER
+       FCLEAR  GOOD-CELL,TOUCHBIT
+       FCLEAR  PRISON-CELL,TOUCHBIT
+       EQUAL?  LCELL,4 \?ELS18
+       FCLEAR  BRONZE-DOOR,INVISIBLE
+       PUSH    GOOD-CELL
+       JUMP    ?CND14
+?ELS18:        PUSH    PRISON-CELL
+?CND14:        CALL    GOTO,STACK
+       FIRST?  CELL >F /?KLU39
+?KLU39:        ZERO?   F /?CND11
+?PRG25:        NEXT?   F >X /?KLU40
+?KLU40:        ZERO?   F \?ELS29
+       JUMP    ?CND11
+?ELS29:        MOVE    F,HERE
+?CND27:        ZERO?   X \?ELS34
+       JUMP    ?CND11
+?ELS34:        SET     'F,X
+       JUMP    ?PRG25
+?ELS13:        CALL    MOVE-CELL-OBJECTS
+?CND11:        SET     'LCELL,PNUMB
+       RETURN  LCELL
+
+
+       .FUNCT  PARAPET-F,RARG
+       EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "You are standing behind a stone retaining wall which rims a large parapet overlooking a fiery pit. It is difficult to see through the smoke and flame which fills the pit, but it seems to be more or less bottomless. The pit itself is circular, about two hundred feet in diameter, and is fashioned of roughly hewn stone. The flames generate considerable heat, so it is rather uncomfortable standing here.
+There is an object here which looks like a sundial. On it are an indicator arrow and (in the center) a large button. On the face of the dial are numbers 1 through 8. The indicator points to the number "
+       PRINTN  PNUMB
+       PRINTI  "."
+       CRLF    
+       PRINTR  "To the south, across a narrow corridor, is a prison cell."
+
+
+       .FUNCT  DIAL,N
+       EQUAL?  PRSA,V?EXAMINE \?ELS5
+       PRINTI  "The dial points to "
+       PRINTN  PNUMB
+       PRINTR  "."
+?ELS5: EQUAL?  PRSA,V?TURN \?ELS9
+       EQUAL?  PRSI,INTNUM \?ELS14
+       ZERO?   P-NUMBER /?THN18
+       GRTR?   P-NUMBER,8 \?CND15
+?THN18:        PRINTR  "There is no such setting."
+?CND15:        SET     'PNUMB,P-NUMBER
+       EQUAL?  WINNER,PLAYER \TRUE
+       PRINTI  "The dial now points to "
+       PRINTN  PNUMB
+       PRINTR  "."
+?ELS14:        ZERO?   PRSI \?ELS28
+       PRINTR  "You must specify what to set the dial to."
+?ELS28:        PRINTR  "The dial face only contains numbers."
+?ELS9: EQUAL?  PRSA,V?SPIN \FALSE
+       RANDOM  8 >PNUMB
+       EQUAL?  WINNER,PLAYER \TRUE
+       PRINTI  "The dial spins and comes to a stop pointing at "
+       PRINTN  PNUMB
+       PRINTI  "."
+       RTRUE   
+
+
+       .FUNCT  DIALBUTTON,C
+       FSET?   CELL-DOOR,OPENBIT /?PRD1
+       PUSH    0
+       JUMP    ?PRD2
+?PRD1: PUSH    1
+?PRD2: SET     'C,STACK
+       FCLEAR  CELL,TOUCHBIT
+       EQUAL?  PRSA,V?PUSH \FALSE
+       EQUAL?  WINNER,PLAYER \?CND8
+       PRINTI  "The button depresses with a slight click, and pops back."
+       CRLF    
+?CND8: CALL    CELL-MOVE
+       ZERO?   C /TRUE
+       PRINTR  "You notice that the cell door is now closed."
+
+
+       .FUNCT  CELL-ROOM,RARG
+       EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "You are in a featureless prison cell. You can see "
+       FSET?   CELL-DOOR,OPENBIT \?ELS10
+       PRINTI  "an east-west corridor outside the open wooden door in front of you. Your view also takes in the parapet, and behind, a large, fiery pit."
+       CRLF    
+       JUMP    ?CND8
+?ELS10:        PRINTI  "through the small window in the closed door in front of you the parapet, and, behind that, smoke and flames rising from a fiery pit."
+       CRLF    
+?CND8: IN?     DUNGEON-MASTER,PARAPET \?CND17
+       PRINTI  "The dungeon master is standing on the parapet, leaning on his wooden staff. His keen gaze is fixed on you and he looks somewhat tense, as if waiting for something to happen."
+       CRLF    
+?CND17:        EQUAL?  LCELL,4 \TRUE
+       PRINTI  "Behind you, to the south, is a bronze door which is "
+       CALL    DPR,BRONZE-DOOR
+       RTRUE   
+
+
+       .FUNCT  NCELL-ROOM,RARG
+       EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "You are in a bare prison cell. Its wooden door is securely fastened, and you can see only flames and smoke through its small window. On the south wall is a bronze door which seems to be "
+       CALL    DPR,BRONZE-DOOR
+       RSTACK  
+
+
+       .FUNCT  DPR,OBJ
+       FSET?   OBJ,OPENBIT \?ELS5
+       PRINTR  "open."
+?ELS5: PRINTR  "closed."
+
+
+       .FUNCT  NORTH-CORRIDOR-F,RARG
+       EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "This is a wide east-west corridor which opens onto a northern parapet at its center. You can see flames and smoke as you peer towards the parapet. The corridor turns south at either end, and in the center of the south wall is a heavy wooden door with a small window barred with iron. The door is "
+       CALL    DPR,CELL-DOOR
+       RSTACK  
+
+
+       .FUNCT  SOUTH-CORRIDOR-F,RARG
+       EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "You are in an east-west corridor which turns north at its eastern and western ends. The walls are made of the finest marble. An additional passage leads south at the center of the corridor."
+       CRLF    
+       EQUAL?  LCELL,4 \TRUE
+       PRINTI  "In the center of the north wall is a bronze door which is "
+       CALL    DPR,BRONZE-DOOR
+       RTRUE   
+
+
+       .FUNCT  BRONZE-DOOR-F
+       EQUAL?  PRSA,V?OPEN \?ELS5
+       FSET?   BRONZE-DOOR,OPENBIT /?ELS5
+       EQUAL?  HERE,GOOD-CELL \?ELS5
+       ZERO?   BRONZE-DOOR-LOCKED \?ELS5
+       PRINTI  "On the other side of the bronze door is a narrow passage which opens out into a larger area."
+       CRLF    
+       FSET    BRONZE-DOOR,OPENBIT
+       RTRUE   
+?ELS5: EQUAL?  PRSA,V?OPEN \FALSE
+       ZERO?   BRONZE-DOOR-LOCKED /FALSE
+       PRINTR  "The bronze door is locked."
+
+
+       .FUNCT  LOCKED-DOOR-F
+       EQUAL?  PRSA,V?UNLOCK,V?OPEN \FALSE
+       PRINTR  "The door is securely fastened."
+
+
+       .FUNCT  NIRVANA-F,RARG
+       EQUAL?  RARG,M-END \FALSE
+       PRINTI  "As you gleefully examine your new-found riches, the Dungeon Master materializes beside you, and says, ""Now that you have solved all the mysteries of the Dungeon, it is time for you to assume your rightly-earned place in the scheme of things. Long have I waited for one capable of releasing me from my burden!"" He taps you lightly on the head with his staff, mumbling a few well-chosen spells, and you feel yourself changing, growing older and more stooped. For a moment there are two identical mages standing among the treasure, then your counterpart dissolves into a mist and disappears, a sardonic grin on his face.
+
+For a moment you are relieved, safe in the knowledge that you have at last completed your quest in ZORK. You begin to feel the vast powers and lore at your command and thirst for an opportunity to use them.
+
+"
+       CALL    FINISH
+       RSTACK  
+
+
+       .FUNCT  BRONZE-DOOR-EXIT
+       FSET?   BRONZE-DOOR,INVISIBLE \?ELS5
+       PRINTI  "You can't go that way."
+       CRLF    
+       RFALSE  
+?ELS5: FSET?   BRONZE-DOOR,OPENBIT \?ELS9
+       RETURN  CELL
+?ELS9: PRINTI  "The bronze door is closed."
+       CRLF    
+       RFALSE  
+
+
+       .FUNCT  SECRET-DOOR-F
+       EQUAL?  PRSA,V?OPEN \FALSE
+       FSET?   SECRET-DOOR,OPENBIT /FALSE
+       PRINTI  "The massive stone door opens noiselessly. "
+       PRINT   SECRET-DOOR-DESC
+       CRLF    
+       FSET    SECRET-DOOR,OPENBIT
+       RTRUE   
+
+
+       .FUNCT  MSTAIRS-F,RARG
+       EQUAL?  RARG,M-ENTER \?ELS5
+       RANDOM  100
+       GRTR?   30,STACK \?ELS5
+       ZERO?   OLD-MAN-FED \?ELS5
+       ZERO?   OLD-MAN-GONE \?ELS5
+       MOVE    OLD-MAN,HERE
+       RTRUE   
+?ELS5: EQUAL?  RARG,M-LOOK \FALSE
+       PRINTI  "You are in a room with passages heading southwest and southeast. The north wall is ornately carved, filled with strange runes and writing in an unfamiliar language."
+       CRLF    
+       FSET?   SECRET-DOOR,OPENBIT \?ELS16
+       PRINT   SECRET-DOOR-DESC
+       CRLF    
+       RTRUE   
+?ELS16:        FSET?   SECRET-DOOR,INVISIBLE /FALSE
+       PRINTR  "The outline of a door is barely visible on the surface of the rock."
+
+
+       .FUNCT  HELLO?,WHO
+       EQUAL?  WINNER,WHO /?THN8
+       EQUAL?  PRSA,V?INCANT,V?HELLO,V?SAY /?THN8
+       EQUAL?  PRSA,V?REPLY,V?ANSWER,V?TELL \FALSE
+?THN8: EQUAL?  PRSA,V?REPLY,V?INCANT /?THN13
+       EQUAL?  PRSA,V?SAY,V?ANSWER,V?TELL \TRUE
+?THN13:        SET     'P-CONT,FALSE-VALUE
+       SET     'QUOTE-FLAG,FALSE-VALUE
+       RTRUE   
+
+
+       .FUNCT  OLD-MAN-F,RARG=0
+       EQUAL?  RARG,M-OBJDESC \?ELS5
+       ZERO?   OLD-MAN-AWAKE /?ELS10
+       PRINTR  "There is an old man huddled in the corner, eyeing you cautiously. He seems weak and tired, and nods off frequently."
+?ELS10:        PRINTR  "An old and wizened man is huddled, asleep, in the corner. He is snoring loudly. From his appearance, he is weak and frail."
+?ELS5: EQUAL?  PRSA,V?GIVE \?ELS19
+       EQUAL?  PRSI,OLD-MAN \?ELS19
+       ZERO?   OLD-MAN-AWAKE /?ELS26
+       EQUAL?  PRSO,WAYBREAD \?ELS32
+       REMOVE  WAYBREAD
+       PRINTI  "He looks up at you and takes the waybread from you. Slowly, he eats the bread and pauses when he is finished. He starts to speak: ""Perhaps what you seek is through there!"" He points at the carved wall to the north, where you now notice the bare outline of a secret door. When you turn back to the old man, you notice that he has gone!"
+       CRLF    
+       FCLEAR  SECRET-DOOR,INVISIBLE
+       SET     'OLD-MAN-GONE,TRUE-VALUE
+       REMOVE  OLD-MAN
+       RTRUE   
+?ELS32:        IN?     WAYBREAD,WINNER \?ELS36
+       PRINTR  "He refuses your offer but motions with his arm to the waybread in your hand."
+?ELS36:        PRINTI  "The old man refuses the "
+       PRINTD  PRSO
+       PRINTR  " with a wave of his hand."
+?ELS26:        PRINTR  "He is asleep!"
+?ELS19:        EQUAL?  PRSA,V?EXAMINE \?ELS48
+       ZERO?   OLD-MAN-AWAKE /?ELS53
+       PRINTR  "The old man is barely awake and appears to nod off every few moments. He has bright eyes, which, when open, appear to see right through your body."
+?ELS53:        PRINTR  "The man is very, very old and wizened. He has a long, stringy beard and is snoring quite loudly."
+?ELS48:        EQUAL?  PRSA,V?LISTEN \?ELS62
+       ZERO?   OLD-MAN-AWAKE /?ELS67
+       PRINTR  "He isn't talking."
+?ELS67:        PRINTR  "He is snoring like a buzz saw."
+?ELS62:        CALL    HELLO?,OLD-MAN
+       ZERO?   STACK /?ELS76
+       ZERO?   OLD-MAN-AWAKE /?ELS81
+       PRINTR  "He nods at you without seeming to have understood."
+?ELS81:        PRINTR  "He is sleeping soundly and does not respond."
+?ELS76:        EQUAL?  PRSA,V?ALARM,V?SHAKE \?ELS90
+       PRINTI  "The old man is roused to consciousness. He peers at you through eyes which appear much younger and stronger than his frail body and waits, as if expecting something to happen."
+       CRLF    
+       SET     'OLD-MAN-AWAKE,TRUE-VALUE
+       CALL    QUEUE,I-OLD-MAN-SLEEPS,3
+       PUT     STACK,0,1
+       RTRUE   
+?ELS90:        EQUAL?  PRSA,V?MUNG,V?ATTACK,V?KILL \FALSE
+       PRINTI  "The attack seems to have left the old man unharmed! You watch in awe as he rises to his feet and seems to tower above you. He peers down menacingly, then sadly and wearily. ""Not yet,"" he mourns, and vanishes in a puff of smoke."
+       CRLF    
+       SET     'OLD-MAN-GONE,TRUE-VALUE
+       REMOVE  OLD-MAN
+       RTRUE   
+
+
+       .FUNCT  I-OLD-MAN-SLEEPS
+       SET     'OLD-MAN-AWAKE,FALSE-VALUE
+       IN?     OLD-MAN,HERE \FALSE
+       PRINTR  "You notice that the old man has fallen asleep."
+
+
+       .FUNCT  RUNES-F
+       EQUAL?  PRSA,V?READ,V?EXAMINE \FALSE
+       PRINTR  "The runes are in an ancient language. Some pictures, among the runes, depict flames, stone statues, and figures of old men."
+
+
+       .FUNCT  T-BAR-F
+       EQUAL?  PRSA,V?TURN \FALSE
+       PRINTR  "You don't have enough leverage to turn the T-bar itself. You might cause the whole structure to turn, however."
+
+
+       .FUNCT  FLAMING-PIT-F
+       EQUAL?  PRSA,V?EXAMINE \?ELS5
+       PRINTR  "The flaming pit is a seemingly bottomless abyss filled with smoke and flame."
+?ELS5: EQUAL?  PRSA,V?PUT \FALSE
+       EQUAL?  PRSI,FLAMING-PIT \FALSE
+       EQUAL?  HERE,PARAPET,NORTH-CORRIDOR \?ELS16
+       EQUAL?  PRSO,ME \?ELS21
+       PRINTR  "It would be a pity to end your life so near the end of your quest!"
+?ELS21:        PRINTI  "You cast the "
+       PRINTD  PRSO
+       PRINTI  " into the pit, where it is lost forever."
+       CRLF    
+       REMOVE  PRSO
+       RTRUE   
+?ELS16:        PRINTR  "You're not close enough."
+
+
+       .FUNCT  PARAPET-OBJ-F
+       EQUAL?  PRSA,V?EXAMINE \FALSE
+       EQUAL?  HERE,CELL,NORTH-CORRIDOR \?ELS10
+       PRINTI  "You can see the parapet and sundial from here."
+       IN?     DUNGEON-MASTER,PARAPET \?CND13
+       PRINTI  " The dungeon master is there also, leaning on his staff."
+?CND13:        CRLF    
+       RTRUE   
+?ELS10:        CALL    V-LOOK
+       RSTACK  
+
+
+       .FUNCT  ROSE-F
+       EQUAL?  PRSA,V?MOVE,V?TURN \FALSE
+       PRINTR  "The compass rose is made of stone and is imbedded in the ground. You could not possibly turn it or move it."
+
+
+       .FUNCT  CELL-DOOR-F
+       EQUAL?  PRSA,V?PUT \?ELS5
+       EQUAL?  PRSI,CELL-DOOR \?ELS5
+       PRINTR  "You will have to enter the cell first."
+?ELS5: EQUAL?  PRSA,V?THROUGH \FALSE
+       EQUAL?  HERE,CELL \?ELS16
+       PRINTR  "Look around."
+?ELS16:        CALL    DO-WALK,P?SOUTH
+       RTRUE   
+
+
+       .FUNCT  LORE-BOOK-F
+       EQUAL?  PRSA,V?BURN \?ELS5
+       IN?     LORE-BOOK,WINNER /?ELS5
+       PRINTI  "The book is consumed in a dazzling display of color."
+       CRLF    
+       REMOVE  PRSO
+       RTRUE   
+?ELS5: ZERO?   IN-DUNGEON /?ELS11
+       EQUAL?  PRSA,V?READ,V?EXAMINE,V?OPEN \?ELS11
+       PRINTR  "The book seems to will itself open to a specific page. On it is a picture of eight small rooms located around a great circle of flame. All are identical save one, which has a bronze door leading to a magnificent room bathed in golden light. A legend beneath the picture says only ""The Dungeon and Treasury of Zork."""
+?ELS11:        EQUAL?  PRSA,V?OPEN \FALSE
+       PRINTR  "The book can be perused but not left open."
+
+
+       .FUNCT  CP-HOLE-F
+       EQUAL?  PRSA,V?THROUGH \FALSE
+       CALL    DO-WALK,P?DOWN
+       RTRUE   
+
+
+       .FUNCT  TORCH-PSEUDO
+       PRINTR  "The torches are out of reach."
+
+
+       .FUNCT  WATER-FCN,AV,PI?
+       EQUAL?  PRSA,V?SGIVE /FALSE
+       EQUAL?  PRSA,V?THROUGH \?ELS5
+       CALL    PERFORM,V?SWIM,PRSO
+       RTRUE   
+?ELS5: EQUAL?  PRSA,V?FILL \?ELS7
+       SET     'PRSA,V?PUT
+       SET     'PRSI,PRSO
+       SET     'PRSO,GLOBAL-WATER
+       SET     'PI?,FALSE-VALUE
+       JUMP    ?CND1
+?ELS7: EQUAL?  PRSO,GLOBAL-WATER \?ELS9
+       SET     'PI?,FALSE-VALUE
+       JUMP    ?CND1
+?ELS9: ZERO?   PRSI /?CND1
+       SET     'PI?,TRUE-VALUE
+?CND1: ZERO?   PI? /?ELS15
+       SET     'PRSI,GLOBAL-WATER
+       JUMP    ?CND13
+?ELS15:        SET     'PRSO,GLOBAL-WATER
+?CND13:        EQUAL?  PRSA,V?PUT,V?TAKE \?ELS23
+       ZERO?   PI? \?ELS23
+       PRINTR  "The water slips through your fingers."
+?ELS23:        ZERO?   PI? /?ELS29
+       PRINTR  "You can't do that."
+?ELS29:        EQUAL?  PRSA,V?THROW,V?GIVE,V?DROP \FALSE
+       PRINTR  "You don't have any water."
+
+
+       .FUNCT  RANDOM-WALL
+       EQUAL?  PRSA,V?PUSH \FALSE
+       EQUAL?  HERE,IN-MIRROR \?ELS10
+       PRINTR  "You should specify which panel you want to push."
+?ELS10:        PRINTR  "You can't budge it; at least from here."
+
+       .ENDI
diff --git a/actions.zil b/actions.zil
new file mode 100644 (file)
index 0000000..00c7b32
--- /dev/null
@@ -0,0 +1,1935 @@
+"ACTIONS3 for
+                    ZORK III: The Dungeon Master
+                The Great Underground Empire (Part 3)
+       (c) Copyright 1982 Infocom, Inc.  All Rights Reserved.
+"
+
+<GLOBAL YUKS
+       <LTABLE
+        "A valiant attempt."
+        "You can't be serious."
+        "An interesting idea..."
+        "What a concept!">>
+
+<ROUTINE SWORD-FCN ()
+        <COND (,SWORD-IN-STONE?
+               <COND (<VERB? TAKE MOVE>
+                      <COND (<PROB 10>
+                             <TELL
+"Who do you think you are? Arthur?" CR>)
+                            (T <TELL
+"The sword is deeply imbedded within the rock.  You can't even begin
+to budge it." CR>)>)>)
+              (<AND <VERB? TAKE> <==? ,WINNER ,ADVENTURER>>
+               <ENABLE <QUEUE I-SWORD -1>>
+               <>)>>
+
+<GLOBAL LAMP-TABLE
+       <TABLE 300
+              "The lamp appears a bit dimmer."
+              100
+              "The lamp is definitely dimmer now."
+              50
+              "The lamp is nearly out."
+              0>>
+
+<ROUTINE LANTERN ()
+        <COND (<VERB? THROW>
+               <TELL
+"The lamp has smashed into the floor, and the light has gone out." CR>
+               <DISABLE <INT I-LANTERN>>
+               <REMOVE ,LAMP>
+               <SETG CURRENT-LAMP ,BROKEN-LAMP>
+               <MOVE ,BROKEN-LAMP ,HERE>)
+              (<VERB? LAMP-ON>
+               <COND (<NOT <FSET? ,LAMP ,LIGHTBIT>>
+                      <TELL "A burned-out lamp won't light." CR>)
+                     (ELSE
+                      <ENABLE <INT I-LANTERN>>
+                      <>)>)
+              (<VERB? LAMP-OFF>
+               <COND (<NOT <FSET? ,LAMP ,LIGHTBIT>>
+                      <TELL "The lamp has already burned out." CR>)
+                     (ELSE
+                      <DISABLE <INT I-LANTERN>>
+                      <>)>)
+              (<VERB? EXAMINE>
+               <COND (<NOT <FSET? ,LAMP ,LIGHTBIT>>
+                      <TELL "The lamp has burned out.">)
+                     (<FSET? ,LAMP ,ONBIT>
+                      <TELL "The lamp is on.">)
+                     (ELSE
+                      <TELL "The lamp is turned off.">)>
+               <CRLF>)>>
+
+<ROUTINE I-LANTERN ("AUX" TICK (TBL <VALUE LAMP-TABLE>))
+        <ENABLE <QUEUE I-LANTERN <SET TICK <GET .TBL 0>>>>
+        <LIGHT-INT ,LAMP .TBL .TICK>
+        <COND (<NOT <0? .TICK>>
+               <SETG LAMP-TABLE <REST .TBL 4>>)>
+        <RTRUE>>
+
+<ROUTINE LIGHT-INT (OBJ TBL TICK)
+        <COND (<0? .TICK>
+               <FCLEAR .OBJ ,LIGHTBIT>
+               <FCLEAR .OBJ ,ONBIT>)>
+        <COND (<OR <HELD? .OBJ> <IN? .OBJ ,HERE>>
+               <COND (<0? .TICK>
+                      <TELL
+"You'd better have more light than from the " D .OBJ "." CR>)
+                     (T
+                      <TELL <GET .TBL 1> CR>)>)>>
+
+<ROUTINE CRETIN ()
+        <COND (<VERB? GIVE>
+               <PERFORM ,V?TAKE ,PRSO>)
+              (<VERB? EAT> <TELL "Auto-cannibalism is not the answer." CR>)
+              (<VERB? KILL MUNG>
+               <JIGS-UP
+"If you insist.... Poof, you're dead!">)
+              (<VERB? TAKE>
+               <TELL "How romantic!" CR>)
+              (<VERB? DISEMBARK>
+               <TELL "You'll have to do that on your own." CR>)
+              (<VERB? EXAMINE>
+               <TELL "That's difficult unless your eyes are prehensile."
+                     CR>)
+              (<VERB? MAKE>
+               <TELL "Only you can do that." CR>)>>
+
+<ROUTINE CHASM-FCN ()
+        <COND (<OR <VERB? LEAP>
+                   <AND <VERB? PUT> <==? ,PRSO ,ME>>>
+               <TELL
+"You look before leaping and realize you would never survive." CR>)
+              (<VERB? CROSS>
+               <TELL "You'll have to find a bridge." CR>)
+              (<AND <VERB? PUT> <==? ,PRSI ,PSEUDO-OBJECT>>
+               <TELL
+"The " D ,PRSO " drops out of sight into the chasm." CR>
+               <REMOVE ,PRSO>)>>
+
+<ROUTINE PATH-OBJECT ()
+        <COND (<VERB? TAKE FOLLOW>
+               <TELL "You must specify a direction to go." CR>)
+              (<VERB? FIND>
+               <TELL "I can't help you there...." CR>)>>
+
+<ROUTINE TUNNEL-OBJECT ()
+        <COND (<AND <VERB? THROUGH> <GETP ,HERE ,P?IN>>
+               <DO-WALK ,P?IN>
+               <RTRUE>)
+              (T <PATH-OBJECT>)>>
+
+<ROUTINE GROUND-FCN ()
+        <COND (<AND <VERB? PUT> <==? ,PRSI ,GROUND>>
+               <PERFORM ,V?DROP ,PRSO>
+               <RTRUE>)
+              (<VERB? DIG>
+               <TELL "The ground is too hard for digging here." CR>)>>
+
+<ROUTINE GRUE-FUNCTION ()
+    <COND (<VERB? EXAMINE>
+          <TELL
+"The grue is a sinister, lurking presence in the dark places of the
+earth. Its favorite diet is adventurers, but its insatiable
+appetite is tempered by its fear of light. No grue has ever been
+seen by the light of day, and few have survived its fearsome jaws
+to tell the tale." CR>)
+         (<VERB? FIND>
+          <TELL
+"There is no grue here, but I'm sure there is at least one lurking
+in the darkness nearby. I wouldn't let my light go out if I were
+you!" CR>)
+         (<VERB? LISTEN>
+          <TELL
+"It makes no sound but is always lurking in the darkness nearby." CR>)>>
+
+
+\\f
+
+"SUBTITLE CHINESE PUZZLE SECTION (COURTESY OF WILL WENG)"
+
+<GLOBAL CPHERE 1>
+
+<GLOBAL CPOBJS <ITABLE NONE <* 8 2 36>>>
+
+<GLOBAL CPTABLE
+      <TABLE   1
+              0
+              -1
+              0
+              0
+              -1
+              0
+              -1
+              0
+              1
+              0
+              -2
+              0
+              0
+              0
+              0
+              0
+              1
+              0
+              -3
+              0
+              0
+              -1
+              -1
+              0
+              0
+              0
+              -1
+              0
+              0
+              0
+              1
+              1
+              0
+              0
+              0
+              1>>
+
+;" 0 is no wall
+    1 is fixed wall
+   -1 is movable wall (-2 is good ladder, -3 bad ladder)"
+
+<GLOBAL CPWALLS <LTABLE CPSWL 6 CPNWL -6 CPEWL 1 CPWWL -1>>
+
+<GLOBAL CPEXITS <LTABLE
+       P?NORTH
+       -6
+       P?SOUTH
+       6
+       P?EAST
+       1
+       P?WEST
+       -1
+       P?NE
+       -5
+       P?NW
+       -7
+       P?SE
+       7
+       P?SW
+       5>>
+
+<GLOBAL CP-MOVED <>>
+
+<ROUTINE CPEXIT ("AUX" FX NFX)
+       #DECL ((FX NFX) FIX)
+       <SETG CP-MOVED <>>
+       <COND (<==? ,PRSO ,P?UP>
+              <COND (<==? ,CPHERE 1>
+                     <COND (<==? <2 ,CPTABLE> -2>
+                            <TELL
+"With the help of the ladder, you exit the puzzle." CR>
+                            ,CP-ANTE)
+                           (T
+                            <TELL
+                             "The exit is too far above your head." CR>
+                            <RFALSE>)>)
+                    (T
+                     <TELL "There is no way up." CR>
+                     <RFALSE>)>)
+             (<AND <==? ,CPHERE 33>
+                   <==? ,PRSO ,P?WEST>
+                   ,CP-FLAG>
+              <FCLEAR ,CP ,TOUCHBIT>
+              ,CP-OUT)
+             (<==? ,PRSO ,P?DOWN>
+              <TELL "There's no way down here." CR>
+              <RFALSE>)
+             (<AND <==? ,CPHERE 33>
+                   <==? ,PRSO ,P?WEST>>
+              <TELL "The metal door bars the way." CR>
+              <RFALSE>)
+             (T
+              <SET FX <LKP ,PRSO ,CPEXITS>>
+              <COND (<OR <G? <SET NFX <+ .FX ,CPHERE>> 36>
+                         <L? .NFX 0>
+                         <ILLCP ,CPHERE .FX>>
+                     <TELL "There is a wall there." CR>
+                     <RFALSE>)
+                    (<EQUAL? <ABS .FX> 1 6>
+                     <CPMOVE .FX>)
+                    (<AND <G? .FX 0> ; "SW AND SE"
+                          <EQUAL? 0
+                                  <GET ,CPTABLE <+ ,CPHERE 6>>
+                                  <GET ,CPTABLE <+ ,CPHERE <- .FX 6>>>>>
+                     <CPMOVE .FX>)
+                    (<AND <L? .FX 0>
+                          <EQUAL? 0
+                                  <GET ,CPTABLE <- ,CPHERE 6>>
+                                  <GET ,CPTABLE <+ ,CPHERE 6 .FX>>>>
+                     <CPMOVE .FX>)
+                    (T
+                     <TELL "There is a wall there." CR>)>
+              <RFALSE>)>>
+
+<GLOBAL MINUS-SEVEN -7>
+<GLOBAL MINUS-FIVE -5>
+<GLOBAL MINUS-FOUR -4>
+<GLOBAL MINUS-ONE -1>
+
+<ROUTINE ILLCP (ONE TWO)
+        <COND (<AND <==? <MOD .ONE 6> 0>
+                    <EQUAL? .TWO ,MINUS-FIVE 1 7>> <RTRUE>)
+              (<AND <==? <MOD .ONE 6> 1>
+                    <EQUAL? .TWO ,MINUS-SEVEN ,MINUS-ONE 5>> <RTRUE>)
+              (<AND <L? .ONE 7> <L? .TWO ,MINUS-FOUR>> <RTRUE>)
+              (<AND <G? .ONE 30> <G? .TWO 4>> <RTRUE>)>>
+
+<ROUTINE CPMOVE (FX)
+        <COND (<0? <GET ,CPTABLE <SET FX <+ ,CPHERE .FX>>>>
+               <CPGOTO .FX>)
+              (T
+               <TELL "There is a wall there." CR>)>>
+
+<ROUTINE CPENTER ()
+       <COND (<OR <NOT <==? ,YEAR ,YEAR-PRESENT>> ,CPBLOCK-FLAG>
+              <TELL "The hole is blocked by sandstone." CR>
+              <RFALSE>)
+             (T
+              <SETG CPHERE 1>
+              ,CP)>>
+
+<ROUTINE CPANT-ROOM (RARG)
+        <COND (<==? .RARG ,M-LOOK>
+               <TELL
+"This is a small square room, in the middle of which is a perfectly round
+hole">
+               <COND (<OR ,CPBLOCK-FLAG <NOT <==? ,YEAR ,YEAR-PRESENT>>>
+                      <TELL
+                       " which is blocked by smooth sandstone." CR>)
+                     (T
+                      <TELL
+" through which you can discern the floor some ten feet below.
+The place under the hole is dark, but it appears to be completely enclosed
+in rock. In any event, it doesn't seem likely that you could climb back up.
+Exits are west and, up a few steps, north." CR>)>)>>
+
+<GLOBAL CPPUSH-FLAG <>>  
+
+<GLOBAL CPSOLVE-FLAG <>>
+
+<ROUTINE CPLADDER-OBJECT ("AUX" (FLG <>))
+       #DECL ((FLG) <OR FALSE ATOM>)
+       <COND (<OR <==? <GET ,CPTABLE <- ,CPHERE 1>> -3>
+                  <AND <==? <GET ,CPTABLE <+ ,CPHERE 1>> -2> <SET FLG T>>>
+              <COND (<VERB? CLIMB-UP CLIMB-FOO>
+                     <COND (<AND .FLG <==? ,CPHERE 1>>
+                            <SETG CPSOLVE-FLAG T>
+                            <GOTO ,CP-ANTE>)
+                           (T
+                            <TELL
+"You hit your head on the ceiling and fall off the ladder." CR>)>)
+                    (T <TELL "Come, come!" CR>)>)
+             (T <TELL "I can't see any ladder here." CR>)>> 
+
+<ROUTINE CPWALL-OBJECT ("AUX" WL NWL NXT NNXT CNT TOP (SNAP <>))
+       #DECL ((NXT WL NNXT NWL) FIX (UVEC) <UVECTOR [REST FIX]>)
+       <COND (<VERB? MOVE> <TELL "You can't grab the wall to pull it." CR>)
+             (<VERB? PUSH>
+              <SET NXT <CPNEXT ,CPHERE ,PRSO>>
+              <COND (<0? .NXT>
+                     <TELL "The wall doesn't budge." CR>
+                     <RTRUE>)>
+              <SET WL <GET ,CPTABLE .NXT>>
+              <COND (<0? .WL>
+                     <TELL "There is only a passage in that direction." CR>)
+                    (<1? .WL>
+                     <TELL "The wall doesn't budge." CR>)
+                    (<0? <SET NNXT <CPNEXT .NXT ,PRSO>>>
+                     <TELL "The wall barely gives." CR>)
+                    (<NOT <0? <SET NWL <GET ,CPTABLE .NNXT>>>>
+                     <TELL "The wall barely gives." CR>)
+                    (T
+                     <TELL
+"The wall slides forward and you follow it">
+                     <COND (,CPPUSH-FLAG <TELL " to this position:" CR>)
+                           (T
+                            <SETG SCORE <+ ,SCORE 1>>
+                            <TELL
+"....|
+The architecture of this region is getting complex, so that further
+descriptions will be diagrams of the immediate vicinity in a 3x3
+grid. The walls here are rock, but of two different types - sandstone
+and marble. The following notations will be used:|
+">
+                            <PUT 0 8 <BOR <GET 0 8> 2>>
+                            <TELL "|
+  ..  = your position (middle of grid)|
+  MM  = marble wall|
+  SS  = sandstone wall|
+  ??  = unknown (blocked by walls)|
+|
+">
+                            <PUT 0 8 <BAND <GET 0 8> -3>>)>
+                     <SETG CPPUSH-FLAG T>
+                     <PUT ,CPTABLE .NXT 0>
+                     <PUT ,CPTABLE .NNXT .WL>
+                     <COND (<NOT <EQUAL? .NNXT 0>>
+                            <SET TOP <* 8 <- .NNXT 1>>>
+                            <SET CNT <GET ,CPOBJS .TOP>>
+                            <REPEAT ()
+                                    <COND (<0? .CNT> <RETURN>)
+                                          (T
+                                           <SET TOP <+ .TOP 1>>
+                                           <MOVE <GET ,CPOBJS .TOP> ,CP-OUT>
+                                           <COND (<NOT .SNAP>
+                                                  <SET SNAP T>
+                                                  <TELL
+"You hear a soft \"snap\" from behind the wall you were pushing." CR>)>
+                                           <SET CNT <- .CNT 1>>)>>)>
+                     <COND (<==? .NNXT 1>
+                            <SETG CPBLOCK-FLAG T>)>
+                     <CPGOTO .NXT>)>)>>
+
+; "Flag for blocking of main entrance"
+
+<GLOBAL CPBLOCK-FLAG <>>
+
+<CONSTANT GCARDLOC 168>        ;"8*(22-1)"
+
+<ROUTINE CPGOTO (FX "AUX" F X CNT TOP)
+       #DECL ((FX CNT TOP) FIX (F X) <OR FALSE OBJECT>)
+       <SETG CP-MOVED T>
+       <FCLEAR ,HERE ,TOUCHBIT>
+       <SET TOP <* 8 <- ,CPHERE 1>>>
+       <SET CNT <+ .TOP 1>>
+       <SET F <FIRST? ,CP>>
+       <REPEAT ()
+               <SET X <NEXT? .F>>
+               <COND (<NOT .F> <RETURN>)
+                     (<==? .F ,ADVENTURER> T)
+                     (T
+                      <PUT ,CPOBJS .CNT .F>
+                      <REMOVE .F>
+                      <SET CNT <+ .CNT 1>>)>
+               <COND (<NOT .X> <RETURN>)
+                     (T <SET F .X>)>>
+       <PUT ,CPOBJS .TOP <- <- .CNT .TOP> 1>>
+       <SETG CPHERE .FX>
+       <SET TOP <* 8 <- ,CPHERE 1>>>
+       <SET CNT <GET ,CPOBJS .TOP>>
+       <REPEAT ()
+               <COND (<0? .CNT> <RETURN>)
+                     (T
+                      <SET TOP <+ .TOP 1>>
+                      <MOVE <GET ,CPOBJS .TOP> ,CP>
+                      <SET CNT <- .CNT 1>>)>>
+       <PERFORM ,V?LOOK>
+       <RTRUE>> 
+
+<ROUTINE CPNEXT (RM OBJ "AUX" FX)
+       #DECL ((RM) FIX (OBJ) OBJECT)
+       <SET FX <LKP .OBJ ,CPWALLS>>
+       <COND (<ILLCP .RM .FX> 0)
+             (T <+ .RM .FX>)>>
+
+<ROUTINE CPDOOR-F ()
+        <COND (<AND <==? ,HERE ,CP> <NOT <==? ,CPHERE 33>>>
+               <TELL "I can't see any steel door here." CR>)
+              (<VERB? OPEN>
+               <COND (,CP-FLAG <TELL "The steel door has already opened." CR>)
+                     (T <TELL "You can't force it open." CR>)>)
+              (<VERB? CLOSE>
+               <COND (,CP-FLAG <TELL
+"There doesn't seem to be any way to close it." CR>)
+                     (T <TELL "Do you think it isn't already?" CR>)>)
+              (<VERB? MUNG>
+               <TELL
+"The door is, to a first approximation, indestructible." CR>)
+              (<VERB? KNOCK>
+               <TELL
+"Besides a great amount of reverberation, nothing happens." CR>)>>
+
+<ROUTINE CP-ROOM (RARG)
+       <COND (<==? .RARG ,M-ENTER>
+              <SETG CPHERE
+                    <COND (<==? ,PRSO ,P?DOWN> 1)
+                          (T 33)>>)
+             (<==? .RARG ,M-LOOK>
+              <COND (,CPPUSH-FLAG <CPWHERE>)
+                    (T
+                     <TELL
+"You are in a small square room bounded to the north and west with
+marble walls and to the east and south with sandstone walls." CR>)>)>>   
+
+<ROUTINE CPNS (NUM)
+        #DECL ((NUM) FIX)
+        <COND (<OR <G? .NUM 36> <L? .NUM 1>> 1)
+              (T <GET ,CPTABLE .NUM>)>>
+
+<ROUTINE CPEW (NUM FOO)
+        #DECL ((NUM FOO) FIX)
+        <COND (<==? <MOD .NUM 6> .FOO> 1)
+              (T <GET ,CPTABLE .NUM>)>>
+
+<ROUTINE CPWHERE ("AUX"  (N <CPNS <+ ,CPHERE -6>>)
+                        (S <CPNS <+ ,CPHERE 6>>)
+                        (E <CPEW <+ ,CPHERE 1> 1>)
+                        (W <CPEW <+ ,CPHERE -1> 0>))
+       #DECL ((N S E W) FIX)
+       <PUT 0 8 <BOR <GET 0 8> 2>>
+       <TELL "      +">                              ;"Top Row"
+       <CP-CORNER ,MINUS-SEVEN .N .W>
+       <TELL " ">
+       <CP-ORTHO .N>
+       <TELL " ">
+       <CP-CORNER ,MINUS-FIVE .N .E>
+       <TELL "+" CR>
+       <TELL "West  +">                           ;"Middle Row"
+       <CP-ORTHO .W>
+       <TELL " .. ">
+       <CP-ORTHO .E>
+       <TELL "+  East" CR>
+       <TELL "      +">                           ;"Bottom Row"
+       <CP-CORNER 5 .S .W>
+       <TELL " ">
+       <CP-ORTHO .S>
+       <TELL " ">
+       <CP-CORNER 7 .S .E>
+       <TELL "+" CR>
+       <PUT 0 8 <BAND <GET 0 8> -3>>
+       <COND (<==? ,CPHERE 1>
+              <TELL
+"In the ceiling above you is a large circular opening." CR>)
+             (<==? ,CPHERE 22>
+              <TELL
+"The center of the floor here is noticeably depressed." CR>)
+             (<==? ,CPHERE 33>
+              <TELL
+"In the center of the west wall is a steel door which is ">
+              <COND (,CP-FLAG <TELL "open">)
+                    (T <TELL "closed">)>
+              <TELL
+".
+On one side of the door is a narrow slot." CR>)>
+       <COND (<==? .E -2>
+              <TELL
+"There is a ladder here, firmly attached to the east wall." CR>)>
+       <COND (<==? .W -3>
+              <TELL
+"There is a ladder here, firmly attached to the west wall." CR>)>>
+
+;"Show where the eight nearest neighbors are located" 
+
+<ROUTINE CP-ORTHO (CONTENTS)
+       #DECL ((CONTENTS) FIX)
+       <COND (<0? .CONTENTS> <TELL "  ">)
+             (<1? .CONTENTS> <TELL "MM">)
+             (T <TELL "SS">)>>
+
+;"Show an orthogonal neighbor"
+
+<ROUTINE CP-CORNER (DIR COL ROW "AUX" LOCN)
+       #DECL ((DIR COL ROW) FIX)
+       <SET LOCN <+ ,CPHERE .DIR>>
+       <COND (<AND <NOT <==? .COL 0>> <NOT <==? .ROW 0>>> <TELL "??">)
+             (<ILLCP ,CPHERE .DIR> <TELL "MM">)
+             (<0? <SET COL
+                       <COND (<OR <L? .LOCN 1> <G? .LOCN 36>> 1)
+                             (T <GET ,CPTABLE .LOCN>)>>>
+              <TELL "  ">)
+             (<1? .COL> <TELL "MM">)
+             (T <TELL "SS">)>>
+
+<ROUTINE CP-SLOT-FCN ()
+       <COND (<VERB? PUT>
+              <COND (<G? <GETP ,PRSO ,P?SIZE> 10>
+                     <TELL "It doesn't fit." CR>
+                     <RTRUE>)>
+              <REMOVE ,PRSO>
+              <COND (<==? ,PRSO ,LORE-BOOK>
+                     <SETG CP-FLAG T>
+                     <TELL
+"The book drops easily into the slot and vanishes.  The metal door slides
+open, revealing a passageway to the west, as a previously unseen sign flashes:|
+    \"Royal Puzzle Exit Fee Paid|
+          Item Confiscated\"" CR>)
+                    (<OR <FSET? ,PRSO ,VICBIT>
+                         <FSET? ,PRSO ,VILLAIN>>
+                     <TELL <PICK-ONE ,YUKS> CR>)
+                    (T
+                     <TELL
+"The item vanishes into the slot.  A moment later, a previously
+unseen sign flashes \"Garbage In, Garbage Out\" and spews
+the " D ,PRSO " (now atomized) through the slot." CR>)>)>>
+            
+<ROUTINE CPOUT-ROOM (RARG)
+       <COND (<==? .RARG ,M-LOOK>
+              <TELL
+"You are in a narrow room, lit from above. A flight of steps leads up
+toward the north, and a ">
+              <COND (,CP-FLAG <TELL "passage">)
+                    (T <TELL "metal door">)>
+              <TELL " leads to the east." CR>)>>
+
+"Old end-game stuff"
+
+"SUBTITLE It's All Done with Mirrors"
+
+<GLOBAL MLOC <>>
+
+<GLOBAL MR1-FLAG T>
+
+<GLOBAL MR2-FLAG T>
+
+<GLOBAL MIRROR-OPEN-FLAG <>>
+
+<GLOBAL WOOD-OPEN-FLAG <>>
+
+<GLOBAL MRSWPUSH-FLAG <>>
+
+<GLOBAL R-SOUTHS <LTABLE FRONT-DOOR MRD MRG MRC MRB MRA MREYE>>
+<GLOBAL R-NORTHS <LTABLE MREYE MRA MRB MRC MRG MRD>>
+
+<ROUTINE MRGO ("AUX" TORM)
+        <COND (<EQUAL? ,PRSO ,P?NORTH ,P?NW ,P?NE>
+               <SET TORM <LKP ,HERE ,R-NORTHS>>)
+              (T <SET TORM <LKP ,HERE ,R-SOUTHS>>)>
+        <COND (<EQUAL? ,PRSO ,P?NORTH ,P?SOUTH>
+               <COND (<==? ,MLOC .TORM>
+                      <COND (<0? <MOD ,MDIR 180>>
+                             <TELL
+ "There is a wooden wall blocking your way." CR>
+                             <RFALSE>)
+                            (<MIRIN <>> ,IN-MIRROR)
+                            (T <MIRBLOCK> <RFALSE>)>)
+                    (T .TORM)>)
+              (<==? ,MLOC .TORM>
+               <COND (<0? <MOD ,MDIR 180>> <GO-E-W .TORM>)
+                     (T <MIRBLOCK> <RFALSE>)>)
+              (T .TORM)>>
+
+<ROUTINE MIRBLOCK ("AUX" MD)
+        <SET MD ,MDIR>
+        <COND (<==? ,PRSO ,P?SOUTH>
+               <SET MD <MOD <+ ,MDIR 180> 360>>)>
+        <COND (<OR <AND <==? .MD 270> <NOT ,MR1-FLAG>>
+                   <AND <==? .MD 90> <NOT ,MR2-FLAG>>>
+               <TELL "There is a large broken mirror blocking your way." CR>)
+              (T
+               <TELL "There is a large mirror blocking your way." CR>)>>
+
+<ROUTINE GO-E-W (RM)
+       <COND (<EQUAL? ,PRSO ,P?NE ,P?SE>
+              <LKP .RM ,R-EASTS>)
+             (T <LKP .RM ,R-WESTS>)>>
+
+<GLOBAL R-EASTS <LTABLE MRA MRAE MRB MRBE MRC MRCE MRG MRGE MRD MRDE>>
+<GLOBAL R-WESTS <LTABLE MRA MRAW MRB MRBW MRC MRCW MRG MRGW MRD MRDW>>
+
+<DEFMAC N-S () '<0? <MOD ,MDIR 180>>>
+
+<DEFMAC E-W ('FX) <FORM OR <FORM ==? .FX 90> <FORM ==? .FX 270>>>
+
+<ROUTINE EWTELL (RM "AUX" (EAST? <>) (M1? <>) MWIN)
+        <COND (<OR <EQUAL? .RM ,MRAE ,MRBE ,MRCE>
+                   <EQUAL? .RM ,MRGE ,MRCE>>
+               <SET EAST? T>)>
+        <COND (<==? <+ ,MDIR <COND (.EAST? 0) (T 180)>> 180>
+               <SET M1? T>)>
+        <COND (.M1? <SET MWIN ,MR1-FLAG>) (T <SET MWIN ,MR2-FLAG>)>
+        <TELL "You are in a narrow room, whose "
+              <COND (.EAST? "west") (T "east")>
+              " wall is a large "
+              <COND (.MWIN "mirror.")
+                    (T "wooden panel
+which once contained a mirror.")>
+              CR>
+        <COND (<AND .M1? ,MIRROR-OPEN-FLAG>
+               <TELL <COND (.MWIN
+"The mirror is mounted on a panel which has been opened outward.")
+                           (T "The panel has been opened outward.")>
+                     CR>)>
+        <TELL "The opposite wall is solid rock." CR>>
+
+<GLOBAL GUARDIANS-SEEN <>>
+
+<ROUTINE MRDEW ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-LOOK>
+               <EWTELL ,HERE>
+               <SETG GUARDIANS-SEEN T>
+               <TELL "Somewhat to the south" ,GUARDSTR CR>)>>
+
+<ROUTINE MRCEW ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-LOOK>
+               <EWTELL ,HERE>
+               <SETG GUARDIANS-SEEN T>
+               <TELL "Somewhat to the north" ,GUARDSTR CR>)>>
+
+<ROUTINE MRBEW ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-LOOK>
+               <EWTELL ,HERE>
+               <TELL "To the north and south are large hallways." CR>)>>
+
+<ROUTINE MRAEW ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-LOOK>
+               <EWTELL ,HERE>
+               <TELL "To the north is a large hallway." CR>)>>
+
+<GLOBAL GUARDSTR
+", identical stone statues face each other from
+pedestals on opposite sides of the corridor.  The statues represent
+Guardians of Zork, a military order of ancient lineage.  They are
+portrayed as heavily armored warriors standing at ease, hands clasped
+around formidable bludgeons.">
+
+<ROUTINE LOOK-TO (RMN RMS "AUX" (NORTH? <>) (NTELL <>) (STELL <>)
+                               MIR? (M1? <>) DIR)
+        <COND (<NOT <EQUAL? ,HERE ,MREYE ,FRONT-DOOR>>
+               <TELL
+"This is a part of the long hallway.  The east and west walls are
+dressed stone.  In the center of the hall is a shallow stone channel.
+In the center of the room the channel widens into a large hole around
+which is engraved a compass rose." CR>)>
+        <COND (<==? ,HERE ,MRG>
+               <SETG GUARDIANS-SEEN T>
+               <TELL
+"On either side of you are identical stone statues holding bludgeons.  They
+appear ready to strike, though, for the moment, they remain impassive." CR>)
+              (<==? ,HERE ,MRC>
+               <SETG GUARDIANS-SEEN T>
+               <TELL "Somewhat to the north" ,GUARDSTR CR>
+               <SET NTELL T>)
+              (<==? ,HERE ,FRONT-DOOR>
+               <TELL
+"You are in a north-south hallway which ends, to the north, at a large wooden
+door." CR>
+               <SET NTELL T>)
+              (<==? ,HERE ,MRD>
+               <SETG GUARDIANS-SEEN T>
+               <TELL "Somewhat to the south" ,GUARDSTR CR>
+               <SET STELL T>)
+              (<==? ,HERE ,MRA>
+               <TELL "The hallway continues to the south." CR>
+               <SET STELL T>)>
+        <COND (<EQUAL? ,MLOC .RMN .RMS>
+               <COND (<==? ,MLOC .RMN>
+                      <SET NORTH? T>
+                      <SET NTELL T>
+                      <SET DIR "nor">)
+                     (T
+                      <SET STELL T>
+                      <SET DIR "sou">)>
+               <SET MIR?
+                   <COND (<AND .NORTH? <G? ,MDIR 180> <L? ,MDIR 359>>
+                          <SET M1? T>
+                          ,MR1-FLAG)
+                         (<AND <NOT .NORTH?> <G? ,MDIR 0> <L? ,MDIR 179>>
+                          <SET M1? T>
+                          ,MR1-FLAG)
+                         (T ,MR2-FLAG)>>
+               <COND (<0? <MOD ,MDIR 180>>
+                      <TELL "The "
+                            .DIR
+"th side of the room is divided by a wooden wall into small
+hallways to the ">
+                      <TELL .DIR "theast and ">
+                      <TELL .DIR "thwest." CR>)
+                     (T
+                      <TELL <COND (.MIR? "A large mirror fills the ")
+                                  (T "A large panel fills the ")>
+                            .DIR
+                            "th side of the hallway." CR>
+                      <COND (<AND .M1? ,MIRROR-OPEN-FLAG>
+                             <TELL <COND (.MIR?
+"The mirror is mounted on a panel which has been opened outward.")
+                                         (T
+"The panel has been opened outward.")> CR>)>)>)>
+        <COND (<AND <NOT .NTELL> <NOT .STELL>>
+               <TELL "The corridor continues north and south." CR>)
+              (<NOT .NTELL>
+               <TELL "The corridor continues north." CR>)
+              (<NOT .STELL>
+               <TELL "The corridor continues south." CR>)>
+        <RTRUE>>
+
+<ROUTINE MRDF ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-LOOK>
+               <LOOK-TO ,FRONT-DOOR ,MRG>)>>
+
+<ROUTINE MRCF ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-LOOK>
+               <LOOK-TO ,MRG ,MRB>)>>
+
+<ROUTINE MRBF ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-LOOK>
+               <LOOK-TO ,MRC ,MRA>)>>
+
+<ROUTINE MRAF ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-LOOK>
+               <LOOK-TO ,MRB <>>)>>
+
+"Infestation function for Sword-glow demon, tailored for end game"
+
+<ROUTINE EG-INFESTED? (R)
+        <OR <AND <==? ,MLOC ,MRG> <==? .R ,IN-MIRROR>>
+            <EQUAL? .R ,MRGE ,MRG ,MRGW>>>
+
+<ROUTINE GUARDIANS ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-LOOK>
+               <COND (<==? ,HERE ,MRG>
+                      <LOOK-TO ,MRD ,MRC>)
+                     (T
+                      <EWTELL ,HERE>
+                      <TELL
+"To the east and west are the Guardians of Zork, in perfect symmetry.
+From here, it's hard to tell which of the two is a reflection!" CR>)>)
+              (<AND <==? .RARG ,M-ENTER> <NOT ,INVIS>>
+               <JIGS-UP
+"The Guardians awake, and in perfect unison, utterly destroy you with
+their stone bludgeons.  Satisfied, they resume their posts.">)
+              (<NOT <==? .RARG ,M-END>> <RFALSE>)
+              (<VERB? EXAMINE>
+               <COND (<==? ,HERE ,IN-MIRROR>
+                      <TELL "You can't see them from here." CR>)
+                     (T <TELL
+"The guardians are quite impressive.  I wouldn't get in their way if
+I were you!" CR>)>)
+              (<AND <VERB? THROW> <==? ,PRSI ,GUARDIAN>>
+               <TELL
+"The " D ,PRSO " flies within sight of the guardians, who, in perfect
+unison, destroy it utterly.  Satisfied, they resume their posts." CR>
+               <REMOVE ,PRSO>)
+              (<VERB? ATTACK>
+               <TELL
+"You aren't close enough to fight them and even if you were, the contest
+would be a bit one-sided." CR>)
+              (<VERB? HELLO>
+               <TELL "The statues are impassive." CR>)>>
+
+<ROUTINE MIRROR-DIR? (DIR RM "AUX" TBL)
+         <SET TBL <COND (<==? .DIR ,P?NORTH> ,R-NORTHS) (T ,R-SOUTHS)>>
+        <COND (<AND <GETPT .RM .DIR>
+                    <==? ,MLOC <LKP .RM .TBL>>>
+               <COND (<AND <==? .DIR ,P?NORTH>
+                           <G? ,MDIR 180>
+                           <L? ,MDIR 360>>
+                      1)
+                     (<AND <==? .DIR ,P?SOUTH>
+                           <G? ,MDIR 0>
+                           <L? ,MDIR 180>>
+                      1)
+                     (T 2)>)>>
+
+<ROUTINE WOODEN-WALL-F ()
+        <COND (<AND <0? <MOD ,MDIR 180>>
+                    <OR <MIRROR-DIR? ,P?NORTH ,HERE>
+                        <MIRROR-DIR? ,P?SOUTH ,HERE>>>
+               <COND (<VERB? PUSH>
+                      <TELL "The structure won't budge." CR>)>)
+              (T <TELL "I can't see any wooden wall here." CR>)>>
+
+<ROUTINE MIRROR-HERE? (RM "AUX" TMP)
+        <COND (<OR <EQUAL? ,HERE ,MRAE ,MRAW ,MRBE>
+                   <EQUAL? ,HERE ,MRBW ,MRCE ,MRCW>
+                   <EQUAL? ,HERE ,MRGE ,MRGW ,MRDE>
+                   <EQUAL? ,HERE ,MRDW>>
+               <COND (<==? 180
+                           <+ ,MDIR <COND (<OR <EQUAL? .RM ,MRAE ,MRBE ,MRCE>
+                                               <EQUAL? .RM ,MRGE ,MRDE>> 0)
+                                          (T 180)>>>
+                      1)
+                     (T 2)>)
+              (<0? <MOD ,MDIR 180>> <RFALSE>)
+              (<SET TMP <MIRROR-DIR? ,P?NORTH .RM>> .TMP)
+              (<SET TMP <MIRROR-DIR? ,P?SOUTH .RM>> .TMP)
+              (T <RFALSE>)>>
+
+<ROUTINE MIRROR-FUNCTION ("AUX" MIRROR)
+        <COND (<NOT <SET MIRROR <MIRROR-HERE? ,HERE>>>
+               <TELL "I can't see any mirror here." CR>)
+              (<VERB? OPEN MOVE>
+               <TELL
+"I don't see a way to open the mirror here." CR>)
+              (<VERB? LOOK-INSIDE>
+               <COND (<OR <AND <==? .MIRROR 1> ,MR1-FLAG> ,MR2-FLAG>
+                      <COND (,INVIS
+                             <TELL
+"Amazingly, you have no reflection!" CR>)
+                            (T
+                             <TELL
+"A disheveled adventurer stares back at you." CR>)>)
+                     (T
+                      <TELL
+"You have destroyed the mirror, or have you forgotten?" CR>)>)
+              (<VERB? MUNG>
+               <COND (<1? .MIRROR>
+                      <COND (,MR1-FLAG
+                             <SETG MR1-FLAG <>>
+                             <TELL
+"The mirror breaks, revealing a wooden panel behind it.  The glistening
+fragments of mirror quietly sparkle into nonexistance." CR>)
+                            (T <TELL "The mirror has already been broken."
+                                     CR>)>)
+                     (,MR2-FLAG
+                      <SETG MR2-FLAG <>>
+                      <TELL
+"The mirror breaks, revealing a wooden panel behind it.  The glistening
+fragments of mirror quietly sparkle into nonexistance." CR>)
+                     (T <TELL "The mirror has already been broken." CR>)>)
+              (<OR <AND <==? .MIRROR 1> <NOT ,MR1-FLAG>> <NOT ,MR2-FLAG>>
+               <TELL
+"There's no mirror left." CR>)
+              (<VERB? PUSH>
+               <TELL <COND (<==? .MIRROR 1>
+"The mirror is mounted on a wooden panel which moves slightly inward
+as you push, and back out when you let go.  The mirror feels fragile.")
+                           (T
+"The mirror is unyielding, but seems rather fragile.")> CR>)>>
+
+<ROUTINE PANEL-FUNCTION ("AUX" MIRROR)
+        <COND (<NOT <SET MIRROR <MIRROR-HERE? ,HERE>>>
+               <TELL "I can't see any panel here." CR>)
+              (<VERB? OPEN MOVE>
+               <TELL
+"I don't see a way to open the panel here." CR>)
+              (<VERB? MUNG>
+               <COND (<==? .MIRROR 1>
+                      <COND (,MR1-FLAG
+                             <TELL
+"To break the panel you would have to break the mirror first." CR>)
+                            (T <TELL
+"The panel is not that easily destroyed." CR>)>)
+                     (,MR2-FLAG
+                      <TELL
+"To break the panel you would have to break the mirror first." CR>)
+                     (T <TELL "The panel is not that easily destroyed." CR>)>)
+              (<VERB? PUSH>
+               <TELL <COND (<==? .MIRROR 1>
+"The wooden panel moves slightly inward as you push, and back out
+when you let go.")
+                           (T
+"The panel is unyielding.")> CR>)>>
+
+<GLOBAL DIRVEC <LTABLE P?NORTH 0 P?NE 45 P?EAST 90 P?SE 135
+                      P?SOUTH 180 P?SW 225 P?WEST 270 P?NW 315>>
+
+<ROUTINE MIROUT ("AUX" DIR RM)
+        <COND (<==? ,PRSO ,P?OUT> <SET DIR 1>)
+              (T <SET DIR <LKP ,PRSO ,DIRVEC>>)>
+        <COND (,MIRROR-OPEN-FLAG
+               <COND (<OR <==? .DIR 1>
+                          <==? <MOD <+ ,MDIR 270> 360> .DIR>>
+                      <COND (<0? <MOD ,MDIR 180>>
+                             <MIREW>)
+                            (T <MIRNS <L? ,MDIR 180> T>)>)
+                     (T <RFALSE>)>)
+              (,WOOD-OPEN-FLAG
+               <COND (<OR <==? .DIR 1>
+                          <==? <MOD <+ ,MDIR 180> 360> .DIR>>
+                      <COND (<0? ,MDIR> <SET RM <>>) (T <SET RM T>)>
+                      <COND (<SET RM <MIRNS .RM T>>
+                             <TELL "As you leave, the door swings shut." CR>
+                             <SETG WOOD-OPEN-FLAG <>>
+                             .RM)
+                            (T
+                             <TELL "You can't go that way." CR>
+                             <RFALSE>)>)
+                     (T
+                      <TELL "You would hit one of the panels." CR>
+                      <RFALSE>)>)
+              (T
+               <TELL "You are inside a closed box!" CR>
+               <RFALSE>)>>
+
+"MIRNS -- returns room in a given direction from the mirror (north or
+south as indicated by first argument).  If second arg is T, then we
+are exiting, not moving the mirror, so don't worry about ends."
+
+<ROUTINE MIRNS (NORTH? "OPTIONAL" (EXIT? <>) "AUX" S T)
+        <COND (<NOT .EXIT?>
+               <COND (<AND .NORTH? <==? ,MLOC ,MRD>>
+                      <RFALSE>)
+                     (<AND <NOT .NORTH?> <==? ,MLOC ,MRA>>
+                      <RFALSE>)>)>
+        <COND (<SET T <GETPT ,MLOC <COND (.NORTH? ,P?NORTH)
+                                         (T ,P?SOUTH)>>>
+               <COND (<==? <SET S <PTSIZE .T>> ,UEXIT>
+                      <GETB .T 0>)
+                     (.NORTH?
+                      <LKP ,MLOC ,R-NORTHS>)
+                     (T
+                      <LKP ,MLOC ,R-SOUTHS>)>)>>
+
+<ROUTINE MIREW ()
+        <COND (<0? ,MDIR> <LKP ,MLOC ,R-WESTS>)
+              (T <LKP ,MLOC ,R-EASTS>)>>
+
+<ROUTINE MIRIN ("OPTIONAL" (VRB T))
+         <COND (<AND <==? <MIRROR-HERE? ,HERE> 1> ,MIRROR-OPEN-FLAG>
+               ,IN-MIRROR)
+              (<NOT .VRB> <RFALSE>)
+              (<==? <MIRROR-HERE? ,HERE> 1>
+               <COND (<AND <NOT ,MIRROR-OPENED> ,MR1-FLAG>
+                      <TELL "A mirror blocks your way." CR>
+                      <RFALSE>)
+                     (T <TELL "The panel is closed." CR> <RFALSE>)>)
+              (T <TELL "The structure blocks your way." CR> <RFALSE>)>>
+
+<ROUTINE MREYE-ROOM ("OPTIONAL" (RARG <>) "AUX" O)
+         <COND (<AND <==? .RARG ,M-BEG>
+                    <VERB? DROP>
+                    <IN? ,PRSO ,WINNER>
+                    <NOT <BEAM-STOPPED?>>>
+               <MOVE ,PRSO ,HERE>
+               <TELL
+"You conveniently drop the " D ,PRSO " in position to block the
+beam of light." CR>)
+              (<==? .RARG ,M-LOOK>
+               <TELL
+"You are in the middle of a long north-south corridor whose walls are
+polished stone.  A narrow red beam of light crosses the room at the north
+end, inches above the floor." CR>
+               <COND (<SET O <BEAM-STOPPED?>>
+                      <TELL
+"The beam is stopped halfway across the room by a " D .O
+" lying on the floor." CR>)>
+               <LOOK-TO ,MRA <>>)>>
+
+<ROUTINE BEAM-STOPPED? ("AUX" N)
+        <SET N <FIRST? ,MREYE>>
+        <REPEAT ()
+                <COND (<NOT <EQUAL? .N ,PLAYER ,BEAM>>
+                       <SETG BEAM-BREAKER .N>
+                       <RETURN .N>)
+                      (<NOT <SET N <NEXT? .N>>> <RFALSE>)>>>
+
+; "This function cannot have its .PRSI and .PRSO's changed to ,PRSI etc!!"
+
+<GLOBAL BEAM-BREAKER <>>
+
+<ROUTINE BEAM-FUNCTION ("AUX" PRO PRI)
+        <COND (<VERB? LEAP>
+               <TELL
+"You jump over the beam and into the hallway." CR>
+               <GOTO ,MRA>
+               <RTRUE>)
+              (<VERB? FOLLOW>
+               <TELL 
+"It simply crosses the northern end of the room, so there's nowhere to
+follow it." CR>)
+              (<VERB? EXAMINE>
+               <TELL
+"The red beam of light crosses the north end of the room only an inch or so
+above the floor.">
+               <COND (<BEAM-STOPPED?>
+                      <TELL " The beam is broken by a " D ,BEAM-BREAKER
+                            " lying on
+the ground.">)>
+               <CRLF>)
+              (<VERB? PUT MUNG>
+               <COND (<VERB? PUT>
+                      <SET PRI ,PRSO>
+                      <SET PRO ,PRSI>)
+                     (T
+                      <SET PRI ,PRSI>
+                      <SET PRO ,PRSO>)>
+               <COND (<OR <NOT .PRI> <NOT <==? .PRO ,BEAM>>> <RFALSE>)
+                     (<IN? .PRI ,WINNER>
+                      <MOVE .PRI ,HERE>
+                      <SETG BEAM-BREAKER .PRI>
+                      <TELL
+"The beam is now interrupted by a " D .PRI " lying on the floor." CR>)
+                     (<IN? .PRI ,HERE>
+                      <TELL
+"The " D .PRI " already breaks the beam." CR>)
+                     (<==? .PRI ,HANDS>
+                      <TELL
+"The beam is broken briefly as it passes through." CR>)
+                     (T <TELL
+"You're not holding the " D .PRI "." CR>)>)
+              (<AND <VERB? TAKE> <==? ,PRSO ,BEAM>>
+               <TELL
+"No doubt you have a bottle of moonbeams as well." CR>)>>
+
+<GLOBAL MIRROR-OPENED <>>
+
+<ROUTINE MRSWITCH ()
+        <COND (<VERB? PUSH>
+               <COND (,MRSWPUSH-FLAG
+                      <TELL "Click." CR>)
+                     (T
+                      <COND (<BEAM-STOPPED?>
+                             <TELL "Click. Snap!" CR>
+                             <ENABLE <QUEUE I-MRINT 7>>
+                             <SETG MRSWPUSH-FLAG T>
+                             <SETG MIRROR-OPEN-FLAG T>
+                             <SETG MIRROR-OPENED T>
+                             <FCLEAR ,MRA ,TOUCHBIT>)
+                            (T <TELL "Click." CR>)>)>)>>
+
+<ROUTINE I-MRINT ()
+        <SETG MRSWPUSH-FLAG <>>
+        <SETG MIRROR-OPEN-FLAG <>>
+        <COND (<OR <==? <MIRROR-HERE? ,HERE> 1>
+                   <==? ,HERE ,IN-MIRROR>>
+               <TELL "The mirror quietly swings shut." CR>)
+              (<==? ,HERE ,MR-ANTE>
+               <TELL "The button pops back to its original position." CR>)>>
+
+<GLOBAL MDIR 270>
+
+;"mirror points... 0 = north"
+
+<GLOBAL POLEUP-FLAG 0>
+
+;"pole raised?: 0 -- in hole or channel, 1 -- foor level, 2 -- in air"
+
+<ROUTINE MAGIC-MIRROR ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-LOOK>
+               <TELL
+"You are inside a rectangular box of wood whose structure is rather
+complicated.  Four sides and the roof are filled in, and the floor is
+open.|
+|
+As you face the side opposite the entrance, two short sides of
+carved and polished wood are to your left and right.  The left panel
+is mahogany, the right pine.  The wall you face is red on its left
+half and black on its right.  On the entrance side, the wall is white
+opposite the red part of the wall it faces, and yellow opposite the
+black section.  The painted walls are at least twice the length of
+the unpainted ones.  The ceiling is painted blue.|
+|
+In the floor is a stone channel about six inches wide and a foot
+deep.  The channel is oriented in a north-south direction.  In the
+exact center of the room the channel widens into a circular
+depression perhaps two feet wide.  Incised in the stone around this
+area is a compass rose.|
+|
+Running from one short wall to the other at about waist height
+is a wooden bar, carefully carved and drilled.  This bar is pierced
+in two places.  The first hole is in the center of the bar (and thus
+the center of the room).  The second is at the left end of the room
+(as you face opposite the entrance).  Through each hole runs a wooden
+pole.|
+|
+The pole at the left end of the bar is short, extending about a foot
+above the bar, and ends in a hand grip.  The pole ">
+               <COND (<AND <==? ,MLOC ,MRB> <==? ,MDIR 270>>
+                      <COND (<NOT <0? ,POLEUP-FLAG>>
+                             <TELL
+"has been lifted out
+of a hole carved in the stone floor.  There is evidently enough
+friction to keep the pole from dropping back down.">)
+                            (T
+                             <TELL "has been dropped
+into a hole carved in the stone floor.">)>)
+                     (<EQUAL? ,MDIR 0 180>
+                      <COND (<NOT <0? ,POLEUP-FLAG>>
+                             <TELL "is positioned above
+the stone channel in the floor.">)
+                            (T
+                             <TELL "has been dropped
+into the stone channel incised in the floor.">)>)
+                     (T
+                      <TELL "is resting on the
+stone floor.">)>
+              <TELL
+"|
+|
+The long pole at the center of the bar extends from the ceiling
+through the bar to the circular area in the stone channel.  This
+bottom end of the pole has a T-bar a bit less than two feet long
+attached to it, and on the T-bar is carved an arrow.  The arrow and
+T-bar are pointing "
+                    <GET ,LONGDIRS </ ,MDIR 45>>
+                    ".">
+              <COND (,WOOD-OPEN-FLAG
+                     <TELL
+"|
+The pine panel has been opened outward.">)>
+              <CRLF>)>>
+
+<GLOBAL LONGDIRS <TABLE "north" "northeast" "east" "southeast"
+                       "south" "southwest" "west" "northwest">>
+
+;"MOVEMENT"
+
+<ROUTINE MPANELS ("AUX" MD)
+         <COND (<VERB? PUSH>
+               <COND (<NOT <0? ,POLEUP-FLAG>>
+                      <COND (<==? ,MLOC ,MRG>
+                             <COND (,GUARDIANS-SEEN
+                                    <JIGS-UP
+"The Guardians awake, and in perfect unison, utterly destroy you with
+their stone bludgeons.  Satisfied, they resume their posts.">
+                                    <RTRUE>)
+                                   (T
+                                    <JIGS-UP
+"All at once, two immense stone bludgeons come through the top of the
+structure, crushing you.">
+                                    <RTRUE>)>)>
+                      <COND (<EQUAL? ,PRSO ,RED-PANEL ,YELLOW-PANEL>
+                             <SET MD <MOD <+ ,MDIR 45> 360>>
+                             <TELL "The structure rotates clockwise." CR>)
+                            (T
+                             <SET MD <MOD <+ ,MDIR 315> 360>>
+                             <TELL
+"The structure rotates counterclockwise." CR>)>
+                      <TELL "The arrow on the compass rose now indicates "
+                            <GET ,LONGDIRS </ .MD 45>>
+                            "." CR>
+                      <COND (,WOOD-OPEN-FLAG
+                             <SETG WOOD-OPEN-FLAG <>>
+                             <TELL "The pine wall closes quietly." CR>)>
+                      <SETG MDIR .MD>)
+                     (<0? <MOD ,MDIR 180>>
+                      <TELL
+ "The short pole prevents the structure from rotating." CR>)
+                     (T
+                      <TELL
+ "The structure shakes slightly but doesn't move." CR>)>)>>
+
+<ROUTINE MENDS ("AUX" RM)
+        <COND (<VERB? CLOSE> <TELL "You can't do that to the panel." CR>)
+              (<OR <VERB? PUSH>
+                   <AND <VERB? OPEN> <==? ,PRSO ,PINE-PANEL>>>
+               <COND (<NOT <0? <MOD ,MDIR 180>>>
+                      <TELL
+"The structure rocks back and forth slightly but doesn't move." CR>)
+                     (<==? ,PRSO ,MAHOGANY-PANEL>
+                      <COND (<SET RM <MIRNS <L? ,MDIR 180>>>
+                             <MIRMOVE <0? ,MDIR> .RM>)
+                            (T
+                             <TELL
+"The structure has reached the end of the stone channel and won't
+budge." CR>)>)
+                     (T
+                      <TELL "The pine wall swings open." CR>
+                      <COND (<OR <AND <==? ,MLOC ,MRD>
+                                      <==? ,MDIR 0>>
+                                 <AND <==? ,MLOC ,MRC>
+                                      <==? ,MDIR 180>>
+                                 <==? ,MLOC ,MRG>>
+                             <COND (,GUARDIANS-SEEN
+                                    <TELL
+"The pine door opens into the field of view of the Guardians." CR>)
+                                   (T
+                                    <TELL
+"The pine door opens into the field of view of the Guardians of
+Zork, represented by two identical stone statues carrying bludgeons." CR>)>
+                             <JIGS-UP
+"The Guardians awake, and in perfect unison, utterly destroy you with
+their stone bludgeons.  Satisfied, they resume their posts.">
+                             <RTRUE>)>
+                      <SETG WOOD-OPEN-FLAG T>
+                      <ENABLE <QUEUE I-PININ 5>>)>)>>
+
+<ROUTINE I-PININ ()
+        <COND (,WOOD-OPEN-FLAG
+               <SETG WOOD-OPEN-FLAG <>>
+               <TELL "The pine wall closes quietly." CR>)>>
+
+<ROUTINE MIRMOVE (NORTH? RM "AUX" (PU? <>) (LOSE <>))
+        <COND (<NOT <0? ,POLEUP-FLAG>> <SET PU? T>)>
+        <TELL <COND (.PU? "The structure sways unsteadily ")
+                    (T "The structure slides ")>
+              <COND (.NORTH? "north") (T "south")>
+              " and stops over another compass rose." CR>
+        <SETG MLOC .RM>
+        <COND (<AND <==? .RM ,MRG> <==? ,HERE ,IN-MIRROR>>
+               <COND (.PU?
+                      <SET LOSE T>)
+                     (<OR <NOT ,MR1-FLAG> <NOT ,MR2-FLAG>>
+                      <SET LOSE T>)
+                     (<OR ,MIRROR-OPEN-FLAG ,WOOD-OPEN-FLAG>
+                      <SET LOSE T>)>
+               <COND (.LOSE
+                      <COND (,GUARDIANS-SEEN
+                             <JIGS-UP
+"Suddenly the Guardians realize someone is trying to sneak by them in
+the structure.  They awake and, in perfect unison, hammer the contents
+of the box (in other words you) to pulp.  They then resume their posts,
+satisfied.">)
+                            (T
+                             <JIGS-UP
+"Suddenly, two identical stone hands holding tremendous bludgeons come
+through the top of the structure and hammer the contents of the box to pulp.
+That includes you.">)>)>
+               <RTRUE>)>
+        T>     
+
+<ROUTINE SHORT-POLE-F ()
+         <COND (<VERB? RAISE>
+               <COND (<==? ,POLEUP-FLAG 2>
+                      <TELL "The pole cannot be raised further." CR>)
+                     (T
+                      <SETG POLEUP-FLAG 2>
+                      <TELL "The pole is now slightly above the floor." CR>)>)
+              (<OR <AND <VERB? PUT> <==? ,PRSI ,CHANNEL>>
+                   <VERB? PUSH LOWER>>
+               <COND (<0? ,POLEUP-FLAG>
+                      <TELL "The pole cannot be lowered further." CR>)
+                     (<0? <MOD ,MDIR 180>>
+                      <TELL "The pole is lowered into the channel." CR>
+                      <SETG POLEUP-FLAG 0>
+                      T)
+                     (<AND <==? ,MDIR 270> <==? ,MLOC ,MRB>>
+                      <SETG POLEUP-FLAG 0>
+                      <TELL "The pole is lowered into the stone hole." CR>)
+                     (<==? ,POLEUP-FLAG 1>
+                      <TELL "The pole is already resting on the floor." CR>)
+                     (T
+                      <SETG POLEUP-FLAG 1>
+                      <TELL "The pole now rests on the stone floor." CR>)>)>>
+
+\\f
+
+<ROUTINE DUNGEON-MASTER-F ("OPTIONAL" (RARG <>)) 
+        <COND (<==? .RARG ,M-OBJDESC> <RFALSE>)
+              (<==? ,WINNER ,DUNGEON-MASTER>
+               <COND (<VERB? FOLLOW>
+                      <COND (<IN? ,DUNGEON-MASTER ,HERE>
+                             <ENABLE <QUEUE I-FOLIN -1>>
+                             <TELL
+"The dungeon master answers, \"I will follow.\"" CR>)
+                            (T
+                             <TELL
+"The dungeon master's voice replies, \"You must come here first!\"" CR>)>)
+                     (<VERB? STAY WAIT>
+                      <QUEUE I-FOLIN 0>
+                      <TELL
+"The dungeon master answers, \"I will stay.\"" CR>)
+                     (<VERB? WALK>
+                      <COND (<AND <EQUAL? ,PRSO ,P?SOUTH ,P?ENTER>
+                                  <==? ,HERE ,NORTH-CORRIDOR>>
+                             <TELL
+"\"I am not permitted to enter the prison cell.\"" CR>)
+                            (<AND <==? ,PRSO ,P?NORTH>
+                                  <==? ,HERE ,NORTH-CORRIDOR>>
+                             <MOVE ,DUNGEON-MASTER ,PARAPET>
+                             <TELL
+"\"Very well. I am at the parapet!\"" CR>
+                             <QUEUE I-FOLIN 0>)
+                            (<AND <EQUAL? ,PRSO ,P?NORTH ,P?ENTER>
+                                  <==? ,HERE ,SOUTH-CORRIDOR>>
+                             <TELL
+"\"I am not permitted to enter the prison cell.\"" CR>)
+                            (T
+                             <TELL
+"\"I prefer to stay where I am, thank you.\"" CR>)>)
+                     (<AND <VERB? WALK-TO> <==? ,PRSO ,PARAPET-OBJ>>
+                      <MOVE ,DUNGEON-MASTER ,PARAPET>
+                      <QUEUE I-FOLIN 0>
+                      <TELL
+"\"Very well!\"" CR>)
+                     (<VERB? TAKE>
+                      <TELL
+"\"I will have no use for that, I am afraid.\"" CR>)
+                     (<AND <VERB? OPEN> <==? ,PRSO ,DUNGEON-DOOR>>
+                      <TELL
+"The dungeon master appears angered. \"Do not run from your quest: you are
+nearing the end!\"" CR>)
+                     (<VERB? PUSH TURN SPIN FOLLOW STAY OPEN CLOSE KILL WAIT
+                             WALK-TO>
+                      <COND (<VERB? STAY FOLLOW WAIT> T)
+                            (T <TELL "\"If you wish,\" he replies." CR>)>
+                      <RFALSE>)
+                     (T <TELL
+"\"Do not be foolish! Consider the end of your quest!\"" CR>)>)
+              (<VERB? EXAMINE>
+               <TELL
+"He is dressed simply in a hood and cloak, wearing an amulet and ring,
+carrying an old book under one arm, and leaning on a wooden staff.  A single
+key, as if to a prison cell, hangs from his belt." CR>)
+              (<VERB? ATTACK KILL MUNG>
+               <REALLY-DEAD
+"The dungeon master is taken momentarily by surprise.  He dodges your
+blow, and then, with a disappointed expression on his face, he raises
+his staff, and traces a complicated pattern in the air.  As it completes
+you crumble into dust.">)
+              (<VERB? TAKE>
+               <TELL
+"\"I'm willing to accompany you, but not ride in your pocket!\"" CR>)
+              (<AND <VERB? GIVE> <==? ,PRSI ,DUNGEON-MASTER>>
+               <TELL
+"\"I have no need for those things.\"" CR>)>>
+
+<ROUTINE MASTER-F () 
+        <COND (<EQUAL? ,HERE ,PRISON-CELL ,GOOD-CELL>
+               <COND (<HELLO? ,MASTER>
+                      <TELL "He can't hear you." CR>)
+                     (T <TELL "He is not here." CR>)>)
+              (<VERB? TELL> <SETG PRSO ,DUNGEON-MASTER> <RFALSE>)
+              (<AND <VERB? GIVE SGIVE> <IN? ,DUNGEON-MASTER ,HERE>>
+               <TELL
+"He politely refuses your offer." CR>)
+              (<AND <VERB? EXAMINE>
+                    <EQUAL? ,HERE ,CELL ,NORTH-CORRIDOR>
+                    <IN? ,DUNGEON-MASTER ,PARAPET>>
+               <TELL "The dungeon master is standing on the parapet." CR>)
+              (T <TELL "The dungeon master isn't here." CR>)>>
+
+<GLOBAL DM-SEEN <>>
+
+<ROUTINE BEHIND-DOOR-F ("OPTIONAL" (RARG <>))
+         <COND (<AND <==? .RARG ,M-ENTER> <NOT ,DM-SEEN>>
+               <ENABLE <QUEUE I-FOLIN -1>>
+               <SETG DM-SEEN T>)
+              (<==? .RARG ,M-LOOK>
+               <TELL
+"You are in a narrow north-south corridor.  At the south end is a door
+and at the north end is an east-west corridor.  The door is ">
+               <DPR ,DUNGEON-DOOR>)>>
+
+<ROUTINE FRONT-DOOR-F ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-ENTER>
+               <QUEUE I-FOLIN 0>)
+              (<==? .RARG ,M-LOOK>
+               <LOOK-TO <> ,MRD>
+               <TELL
+"The wooden door has a barred panel in it at about head height.  The
+door itself is ">
+               <DPR ,DUNGEON-DOOR>)>>
+
+<ROUTINE LOOK-LIKE-DM? ()
+        <AND <IN? ,CLOAK ,WINNER>
+             <IN? ,HOOD ,WINNER>
+             <IN? ,AMULET ,WINNER>
+             <IN? ,STAFF ,WINNER>
+             <IN? ,RING ,WINNER>
+             <IN? ,LORE-BOOK ,WINNER>
+             <IN? ,KEY ,WINNER>>>
+
+<ROUTINE DUNGEON-DOOR-F ()
+        <COND (<VERB? OPEN CLOSE>
+               <TELL "The door won't budge." CR>)
+              (<AND <VERB? KNOCK> <EQUAL? ,HERE ,FRONT-DOOR>>
+               <TELL
+"The knock reverberates along the hall.  For a time it seems there
+will be no answer.  Then you hear someone unlatching the small
+wooden panel.  Through the bars of the great door, the wrinkled
+face of an old man appears.">
+               <COND (,INVIS
+                      <TELL " He seems not to take notice of you for
+for a brief moment, then recovers.">)>
+               <COND (<LOOK-LIKE-DM?>
+                      <TELL " After a moment, he starts to smile
+broadly.  He disappears for an instant and the massive door opens
+without a sound.  The old man motions and you feel yourself drawn toward him.|
+\"I am the Master of the Dungeon!\" he booms. \"I have been watching
+you closely during your journey through the Great Underground Empire.
+Yes!,\" he says, as if recalling some almost forgotten time, \"we have
+met before, although I may not appear as I did then.\"  You look
+closely into his deeply lined face and see the faces of the old man by the
+secret door, your \"friend\" at the cliff, and the hooded figure.  \"You have
+shown kindness to the old man, and compassion toward the hooded one.  I have
+seen you display patience in the puzzle and trust at the cliff.  You have
+demonstrated strength, ingenuity, and valor.  However, one final test awaits
+you.  Now!  Command me as you will, and complete your quest!\"|
+" CR>
+                      <GOTO ,BEHIND-DOOR>
+                      <SETG IN-DUNGEON T>)
+                     (T
+                      <TELL " He looks you over with his keen,
+piercing gaze and then speaks gravely.  \"I have been waiting a long time
+for you, ">
+                      <TELL <GET ,DM-REASONS <DMISH>>>
+                      <TELL "
+I will remain here. When you feel you are ready, go to the
+secret door and 'SAY \"FROTZ OZMOO\"'!  Go, now!\" He starts to leave but
+turns back briefly and wags his finger in warning. \"Do not forget the double
+quotes!\" A moment later, you find yourself in the Button Room." CR>
+                      <GOTO ,MR-ANTE <>>
+                      <RTRUE>)>)>>
+
+<GLOBAL IN-DUNGEON <>>
+
+<GLOBAL DM-REASONS <TABLE
+"but I fear my waiting may be in vain.  I must not give up hope!"
+"but you have far to go before you are ready."
+"and you seem to have made some progress, albeit slight."
+"and your journey is half complete.  Be of good cheer!"
+"and you are coming nearer the end of your long quest!"
+"and it will not be long yet before you are ready!"
+"and you are nearly ready for the last test!">>
+
+<ROUTINE DMISH ("AUX" (CNT 0))
+        <COND (<IN? ,AMULET ,WINNER> <SET CNT <+ .CNT 1>>)>
+        <COND (<IN? ,LORE-BOOK ,WINNER> <SET CNT <+ .CNT 1>>)>
+        <COND (<IN? ,HOOD ,WINNER> <SET CNT <+ .CNT 1>>)>
+        <COND (<IN? ,CLOAK ,WINNER> <SET CNT <+ .CNT 1>>)>
+        <COND (<IN? ,RING ,WINNER> <SET CNT <+ .CNT 1>>)>
+        <COND (<IN? ,KEY ,WINNER> <SET CNT <+ .CNT 1>>)>
+        <COND (<IN? ,STAFF ,WINNER> <SET CNT <+ .CNT 1>>)>
+        .CNT>
+       
+<GLOBAL FOLFLAG T>     ;"Following?"
+
+<ROUTINE I-FOLIN ()
+        <COND (<IN? ,DUNGEON-MASTER ,HERE> <RFALSE>)
+              (<AND <EQUAL? ,HERE ,PRISON-CELL ,CELL> ,FOLFLAG>
+               <TELL
+"You notice that the dungeon master doesn't follow you." CR>
+               <SETG FOLFLAG <>>
+               <RTRUE>)
+              (<EQUAL? ,HERE ,PRISON-CELL ,CELL> <RFALSE>)
+              (<NOT ,FOLFLAG>
+               <SETG FOLFLAG T>
+               <TELL "The dungeon master rejoins you." CR>
+               <MOVE ,DUNGEON-MASTER ,HERE>
+               <RTRUE>)
+              (T
+               <TELL "The dungeon master follows you." CR>
+               <MOVE ,DUNGEON-MASTER ,HERE>
+               <RTRUE>)>>
+
+\\f
+
+;"SUBTITLE
+ 'The end had come, and this was it; he dropped her in the Flaming Pit.'"
+
+<GLOBAL LCELL 1> ;"cell in slot"
+
+<GLOBAL PNUMB 1> ;"cell pointed at"
+
+<GLOBAL CELLOBJS <ITABLE NONE <* 8 2 8>>>
+
+<ROUTINE MOVE-CELL-OBJECTS ("AUX" TOP CNT F X)
+        <SET TOP <* 8 <- ,LCELL 1>>>
+        <SET CNT <+ .TOP 1>>
+        <SET F <FIRST? ,CELL>>
+        <COND (.F
+               <REPEAT ()
+                       <SET X <NEXT? .F>>
+                       <COND (<NOT .F> <RETURN>)
+                             (T
+                              <PUT ,CELLOBJS .CNT .F>
+                              <REMOVE .F>
+                              <SET CNT <+ .CNT 1>>)>
+                       <COND (<NOT .X> <RETURN>)
+                             (T <SET F .X>)>>)>
+        <PUT ,CELLOBJS .TOP <- <- .CNT .TOP> 1>>
+        <SET TOP <* 8 <- ,PNUMB 1>>>
+        <SET CNT <GET ,CELLOBJS .TOP>>
+        <REPEAT ()
+                <COND (<0? .CNT> <RETURN>)
+                      (T
+                       <SET TOP <+ .TOP 1>>
+                       <MOVE <GET ,CELLOBJS .TOP> ,CELL>
+                       <SET CNT <- .CNT 1>>)>>>
+
+<ROUTINE CELL-MOVE ("AUX" F X)
+        <FCLEAR ,CELL-DOOR ,OPENBIT>
+        <FCLEAR ,BRONZE-DOOR ,OPENBIT>
+        <COND (<NOT <==? ,PNUMB ,LCELL>>
+               <COND (<==? ,PNUMB 4> <FCLEAR ,BRONZE-DOOR ,INVISIBLE>)
+                     (ELSE <FSET ,BRONZE-DOOR ,INVISIBLE>)>
+               <COND (<IN? ,PLAYER ,CELL>
+                      <SETG WINNER ,PLAYER>
+                      <FCLEAR ,GOOD-CELL ,TOUCHBIT>
+                      <FCLEAR ,PRISON-CELL ,TOUCHBIT>
+                      <GOTO <COND (<==? ,LCELL 4>
+                                   <FCLEAR ,BRONZE-DOOR ,INVISIBLE>
+                                   ,GOOD-CELL)
+                                  (ELSE ,PRISON-CELL)>>
+                      <SET F <FIRST? ,CELL>>
+                      <COND (.F
+                             <REPEAT ()
+                                     <SET X <NEXT? .F>>
+                                     <COND (<NOT .F> <RETURN>)
+                                           (T <MOVE .F ,HERE>)>
+                                     <COND (<NOT .X> <RETURN>)
+                                           (T <SET F .X>)>>)>)
+                     (T <MOVE-CELL-OBJECTS>)>
+               <SETG LCELL ,PNUMB>)>>
+
+<ROUTINE PARAPET-F (RARG)
+        <COND (<==? .RARG ,M-LOOK>
+               <TELL
+"You are standing behind a stone retaining wall which rims a large
+parapet overlooking a fiery pit.  It is difficult to see through the
+smoke and flame which fills the pit, but it seems to be more or less
+bottomless.  The pit itself is circular, about two hundred feet in diameter,
+and is fashioned of roughly hewn stone.  The flames generate considerable
+heat, so it is rather uncomfortable standing here.|
+There is an object here which looks like a sundial.  On it are an
+indicator arrow and (in the center) a large button.  On the face of
+the dial are numbers 1 through 8.  The indicator points to the number "
+N ,PNUMB "." CR>
+               <TELL
+"To the south, across a narrow corridor, is a prison cell." CR>)>>
+
+<ROUTINE DIAL ("AUX" N)
+        <COND (<VERB? EXAMINE>
+               <TELL "The dial points to " N ,PNUMB "." CR>)
+              (<VERB? TURN>
+               <COND (<==? ,PRSI ,INTNUM>
+                      <COND (<OR <0? ,P-NUMBER>
+                                 <G? ,P-NUMBER 8>>
+                             <TELL "There is no such setting." CR>
+                             <RTRUE>)>
+                      <SETG PNUMB ,P-NUMBER>
+                      <COND (<==? ,WINNER ,PLAYER>
+                             <TELL
+"The dial now points to " N ,PNUMB "." CR>)>
+                      <RTRUE>)
+                     (<NOT ,PRSI>
+                      <TELL "You must specify what to set the dial to." CR>)
+                     (T <TELL "The dial face only contains numbers." CR>)>)
+              (<VERB? SPIN>
+               <SETG PNUMB <RANDOM 8>>
+               <COND (<==? ,WINNER ,PLAYER>
+                      <TELL
+"The dial spins and comes to a stop pointing at " N ,PNUMB ".">)>
+               <RTRUE>)>>
+
+<ROUTINE DIALBUTTON ("AUX" C)
+        <SET C <FSET? ,CELL-DOOR ,OPENBIT>>
+        <FCLEAR ,CELL ,TOUCHBIT>
+        <COND (<VERB? PUSH>
+               <COND (<==? ,WINNER ,PLAYER>
+                      <TELL
+"The button depresses with a slight click, and pops back." CR>)>
+               <CELL-MOVE>
+               <COND (.C <TELL
+"You notice that the cell door is now closed." CR>)>
+               <RTRUE>)>>
+
+<ROUTINE CELL-ROOM (RARG)
+         <COND (<==? .RARG ,M-LOOK>
+               <TELL
+"You are in a featureless prison cell.  You can see ">
+               <COND (<FSET? ,CELL-DOOR ,OPENBIT>
+                      <TELL "an east-west
+corridor outside the open wooden door in front of you. Your view
+also takes in the parapet, and behind, a large, fiery pit." CR>)
+                     (T
+                      <TELL "through the small window
+in the closed door in front of you the parapet, and, behind that,
+smoke and flames rising from a fiery pit." CR>)>
+               <COND (<IN? ,DUNGEON-MASTER ,PARAPET>
+                      <TELL
+"The dungeon master is standing on the parapet, leaning on his wooden
+staff.  His keen gaze is fixed on you and he looks somewhat tense,
+as if waiting for something to happen." CR>)> 
+               <COND (<==? ,LCELL 4>
+                      <TELL
+"Behind you, to the south, is a bronze door which is ">
+                      <DPR ,BRONZE-DOOR>)>
+               <RTRUE>)>>
+               
+<ROUTINE NCELL-ROOM (RARG)
+         <COND (<==? .RARG ,M-LOOK>
+               <TELL
+"You are in a bare prison cell.  Its wooden door is securely fastened,
+and you can see only flames and smoke through its small window.  On the
+south wall is a bronze door which seems to be ">
+               <DPR ,BRONZE-DOOR>)>>
+
+<ROUTINE DPR (OBJ)
+        <COND (<FSET? .OBJ ,OPENBIT> <TELL "open." CR>)
+              (T <TELL "closed." CR>)>>
+
+<ROUTINE NORTH-CORRIDOR-F (RARG)
+        <COND (<==? .RARG ,M-LOOK>
+               <TELL
+"This is a wide east-west corridor which opens onto a northern
+parapet at its center.  You can see flames and smoke as you peer
+towards the parapet.  The corridor turns south at either end, and in
+the center of the south wall is a heavy wooden door with a small
+window barred with iron.  The door is ">
+               <DPR ,CELL-DOOR>)>>
+
+<ROUTINE SOUTH-CORRIDOR-F (RARG)
+        <COND (<==? .RARG ,M-LOOK>
+               <TELL
+"You are in an east-west corridor which turns north at its eastern
+and western ends.  The walls are made of the finest marble.  An
+additional passage leads south at the center of the corridor." CR>
+              <COND (<==? ,LCELL 4>
+                     <TELL
+"In the center of the north wall is a bronze door which is ">
+                     <DPR ,BRONZE-DOOR>)>
+              <RTRUE>)>>
+
+<GLOBAL BRONZE-DOOR-LOCKED T>
+
+<ROUTINE BRONZE-DOOR-F ()
+        <COND (<AND <VERB? OPEN>
+                    <NOT <FSET? ,BRONZE-DOOR ,OPENBIT>>
+                    <==? ,HERE ,GOOD-CELL>
+                    <NOT ,BRONZE-DOOR-LOCKED>>
+               <TELL
+"On the other side of the bronze door is a narrow passage which opens out
+into a larger area." CR>
+               <FSET ,BRONZE-DOOR ,OPENBIT>)
+              (<AND <VERB? OPEN> ,BRONZE-DOOR-LOCKED>
+               <TELL
+"The bronze door is locked." CR>)>>
+
+<ROUTINE LOCKED-DOOR-F ()
+        <COND (<VERB? OPEN UNLOCK>
+               <TELL "The door is securely fastened." CR>)>>
+
+\\f
+
+"=========== The Ultimate Winnage =========="
+
+<ROUTINE NIRVANA-F (RARG)
+        <COND (<==? .RARG ,M-END>
+               <TELL
+"As you gleefully examine your new-found riches, the Dungeon Master
+materializes beside you, and says, \"Now that you have solved all the
+mysteries of the Dungeon, it is time for you to assume your rightly-earned
+place in the scheme of things. Long have I waited for one capable of
+releasing me from my burden!\" He taps you lightly on the head with his
+staff, mumbling a few well-chosen spells, and you feel yourself changing,
+growing older and more stooped. For a moment there are two identical mages
+standing among the treasure, then your counterpart dissolves into a
+mist and disappears, a sardonic grin on his face.|
+|
+For a moment you are relieved, safe in the knowledge that you have
+at last completed your quest in ZORK. You begin to feel the vast powers
+and lore at your command and thirst for an opportunity to use them.|
+|
+">
+              <FINISH>)>>
+
+<ROUTINE BRONZE-DOOR-EXIT ()
+        <COND (<FSET? ,BRONZE-DOOR ,INVISIBLE>
+               <TELL "You can't go that way." CR>
+               <RFALSE>)
+              (<FSET? ,BRONZE-DOOR ,OPENBIT>
+               ,CELL)
+              (T
+               <TELL "The bronze door is closed." CR>
+               <RFALSE>)>>
+
+;<ROUTINE MASTER-F ()
+        <PERFORM ,PRSA ,DUNGEON-MASTER>
+        <RTRUE>>
+
+<GLOBAL OLD-MAN-GONE <>>
+<GLOBAL OLD-MAN-FED <>>
+
+<GLOBAL SECRET-DOOR-DESC
+"Beyond the once-secret door are dark, forbidding stairs that lead down to
+a passage below.  Dim light, as from torches, can be seen in the
+passage.">
+
+<ROUTINE SECRET-DOOR-F ()
+        <COND (<AND <VERB? OPEN> <NOT <FSET? ,SECRET-DOOR ,OPENBIT>>>
+               <TELL "The massive stone door opens noiselessly. "
+                     ,SECRET-DOOR-DESC CR>
+               <FSET ,SECRET-DOOR ,OPENBIT>)>>
+
+<ROUTINE MSTAIRS-F (RARG)
+        <COND (<AND <==? .RARG ,M-ENTER>
+                    <PROB 30>
+                    <NOT ,OLD-MAN-FED>
+                    <NOT ,OLD-MAN-GONE>>
+               <MOVE ,OLD-MAN ,HERE>)
+              (<==? .RARG ,M-LOOK>
+               <TELL
+"You are in a room with passages heading southwest and southeast.  The
+north wall is ornately carved, filled with strange runes and writing in
+an unfamiliar language." CR>
+               <COND (<FSET? ,SECRET-DOOR ,OPENBIT>
+                      <TELL ,SECRET-DOOR-DESC CR>)
+                     (<NOT <FSET? ,SECRET-DOOR ,INVISIBLE>>
+                      <TELL
+"The outline of a door is barely visible on the surface of the rock." CR>)>)>>
+
+<ROUTINE HELLO? (WHO)
+        <COND (<OR <==? ,WINNER .WHO>
+                   <VERB? TELL ANSWER REPLY SAY HELLO INCANT>>
+               <COND (<VERB? TELL ANSWER SAY INCANT REPLY>
+                      <SETG P-CONT <>>
+                      <SETG QUOTE-FLAG <>>)>
+               <RTRUE>)>>
+
+<ROUTINE OLD-MAN-F ("OPTIONAL" (RARG <>))
+        <COND (<==? .RARG ,M-OBJDESC>
+               <COND (,OLD-MAN-AWAKE
+                      <TELL
+"There is an old man huddled in the corner, eyeing you cautiously.
+He seems weak and tired, and nods off frequently." CR>)
+                     (T
+                      <TELL
+"An old and wizened man is huddled, asleep, in the corner.  He is snoring
+loudly.  From his appearance, he is weak and frail." CR>)>)
+              (<AND <VERB? GIVE> <==? ,PRSI ,OLD-MAN>>
+               <COND (,OLD-MAN-AWAKE
+                      <COND (<==? ,PRSO ,WAYBREAD>
+                             <REMOVE ,WAYBREAD>
+                             <TELL
+"He looks up at you and takes the waybread from you. Slowly, he eats the
+bread and pauses when he is finished. He starts to speak: \"Perhaps what you
+seek is through there!\" He points at the carved wall to the north, where you
+now notice the bare outline of a secret door. When you turn back to the old
+man, you notice that he has gone!" CR>
+                             <FCLEAR ,SECRET-DOOR ,INVISIBLE>
+                             <SETG OLD-MAN-GONE T>
+                             <REMOVE ,OLD-MAN>)
+                            (<IN? ,WAYBREAD ,WINNER>
+                             <TELL
+"He refuses your offer but motions with his arm to the waybread in your
+hand." CR>)
+                            (T
+                             <TELL
+"The old man refuses the " D ,PRSO " with a wave of his hand." CR>)>)
+                     (T <TELL "He is asleep!" CR>)>)
+              (<VERB? EXAMINE>
+               <COND (,OLD-MAN-AWAKE
+                      <TELL
+"The old man is barely awake and appears to nod off every few moments.
+He has bright eyes, which, when open, appear to see right through your
+body." CR>)
+                     (T
+                      <TELL
+"The man is very, very old and wizened.  He has a long, stringy
+beard and is snoring quite loudly." CR>)>)
+              (<VERB? LISTEN>
+               <COND (,OLD-MAN-AWAKE <TELL "He isn't talking." CR>)
+                     (T
+                      <TELL
+"He is snoring like a buzz saw." CR>)>)
+              (<HELLO? ,OLD-MAN>
+               <COND (,OLD-MAN-AWAKE
+                      <TELL
+"He nods at you without seeming to have understood." CR>)
+                     (T
+                      <TELL
+"He is sleeping soundly and does not respond." CR>)>)
+              (<VERB? SHAKE ALARM>
+               <TELL
+"The old man is roused to consciousness.  He peers at you through eyes which
+appear much younger and stronger than his frail body and waits, as if expecting
+something to happen." CR>
+               <SETG OLD-MAN-AWAKE T>
+               <ENABLE <QUEUE I-OLD-MAN-SLEEPS 3>>)
+              (<VERB? KILL ATTACK MUNG>
+               <TELL
+"The attack seems to have left the old man unharmed! You watch in awe as he
+rises to his feet and seems to tower above you. He peers down menacingly,
+then sadly and wearily. \"Not yet,\" he mourns, and vanishes in a puff of
+smoke." CR>
+               <SETG OLD-MAN-GONE T>
+               <REMOVE ,OLD-MAN>)>>
+
+<GLOBAL OLD-MAN-AWAKE <>>
+
+<ROUTINE I-OLD-MAN-SLEEPS ()
+        <SETG OLD-MAN-AWAKE <>>
+        <COND (<IN? ,OLD-MAN ,HERE>
+               <TELL "You notice that the old man has fallen asleep." CR>)>>
+
+<ROUTINE RUNES-F ()
+        <COND (<VERB? EXAMINE READ>
+               <TELL
+"The runes are in an ancient language. Some pictures, among
+the runes, depict flames, stone statues, and figures of old men." CR>)>>
+
+<ROUTINE T-BAR-F ()
+        <COND (<VERB? TURN>
+               <TELL
+"You don't have enough leverage to turn the T-bar itself.  You might
+cause the whole structure to turn, however." CR>)>>
+
+<ROUTINE FLAMING-PIT-F ()
+        <COND (<VERB? EXAMINE>
+               <TELL
+"The flaming pit is a seemingly bottomless abyss filled with smoke and
+flame." CR>)
+              (<AND <VERB? PUT> <==? ,PRSI ,FLAMING-PIT>>
+               <COND (<EQUAL? ,HERE ,PARAPET ,NORTH-CORRIDOR>
+                      <COND (<==? ,PRSO ,ME>
+                             <TELL
+"It would be a pity to end your life so near the end of your quest!" CR>)
+                            (T
+                             <TELL
+"You cast the " D ,PRSO " into the pit, where it is lost forever." CR>
+                             <REMOVE ,PRSO>)>)
+                     (T <TELL "You're not close enough." CR>)>)>>
+
+<ROUTINE PARAPET-OBJ-F ()
+        <COND (<VERB? EXAMINE>
+               <COND (<EQUAL? ,HERE ,CELL ,NORTH-CORRIDOR>
+                      <TELL
+"You can see the parapet and sundial from here.">
+                      <COND (<IN? ,DUNGEON-MASTER ,PARAPET>
+                             <TELL " The dungeon master is there
+also, leaning on his staff.">)>
+                      <CRLF>)
+                     (T <V-LOOK>)>)>>
+
+<ROUTINE ROSE-F ()
+         <COND (<VERB? TURN MOVE>
+                <TELL
+"The compass rose is made of stone and is imbedded in the ground.
+You could not possibly turn it or move it." CR>)>>
+
+<ROUTINE CELL-DOOR-F ()
+        <COND (<AND <VERB? PUT> <==? ,PRSI ,CELL-DOOR>>
+               <TELL "You will have to enter the cell first." CR>)
+              (<VERB? THROUGH>
+               <COND (<==? ,HERE ,CELL>
+                      <TELL "Look around." CR>)
+                     (T
+                      <DO-WALK ,P?SOUTH>
+                      <RTRUE>)>)>>
+
+<ROUTINE LORE-BOOK-F ()
+        <COND (<AND <VERB? BURN> <NOT <IN? ,LORE-BOOK ,WINNER>>>
+               <TELL
+"The book is consumed in a dazzling display of color." CR>
+               <REMOVE ,PRSO>
+               <RTRUE>)
+              (<AND ,IN-DUNGEON <VERB? OPEN EXAMINE READ>>
+               <TELL
+"The book seems to will itself open to a specific page.  On it is a picture of
+eight small rooms located around a great circle of flame.  All are identical
+save one, which has a bronze door leading to a magnificent room bathed in
+golden light.  A legend beneath the picture says only \"The Dungeon and
+Treasury of Zork.\"" CR>)
+              (<VERB? OPEN>
+               <TELL
+"The book can be perused but not left open." CR>)>>
+
+<ROUTINE CP-HOLE-F ()
+        <COND (<VERB? THROUGH>
+               <DO-WALK ,P?DOWN>
+               <RTRUE>)>>
+
+<ROUTINE TORCH-PSEUDO ()
+        <TELL "The torches are out of reach." CR>>
+
+<ROUTINE WATER-FCN ("AUX" AV PI?)
+        #DECL ((AV) <OR OBJECT FALSE> (PI?) <OR ATOM FALSE>)
+        <COND (<VERB? SGIVE> <RFALSE>)
+              (<VERB? THROUGH>
+               <PERFORM ,V?SWIM ,PRSO>
+               <RTRUE>)
+              (<VERB? FILL>    ;"fill bottle with water =>"
+               <SETG PRSA ,V?PUT>
+               <SETG PRSI ,PRSO>
+               <SETG PRSO ,GLOBAL-WATER>
+               <SET PI? <>>)
+              (<EQUAL? ,PRSO ,GLOBAL-WATER>
+               <SET PI? <>>)
+              (,PRSI
+               <SET PI? T>)>
+        <COND (.PI? <SETG PRSI ,GLOBAL-WATER>)
+              (T <SETG PRSO ,GLOBAL-WATER>)>
+        <COND (<AND <VERB? TAKE PUT> <NOT .PI?>>
+               <TELL "The water slips through your fingers." CR>)
+              (.PI? <TELL "You can't do that." CR>)
+              (<VERB? DROP GIVE THROW>
+               <TELL "You don't have any water." CR>)>>
+
+<ROUTINE RANDOM-WALL ()
+        <COND (<VERB? PUSH>
+               <COND (<==? ,HERE ,IN-MIRROR>
+                      <TELL
+"You should specify which panel you want to push." CR>)
+                     (T <TELL
+"You can't budge it; at least from here." CR>)>)>>
\ No newline at end of file
diff --git a/clock.zap b/clock.zap
new file mode 100644 (file)
index 0000000..7c145e4
--- /dev/null
+++ b/clock.zap
@@ -0,0 +1,60 @@
+
+
+       .FUNCT  DEMON,RTN,TICK,CINT
+       CALL    INT,RTN,TRUE-VALUE >CINT
+       PUT     CINT,C-TICK,TICK
+       RETURN  CINT
+
+
+       .FUNCT  QUEUE,RTN,TICK,CINT
+       CALL    INT,RTN >CINT
+       PUT     CINT,C-TICK,TICK
+       RETURN  CINT
+
+
+       .FUNCT  INT,RTN,DEMON=0,E,C,INT
+       ADD     C-TABLE,C-TABLELEN >E
+       ADD     C-TABLE,C-INTS >C
+?PRG1: EQUAL?  C,E \?ELS5
+       SUB     C-INTS,C-INTLEN >C-INTS
+       ZERO?   DEMON /?ELS7
+       SUB     C-DEMONS,C-INTLEN >C-DEMONS
+?ELS7: ADD     C-TABLE,C-INTS >INT
+       PUT     INT,C-RTN,RTN
+       RETURN  INT
+?ELS5: GET     C,C-RTN
+       EQUAL?  STACK,RTN \?CND3
+       RETURN  C
+?CND3: ADD     C,C-INTLEN >C
+       JUMP    ?PRG1
+
+
+       .FUNCT  CLOCKER,C,E,TICK,FLG=0
+       ZERO?   CLOCK-WAIT /?CND1
+       SET     'CLOCK-WAIT,FALSE-VALUE
+       RFALSE  
+?CND1: ZERO?   P-WON /?ELS9
+       PUSH    C-INTS
+       JUMP    ?CND5
+?ELS9: PUSH    C-DEMONS
+?CND5: ADD     C-TABLE,STACK >C
+       ADD     C-TABLE,C-TABLELEN >E
+?PRG13:        EQUAL?  C,E \?ELS17
+       RETURN  FLG
+?ELS17:        GET     C,C-ENABLED?
+       ZERO?   STACK /?CND15
+       GET     C,C-TICK >TICK
+       ZERO?   TICK \?ELS22
+       JUMP    ?CND15
+?ELS22:        SUB     TICK,1
+       PUT     C,C-TICK,STACK
+       GRTR?   TICK,1 /?CND20
+       GET     C,C-RTN
+       CALL    STACK
+       ZERO?   STACK /?CND20
+       SET     'FLG,TRUE-VALUE
+?CND20:        
+?CND15:        ADD     C,C-INTLEN >C
+       JUMP    ?PRG13
+
+       .ENDI
diff --git a/clock.zil b/clock.zil
new file mode 100644 (file)
index 0000000..e98e59f
--- /dev/null
+++ b/clock.zil
@@ -0,0 +1,60 @@
+
+<CONSTANT C-TABLELEN 180>
+
+<GLOBAL C-TABLE <ITABLE NONE 180>>
+
+<GLOBAL C-DEMONS 180>
+
+<GLOBAL C-INTS 180>
+
+<CONSTANT C-INTLEN 6>
+
+<CONSTANT C-ENABLED? 0>
+
+<CONSTANT C-TICK 1>
+
+<CONSTANT C-RTN 2>
+
+<ROUTINE DEMON (RTN TICK "AUX" CINT)
+        #DECL ((RTN) ATOM (TICK) FIX (CINT) <PRIMTYPE VECTOR>)
+        <PUT <SET CINT <INT .RTN T>> ,C-TICK .TICK>
+        .CINT>
+
+<ROUTINE QUEUE (RTN TICK "AUX" CINT)
+        #DECL ((RTN) ATOM (TICK) FIX (CINT) <PRIMTYPE VECTOR>)
+        <PUT <SET CINT <INT .RTN>> ,C-TICK .TICK>
+        .CINT>
+
+<ROUTINE INT (RTN "OPTIONAL" (DEMON <>) E C INT)
+        #DECL ((RTN) ATOM (DEMON) <OR ATOM FALSE> (E C INT) <PRIMTYPE
+                                                             VECTOR>)
+        <SET E <REST ,C-TABLE ,C-TABLELEN>>
+        <SET C <REST ,C-TABLE ,C-INTS>>
+        <REPEAT ()
+                <COND (<==? .C .E>
+                       <SETG C-INTS <- ,C-INTS ,C-INTLEN>>
+                       <AND .DEMON <SETG C-DEMONS <- ,C-DEMONS ,C-INTLEN>>>
+                       <SET INT <REST ,C-TABLE ,C-INTS>>
+                       <PUT .INT ,C-RTN .RTN>
+                       <RETURN .INT>)
+                      (<==? <GET .C ,C-RTN> .RTN> <RETURN .C>)>
+                <SET C <REST .C ,C-INTLEN>>>>
+
+<GLOBAL CLOCK-WAIT <>>
+
+<ROUTINE CLOCKER ("AUX" C E TICK (FLG <>))
+        #DECL ((C E) <PRIMTYPE VECTOR> (TICK) FIX (FLG) <OR FALSE ATOM>)
+        <COND (,CLOCK-WAIT <SETG CLOCK-WAIT <>> <RFALSE>)>
+        <SET C <REST ,C-TABLE <COND (,P-WON ,C-INTS) (T ,C-DEMONS)>>>
+        <SET E <REST ,C-TABLE ,C-TABLELEN>>
+        <REPEAT ()
+                <COND (<==? .C .E> <RETURN .FLG>)
+                      (<NOT <0? <GET .C ,C-ENABLED?>>>
+                       <SET TICK <GET .C ,C-TICK>>
+                       <COND (<0? .TICK>)
+                             (T
+                              <PUT .C ,C-TICK <- .TICK 1>>
+                              <COND (<AND <NOT <G? .TICK 1>>
+                                          <APPLY <GET .C ,C-RTN>>>
+                                     <SET FLG T>)>)>)>
+                <SET C <REST .C ,C-INTLEN>>>>
diff --git a/demons.zap b/demons.zap
new file mode 100644 (file)
index 0000000..a8dc291
--- /dev/null
@@ -0,0 +1,58 @@
+
+
+       .FUNCT  I-SWORD,DEM,NG=0,P,T,L
+       CALL    INT,I-SWORD >DEM
+       IN?     SWORD,ADVENTURER \?ELS5
+       EQUAL?  HERE,CLIFF \?ELS8
+       ZERO?   MAN-GONE \?ELS8
+       SET     'NG,1
+       JUMP    ?CND6
+?ELS8: EQUAL?  HERE,CLIFF-LEDGE \?ELS12
+       ZERO?   MAN-FLAG /?ELS12
+       SET     'NG,1
+       JUMP    ?CND6
+?ELS12:        CALL    INFESTED?,HERE
+       ZERO?   STACK /?ELS16
+       SET     'NG,2
+       JUMP    ?CND6
+?ELS16:        SET     'P,0
+?PRG19:        NEXTP   HERE,P >P
+       ZERO?   P \?ELS23
+       JUMP    ?CND6
+?ELS23:        LESS?   P,LOW-DIRECTION /?PRG19
+       GETPT   HERE,P >T
+       PTSIZE  T >L
+       EQUAL?  L,UEXIT,CEXIT,DEXIT \?PRG19
+       GETB    T,0
+       CALL    INFESTED?,STACK
+       ZERO?   STACK /?PRG19
+       SET     'NG,1
+?CND6: EQUAL?  NG,SWORD-STATE /FALSE
+       EQUAL?  NG,2 \?ELS36
+       PRINTI  "Your sword has begun to glow very brightly."
+       CRLF    
+       JUMP    ?CND32
+?ELS36:        EQUAL?  NG,1 \?ELS40
+       PRINTI  "Your sword is glowing with a faint blue glow."
+       CRLF    
+       JUMP    ?CND32
+?ELS40:        ZERO?   NG \?CND32
+       PRINTI  "Your sword is no longer glowing."
+       CRLF    
+?CND32:        SET     'SWORD-STATE,NG
+       RTRUE   
+?ELS5: PUT     DEM,0,0
+       RFALSE  
+
+
+       .FUNCT  INFESTED?,R,F
+       FIRST?  R >F /?KLU12
+?KLU12:        
+?PRG1: ZERO?   F /FALSE
+       FSET?   F,VILLAIN \?ELS7
+       FSET?   F,INVISIBLE /?ELS7
+       RETURN  F
+?ELS7: NEXT?   F >F /?PRG1
+       RFALSE  
+
+       .ENDI
diff --git a/demons.zil b/demons.zil
new file mode 100644 (file)
index 0000000..1d36545
--- /dev/null
@@ -0,0 +1,41 @@
+
+
+"SWORD demon"
+
+<ROUTINE I-SWORD ("AUX" (DEM <INT I-SWORD>) (NG 0) P T L)
+        <COND (<IN? ,SWORD ,ADVENTURER>
+               <COND (<AND <==? ,HERE ,CLIFF> <NOT ,MAN-GONE>> <SET NG 1>)
+                     (<AND <==? ,HERE ,CLIFF-LEDGE> ,MAN-FLAG> <SET NG 1>)
+                     (<INFESTED? ,HERE> <SET NG 2>)
+                     (ELSE
+                      <SET P 0>
+                      <REPEAT ()
+                              <COND (<0? <SET P <NEXTP ,HERE .P>>>
+                                     <RETURN>)
+                                    (<NOT <L? .P ,LOW-DIRECTION>>
+                                     <SET T <GETPT ,HERE .P>>
+                                     <SET L <PTSIZE .T>>
+                                     <COND (<EQUAL? .L ,UEXIT ,CEXIT ,DEXIT>
+                                            <COND (<INFESTED? <GETB .T 0>>
+                                                   <SET NG 1>
+                                                   <RETURN>)>)>)>>)>
+               <COND (<==? .NG ,SWORD-STATE> <RFALSE>)
+                     (<==? .NG 2>
+                      <TELL "Your sword has begun to glow very brightly." CR>)
+                     (<1? .NG>
+                      <TELL "Your sword is glowing with a faint blue glow."
+                            CR>)
+                     (<0? .NG>
+                      <TELL "Your sword is no longer glowing." CR>)>
+               <SETG SWORD-STATE .NG>
+               <RTRUE>)
+              (ELSE <DISABLE .DEM> <RFALSE>)>>
+
+<GLOBAL SWORD-STATE 0>
+
+<ROUTINE INFESTED? (R "AUX" (F <FIRST? .R>)) 
+        <REPEAT ()
+                <COND (<NOT .F> <RETURN <>>)
+                      (<AND <FSET? .F ,VILLAIN> <NOT <FSET? .F ,INVISIBLE>>>
+                       <RETURN .F>)
+                      (<NOT <SET F <NEXT? .F>>> <RETURN <>>)>>>
diff --git a/dungeon.zap b/dungeon.zap
new file mode 100644 (file)
index 0000000..a92e0b4
--- /dev/null
@@ -0,0 +1,2 @@
+
+       .ENDI
diff --git a/dungeon.zil b/dungeon.zil
new file mode 100644 (file)
index 0000000..91c6644
--- /dev/null
@@ -0,0 +1,999 @@
+"DUNGEON3 for
+                    ZORK III: The Dungeon Master
+                The Great Underground Empire (Part 3)
+       (c) Copyright 1982 Infocom, Inc.  All Rights Reserved.
+"
+
+<DIRECTIONS NORTH EAST WEST SOUTH NE NW SE SW UP DOWN IN OUT LAND CROSS>
+
+"SUBTITLE GLOBAL OBJECTS"
+
+<GLOBAL LOAD-MAX 100>
+<GLOBAL LOAD-ALLOWED 100>
+
+<OBJECT GLOBAL-OBJECTS
+       (FLAGS SEARCHBIT TRANSBIT RMUNGBIT INVISIBLE TOUCHBIT SURFACEBIT)>
+
+<OBJECT LOCAL-GLOBALS
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM MGCKJK)
+       (PSEUDO "FOOBAR" PATH-OBJECT)
+       (VTYPE 1)
+       (DESCFCN PATH-OBJECT)>
+
+;"Yes, this synonym for LOCAL-GLOBALS needs to exist... sigh"
+
+<OBJECT ROOMS>
+
+<OBJECT PSEUDO-OBJECT
+       (IN LOCAL-GLOBALS)
+       (DESC "pseudo")
+       (ACTION PATH-OBJECT)>
+
+<OBJECT IT     ;"was IT"
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM IT THAT THIS HIM)
+       (DESC "random object")
+       (FLAGS NDESCBIT)>
+
+<OBJECT BLESSINGS
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM BLESSINGS GRACES)
+       (DESC "blessings")
+       (FLAGS NDESCBIT)>
+
+<OBJECT STAIRS
+       (IN LOCAL-GLOBALS)
+       (SYNONYM STAIRS STEPS STAIRCASE STAIR)
+       (ADJECTIVE STONE MARBLE STEEP)
+       (DESC "stairs")
+       (FLAGS NDESCBIT CLIMBBIT)>
+
+<OBJECT RUBBLE
+       (IN LOCAL-GLOBALS)
+       (SYNONYM ROCK ROCKS BOULDER RUBBLE)
+       (DESC "rubble")
+       (FLAGS NDESCBIT)>
+
+<OBJECT DEBRIS
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM DUST DEBRIS)
+       (DESC "dust and debris")
+       (FLAGS NDESCBIT)>
+
+<OBJECT CHASM
+       (IN LOCAL-GLOBALS)
+       (SYNONYM CHASM GORGE RAVINE)
+       (ADJECTIVE ROCKY DEEP)
+       (DESC "chasm")
+       (ACTION CHASM-FCN)
+       (FLAGS NDESCBIT)>
+
+<OBJECT PATHOBJ
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM EXIT PATH TRAIL)
+        (ADJECTIVE FOREST NARROW LONG WINDING)
+       (DESC "way")
+       (FLAGS NDESCBIT)
+       (ACTION PATH-OBJECT)>
+
+<OBJECT TUNNEL
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM PASSAGE CRAWLWAY)
+        (ADJECTIVE DARK SMOKY)
+       (DESC "tunnel")
+       (FLAGS NDESCBIT)
+       (ACTION TUNNEL-OBJECT)>
+
+<OBJECT GROUND ;"was GROUND"
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM GROUND EARTH SAND FLOOR)
+       (DESC "ground")
+       (ACTION GROUND-FCN)>
+
+<OBJECT GRUE   ;"was GRUE"
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM GRUE)
+       (ADJECTIVE LURKING SINISTER HUNGRY SILENT)
+       (DESC "lurking grue")
+       (ACTION GRUE-FUNCTION)>
+
+<OBJECT HANDS  ;"was HANDS"
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM PAIR HANDS)
+       (ADJECTIVE BARE)
+       (DESC "pair of hands")
+       (FLAGS NDESCBIT TOOLBIT)>
+
+<OBJECT EAST-WALL      ;"was EAST-WALL"
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM WALL)
+       (ADJECTIVE EAST EASTERN)
+       (DESC "eastern wall")
+       (FLAGS NDESCBIT)
+       (ACTION RANDOM-WALL)>
+
+<OBJECT SOUTH-WALL     ;"was SOUTH-WALL"
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM WALL)
+       (ADJECTIVE SOUTH SOUTHE) ;"only 6 chars count and southeast exists"
+       (DESC "southern wall")
+       (FLAGS NDESCBIT)
+       (ACTION RANDOM-WALL)>
+
+<OBJECT WEST-WALL      ;"was WEST-WALL"
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM WALL)
+       (ADJECTIVE WEST WESTERN)
+       (DESC "western wall")
+       (FLAGS NDESCBIT)
+       (ACTION RANDOM-WALL)>
+
+<OBJECT NORTH-WALL     ;"was NORTH-WALL"
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM WALL)
+       (ADJECTIVE NORTH NORTHE)        ;"only six chars used..."
+       (DESC "northern wall")
+       (FLAGS NDESCBIT)
+       (ACTION RANDOM-WALL)>
+
+<OBJECT GLOBAL-WATER   ;"was GLOBAL-WATER"
+       (IN LOCAL-GLOBALS)
+       (SYNONYM WATER QUANTITY)
+       (DESC "water")
+       (FLAGS DRINKBIT)
+       (ACTION WATER-FCN)>
+
+<OBJECT ADVENTURER     ;"was ADVENTURER"
+       (IN CP-ANTE)
+       (SYNONYM ADVENTURER)
+       (DESC "cretin")
+       (FLAGS VILLAIN NDESCBIT INVISIBLE )
+       (STRENGTH 0)
+       (ACTION 0)>
+
+<OBJECT ME
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM ME MYSELF SELF CRETIN)
+       (DESC "you")
+       (FLAGS VILLAIN)
+       (ACTION CRETIN)>
+
+<OBJECT BROKEN-LAMP    ;"was BLAMP"
+       (SYNONYM LAMP LANTERN)
+       (ADJECTIVE BROKEN BRASS)
+       (DESC "broken brass lantern")
+       (FLAGS TAKEBIT)
+       (SIZE 15)>
+
+<OBJECT LAMP   ;"was LAMP"
+       (IN CP-ANTE)
+       (SYNONYM LAMP LANTERN)
+       (ADJECTIVE BRASS)
+       (DESC "lamp")
+       (FLAGS TAKEBIT LIGHTBIT)
+       (FDESC "Your old friend, the brass lantern, is at your feet.")
+       (ACTION LANTERN)
+       (SIZE 15)>
+
+<OBJECT SWORD  ;"was SWORD"
+       (IN STONE)
+       (SYNONYM SWORD ORCRIST GLAMDRING BLADE)
+       (ADJECTIVE ELVISH OLD ANTIQUE)
+       (DESC "sword")
+       (FLAGS TAKEBIT WEAPONBIT TRYTAKEBIT)
+       (ACTION SWORD-FCN)
+       (SIZE 25)
+       (VALUE 0)>
+
+"CHINESE PUZZLE ROOMS/OBJECTS"
+
+<ROOM CP-ANTE
+      (IN ROOMS)
+      (DESC "Royal Puzzle Entrance")
+      (WEST TO CP-OUT)
+      (NORTH TO MUSEUM-ENTRANCE)
+      (UP TO MUSEUM-ENTRANCE)
+      (DOWN PER CPENTER)
+      (FLAGS RLANDBIT ONBIT)
+      (ACTION CPANT-ROOM)
+      (GLOBAL STAIRS)>
+
+<ROOM CP-OUT
+      (IN ROOMS)
+      (DESC "Side Room")
+      (NORTH TO CP-ANTE)
+      (UP TO CP-ANTE)
+      (EAST TO CP IF CP-FLAG ELSE "The steel door is closed.")
+      (FLAGS RLANDBIT ONBIT)
+      (ACTION CPOUT-ROOM)
+      (GLOBAL CPDOOR STAIRS)>
+
+<ROOM CP
+      (IN ROOMS)
+      (DESC "Room in a Puzzle")
+      (NORTH PER CPEXIT)
+      (SOUTH PER CPEXIT)
+      (EAST PER CPEXIT)
+      (WEST PER CPEXIT)
+      (NE PER CPEXIT)
+      (NW PER CPEXIT)
+      (SE PER CPEXIT)
+      (UP PER CPEXIT)
+      (SW PER CPEXIT)
+      (ACTION CP-ROOM)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL CPLADDER CPDOOR CPEWL CPWWL CPNWL CPSWL)>
+
+;"SUBTITLE CHINESE PUZZLE OBJECTS"
+
+<OBJECT WARNING-NOTE
+       (IN CP-ANTE)
+       (DESC "warning note")
+       (SYNONYM NOTE WARNING TEXT)
+       (ADJECTIVE WARNING SMALL)
+       (FDESC "Lying on the ground is a small note of some kind.")
+       (FLAGS TAKEBIT READBIT BURNBIT)
+       (SIZE 2)
+       (TEXT
+"Warning:|
+    The Royal Puzzle is quite dangerous and it is possible to become
+trapped within its confines.  Please do not enter the puzzle after hours
+or when museum personnel are not present.|
+              The Management|")>
+
+<OBJECT CP-SLOT
+       (SYNONYM CPSLT SLIT SLOT)
+       (ADJECTIVE SMALL)
+       (DESC "small slot")
+       (FLAGS NDESCBIT OPENBIT)
+       (ACTION CP-SLOT-FCN)
+       (CAPACITY 4)>
+
+<OBJECT CPDOOR
+       (IN LOCAL-GLOBALS)
+       (SYNONYM DOOR)
+       (ADJECTIVE STEEL METAL)
+       (DESC "steel door")
+       (FLAGS NDESCBIT)
+       (ACTION CPDOOR-F)>
+
+<OBJECT LORE-BOOK
+       (SYNONYM BOOK LORE TEXT)
+       (ADJECTIVE LORE OLD STRANGE)
+       (DESC "very ancient book")
+       (FLAGS TAKEBIT READBIT)
+       (LDESC
+        "There is an old book here.")
+       (FDESC
+        "Nestled inside the niche is an old and dusty book.")
+       (TEXT
+"The book is written in a strong and elegant hand and is full of strange
+and wondrous pictures.  The text is in a tongue unknown to you and is penned
+in many colours.  Some of the words seem to change colour as you read them. 
+The book itself is very old and the pages dry and brittle.")
+       (SIZE 4)
+       (ACTION LORE-BOOK-F)>
+
+<GLOBAL CP-FLAG <>>
+
+<OBJECT CPEWL          ;"defined CPWALL"
+        (IN LOCAL-GLOBALS)
+       (SYNONYM WALL)
+       (ADJECTIVE EAST EASTERN)
+       (DESC "eastern wall")
+       (FLAGS NDESCBIT)
+       (ACTION CPWALL-OBJECT)>
+
+<OBJECT CPWWL          ;"defined CPWALL"
+        (IN LOCAL-GLOBALS)
+       (SYNONYM WALL)
+       (ADJECTIVE WEST WESTERN)
+       (DESC "western wall")
+       (FLAGS NDESCBIT)
+       (ACTION CPWALL-OBJECT)>
+
+<OBJECT CPSWL          ;"defined CPWALL"
+        (IN LOCAL-GLOBALS)
+       (SYNONYM WALL)
+       (ADJECTIVE SOUTH)
+       (DESC "southern wall")
+       (FLAGS NDESCBIT)
+       (ACTION CPWALL-OBJECT)>
+
+<OBJECT CPNWL          ;"defined CPWALL"
+        (IN LOCAL-GLOBALS)
+       (SYNONYM WALL)
+       (ADJECTIVE NORTH)
+       (DESC "northern wall")
+       (FLAGS NDESCBIT)
+       (ACTION CPWALL-OBJECT)>
+
+<OBJECT CPLADDER               ;"defined CPLADDER"
+        (IN GLOBAL-OBJECTS)
+       (SYNONYM LADDER)
+       (DESC "ladder")
+       (ACTION CPLADDER-OBJECT)>
+
+;"Objects/rooms for old end-game"
+
+<OBJECT INTNUM
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM INTNUM)
+       (FLAGS TOOLBIT)
+       (DESC "number")>
+
+<OBJECT INTDIR
+       (IN GLOBAL-OBJECTS)
+       (SYNONYM INTDIR)
+       (FLAGS TOOLBIT)
+       (DESC "direction")>
+
+<OBJECT GUARDIAN
+       (IN LOCAL-GLOBALS)
+       (DESC "Guardians of Zork")
+       (SYNONYM STATUE GUARDIAN GUARD GUARDS)
+       (FLAGS VILLAIN)
+       (ACTION GUARDIANS)>
+
+<OBJECT ROSE
+       (IN LOCAL-GLOBALS)
+       (DESC "compass rose")
+       (SYNONYM ROSE)
+       (ADJECTIVE COMPASS)
+       (ACTION ROSE-F)>
+
+<OBJECT MASTER
+       (IN LOCAL-GLOBALS)
+       (DESC "dungeon master")
+       (SYNONYM MASTER)
+       (ADJECTIVE DUNGEON)
+       (FLAGS VICBIT)
+       (ACTION MASTER-F)>
+
+<OBJECT DUNGEON-MASTER
+       (IN BEHIND-DOOR)
+       (DESC "dungeon master")
+       (LDESC
+"The dungeon master is quietly leaning on his staff here.")
+       (SYNONYM MASTER DUNGEON)
+       (ADJECTIVE DUNGEON)
+       (FLAGS VILLAIN VICBIT)
+       (ACTION DUNGEON-MASTER-F)>
+
+<OBJECT MIRROR
+       (IN LOCAL-GLOBALS)
+       (DESC "mirror")
+       (SYNONYM MIRROR STRUCTURE)
+       (FLAGS VICBIT)
+       (ACTION MIRROR-FUNCTION)>
+
+<OBJECT PANEL
+       (IN LOCAL-GLOBALS)
+       (DESC "panel")
+       (SYNONYM PANEL)
+       (ACTION PANEL-FUNCTION)>
+
+<OBJECT CHANNEL
+       (IN LOCAL-GLOBALS)
+       (DESC "stone channel")
+       (SYNONYM CHANNEL HOLE)
+       (ADJECTIVE STONE)>
+
+<ROOM MRD
+      (IN ROOMS)
+      (DESC "Hallway")
+      (LDESC " ")
+      (NORTH TO FRONT-DOOR)
+      (NE TO FRONT-DOOR)
+      (NW TO FRONT-DOOR)
+      (SOUTH PER MRGO)
+      (SE PER MRGO)
+      (SW PER MRGO)
+      (ACTION MRDF)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL ROSE CHANNEL GUARDIAN WOODEN-WALL)>
+
+<ROOM MRG
+      (IN ROOMS)
+      (DESC "Hallway")
+      (LDESC " ")
+      (NORTH PER MRGO)
+      (NW PER MRGO)
+      (NE PER MRGO)
+      (ENTER PER MIRIN)
+      (SOUTH PER MRGO)
+      (SW PER MRGO)
+      (SE PER MRGO)
+      (ACTION GUARDIANS)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL GUARDIAN)>
+
+<ROOM MRC
+      (IN ROOMS)
+      (DESC "Hallway")
+      (LDESC " ")
+      (NORTH PER MRGO)
+      (NW PER MRGO)
+      (NE PER MRGO)
+      (ENTER PER MIRIN)
+      (SOUTH PER MRGO)
+      (SW PER MRGO)
+      (SE PER MRGO)
+      (ACTION MRCF)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL ROSE CHANNEL GUARDIAN WOODEN-WALL)>
+
+<ROOM MRB
+      (IN ROOMS)
+      (DESC "Hallway")
+      (LDESC " ")
+      (NORTH PER MRGO)
+      (NW PER MRGO)
+      (NE PER MRGO)
+      (ENTER PER MIRIN)
+      (SOUTH PER MRGO)
+      (SW PER MRGO)
+      (SE PER MRGO)
+      (ACTION MRBF)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL ROSE CHANNEL WOODEN-WALL)>
+
+<ROOM MRA
+      (IN ROOMS)
+      (DESC "Hallway")
+      (LDESC " ")
+      (NORTH PER MRGO)
+      (NW PER MRGO)
+      (NE PER MRGO)
+      (ENTER PER MIRIN)
+      (SOUTH TO MREYE)
+      (ACTION MRAF)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL ROSE CHANNEL WOODEN-WALL)>
+
+<ROOM MRDE
+      (IN ROOMS)
+      (DESC "Narrow Room")
+      (LDESC " ")
+      (ENTER PER MIRIN)
+      (WEST PER MIRIN)
+      (NORTH TO FRONT-DOOR)
+      (SOUTH TO MRG)
+      (ACTION MRDEW)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL GUARDIAN)>
+
+<ROOM MRDW
+      (IN ROOMS)
+      (DESC "Narrow Room")
+      (LDESC " ")
+      (ENTER PER MIRIN)
+      (WEST PER MIRIN)
+      (NORTH TO FRONT-DOOR)
+      (SOUTH TO MRG)
+      (ACTION MRDEW)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL GUARDIAN)>
+
+<ROOM MRGE
+      (IN ROOMS)
+      (DESC "Narrow Room")
+      (LDESC " ")
+      (ENTER PER MIRIN)
+      (WEST PER MIRIN)
+      (NORTH TO MRD)
+      (SOUTH TO MRC)
+      (ACTION GUARDIANS)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL GUARDIAN)>
+
+<ROOM MRGW
+      (IN ROOMS)
+      (DESC "Narrow Room")
+      (LDESC " ")
+      (ENTER PER MIRIN)
+      (EAST PER MIRIN)
+      (NORTH TO MRD)
+      (SOUTH TO MRC)
+      (ACTION GUARDIANS)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL GUARDIAN)>
+
+<ROOM MRCE
+      (IN ROOMS)
+      (DESC "Narrow Room")
+      (LDESC " ")
+      (ENTER PER MIRIN)
+      (WEST PER MIRIN)
+      (NORTH TO MRG)
+      (SOUTH TO MRB)
+      (ACTION MRCEW)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL GUARDIAN)>
+
+<ROOM MRCW
+      (IN ROOMS)
+      (DESC "Narrow Room")
+      (LDESC " ")
+      (ENTER PER MIRIN)
+      (EAST PER MIRIN)
+      (NORTH TO MRG)
+      (SOUTH TO MRB)
+      (ACTION MRCEW)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL GUARDIAN)>
+
+<ROOM MRBE
+      (IN ROOMS)
+      (DESC "Narrow Room")
+      (LDESC " ")
+      (ENTER PER MIRIN)
+      (WEST PER MIRIN)
+      (NORTH TO MRC)
+      (SOUTH TO MRA)
+      (ACTION MRBEW)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL GUARDIAN)>
+
+<ROOM MRBW
+      (IN ROOMS)
+      (DESC "Narrow Room")
+      (LDESC " ")
+      (ENTER PER MIRIN)
+      (EAST PER MIRIN)
+      (NORTH TO MRC)
+      (SOUTH TO MRA)
+      (ACTION MRBEW)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL GUARDIAN)>
+
+<ROOM MRAE
+      (IN ROOMS)
+      (DESC "Narrow Room")
+      (LDESC " ")
+      (ENTER PER MIRIN)
+      (WEST PER MIRIN)
+      (NORTH TO MRB)
+      (SOUTH TO MREYE)
+      (ACTION MRAEW)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL GUARDIAN)>
+
+<ROOM MRAW
+      (IN ROOMS)
+      (DESC "Narrow Room")
+      (LDESC " ")
+      (ENTER PER MIRIN)
+      (EAST PER MIRIN)
+      (NORTH TO MRB)
+      (SOUTH TO MREYE)
+      (ACTION MRAEW)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MIRROR PANEL GUARDIAN)>
+
+<ROOM IN-MIRROR
+      (IN ROOMS)
+      (DESC "Inside Mirror")
+      (LDESC " ")
+      (OUT PER MIROUT)
+      (NORTH PER MIROUT)
+      (SOUTH PER MIROUT)
+      (NW PER MIROUT)
+      (NE PER MIROUT)
+      (SE PER MIROUT)
+      (SW PER MIROUT)
+      (WEST PER MIROUT)
+      (EAST PER MIROUT)
+      (ACTION MAGIC-MIRROR)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL ROSE CHANNEL GUARDIAN)>
+
+<ROOM MR-ANTE
+      (IN ROOMS)
+      (DESC "Button Room")
+      (LDESC
+"You are standing at the southern end of a long, dimly lit hall.  To the
+south, stairs ascend into darkness.  To the north the corridor is illuminated
+by torches set high in the walls, out of reach.  On one wall is a red
+button.")
+       (SOUTH TO MSTAIRS IF SECRET-DOOR IS OPEN)
+       (UP TO MSTAIRS IF SECRET-DOOR IS OPEN)
+       (NORTH TO MREYE)
+       (FLAGS RLANDBIT ONBIT)
+       (GLOBAL SECRET-DOOR STAIRS)
+       (PSEUDO "TORCH" TORCH-PSEUDO "TORCHE" TORCH-PSEUDO)>
+
+<ROOM MREYE
+      (IN ROOMS)
+      (DESC "Beam Room")
+      (LDESC " ")
+      (NORTH PER MRGO)
+      (NW PER MRGO)
+      (NE PER MRGO)
+      (SOUTH TO MR-ANTE)
+      (ACTION MREYE-ROOM)
+      (FLAGS RLANDBIT ONBIT)>
+
+<ROOM MSTAIRS
+      (IN ROOMS)
+      (DESC "Engravings Room")
+      (NORTH TO MR-ANTE IF SECRET-DOOR IS OPEN ELSE "You can't go that way.")
+      (DOWN TO MR-ANTE IF SECRET-DOOR IS OPEN ELSE "You can't go that way.")
+      (SW TO DAMP-PASSAGE)
+      (SE TO DEAD-END)
+      (FLAGS RLANDBIT)
+      (ACTION MSTAIRS-F)
+      (GLOBAL SECRET-DOOR STAIRS)>
+
+<ROOM DEAD-END
+      (IN ROOMS)
+      (DESC "Dead End")
+      (LDESC
+"You have come to the end of two adjoining passages to the west and the
+northwest.")
+      (WEST TO DAMP-PASSAGE)
+      (NW TO MSTAIRS)
+      (FLAGS RLANDBIT)>
+
+<ROOM DAMP-PASSAGE
+      (IN ROOMS)
+      (DESC "Damp Passage")
+      (LDESC
+"This is a particularly damp spot even by dungeon standards.  You can see a
+crossroads to the west, and two nearly identical passages lead east and
+northeast.  A stone channel, wide and deep, steeply descends into the room
+from the south.  It is covered with moss and lichen, and is far too slippery
+to climb.  The channel crosses the room, but the opening where it once
+continued north is now blocked by rubble.")
+      (WEST TO JUNCTION)
+      (EAST TO DEAD-END)
+      (NE TO MSTAIRS)
+      (NORTH "The channel opening is blocked by tons of debris.")
+      (UP "The channel is too steep and the moss too slippery.")
+      (SOUTH "The channel is too steep and the moss too slippery.")
+      (FLAGS RLANDBIT)
+      (GLOBAL MOSS RUBBLE WATER-CHANNEL)>
+
+<ROOM EAST-CORRIDOR
+      (IN ROOMS)
+      (DESC "East Corridor")
+      (LDESC
+"This is a hall with polished marble walls.  It widens slightly as it turns
+west at its northern and southern ends.")
+      (NORTH TO NORTH-CORRIDOR)
+      (SOUTH TO SOUTH-CORRIDOR)
+      (FLAGS RLANDBIT ONBIT)>
+
+<ROOM WEST-CORRIDOR
+      (IN ROOMS)
+      (DESC "West Corridor")
+      (LDESC
+"This is a hall with polished marble walls.  It widens slightly as it turns
+east at its northern and southern ends.")
+      (NORTH TO NORTH-CORRIDOR)
+      (SOUTH TO SOUTH-CORRIDOR)
+      (FLAGS RLANDBIT ONBIT)>
+
+<ROOM SOUTH-CORRIDOR
+      (IN ROOMS)
+      (DESC "South Corridor")
+      (LDESC " ")
+      (EAST TO EAST-CORRIDOR)
+      (WEST TO WEST-CORRIDOR)
+      (NORTH PER BRONZE-DOOR-EXIT)
+      (SOUTH TO BEHIND-DOOR)
+      (ACTION SOUTH-CORRIDOR-F)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL BRONZE-DOOR)>
+
+<ROOM BEHIND-DOOR
+      (IN ROOMS)
+      (DESC "Narrow Corridor")
+      (LDESC " ")
+      (NORTH TO SOUTH-CORRIDOR)
+      (SOUTH TO FRONT-DOOR IF DUNGEON-DOOR IS OPEN)
+      (ACTION BEHIND-DOOR-F)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL DUNGEON-DOOR)>
+
+<ROOM FRONT-DOOR
+      (IN ROOMS)
+      (DESC "Dungeon Entrance")
+      (LDESC " ")
+      (NORTH TO BEHIND-DOOR IF DUNGEON-DOOR IS OPEN)
+      (ENTER TO BEHIND-DOOR IF DUNGEON-DOOR IS OPEN)
+      (SOUTH PER MRGO)
+      (SE TO MRDE)
+      (SW TO MRDW)
+      (ACTION FRONT-DOOR-F)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MASTER DUNGEON-DOOR WOODEN-WALL)>
+
+<OBJECT WOODEN-WALL
+       (IN LOCAL-GLOBALS)
+       (DESC "wooden wall")
+       (SYNONYM WALL)
+       (ADJECTIVE WOOD WOODEN)
+       (ACTION WOODEN-WALL-F)>
+
+<ROOM NORTH-CORRIDOR
+      (IN ROOMS)
+      (DESC "North Corridor")
+      (LDESC " ")
+      (EAST TO EAST-CORRIDOR)
+      (WEST TO WEST-CORRIDOR)
+      (NORTH TO PARAPET)
+      (SOUTH TO CELL IF CELL-DOOR IS OPEN)
+      (ENTER TO CELL IF CELL-DOOR IS OPEN)
+      (ACTION NORTH-CORRIDOR-F)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MASTER CELL-DOOR PARAPET-OBJ FLAMING-PIT)>
+
+<ROOM PARAPET
+      (IN ROOMS)
+      (DESC "Parapet")
+      (LDESC " ")
+      (SOUTH TO NORTH-CORRIDOR)
+      (NORTH "You would be burned to a crisp in no time.")
+      (ACTION PARAPET-F)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MASTER PARAPET-OBJ FLAMING-PIT)>
+
+<ROOM CELL
+      (IN ROOMS)
+      (DESC "Prison Cell")
+      (LDESC " ")
+      (OUT TO NORTH-CORRIDOR IF CELL-DOOR IS OPEN)
+      (NORTH TO NORTH-CORRIDOR IF CELL-DOOR IS OPEN)
+      (ACTION CELL-ROOM)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL MASTER BRONZE-DOOR CELL-DOOR PARAPET-OBJ FLAMING-PIT)>
+
+<ROOM PRISON-CELL
+      (IN ROOMS)
+      (DESC "Prison Cell")
+      (LDESC
+"You are in a bare prison cell.  Its wooden door is securely fastened, and
+you can see only flames and smoke through its small window.")
+      (OUT "The door is securely fastened.")
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL LOCKED-DOOR MASTER FLAMING-PIT)>
+
+<ROOM GOOD-CELL
+      (IN ROOMS)
+      (DESC "Prison Cell")
+      (LDESC " ")
+      (OUT TO NIRVANA IF BRONZE-DOOR IS OPEN)
+      (SOUTH TO NIRVANA IF BRONZE-DOOR IS OPEN)
+      (ACTION NCELL-ROOM)
+      (FLAGS RLANDBIT ONBIT)
+      (GLOBAL GOOD-LOCKED-DOOR MASTER BRONZE-DOOR FLAMING-PIT)>
+
+<ROOM NIRVANA
+      (IN ROOMS)
+      (DESC "Treasury of Zork")
+      (LDESC
+"This is a large room, richly appointed in a style that bespeaks exquisite
+taste.  To judge from its contents, it is the ultimate storehouse of the
+wealth of the Great Underground Empire.|
+|
+There are chests here containing precious jewels, mountains of
+zorkmids, rare paintings, ancient statuary, and beguiling curios.|
+|
+On one wall is an annotated map of the Empire, showing the locations of
+various troves of treasure, and of several superior scenic views.|
+|
+On a desk at the far end of the room may be found stock certificates
+representing a controlling interest in FrobozzCo International, the
+multinational conglomerate and parent company of
+the Frobozz Magic Boat Co., etc.|
+")
+      (ACTION NIRVANA-F)
+      (FLAGS RLANDBIT ONBIT)>
+
+\\f
+
+<OBJECT RUNES
+       (IN MSTAIRS)
+       (DESC "runes")
+       (SYNONYM ENGRAV TEXT WALL RUNES)
+       (ADJECTIVE CARVED)
+       (FLAGS NDESCBIT READBIT)
+       (ACTION RUNES-F)>
+
+<OBJECT T-BAR
+       (IN IN-MIRROR)
+       (DESC "T-bar")
+       (SYNONYM T-BAR BAR)
+       (FLAGS NDESCBIT)
+       (ACTION T-BAR-F)>
+
+<OBJECT BLACK-PANEL
+       (IN IN-MIRROR)
+       (DESC "black panel")
+       (SYNONYM WALL PANEL)
+       (ADJECTIVE BLACK)
+       (FLAGS NDESCBIT)
+       (ACTION MPANELS)>
+
+<OBJECT BRONZE-DOOR
+       (IN LOCAL-GLOBALS)
+       (DESC "bronze door")
+       (SYNONYM DOOR)
+       (ADJECTIVE BRONZE)
+       (FLAGS CONTBIT DOORBIT INVISIBLE)
+       (ACTION BRONZE-DOOR-F)>
+
+<OBJECT CELL-DOOR
+       (IN LOCAL-GLOBALS)
+       (DESC "cell door")
+       (SYNONYM DOOR)
+       (ADJECTIVE WOOD WOODEN CELL)
+       (FLAGS CONTBIT DOORBIT)
+       (ACTION CELL-DOOR-F)>
+
+<OBJECT COMPASS-ARROW
+       (IN IN-MIRROR)
+       (DESC "compass arrow")
+       (SYNONYM ARROW)
+       (ADJECTIVE COMPASS)
+       (FLAGS NDESCBIT)>
+
+<OBJECT DIAL-BUTTON
+       (IN PARAPET)
+       (DESC "large button")
+       (SYNONYM BUTTON)
+       (ADJECTIVE LARGE)
+       (FLAGS NDESCBIT)
+       (ACTION DIALBUTTON)>
+
+<OBJECT GOOD-LOCKED-DOOR
+       (IN LOCAL-GLOBALS)
+       (DESC "cell door")
+       (SYNONYM DOOR)
+       (ADJECTIVE LOCKED WOOD WOODEN CELL)
+       (FLAGS NDESCBIT)
+       (ACTION LOCKED-DOOR-F)>
+
+<OBJECT LOCKED-DOOR
+       (IN LOCAL-GLOBALS)
+       (DESC "cell door")
+       (SYNONYM DOOR)
+       (ADJECTIVE LOCKED WOOD WOODEN CELL)
+       (FLAGS NDESCBIT)
+       (ACTION LOCKED-DOOR-F)>
+
+<OBJECT LONG-POLE
+       (IN IN-MIRROR)
+       (DESC "long pole")
+       (SYNONYM POLE)
+       (ADJECTIVE LONG CENTER)
+       (FLAGS NDESCBIT)>
+
+<OBJECT MAHOGANY-PANEL
+       (IN IN-MIRROR)
+       (DESC "mahogany panel")
+       (SYNONYM WALL PANEL)
+       (ADJECTIVE MAHOGANY)
+       (FLAGS NDESCBIT)
+       (ACTION MENDS)>
+
+<OBJECT FLAMING-PIT
+       (IN LOCAL-GLOBALS)
+       (DESC "flaming pit")
+       (SYNONYM PIT ABYSS)
+       (ADJECTIVE FIERY FLAMING)
+       (FLAGS NDESCBIT)
+       (ACTION FLAMING-PIT-F)>
+
+<OBJECT PARAPET-OBJ
+       (IN LOCAL-GLOBALS)
+       (DESC "parapet")
+       (SYNONYM PARAPET)
+       (FLAGS NDESCBIT)
+       (ACTION PARAPET-OBJ-F)>
+
+<OBJECT PINE-PANEL
+       (IN IN-MIRROR)
+       (DESC "pine panel")
+       (SYNONYM PANEL WALL)
+       (ADJECTIVE PINE)
+       (FLAGS NDESCBIT)
+       (ACTION MENDS)>
+
+<OBJECT BEAM
+       (IN MREYE)
+       (DESC "red beam of light")
+       (SYNONYM BEAM LIGHT)
+       (ADJECTIVE RED)
+       (FLAGS NDESCBIT OPENBIT CONTBIT)
+       (CAPACITY 100)
+       (ACTION BEAM-FUNCTION)>
+
+<OBJECT RED-BUTTON
+       (IN MR-ANTE)
+       (DESC "red button")
+       (SYNONYM BUTTON)
+       (ADJECTIVE RED)
+       (FLAGS NDESCBIT)
+       (ACTION MRSWITCH)>
+
+<OBJECT RED-PANEL
+       (IN IN-MIRROR)
+       (DESC "red panel")
+       (SYNONYM PANEL WALL)
+       (ADJECTIVE RED)
+       (FLAGS NDESCBIT)
+       (ACTION MPANELS)>
+
+<OBJECT SHORT-POLE
+       (IN IN-MIRROR)
+       (DESC "short pole")
+       (SYNONYM POLE POST HANDGRIP GRIP)
+       (ADJECTIVE SHORT SMALL HAND)
+       (FLAGS NDESCBIT)
+       (ACTION SHORT-POLE-F)>
+
+<OBJECT SUNDIAL
+       (IN PARAPET)
+       (DESC "sundial")
+       (SYNONYM DIAL INDICATOR ARROW SUNDIAL)
+       (ADJECTIVE INDICATOR SUN)
+       (FLAGS NDESCBIT TURNBIT)
+       (ACTION DIAL)>
+
+<OBJECT YELLOW-PANEL
+       (IN IN-MIRROR)
+       (DESC "yellow panel")
+       (SYNONYM PANEL WALL)
+       (ADJECTIVE YELLOW)
+       (FLAGS NDESCBIT)
+       (ACTION MPANELS)>
+
+<OBJECT WHITE-PANEL
+       (IN IN-MIRROR)
+       (DESC "white panel")
+       (SYNONYM PANEL WALL)
+       (ADJECTIVE WHITE)
+       (FLAGS NDESCBIT)
+       (ACTION MPANELS)>
+
+<OBJECT WOODEN-BAR
+       (IN IN-MIRROR)
+       (DESC "wooden bar")
+       (SYNONYM BAR)
+       (ADJECTIVE WOOD WOODEN)
+       (FLAGS NDESCBIT)>
+
+<OBJECT DUNGEON-DOOR
+       (IN LOCAL-GLOBALS)
+       (DESC "wooden door")
+       (SYNONYM DOOR)
+       (ADJECTIVE WOOD WOODEN)
+       (FLAGS NDESCBIT DOORBIT CONTBIT)
+       (ACTION DUNGEON-DOOR-F)>
+
+<OBJECT SECRET-DOOR
+       (IN LOCAL-GLOBALS)
+       (DESC "secret door")
+       (SYNONYM DOOR)
+       (ADJECTIVE SECRET)
+       (FLAGS DOORBIT CONTBIT INVISIBLE)
+       (ACTION SECRET-DOOR-F)>
+
+<OBJECT OLD-MAN
+       (DESC "old man")
+       (SYNONYM MAN)
+       (ADJECTIVE OLD)
+       (FLAGS VICBIT VILLAIN)
+       (ACTION OLD-MAN-F)
+       (DESCFCN OLD-MAN-F)>
+
+<OBJECT CP-HOLE
+       (IN CP-ANTE)
+       (DESC "hole")
+       (SYNONYM HOLE)
+       (ADJECTIVE ROUND)
+       (FLAGS NDESCBIT)
+       (ACTION CP-HOLE-F)>
\ No newline at end of file
diff --git a/gmain.cmp b/gmain.cmp
new file mode 100644 (file)
index 0000000..1536a05
--- /dev/null
+++ b/gmain.cmp
@@ -0,0 +1,380 @@
+
+;COMPARISON OF SS:<ZORK2>GMAIN.ZIL.28 AND SS:<ZORK3.R17>MAIN.ZIL.31
+;OPTIONS ARE    /S /9
+
+**** FILE SS:<ZORK2>GMAIN.ZIL.28, 1-1 (0)
+                       "Generic MAIN file for
+                           The ZORK Trilogy
+                      started on 7/28/83 by MARC"
+<GLOBAL PLAYER <>>
+<GLOBAL P-WON <>>
+<CONSTANT M-FATAL 2>
+<CONSTANT M-HANDLED 1>   
+<CONSTANT M-NOT-HANDLED <>>   
+<CONSTANT M-OBJECT <>>
+<CONSTANT M-BEG 1>  
+<CONSTANT M-END 6> 
+<CONSTANT M-ENTER 2>
+<CONSTANT M-LOOK 3> 
+<CONSTANT M-FLASH 4>
+<CONSTANT M-OBJDESC 5>
+<GLOBAL DEBUG <>>
+;"GO now lives in SPECIAL.ZIL"    
+<ROUTINE MAIN-LOOP ("AUX" ICNT OCNT NUM CNT OBJ TBL V PTBL OBJ1 TMP) 
+**** FILE SS:<ZORK3.R17>MAIN.ZIL.31, 1-1 (0)
+"MAIN3 for
+                Zork III: The Dungeon Master
+       Copyright 1982 Infocom, Inc.  All Rights Reserved.
+"
+<GLOBAL PLAYER <>>
+<GLOBAL P-WON <>>
+<CONSTANT M-FATAL 2>
+<CONSTANT M-HANDLED 1>   
+<CONSTANT M-NOT-HANDLED <>>   
+<CONSTANT M-BEG 1>  
+<CONSTANT M-END <>> 
+<CONSTANT M-ENTER 2>
+<CONSTANT M-LOOK 3> 
+<CONSTANT M-FLASH 4>
+<CONSTANT M-OBJDESC 5>
+<ROUTINE GO () 
+;"put interrupts on clock chain"
+        <QUEUE I-LANTERN 200>
+;"clean up junk compiler can't do"
+        <SETG CURRENT-LAMP ,LAMP>
+        <PUT ,CPOBJS <* 8 21> 1>
+        <PUT ,CPOBJS <+ <* 8 21> 1> ,LORE-BOOK>
+        <PUT ,CPOBJS <* 8 32> 1>
+        <PUT ,CPOBJS <+ <* 8 32> 1> ,CP-SLOT>
+ ;"set up and go"
+        <SETG LIT T>
+        <SETG WINNER ,ADVENTURER>
+        <SETG PLAYER ,WINNER>
+        <SETG MLOC ,MRB>
+        <SETG HERE ,ZORK2-STAIR>
+        <ENABLE <QUEUE I-CLEFT <+ 70 <RANDOM 70>>>>
+        <ENABLE <QUEUE I-VIEW-CHANGE 4>>
+        <SETG P-IT-LOC ,HERE>
+        <SETG P-IT-OBJECT <>>
+        <COND (<NOT <FSET? ,HERE ,TOUCHBIT>>
+               <TELL
+"As in a dream, you see yourself tumbling down a great, dark staircase.
+All about you are shadowy images of struggles against fierce opponents
+and diabolical traps. These give way to another round of images: of
+imposing stone figures, a cool, clear lake, and, now, of an old, yet
+oddly youthful man. He turns toward you slowly, his long, silver hair
+dancing about him in a fresh breeze. \"You have reached the final test,
+my friend! You are proved clever and powerful, but this is not yet
+enough! Seek me when you feel yourself worthy!\" The dream dissolves
+around you as his last words echo through the void...." CR>
+               <CRLF>
+               <V-VERSION>
+               <CRLF>)>
+        <MOVE ,WINNER ,HERE>
+        <MOVE ,LAMP ,HERE>
+        <V-LOOK>
+        <MAIN-LOOP>
+        <AGAIN>>    
+<ROUTINE MAIN-LOOP ("AUX" ICNT OCNT NUM CNT OBJ TBL V PTBL OBJ1 TMP) 
+   #DECL ((CNT OCNT ICNT NUM) FIX (V) <OR 'T FIX FALSE> (OBJ) <OR FALSE OBJECT>
+         (OBJ1) OBJECT (TBL) TABLE (PTBL) <OR FALSE ATOM>)
+***************
+
+**** FILE SS:<ZORK2>GMAIN.ZIL.28, 2-31 (1342)
+                         <TELL "It's not clear what you're referring to." CR>
+                         <SET V <>>)>)
+                 (T
+                  <SETG P-NOT-HERE 0>
+                  <SETG P-MULT <>>
+                  <COND (<G? .NUM 1> <SETG P-MULT T>)>
+                  <SET TMP <>>
+                  <REPEAT ()
+                          <COND (<G? <SET CNT <+ .CNT 1>> .NUM>
+                                 <COND (<G? ,P-NOT-HERE 0>
+                                        <TELL "The ">
+                                        <COND (<NOT <EQUAL? ,P-NOT-HERE .NUM>>
+                                               <TELL "other ">)>
+                                        <TELL "object">
+                                        <COND (<NOT <EQUAL? ,P-NOT-HERE 1>>
+                                               <TELL "s">)>
+                                        <TELL " that you mentioned ">
+                                        <COND (<NOT <EQUAL? ,P-NOT-HERE 1>>
+                                               <TELL "are">)
+                                              (T <TELL "is">)>
+                                        <TELL "n't here." CR>)
+                                       (<NOT .TMP>
+                                        <TELL
+"There's nothing here to take." CR>)>
+                                 <RETURN>)
+                                (T
+                                 <COND (.PTBL <SET OBJ1 <GET ,P-PRSO .CNT>>)
+                                       (T <SET OBJ1 <GET ,P-PRSI .CNT>>)>
+                                 <SETG PRSO <COND (.PTBL .OBJ1) (T .OBJ)>>
+                                 <SETG PRSI <COND (.PTBL .OBJ) (T .OBJ1)>>
+                                 <COND (<OR <G? .NUM 1>
+                                            <EQUAL? <GET <GET ,P-ITBL ,P-NC1>
+                                                         0>
+                                                    ,W?ALL>>
+                                        <SET V <LOC ,WINNER>>
+                                        <COND (<EQUAL? .OBJ1
+                                                       ,NOT-HERE-OBJECT>
+                                               <SETG P-NOT-HERE
+                                                     <+ ,P-NOT-HERE 1>>
+                                               <AGAIN>)
+                                              (<AND <VERB? TAKE>
+                                                    ,PRSI
+                                                    <EQUAL? <GET <GET ,P-ITBL
+                                                                      ,P-NC1>
+                                                                 0>
+                                                            ,W?ALL>
+                                                    <NOT <IN? ,PRSO ,PRSI>>>
+                                               <AGAIN>)
+                                              (<AND <EQUAL? ,P-GETFLAGS
+                                                            ,P-ALL>
+                                                    <VERB? TAKE>
+                                                    <OR <AND <NOT <EQUAL?
+                                                              <LOC .OBJ1>
+                                                              ,WINNER
+                                                              .V>>
+                                                             <NOT <FSET?
+                                                                 <LOC .OBJ1>
+                                                                ,SURFACEBIT>>>
+                                                        <NOT <OR <FSET? .OBJ1
+                                                                     ,TAKEBIT>
+                                                                 <FSET? .OBJ1
+                                                              ,TRYTAKEBIT>>>>>
+                                               <AGAIN>)
+                                              (T
+                                               <COND (<EQUAL? .OBJ1 ,IT>
+                                                      <PRINTD ,P-IT-OBJECT>)
+                                                     (T <PRINTD .OBJ1>)>
+                                               <TELL ": ">)>)>
+                                 <SET TMP T>
+                                 <SET V <PERFORM ,PRSA ,PRSO ,PRSI>>
+                                 <COND (<==? .V ,M-FATAL> <RETURN>)>)>>)>
+           <COND (<NOT <==? .V ,M-FATAL>>
+                  ;<COND (<==? <LOC ,WINNER> ,PRSO>
+                         <SETG PRSO <>>)>
+                  <SET V <APPLY <GETP <LOC ,WINNER> ,P?ACTION> ,M-END>>)>
+           <COND (<VERB? AGAIN WALK SAVE RESTORE SCORE VERSION ;WAIT> T)
+                 (T
+                  <SETG L-PRSA ,PRSA>
+                  <SETG L-PRSO ,PRSO>
+                  <SETG L-PRSI ,PRSI>)>
+           <COND (<==? .V ,M-FATAL> <SETG P-CONT <>>)>)
+          (T
+           <SETG P-CONT <>>)>
+     <COND (,P-WON
+           <COND (<VERB? TELL BRIEF SUPER-BRIEF VERBOSE SAVE VERSION
+                         QUIT RESTART SCORE SCRIPT UNSCRIPT RESTORE> T)
+                 (T <SET V <CLOCKER>>)>)>>>
+<GLOBAL L-PRSA <>>  
+<GLOBAL L-PRSO <>>  
+<GLOBAL L-PRSI <>>  
+<GLOBAL P-MULT <>>
+<GLOBAL P-NOT-HERE 0>
+%<COND (<GASSIGNED? PREDGEN>
+'<ROUTINE PERFORM (A "OPTIONAL" (O <>) (I <>) "AUX" V OA OO OI) 
+       <COND (,DEBUG
+              <TELL "[Perform: ">
+              %<COND (<GASSIGNED? PREDGEN> '<TELL N .A>)
+                     (T '<PRINC <NTH ,ACTIONS <+ <* .A 2> 1>>>)>
+              <COND (<AND .O <NOT <==? .A ,V?WALK>>>
+                     <TELL "/" D .O>)>
+              <COND (.I <TELL "/" D .I>)>
+              <TELL "]" CR>)>
+**** FILE SS:<ZORK3.R17>MAIN.ZIL.31, 2-33 (2759)
+                         <TELL "There isn't anything to ">
+                         <SET TMP <GET ,P-ITBL ,P-VERBN>>
+                         <COND (,P-OFLAG
+                                <PRINTB <GET .TMP 0>>)
+                               (T
+                                <WORD-PRINT <GETB .TMP 2> <GETB .TMP 3>>)>
+                         <TELL "!" CR>
+                         <SET V <>>)>)
+                 (T
+                  <REPEAT ()
+                          <COND (<G? <SET CNT <+ .CNT 1>> .NUM> <RETURN>)
+                                (T
+                                 <COND (.PTBL <SET OBJ1 <GET ,P-PRSO .CNT>>)
+                                       (T <SET OBJ1 <GET ,P-PRSI .CNT>>)>
+                                 <COND (<G? .NUM 1>
+                                        <PRINTD .OBJ1>
+                                        <TELL ": ">)>
+                                 <SETG PRSO <COND (.PTBL .OBJ1) (T .OBJ)>>
+                                 <SETG PRSI <COND (.PTBL .OBJ) (T .OBJ1)>>
+                                 <SET V <PERFORM ,PRSA ,PRSO ,PRSI>>
+                                 <COND (<==? .V ,M-FATAL> <RETURN>)>)>>)>
+           <COND (<VERB? AGAIN WALK SAVE RESTORE SCORE VERSION WAIT> T)
+                 (T
+                  <SETG L-PRSA ,PRSA>
+                  <SETG L-PRSO ,PRSO>
+                  <SETG L-PRSI ,PRSI>)>
+           <SETG MOVES <+ ,MOVES 1>>
+           <COND (<==? .V ,M-FATAL> <SETG P-CONT <>>)>)
+          (T
+           <SETG P-CONT <>>)>
+     <COND (,P-WON
+           <COND (<VERB? TELL BRIEF SUPER-BRIEF VERBOSE SAVE VERSION> T)
+                 (T <SET V <CLOCKER>>)>)>>>
+<GLOBAL L-PRSA <>>  
+<GLOBAL L-PRSO <>>  
+<GLOBAL L-PRSI <>>  
+<ROUTINE PERFORM (A "OPTIONAL" (O <>) (I <>) "AUX" V OA OO OI) 
+       #DECL ((A) FIX (O) <OR FALSE OBJECT FIX> (I) <OR FALSE OBJECT> (V) ANY)
+***************
+
+**** FILE SS:<ZORK2>GMAIN.ZIL.28, 3-25 (4793)
+       <COND (<AND ,PRSO <NOT <EQUAL? ,PRSI ,IT>> <NOT <VERB? WALK>>>
+              <SETG P-IT-OBJECT ,PRSO>
+              <SETG P-IT-LOC ,HERE>)>
+       <SETG PRSI .I>
+       <COND (<AND <EQUAL? ,NOT-HERE-OBJECT ,PRSO ,PRSI>
+                   <SET V <NOT-HERE-OBJECT-F>>> .V)
+             (T
+              <SET O ,PRSO>
+              <SET I ,PRSI>
+              <COND
+               (<SET V <APPLY <GETP ,WINNER ,P?ACTION>>> .V)
+               (<SET V <APPLY <GETP <LOC ,WINNER> ,P?ACTION> ,M-BEG>> .V)
+               (<SET V <APPLY <GET ,PREACTIONS .A>>> .V)
+               (<AND .I <SET V <APPLY <GETP .I ,P?ACTION>>>> .V)
+               (<AND .O
+                     <NOT <==? .A ,V?WALK>>
+                     <LOC .O>
+                     <SET V <APPLY <GETP <LOC .O> ,P?CONTFCN>>>>
+                .V)
+               (<AND .O
+                     <NOT <==? .A ,V?WALK>>
+                     <SET V <APPLY <GETP .O ,P?ACTION>>>>
+                .V)
+               (<SET V <APPLY <GET ,ACTIONS .A>>> .V)>)>
+       <SETG PRSA .OA>
+       <SETG PRSO .OO>
+       <SETG PRSI .OI>
+       .V>)
+       (T
+       
+'<PROG ()
+<SETG DEBUG <>>
+<ROUTINE PERFORM (A "OPTIONAL" (O <>) (I <>) "AUX" V OA OO OI) 
+       #DECL ((A) FIX (O) <OR FALSE OBJECT FIX> (I) <OR FALSE OBJECT> (V) ANY)
+       <COND (,DEBUG
+              <TELL "** PERFORM: PRSA = ">
+              <PRINC <NTH ,ACTIONS <+ <* .A 2> 1>>>
+              <COND (<AND .O <NOT <==? .A ,V?WALK>>>
+                     <TELL " | PRSO = " D .O>)>
+              <COND (.I <TELL " | PRSI = " D .I>)>)>
+       <SET OA ,PRSA>
+       <SET OO ,PRSO>
+       <SET OI ,PRSI>
+       <COND (<AND <EQUAL? ,IT .I .O>
+                   <NOT <EQUAL? ,P-IT-LOC ,HERE>>>
+              <TELL "I don't see what you are referring to." CR>
+              <RFATAL>)>
+       <COND (<==? .O ,IT> <SET O ,P-IT-OBJECT>)>
+       <COND (<==? .I ,IT> <SET I ,P-IT-OBJECT>)>
+       <SETG PRSA .A>
+       <SETG PRSO .O>
+       <COND (<AND ,PRSO <NOT <VERB? WALK>>>
+              <SETG P-IT-OBJECT ,PRSO>
+              <SETG P-IT-LOC ,HERE>)>
+       <SETG PRSI .I>
+       <COND (<AND <EQUAL? ,NOT-HERE-OBJECT ,PRSO ,PRSI>
+                   <SET V <D-APPLY "Not Here" ,NOT-HERE-OBJECT-F>>> .V)
+             (T
+              <SET O ,PRSO>
+              <SET I ,PRSI>
+              <COND (<SET V <DD-APPLY "Actor" ,WINNER
+                                     <GETP ,WINNER ,P?ACTION>>> .V)
+                    (<SET V <D-APPLY "Room (M-BEG)"
+                                     <GETP <LOC ,WINNER> ,P?ACTION>
+                                     ,M-BEG>> .V)
+                    (<SET V <D-APPLY "Preaction"
+                                     <GET ,PREACTIONS .A>>> .V)
+                    (<AND .I <SET V <D-APPLY "PRSI"
+                                             <GETP .I ,P?ACTION>>>> .V)
+                    (<AND .O
+                          <NOT <==? .A ,V?WALK>>
+                          <LOC .O>
+                          <GETP <LOC .O> ,P?CONTFCN>
+                          <SET V <DD-APPLY "Container" <LOC .O>
+                                          <GETP <LOC .O> ,P?CONTFCN>>>>
+                     .V)
+                    (<AND .O
+                          <NOT <==? .A ,V?WALK>>
+                          <SET V <D-APPLY "PRSO"
+                                          <GETP .O ,P?ACTION>>>>
+                     .V)
+                    (<SET V <D-APPLY <>
+                                     <GET ,ACTIONS .A>>> .V)>)>
+       <SETG PRSA .OA>
+       <SETG PRSO .OO>
+       <SETG PRSI .OI>
+       .V>
+<DEFINE D-APPLY (STR FCN "OPTIONAL" FOO "AUX" RES)
+       <COND (<NOT .FCN> <>)
+             (T
+              <COND (,DEBUG
+                     <COND (<NOT .STR>
+                            <TELL CR "  Default ->" CR>)
+                           (T <TELL CR "  " .STR " -> ">)>)>
+              <SET RES
+                   <COND (<ASSIGNED? FOO>
+                          <APPLY .FCN .FOO>)
+                         (T <APPLY .FCN>)>>
+              <COND (<AND ,DEBUG .STR>
+                     <COND (<==? .RES 2>
+                            <TELL "Fatal" CR>)
+                           (<NOT .RES>
+                            <TELL "Not handled">)
+                           (T <TELL "Handled" CR>)>)>
+              .RES)>>
+<ROUTINE DD-APPLY (STR OBJ FCN "OPTIONAL" (FOO <>))
+       <COND (,DEBUG <TELL "[" D .OBJ "=]">)>
+       <D-APPLY .STR .FCN .FOO>>
+>)>
+**** FILE SS:<ZORK3.R17>MAIN.ZIL.31, 3-15 (4360)
+       <COND (<AND ,PRSO <NOT <VERB? WALK>>>
+              <SETG P-IT-OBJECT ,PRSO>
+              <SETG P-IT-LOC ,HERE>)>
+       <SETG PRSI .I>
+       <COND (<SET V <APPLY <GETP ,WINNER ,P?ACTION>>> .V)
+             (<SET V <APPLY <GETP <LOC ,WINNER> ,P?ACTION> ,M-BEG>> .V)
+             (<SET V <APPLY <GET ,PREACTIONS .A>>> .V)
+             (<AND .I <SET V <APPLY <GETP .I ,P?ACTION>>>> .V)
+             (<AND .O
+                   <NOT <==? .A ,V?WALK>>
+                   <SET V <APPLY <GETP .O ,P?ACTION>>>>
+              .V)
+             (<SET V <APPLY <GET ,ACTIONS .A>>> .V)>
+       <COND (<NOT <==? .V ,M-FATAL>>
+              <COND (<==? <LOC ,WINNER> ,PRSO>
+                     <SETG PRSO <>>)>
+              <SET V <APPLY <GETP <LOC ,WINNER> ,P?ACTION> ,M-END>>)>
+       <SETG PRSA .OA>
+       <SETG PRSO .OO>
+       <SETG PRSI .OI>
+       .V>  
+***************
diff --git a/macros.zap b/macros.zap
new file mode 100644 (file)
index 0000000..548fceb
--- /dev/null
@@ -0,0 +1,19 @@
+
+
+       .FUNCT  ZPROB,BASE
+       ZERO?   LUCKY /?ELS5
+       RANDOM  100
+       GRTR?   BASE,STACK /TRUE
+       RFALSE  
+?ELS5: RANDOM  300
+       GRTR?   BASE,STACK /TRUE
+       RFALSE  
+
+
+       .FUNCT  PICK-ONE,FROB
+       GET     FROB,0
+       RANDOM  STACK
+       GET     FROB,STACK
+       RSTACK  
+
+       .ENDI
diff --git a/macros.zil b/macros.zil
new file mode 100644 (file)
index 0000000..5028d33
--- /dev/null
@@ -0,0 +1,94 @@
+<ZSTR-OFF>
+
+<SETG C-ENABLED? 0>
+<SETG C-ENABLED 1>
+<SETG C-DISABLED 0>
+
+<DEFMAC TELL ("ARGS" A)
+       <FORM PROG ()
+             !<MAPF ,LIST
+                    <FUNCTION ("AUX" E P O)
+                         <COND (<EMPTY? .A> <MAPSTOP>)
+                               (<SET E <NTH .A 1>>
+                                <SET A <REST .A>>)>
+                         <COND (<TYPE? .E ATOM>
+                                <COND (<OR <=? <SET P <SPNAME .E>>
+                                               "CRLF">
+                                           <=? .P "CR">>
+                                       <MAPRET '<CRLF>>)
+                                      (<EMPTY? .A>
+                                       <ERROR INDICATOR-AT-END? .E>)
+                                      (ELSE
+                                       <SET O <NTH .A 1>>
+                                       <SET A <REST .A>>
+                                       <COND (<OR <=? <SET P <SPNAME .E>>
+                                                      "DESC">
+                                                  <=? .P "D">
+                                                  <=? .P "OBJ">
+                                                  <=? .P "O">>
+                                              <MAPRET <FORM PRINTD .O>>)
+                                             (<OR <=? .P "NUM">
+                                                  <=? .P "N">>
+                                              <MAPRET <FORM PRINTN .O>>)
+                                             (<OR <=? .P "CHAR">
+                                                  <=? .P "CHR">
+                                                  <=? .P "C">>
+                                              <MAPRET <FORM PRINTC .O>>)
+                                             (ELSE
+                                              <MAPRET
+                                                <FORM PRINT
+                                                      <FORM GETP .O .E>>>)>)>)
+                               (<TYPE? .E STRING>
+                                <MAPRET <FORM PRINTI .E>>)
+                               (<TYPE? .E FORM LVAL GVAL>
+                                <MAPRET <FORM PRINT .E>>)
+                               (ELSE <ERROR UNKNOWN-TYPE .E>)>>>>>
+
+<DEFMAC VERB? ("TUPLE" ATMS "AUX" (O ()) (L ())) 
+       <REPEAT ()
+               <COND (<EMPTY? .ATMS>
+                      <RETURN!- <COND (<LENGTH? .O 1> <NTH .O 1>)
+                                    (ELSE <FORM OR !.O>)>>)>
+               <REPEAT ()
+                       <COND (<EMPTY? .ATMS> <RETURN!->)>
+                       <SET ATM <NTH .ATMS 1>>
+                       <SET L
+                            (<FORM GVAL <PARSE <STRING "V?" <SPNAME .ATM>>>>
+                             !.L)>
+                       <SET ATMS <REST .ATMS>>
+                       <COND (<==? <LENGTH .L> 3> <RETURN!->)>>
+               <SET O (<FORM EQUAL? ',PRSA !.L> !.O)>
+               <SET L ()>>>
+
+<DEFMAC RFATAL ()
+       '<PROG () <PUSH 2> <RSTACK>>>
+
+<DEFMAC PROB ('BASE? "OPTIONAL" 'LOSER?)
+       <COND (<ASSIGNED? LOSER?> <FORM ZPROB .BASE?>)
+             (ELSE <FORM G? .BASE? '<RANDOM 100>>)>>
+
+<ROUTINE ZPROB
+        (BASE)
+        <COND (,LUCKY <G? .BASE <RANDOM 100>>)
+              (ELSE <G? .BASE <RANDOM 300>>)>>
+
+<ROUTINE PICK-ONE (FROB)
+        <GET .FROB <RANDOM <GET .FROB 0>>>>
+
+<DEFMAC ENABLE ('INT) <FORM PUT .INT ,C-ENABLED? 1>>
+
+<DEFMAC DISABLE ('INT) <FORM PUT .INT ,C-ENABLED? 0>>
+
+<DEFMAC FLAMING? ('OBJ)
+       <FORM AND <FORM FSET? .OBJ ',FLAMEBIT>
+                 <FORM FSET? .OBJ ',ONBIT>>>
+
+<DEFMAC OPENABLE? ('OBJ)
+       <FORM OR <FORM FSET? .OBJ ',DOORBIT>
+                <FORM FSET? .OBJ ',CONTBIT>>> 
+
+<DEFMAC ABS ('NUM)
+       <FORM COND (<FORM L? .NUM 0> <FORM - 0 .NUM>)
+                  (T .NUM)>>
+
+<ZSTR-ON>
diff --git a/main.zap b/main.zap
new file mode 100644 (file)
index 0000000..afb8691
--- /dev/null
+++ b/main.zap
@@ -0,0 +1,204 @@
+
+
+       .FUNCT  GO
+START::
+
+?FCN:  CALL    QUEUE,I-LANTERN,200
+       SET     'CURRENT-LAMP,LAMP
+       MUL     8,21
+       PUT     CPOBJS,STACK,1
+       MUL     8,21
+       ADD     STACK,1
+       PUT     CPOBJS,STACK,LORE-BOOK
+       MUL     8,32
+       PUT     CPOBJS,STACK,1
+       MUL     8,32
+       ADD     STACK,1
+       PUT     CPOBJS,STACK,CP-SLOT
+       SET     'LIT,TRUE-VALUE
+       SET     'WINNER,ADVENTURER
+       SET     'PLAYER,WINNER
+       SET     'MLOC,MRB
+       SET     'HERE,ZORK2-STAIR
+       RANDOM  70
+       ADD     70,STACK
+       CALL    QUEUE,I-CLEFT,STACK
+       PUT     STACK,0,1
+       CALL    QUEUE,I-VIEW-CHANGE,4
+       PUT     STACK,0,1
+       SET     'P-IT-LOC,HERE
+       SET     'P-IT-OBJECT,FALSE-VALUE
+       FSET?   HERE,TOUCHBIT /?CND1
+       PRINTI  "As in a dream, you see yourself tumbling down a great, dark staircase. All about you are shadowy images of struggles against fierce opponents and diabolical traps. These give way to another round of images: of imposing stone figures, a cool, clear lake, and, now, of an old, yet oddly youthful man. He turns toward you slowly, his long, silver hair dancing about him in a fresh breeze. ""You have reached the final test, my friend! You are proved clever and powerful, but this is not yet enough! Seek me when you feel yourself worthy!"" The dream dissolves around you as his last words echo through the void...."
+       CRLF    
+       CRLF    
+       CALL    V-VERSION
+       CRLF    
+?CND1: MOVE    WINNER,HERE
+       MOVE    LAMP,HERE
+       CALL    V-LOOK
+       CALL    MAIN-LOOP
+       JUMP    ?FCN
+
+
+       .FUNCT  MAIN-LOOP,ICNT,OCNT,NUM,CNT,OBJ,TBL,V,PTBL,OBJ1,TMP,?TMP1
+?PRG1: SET     'CNT,0
+       SET     'OBJ,FALSE-VALUE
+       SET     'PTBL,TRUE-VALUE
+       CALL    PARSER >P-WON
+       ZERO?   P-WON /?ELS5
+       GET     P-PRSI,P-MATCHLEN >ICNT
+       GET     P-PRSO,P-MATCHLEN >OCNT
+       ZERO?   OCNT \?ELS10
+       PUSH    OCNT
+       JUMP    ?CND6
+?ELS10:        GRTR?   OCNT,1 \?ELS12
+       SET     'TBL,P-PRSO
+       ZERO?   ICNT \?ELS15
+       SET     'OBJ,FALSE-VALUE
+       JUMP    ?CND13
+?ELS15:        GET     P-PRSI,1 >OBJ
+?CND13:        PUSH    OCNT
+       JUMP    ?CND6
+?ELS12:        GRTR?   ICNT,1 \?ELS19
+       SET     'PTBL,FALSE-VALUE
+       SET     'TBL,P-PRSI
+       GET     P-PRSO,1 >OBJ
+       PUSH    ICNT
+       JUMP    ?CND6
+?ELS19:        PUSH    1
+?CND6: SET     'NUM,STACK
+       ZERO?   OBJ \?CND22
+       EQUAL?  ICNT,1 \?CND22
+       GET     P-PRSI,1 >OBJ
+?CND22:        EQUAL?  PRSA,V?WALK \?ELS29
+       CALL    PERFORM,PRSA,PRSO >V
+       JUMP    ?CND27
+?ELS29:        ZERO?   NUM \?ELS31
+       GETB    P-SYNTAX,P-SBITS
+       BAND    STACK,P-SONUMS
+       ZERO?   STACK \?ELS34
+       CALL    PERFORM,PRSA >V
+       SET     'PRSO,FALSE-VALUE
+       JUMP    ?CND27
+?ELS34:        ZERO?   LIT \?ELS36
+       PRINTI  "It's too dark to see."
+       CRLF    
+       JUMP    ?CND27
+?ELS36:        PRINTI  "There isn't anything to "
+       GET     P-ITBL,P-VERBN >TMP
+       ZERO?   P-OFLAG /?ELS45
+       GET     TMP,0
+       PRINTB  STACK
+       JUMP    ?CND43
+?ELS45:        GETB    TMP,2 >?TMP1
+       GETB    TMP,3
+       CALL    WORD-PRINT,?TMP1,STACK
+?CND43:        PRINTI  "!"
+       CRLF    
+       SET     'V,FALSE-VALUE
+       JUMP    ?CND27
+?ELS31:        
+?PRG53:        IGRTR?  'CNT,NUM \?ELS57
+       JUMP    ?CND27
+?ELS57:        ZERO?   PTBL /?ELS62
+       GET     P-PRSO,CNT >OBJ1
+       JUMP    ?CND60
+?ELS62:        GET     P-PRSI,CNT >OBJ1
+?CND60:        GRTR?   NUM,1 \?CND66
+       PRINTD  OBJ1
+       PRINTI  ": "
+?CND66:        ZERO?   PTBL /?ELS75
+       PUSH    OBJ1
+       JUMP    ?CND71
+?ELS75:        PUSH    OBJ
+?CND71:        SET     'PRSO,STACK
+       ZERO?   PTBL /?ELS83
+       PUSH    OBJ
+       JUMP    ?CND79
+?ELS83:        PUSH    OBJ1
+?CND79:        SET     'PRSI,STACK
+       CALL    PERFORM,PRSA,PRSO,PRSI >V
+       EQUAL?  V,M-FATAL \?PRG53
+?CND27:        EQUAL?  PRSA,V?WAIT /?CND90
+       EQUAL?  PRSA,V?VERSION,V?SCORE,V?RESTORE /?CND90
+       EQUAL?  PRSA,V?SAVE,V?WALK,V?AGAIN \?ELS92
+       JUMP    ?CND90
+?ELS92:        SET     'L-PRSA,PRSA
+       SET     'L-PRSO,PRSO
+       SET     'L-PRSI,PRSI
+?CND90:        EQUAL?  V,M-FATAL \?CND3
+       SET     'P-CONT,FALSE-VALUE
+       JUMP    ?CND3
+?ELS5: SET     'P-CONT,FALSE-VALUE
+?CND3: ZERO?   P-WON /?PRG1
+       EQUAL?  PRSA,V?RESTORE,V?UNSCRIPT,V?SCRIPT /?PRG1
+       EQUAL?  PRSA,V?SCORE,V?RESTART,V?QUIT /?PRG1
+       EQUAL?  PRSA,V?VERSION,V?SAVE,V?VERBOSE /?PRG1
+       EQUAL?  PRSA,V?SUPER-BRIEF,V?BRIEF,V?TELL \?ELS108
+       JUMP    ?PRG1
+?ELS108:       INC     'MOVES
+       CALL    CLOCKER >V
+       JUMP    ?PRG1
+
+
+       .FUNCT  PERFORM,A,O=0,I=0,V,OA,OO,OI
+       SET     'OA,PRSA
+       SET     'OO,PRSO
+       SET     'OI,PRSI
+       EQUAL?  IT,I,O \?CND1
+       EQUAL?  P-IT-LOC,HERE /?CND1
+       PRINTI  "I don't see what you are referring to."
+       CRLF    
+       RETURN  2
+?CND1: EQUAL?  O,IT \?CND10
+       SET     'O,P-IT-OBJECT
+?CND10:        EQUAL?  I,IT \?CND13
+       SET     'I,P-IT-OBJECT
+?CND13:        SET     'PRSA,A
+       SET     'PRSO,O
+       ZERO?   PRSO /?CND16
+       EQUAL?  PRSA,V?WALK /?CND16
+       SET     'P-IT-OBJECT,PRSO
+       SET     'P-IT-LOC,HERE
+?CND16:        SET     'PRSI,I
+       GETP    WINNER,P?ACTION
+       CALL    STACK >V
+       ZERO?   V /?ELS23
+       JUMP    ?CND21
+?ELS23:        LOC     WINNER
+       GETP    STACK,P?ACTION
+       CALL    STACK,M-BEG >V
+       ZERO?   V /?ELS25
+       JUMP    ?CND21
+?ELS25:        GET     PREACTIONS,A
+       CALL    STACK >V
+       ZERO?   V /?ELS27
+       JUMP    ?CND21
+?ELS27:        ZERO?   I /?ELS29
+       GETP    I,P?ACTION
+       CALL    STACK >V
+       ZERO?   V /?ELS29
+       JUMP    ?CND21
+?ELS29:        ZERO?   O /?ELS33
+       EQUAL?  A,V?WALK /?ELS33
+       GETP    O,P?ACTION
+       CALL    STACK >V
+       ZERO?   V /?ELS33
+       JUMP    ?CND21
+?ELS33:        GET     ACTIONS,A
+       CALL    STACK >V
+       ZERO?   V /?CND21
+?CND21:        EQUAL?  V,M-FATAL /?CND38
+       LOC     WINNER
+       EQUAL?  STACK,PRSO \?CND41
+       SET     'PRSO,FALSE-VALUE
+?CND41:        LOC     WINNER
+       GETP    STACK,P?ACTION
+       CALL    STACK,M-END >V
+?CND38:        SET     'PRSA,OA
+       SET     'PRSO,OO
+       SET     'PRSI,OI
+       RETURN  V
+
+       .ENDI
diff --git a/main.zil b/main.zil
new file mode 100644 (file)
index 0000000..f548ddb
--- /dev/null
+++ b/main.zil
@@ -0,0 +1,175 @@
+"MAIN3 for
+                Zork III: The Dungeon Master
+       Copyright 1982 Infocom, Inc.  All Rights Reserved.
+"
+
+<GLOBAL PLAYER <>>
+
+<GLOBAL P-WON <>>
+
+<CONSTANT M-FATAL 2>
+<CONSTANT M-HANDLED 1>   
+<CONSTANT M-NOT-HANDLED <>>   
+<CONSTANT M-BEG 1>  
+<CONSTANT M-END <>> 
+<CONSTANT M-ENTER 2>
+<CONSTANT M-LOOK 3> 
+<CONSTANT M-FLASH 4>
+
+<CONSTANT M-OBJDESC 5>
+
+<ROUTINE GO () 
+;"put interrupts on clock chain"
+        <QUEUE I-LANTERN 200>
+;"clean up junk compiler can't do"
+        <SETG CURRENT-LAMP ,LAMP>
+        <PUT ,CPOBJS <* 8 21> 1>
+        <PUT ,CPOBJS <+ <* 8 21> 1> ,LORE-BOOK>
+        <PUT ,CPOBJS <* 8 32> 1>
+        <PUT ,CPOBJS <+ <* 8 32> 1> ,CP-SLOT>
+ ;"set up and go"
+        <SETG LIT T>
+        <SETG WINNER ,ADVENTURER>
+        <SETG PLAYER ,WINNER>
+        <SETG MLOC ,MRB>
+        <SETG HERE ,ZORK2-STAIR>
+        <ENABLE <QUEUE I-CLEFT <+ 70 <RANDOM 70>>>>
+        <ENABLE <QUEUE I-VIEW-CHANGE 4>>
+        <SETG P-IT-LOC ,HERE>
+        <SETG P-IT-OBJECT <>>
+        <COND (<NOT <FSET? ,HERE ,TOUCHBIT>>
+               <TELL
+"As in a dream, you see yourself tumbling down a great, dark staircase.
+All about you are shadowy images of struggles against fierce opponents
+and diabolical traps. These give way to another round of images: of
+imposing stone figures, a cool, clear lake, and, now, of an old, yet
+oddly youthful man. He turns toward you slowly, his long, silver hair
+dancing about him in a fresh breeze. \"You have reached the final test,
+my friend! You are proved clever and powerful, but this is not yet
+enough! Seek me when you feel yourself worthy!\" The dream dissolves
+around you as his last words echo through the void...." CR>
+               <CRLF>
+               <V-VERSION>
+               <CRLF>)>
+        <MOVE ,WINNER ,HERE>
+        <MOVE ,LAMP ,HERE>
+        <V-LOOK>
+        <MAIN-LOOP>
+        <AGAIN>>    
+
+\f
+<ROUTINE MAIN-LOOP ("AUX" ICNT OCNT NUM CNT OBJ TBL V PTBL OBJ1 TMP) 
+   #DECL ((CNT OCNT ICNT NUM) FIX (V) <OR 'T FIX FALSE> (OBJ) <OR FALSE OBJECT>
+         (OBJ1) OBJECT (TBL) TABLE (PTBL) <OR FALSE ATOM>)
+   <REPEAT ()
+     <SET CNT 0>
+     <SET OBJ <>>
+     <SET PTBL T>
+     <COND (<SETG P-WON <PARSER>>
+           <SET ICNT <GET ,P-PRSI ,P-MATCHLEN>>
+           <SET NUM
+                <COND (<0? <SET OCNT <GET ,P-PRSO ,P-MATCHLEN>>> .OCNT)
+                      (<G? .OCNT 1>
+                       <SET TBL ,P-PRSO>
+                       <COND (<0? .ICNT> <SET OBJ <>>)
+                             (T <SET OBJ <GET ,P-PRSI 1>>)>
+                       .OCNT)
+                      (<G? .ICNT 1>
+                       <SET PTBL <>>
+                       <SET TBL ,P-PRSI>
+                       <SET OBJ <GET ,P-PRSO 1>>
+                       .ICNT)
+                      (T 1)>>
+           <COND (<AND <NOT .OBJ> <1? .ICNT>> <SET OBJ <GET ,P-PRSI 1>>)>
+           <COND (<==? ,PRSA ,V?WALK> <SET V <PERFORM ,PRSA ,PRSO>>)
+                 (<0? .NUM>
+                  <COND (<0? <BAND <GETB ,P-SYNTAX ,P-SBITS> ,P-SONUMS>>
+                         <SET V <PERFORM ,PRSA>>
+                         <SETG PRSO <>>)
+                        (<NOT ,LIT>
+                         <TELL "It's too dark to see." CR>)
+                        (T
+                         <TELL "There isn't anything to ">
+                         <SET TMP <GET ,P-ITBL ,P-VERBN>>
+                         <COND (,P-OFLAG
+                                <PRINTB <GET .TMP 0>>)
+                               (T
+                                <WORD-PRINT <GETB .TMP 2> <GETB .TMP 3>>)>
+                         <TELL "!" CR>
+                         <SET V <>>)>)
+                 (T
+                  <REPEAT ()
+                          <COND (<G? <SET CNT <+ .CNT 1>> .NUM> <RETURN>)
+                                (T
+                                 <COND (.PTBL <SET OBJ1 <GET ,P-PRSO .CNT>>)
+                                       (T <SET OBJ1 <GET ,P-PRSI .CNT>>)>
+                                 <COND (<G? .NUM 1>
+                                        <PRINTD .OBJ1>
+                                        <TELL ": ">)>
+                                 <SETG PRSO <COND (.PTBL .OBJ1) (T .OBJ)>>
+                                 <SETG PRSI <COND (.PTBL .OBJ) (T .OBJ1)>>
+                                 <SET V <PERFORM ,PRSA ,PRSO ,PRSI>>
+                                 <COND (<==? .V ,M-FATAL> <RETURN>)>)>>)>
+           <COND (<VERB? AGAIN WALK SAVE RESTORE SCORE VERSION WAIT> T)
+                 (T
+                  <SETG L-PRSA ,PRSA>
+                  <SETG L-PRSO ,PRSO>
+                  <SETG L-PRSI ,PRSI>)>
+           <COND (<==? .V ,M-FATAL> <SETG P-CONT <>>)>)
+          (T
+           <SETG P-CONT <>>)>
+     <COND (,P-WON
+           <COND (<VERB? TELL BRIEF SUPER-BRIEF VERBOSE SAVE VERSION
+                         QUIT RESTART SCORE SCRIPT UNSCRIPT RESTORE> T)
+                 (T
+                  <SETG MOVES <+ ,MOVES 1>>
+                  <SET V <CLOCKER>>)>)>>>
+<GLOBAL L-PRSA <>>  
+<GLOBAL L-PRSO <>>  
+<GLOBAL L-PRSI <>>  
+\f
+<ROUTINE PERFORM (A "OPTIONAL" (O <>) (I <>) "AUX" V OA OO OI) 
+       #DECL ((A) FIX (O) <OR FALSE OBJECT FIX> (I) <OR FALSE OBJECT> (V) ANY)
+       <SET OA ,PRSA>
+       <SET OO ,PRSO>
+       <SET OI ,PRSI>
+       <COND (<AND <EQUAL? ,IT .I .O>
+                   <NOT <EQUAL? ,P-IT-LOC ,HERE>>>
+              <TELL "I don't see what you are referring to." CR>
+              <RFATAL>)>
+       <COND (<==? .O ,IT> <SET O ,P-IT-OBJECT>)>
+       <COND (<==? .I ,IT> <SET I ,P-IT-OBJECT>)>
+       <SETG PRSA .A>
+       <SETG PRSO .O>
+       <COND (<AND ,PRSO <NOT <VERB? WALK>>>
+              <SETG P-IT-OBJECT ,PRSO>
+              <SETG P-IT-LOC ,HERE>)>
+       <SETG PRSI .I>
+       <COND (<SET V <APPLY <GETP ,WINNER ,P?ACTION>>> .V)
+             (<SET V <APPLY <GETP <LOC ,WINNER> ,P?ACTION> ,M-BEG>> .V)
+             (<SET V <APPLY <GET ,PREACTIONS .A>>> .V)
+             (<AND .I <SET V <APPLY <GETP .I ,P?ACTION>>>> .V)
+             (<AND .O
+                   <NOT <==? .A ,V?WALK>>
+                   <SET V <APPLY <GETP .O ,P?ACTION>>>>
+              .V)
+             (<SET V <APPLY <GET ,ACTIONS .A>>> .V)>
+       <COND (<NOT <==? .V ,M-FATAL>>
+              <COND (<==? <LOC ,WINNER> ,PRSO>
+                     <SETG PRSO <>>)>
+              <SET V <APPLY <GETP <LOC ,WINNER> ,P?ACTION> ,M-END>>)>
+       <SETG PRSA .OA>
+       <SETG PRSO .OO>
+       <SETG PRSI .OI>
+       .V>  
diff --git a/parser.zap b/parser.zap
new file mode 100644 (file)
index 0000000..0c3a746
--- /dev/null
@@ -0,0 +1,1220 @@
+
+
+       .FUNCT  PARSER,PTR=P-LEXSTART,WRD,VAL=0,VERB=0,LEN,DIR=0,NW=0,LW=0,NUM,SCNT,CNT=-1
+?PRG1: IGRTR?  'CNT,P-ITBLLEN \?ELS5
+       JUMP    ?REP2
+?ELS5: PUT     P-ITBL,CNT,0
+       JUMP    ?PRG1
+?REP2: SET     'P-ADVERB,FALSE-VALUE
+       SET     'P-MERGED,FALSE-VALUE
+       PUT     P-PRSO,P-MATCHLEN,0
+       PUT     P-PRSI,P-MATCHLEN,0
+       PUT     P-BUTS,P-MATCHLEN,0
+       ZERO?   QUOTE-FLAG \?CND8
+       EQUAL?  WINNER,PLAYER /?CND8
+       SET     'WINNER,PLAYER
+       LOC     WINNER
+       FSET?   STACK,VEHBIT /?CND8
+       LOC     WINNER >HERE
+?CND8: ZERO?   P-CONT /?ELS18
+       SET     'PTR,P-CONT
+       ZERO?   SUPER-BRIEF \?CND20
+       EQUAL?  PLAYER,WINNER \?CND20
+       CRLF    
+?CND20:        SET     'P-CONT,FALSE-VALUE
+       JUMP    ?CND16
+?ELS18:        SET     'WINNER,PLAYER
+       SET     'QUOTE-FLAG,FALSE-VALUE
+       LOC     WINNER
+       FSET?   STACK,VEHBIT /?CND27
+       LOC     WINNER >HERE
+?CND27:        ZERO?   SUPER-BRIEF \?CND30
+       CRLF    
+?CND30:        PRINTI  ">"
+       READ    P-INBUF,P-LEXV
+?CND16:        GETB    P-LEXV,P-LEXWORDS >P-LEN
+       ZERO?   P-LEN \?CND35
+       PRINTI  "I beg your pardon?"
+       CRLF    
+       RFALSE  
+?CND35:        SET     'LEN,P-LEN
+       SET     'P-DIR,FALSE-VALUE
+       SET     'P-NCN,0
+       SET     'P-GETFLAGS,0
+?PRG40:        DLESS?  'P-LEN,0 \?ELS44
+       SET     'QUOTE-FLAG,FALSE-VALUE
+       JUMP    ?REP41
+?ELS44:        GET     P-LEXV,PTR >WRD
+       ZERO?   WRD \?THN47
+       CALL    NUMBER?,PTR >WRD
+       ZERO?   WRD /?ELS46
+?THN47:        EQUAL?  WRD,W?TO \?ELS51
+       EQUAL?  VERB,ACT?TELL \?ELS51
+       SET     'WRD,W?QUOTE
+       JUMP    ?CND49
+?ELS51:        EQUAL?  WRD,W?THEN \?CND49
+       ZERO?   VERB \?CND49
+       PUT     P-ITBL,P-VERB,ACT?TELL
+       PUT     P-ITBL,P-VERBN,0
+       SET     'WRD,W?QUOTE
+?CND49:        EQUAL?  WRD,W?THEN,W?PERIOD /?THN61
+       EQUAL?  WRD,W?QUOTE \?ELS60
+?THN61:        EQUAL?  WRD,W?QUOTE \?CND63
+       ZERO?   QUOTE-FLAG /?ELS68
+       SET     'QUOTE-FLAG,FALSE-VALUE
+       JUMP    ?CND63
+?ELS68:        SET     'QUOTE-FLAG,TRUE-VALUE
+?CND63:        ZERO?   P-LEN /?THN72
+       ADD     PTR,P-LEXELEN >P-CONT
+?THN72:        PUTB    P-LEXV,P-LEXWORDS,P-LEN
+       JUMP    ?REP41
+?ELS60:        CALL    WT?,WRD,PS?DIRECTION,P1?DIRECTION >VAL
+       ZERO?   VAL /?ELS75
+       EQUAL?  VERB,FALSE-VALUE,ACT?WALK \?ELS75
+       EQUAL?  LEN,1 /?THN78
+       EQUAL?  LEN,2 \?ELS81
+       EQUAL?  VERB,ACT?WALK /?THN78
+?ELS81:        ADD     PTR,P-LEXELEN
+       GET     P-LEXV,STACK >NW
+       EQUAL?  NW,W?THEN,W?PERIOD,W?QUOTE \?ELS83
+       LESS?   LEN,2 \?THN78
+?ELS83:        ZERO?   QUOTE-FLAG /?ELS85
+       EQUAL?  LEN,2 \?ELS85
+       EQUAL?  NW,W?QUOTE /?THN78
+?ELS85:        GRTR?   LEN,2 \?ELS75
+       EQUAL?  NW,W?COMMA,W?AND \?ELS75
+?THN78:        SET     'DIR,VAL
+       EQUAL?  NW,W?COMMA,W?AND \?CND88
+       ADD     PTR,P-LEXELEN
+       PUT     P-LEXV,STACK,W?THEN
+?CND88:        GRTR?   LEN,2 /?CND42
+       SET     'QUOTE-FLAG,FALSE-VALUE
+       JUMP    ?REP41
+?ELS75:        CALL    WT?,WRD,PS?VERB,P1?VERB >VAL
+       ZERO?   VAL /?ELS95
+       ZERO?   VERB \?ELS95
+       SET     'VERB,VAL
+       PUT     P-ITBL,P-VERB,VAL
+       PUT     P-ITBL,P-VERBN,P-VTBL
+       PUT     P-VTBL,0,WRD
+       MUL     PTR,2
+       ADD     STACK,2 >NUM
+       GETB    P-LEXV,NUM
+       PUTB    P-VTBL,2,STACK
+       ADD     NUM,1
+       GETB    P-LEXV,STACK
+       PUTB    P-VTBL,3,STACK
+       JUMP    ?CND42
+?ELS95:        CALL    WT?,WRD,PS?PREPOSITION,0 >VAL
+       ZERO?   VAL \?THN100
+       EQUAL?  WRD,W?ALL,W?ONE,W?A /?THN104
+       CALL    WT?,WRD,PS?ADJECTIVE
+       ZERO?   STACK \?THN104
+       CALL    WT?,WRD,PS?OBJECT
+       ZERO?   STACK /?ELS99
+?THN104:       SET     'VAL,0
+?THN100:       GRTR?   P-LEN,0 \?ELS108
+       ADD     PTR,P-LEXELEN
+       GET     P-LEXV,STACK
+       EQUAL?  STACK,W?OF \?ELS108
+       ZERO?   VAL \?ELS108
+       EQUAL?  WRD,W?ALL,W?ONE,W?A /?ELS108
+       JUMP    ?CND42
+?ELS108:       ZERO?   VAL /?ELS112
+       ZERO?   P-LEN /?THN115
+       ADD     PTR,2
+       GET     P-LEXV,STACK
+       EQUAL?  STACK,W?THEN,W?PERIOD \?ELS112
+?THN115:       LESS?   P-NCN,2 \?CND42
+       PUT     P-ITBL,P-PREP1,VAL
+       PUT     P-ITBL,P-PREP1N,WRD
+       JUMP    ?CND42
+?ELS112:       EQUAL?  P-NCN,2 \?ELS121
+       PRINTI  "There were too many nouns in that sentence."
+       CRLF    
+       RFALSE  
+?ELS121:       INC     'P-NCN
+       CALL    CLAUSE,PTR,VAL,WRD >PTR
+       ZERO?   PTR /FALSE
+       LESS?   PTR,0 \?CND42
+       SET     'QUOTE-FLAG,FALSE-VALUE
+       JUMP    ?REP41
+?ELS99:        CALL    WT?,WRD,PS?BUZZ-WORD
+       ZERO?   STACK /?ELS132
+       JUMP    ?CND42
+?ELS132:       CALL    CANT-USE,PTR
+       RFALSE  
+?ELS46:        CALL    UNKNOWN-WORD,PTR
+       RFALSE  
+?CND42:        SET     'LW,WRD
+       ADD     PTR,P-LEXELEN >PTR
+       JUMP    ?PRG40
+?REP41:        ZERO?   DIR /?CND137
+       SET     'PRSA,V?WALK
+       SET     'PRSO,DIR
+       SET     'P-WALK-DIR,DIR
+       RETURN  TRUE-VALUE
+?CND137:       SET     'P-WALK-DIR,FALSE-VALUE
+       ZERO?   P-OFLAG /?CND141
+       CALL    ORPHAN-MERGE
+?CND141:       CALL    SYNTAX-CHECK
+       ZERO?   STACK /FALSE
+       CALL    SNARF-OBJECTS
+       ZERO?   STACK /FALSE
+       CALL    TAKE-CHECK
+       ZERO?   STACK /FALSE
+       CALL    MANY-CHECK
+       ZERO?   STACK /FALSE
+       RTRUE
+
+
+       .FUNCT  WT?,PTR,BIT,B1=5,OFFS=P-P1OFF,TYP
+       GETB    PTR,P-PSOFF >TYP
+       BTST    TYP,BIT \FALSE
+       GRTR?   B1,4 /TRUE
+       BAND    TYP,P-P1BITS >TYP
+       EQUAL?  TYP,B1 /?CND13
+       INC     'OFFS
+?CND13:        GETB    PTR,OFFS
+       RSTACK  
+
+
+       .FUNCT  CLAUSE,PTR,VAL,WRD,OFF,NUM,ANDFLG=0,FIRST??=1,NW,LW=0,?TMP1
+       SUB     P-NCN,1
+       MUL     STACK,2 >OFF
+       ZERO?   VAL /?ELS3
+       ADD     P-PREP1,OFF >NUM
+       PUT     P-ITBL,NUM,VAL
+       ADD     NUM,1
+       PUT     P-ITBL,STACK,WRD
+       ADD     PTR,P-LEXELEN >PTR
+       JUMP    ?CND1
+?ELS3: INC     'P-LEN
+?CND1: ZERO?   P-LEN \?CND6
+       DEC     'P-NCN
+       RETURN  -1
+?CND6: ADD     P-NC1,OFF >NUM
+       MUL     PTR,2
+       ADD     P-LEXV,STACK
+       PUT     P-ITBL,NUM,STACK
+       GET     P-LEXV,PTR
+       EQUAL?  STACK,W?THE,W?A,W?AN \?CND9
+       GET     P-ITBL,NUM
+       ADD     STACK,4
+       PUT     P-ITBL,NUM,STACK
+?CND9: 
+?PRG12:        DLESS?  'P-LEN,0 \?CND14
+       ADD     NUM,1 >?TMP1
+       MUL     PTR,2
+       ADD     P-LEXV,STACK
+       PUT     P-ITBL,?TMP1,STACK
+       RETURN  -1
+?CND14:        GET     P-LEXV,PTR >WRD
+       ZERO?   WRD \?THN20
+       CALL    NUMBER?,PTR >WRD
+       ZERO?   WRD /?ELS19
+?THN20:        ZERO?   P-LEN \?ELS24
+       SET     'NW,0
+       JUMP    ?CND22
+?ELS24:        ADD     PTR,P-LEXELEN
+       GET     P-LEXV,STACK >NW
+?CND22:        EQUAL?  WRD,W?AND,W?COMMA \?ELS29
+       SET     'ANDFLG,TRUE-VALUE
+       JUMP    ?CND17
+?ELS29:        EQUAL?  WRD,W?ALL,W?ONE \?ELS31
+       EQUAL?  NW,W?OF \?CND17
+       DEC     'P-LEN
+       ADD     PTR,P-LEXELEN >PTR
+       JUMP    ?CND17
+?ELS31:        EQUAL?  WRD,W?THEN,W?PERIOD /?THN37
+       CALL    WT?,WRD,PS?PREPOSITION
+       ZERO?   STACK /?ELS36
+       ZERO?   FIRST?? \?ELS36
+?THN37:        INC     'P-LEN
+       ADD     NUM,1 >?TMP1
+       MUL     PTR,2
+       ADD     P-LEXV,STACK
+       PUT     P-ITBL,?TMP1,STACK
+       SUB     PTR,P-LEXELEN
+       RETURN  STACK
+?ELS36:        CALL    WT?,WRD,PS?OBJECT
+       ZERO?   STACK /?ELS42
+       CALL    WT?,WRD,PS?ADJECTIVE,P1?ADJECTIVE
+       ZERO?   STACK /?ELS45
+       ZERO?   NW /?ELS45
+       CALL    WT?,NW,PS?OBJECT
+       ZERO?   STACK /?ELS45
+       JUMP    ?CND17
+?ELS45:        ZERO?   ANDFLG \?ELS49
+       EQUAL?  NW,W?BUT,W?EXCEPT /?ELS49
+       EQUAL?  NW,W?AND,W?COMMA /?ELS49
+       ADD     NUM,1 >?TMP1
+       ADD     PTR,2
+       MUL     STACK,2
+       ADD     P-LEXV,STACK
+       PUT     P-ITBL,?TMP1,STACK
+       RETURN  PTR
+?ELS49:        SET     'ANDFLG,FALSE-VALUE
+       JUMP    ?CND17
+?ELS42:        CALL    WT?,WRD,PS?ADJECTIVE
+       ZERO?   STACK \?CND17
+       CALL    WT?,WRD,PS?BUZZ-WORD
+       ZERO?   STACK /?ELS55
+       JUMP    ?CND17
+?ELS55:        ZERO?   ANDFLG /?ELS59
+       CALL    WT?,WRD,PS?DIRECTION
+       ZERO?   STACK \?THN62
+       CALL    WT?,WRD,PS?VERB
+       ZERO?   STACK /?ELS59
+?THN62:        SUB     PTR,4 >PTR
+       ADD     PTR,2
+       PUT     P-LEXV,STACK,W?THEN
+       ADD     P-LEN,2 >P-LEN
+       JUMP    ?CND17
+?ELS59:        CALL    WT?,WRD,PS?PREPOSITION
+       ZERO?   STACK /?ELS65
+       JUMP    ?CND17
+?ELS65:        CALL    CANT-USE,PTR
+       RFALSE  
+?ELS19:        CALL    UNKNOWN-WORD,PTR
+       RFALSE  
+?CND17:        SET     'LW,WRD
+       SET     'FIRST??,FALSE-VALUE
+       ADD     PTR,P-LEXELEN >PTR
+       JUMP    ?PRG12
+
+
+       .FUNCT  NUMBER?,PTR,CNT,BPTR,CHR,SUM=0,TIM=0,?TMP1
+       MUL     PTR,2
+       ADD     P-LEXV,STACK
+       GETB    STACK,2 >CNT
+       MUL     PTR,2
+       ADD     P-LEXV,STACK
+       GETB    STACK,3 >BPTR
+?PRG1: DLESS?  'CNT,0 \?ELS5
+       JUMP    ?REP2
+?ELS5: GETB    P-INBUF,BPTR >CHR
+       EQUAL?  CHR,58 \?ELS10
+       SET     'TIM,SUM
+       SET     'SUM,0
+       JUMP    ?CND8
+?ELS10:        GRTR?   SUM,10000 /FALSE
+       LESS?   CHR,58 \FALSE
+       GRTR?   CHR,47 \FALSE
+       MUL     SUM,10 >?TMP1
+       SUB     CHR,48
+       ADD     ?TMP1,STACK >SUM
+?CND8: INC     'BPTR
+       JUMP    ?PRG1
+?REP2: PUT     P-LEXV,PTR,W?INTNUM
+       GRTR?   SUM,1000 /FALSE
+       ZERO?   TIM /?CND19
+       LESS?   TIM,8 \?ELS27
+       ADD     TIM,12 >TIM
+       JUMP    ?CND25
+?ELS27:        GRTR?   TIM,23 /FALSE
+?CND25:        MUL     TIM,60
+       ADD     SUM,STACK >SUM
+?CND19:        SET     'P-NUMBER,SUM
+       RETURN  W?INTNUM
+
+
+       .FUNCT  ORPHAN-MERGE,CNT=-1,TEMP,VERB,BEG,END,ADJ=0,WRD,?TMP1
+       SET     'P-OFLAG,FALSE-VALUE
+       GET     P-ITBL,P-VERB >VERB
+       ZERO?   VERB /?ELS3
+       GET     P-OTBL,P-VERB
+       EQUAL?  VERB,STACK \FALSE
+?ELS3: EQUAL?  P-NCN,2 /FALSE
+       GET     P-OTBL,P-NC1
+       EQUAL?  STACK,1 \?ELS9
+       GET     P-ITBL,P-PREP1 >TEMP
+       GET     P-OTBL,P-PREP1
+       EQUAL?  TEMP,STACK /?THN13
+       ZERO?   TEMP \FALSE
+?THN13:        GET     P-ITBL,P-NC1
+       PUT     P-OTBL,P-NC1,STACK
+       GET     P-ITBL,P-NC1L
+       PUT     P-OTBL,P-NC1L,STACK
+       JUMP    ?CND1
+?ELS9: GET     P-OTBL,P-NC2
+       EQUAL?  STACK,1 \?ELS18
+       GET     P-ITBL,P-PREP1 >TEMP
+       GET     P-OTBL,P-PREP2
+       EQUAL?  TEMP,STACK /?THN22
+       ZERO?   TEMP \FALSE
+?THN22:        GET     P-ITBL,P-NC1
+       PUT     P-OTBL,P-NC2,STACK
+       GET     P-ITBL,P-NC1L
+       PUT     P-OTBL,P-NC2L,STACK
+       SET     'P-NCN,2
+       JUMP    ?CND1
+?ELS18:        ZERO?   P-ACLAUSE /?CND1
+       EQUAL?  P-NCN,1 /?ELS31
+       SET     'P-ACLAUSE,FALSE-VALUE
+       RFALSE  
+?ELS31:        GET     P-ITBL,P-NC1 >BEG
+       GET     P-ITBL,P-NC1L >END
+?PRG34:        EQUAL?  BEG,END \?ELS38
+       ZERO?   ADJ /?ELS41
+       CALL    ACLAUSE-WIN,ADJ
+       JUMP    ?CND29
+?ELS41:        SET     'P-ACLAUSE,FALSE-VALUE
+       RFALSE  
+?ELS38:        ZERO?   ADJ \?ELS46
+       GET     BEG,0 >WRD
+       GETB    WRD,P-PSOFF
+       BTST    STACK,PS?ADJECTIVE \?ELS46
+       SET     'ADJ,WRD
+       JUMP    ?CND36
+?ELS46:        GETB    WRD,P-PSOFF
+       BTST    STACK,PS?OBJECT /?THN51
+       EQUAL?  WRD,W?ONE \?CND36
+?THN51:        EQUAL?  WRD,P-ANAM,W?ONE \FALSE
+       CALL    ACLAUSE-WIN,ADJ
+       JUMP    ?CND29
+?CND36:        ADD     BEG,P-WORDLEN >BEG
+       JUMP    ?PRG34
+?CND29:        
+?CND1: 
+?PRG58:        IGRTR?  'CNT,P-ITBLLEN \?ELS62
+       SET     'P-MERGED,TRUE-VALUE
+       RTRUE   
+?ELS62:        GET     P-OTBL,CNT
+       PUT     P-ITBL,CNT,STACK
+       JUMP    ?PRG58
+
+
+       .FUNCT  ACLAUSE-WIN,ADJ
+       SET     'P-CCSRC,P-OTBL
+       ADD     P-ACLAUSE,1
+       CALL    CLAUSE-COPY,P-ACLAUSE,STACK,ADJ
+       GET     P-OTBL,P-NC2
+       ZERO?   STACK /?ELS2
+       SET     'P-NCN,2
+?ELS2: SET     'P-ACLAUSE,FALSE-VALUE
+       RTRUE   
+
+
+       .FUNCT  WORD-PRINT,CNT,BUF
+?PRG1: DLESS?  'CNT,0 /TRUE
+       GETB    P-INBUF,BUF
+       PRINTC  STACK
+       INC     'BUF
+       JUMP    ?PRG1
+
+
+       .FUNCT  UNKNOWN-WORD,PTR,BUF,?TMP1
+       EQUAL?  PRSA,V?SAY \?CND1
+       PRINTI  "Nothing happens."
+       CRLF    
+       RFALSE  
+?CND1: PRINTI  "I don't know the word """
+       MUL     PTR,2 >BUF
+       ADD     P-LEXV,BUF
+       GETB    STACK,2 >?TMP1
+       ADD     P-LEXV,BUF
+       GETB    STACK,3
+       CALL    WORD-PRINT,?TMP1,STACK
+       PRINTI  """."
+       CRLF    
+       SET     'QUOTE-FLAG,FALSE-VALUE
+       SET     'P-OFLAG,FALSE-VALUE
+       RETURN  P-OFLAG
+
+
+       .FUNCT  CANT-USE,PTR,BUF,?TMP1
+       EQUAL?  PRSA,V?SAY \?CND1
+       PRINTI  "Nothing happens."
+       CRLF    
+       RFALSE  
+?CND1: PRINTI  "You used the word """
+       MUL     PTR,2 >BUF
+       ADD     P-LEXV,BUF
+       GETB    STACK,2 >?TMP1
+       ADD     P-LEXV,BUF
+       GETB    STACK,3
+       CALL    WORD-PRINT,?TMP1,STACK
+       PRINTI  """ in a way that I don't understand."
+       CRLF    
+       SET     'QUOTE-FLAG,FALSE-VALUE
+       SET     'P-OFLAG,FALSE-VALUE
+       RETURN  P-OFLAG
+
+
+       .FUNCT  SYNTAX-CHECK,SYN,LEN,NUM,OBJ,DRIVE1=0,DRIVE2=0,PREP,VERB,TMP,?TMP2,?TMP1
+       GET     P-ITBL,P-VERB >VERB
+       ZERO?   VERB \?CND1
+       PRINTI  "There was no verb in that sentence!"
+       CRLF    
+       RFALSE  
+?CND1: SUB     255,VERB
+       GET     VERBS,STACK >SYN
+       GETB    SYN,0 >LEN
+       ADD     1,SYN >SYN
+?PRG6: GETB    SYN,P-SBITS
+       BAND    STACK,P-SONUMS >NUM
+       LESS?   NUM,1 /?ELS10
+       ZERO?   P-NCN \?ELS10
+       GET     P-ITBL,P-PREP1 >PREP
+       ZERO?   PREP /?THN13
+       GETB    SYN,P-SPREP1
+       EQUAL?  PREP,STACK \?ELS10
+?THN13:        SET     'DRIVE1,SYN
+       JUMP    ?CND8
+?ELS10:        GETB    SYN,P-SPREP1 >?TMP1
+       GET     P-ITBL,P-PREP1
+       EQUAL?  ?TMP1,STACK \?CND8
+       EQUAL?  NUM,2 \?ELS19
+       EQUAL?  P-NCN,1 \?ELS19
+       SET     'DRIVE2,SYN
+       JUMP    ?CND8
+?ELS19:        GETB    SYN,P-SPREP2 >?TMP1
+       GET     P-ITBL,P-PREP2
+       EQUAL?  ?TMP1,STACK \?CND8
+       CALL    SYNTAX-FOUND,SYN
+       RTRUE   
+?CND8: DLESS?  'LEN,1 \?ELS26
+       ZERO?   DRIVE1 \?REP7
+       ZERO?   DRIVE2 /?ELS29
+       JUMP    ?REP7
+?ELS29:        PRINTI  "That sentence isn't one I recognize."
+       CRLF    
+       RFALSE  
+?ELS26:        ADD     SYN,P-SYNLEN >SYN
+       JUMP    ?PRG6
+?REP7: ZERO?   DRIVE1 /?ELS42
+       GETB    DRIVE1,P-SFWIM1 >?TMP2
+       GETB    DRIVE1,P-SLOC1 >?TMP1
+       GETB    DRIVE1,P-SPREP1
+       CALL    GWIM,?TMP2,?TMP1,STACK >OBJ
+       ZERO?   OBJ /?ELS42
+       PUT     P-PRSO,P-MATCHLEN,1
+       PUT     P-PRSO,1,OBJ
+       CALL    SYNTAX-FOUND,DRIVE1
+       RSTACK  
+?ELS42:        ZERO?   DRIVE2 /?ELS46
+       GETB    DRIVE2,P-SFWIM2 >?TMP2
+       GETB    DRIVE2,P-SLOC2 >?TMP1
+       GETB    DRIVE2,P-SPREP2
+       CALL    GWIM,?TMP2,?TMP1,STACK >OBJ
+       ZERO?   OBJ /?ELS46
+       PUT     P-PRSI,P-MATCHLEN,1
+       PUT     P-PRSI,1,OBJ
+       CALL    SYNTAX-FOUND,DRIVE2
+       RSTACK  
+?ELS46:        EQUAL?  VERB,ACT?FIND \?ELS50
+       PRINTI  "That question can't be answered."
+       CRLF    
+       RFALSE  
+?ELS50:        CALL    ORPHAN,DRIVE1,DRIVE2
+       PRINTI  "What do you want to "
+       GET     P-OTBL,P-VERBN >TMP
+       ZERO?   TMP \?ELS59
+       PRINTI  "tell"
+       JUMP    ?CND57
+?ELS59:        GETB    P-VTBL,2
+       ZERO?   STACK \?ELS63
+       GET     TMP,0
+       PRINTB  STACK
+       JUMP    ?CND57
+?ELS63:        GETB    TMP,2 >?TMP1
+       GETB    TMP,3
+       CALL    WORD-PRINT,?TMP1,STACK
+       PUTB    P-VTBL,2,0
+?CND57:        ZERO?   DRIVE2 /?CND66
+       CALL    CLAUSE-PRINT,P-NC1,P-NC1L
+?CND66:        SET     'P-OFLAG,TRUE-VALUE
+       ZERO?   DRIVE1 /?ELS74
+       GETB    DRIVE1,P-SPREP1
+       JUMP    ?CND70
+?ELS74:        GETB    DRIVE2,P-SPREP2
+?CND70:        CALL    PREP-PRINT,STACK
+       PRINTI  "?"
+       CRLF    
+       RFALSE  
+
+
+       .FUNCT  ORPHAN,D1,D2,CNT=-1
+       PUT     P-OCLAUSE,P-MATCHLEN,0
+       SET     'P-CCSRC,P-ITBL
+?PRG1: IGRTR?  'CNT,P-ITBLLEN \?ELS5
+       JUMP    ?REP2
+?ELS5: GET     P-ITBL,CNT
+       PUT     P-OTBL,CNT,STACK
+       JUMP    ?PRG1
+?REP2: EQUAL?  P-NCN,2 \?CND8
+       CALL    CLAUSE-COPY,P-NC2,P-NC2L
+?CND8: LESS?   P-NCN,1 /?CND11
+       CALL    CLAUSE-COPY,P-NC1,P-NC1L
+?CND11:        ZERO?   D1 /?ELS18
+       GETB    D1,P-SPREP1
+       PUT     P-OTBL,P-PREP1,STACK
+       PUT     P-OTBL,P-NC1,1
+       RTRUE   
+?ELS18:        ZERO?   D2 /FALSE
+       GETB    D2,P-SPREP2
+       PUT     P-OTBL,P-PREP2,STACK
+       PUT     P-OTBL,P-NC2,1
+       RTRUE   
+
+
+       .FUNCT  CLAUSE-PRINT,BPTR,EPTR,?TMP1
+       GET     P-ITBL,BPTR >?TMP1
+       GET     P-ITBL,EPTR
+       CALL    BUFFER-PRINT,?TMP1,STACK,TRUE-VALUE
+       RSTACK  
+
+
+       .FUNCT  BUFFER-PRINT,BEG,END,CP,NOSP=0,WRD,FIRST??=1,PN=0,?TMP1
+?PRG1: EQUAL?  BEG,END /TRUE
+       ZERO?   NOSP /?ELS10
+       SET     'NOSP,FALSE-VALUE
+       JUMP    ?CND8
+?ELS10:        PRINTI  " "
+?CND8: GET     BEG,0 >WRD
+       EQUAL?  WRD,W?PERIOD \?ELS18
+       SET     'NOSP,TRUE-VALUE
+       JUMP    ?CND3
+?ELS18:        ZERO?   FIRST?? /?CND21
+       ZERO?   PN \?CND21
+       ZERO?   CP /?CND21
+       PRINTI  "the "
+?CND21:        ZERO?   P-OFLAG /?ELS30
+       PRINTB  WRD
+       JUMP    ?CND28
+?ELS30:        EQUAL?  WRD,W?IT \?ELS33
+       EQUAL?  P-IT-LOC,HERE \?ELS33
+       PRINTD  P-IT-OBJECT
+       JUMP    ?CND28
+?ELS33:        GETB    BEG,2 >?TMP1
+       GETB    BEG,3
+       CALL    WORD-PRINT,?TMP1,STACK
+?CND28:        SET     'FIRST??,FALSE-VALUE
+?CND3: ADD     BEG,P-WORDLEN >BEG
+       JUMP    ?PRG1
+
+
+       .FUNCT  CAPITALIZE,PTR,?TMP1
+       GETB    PTR,3
+       GETB    P-INBUF,STACK
+       SUB     STACK,32
+       PRINTC  STACK
+       GETB    PTR,2
+       SUB     STACK,1 >?TMP1
+       GETB    PTR,3
+       ADD     STACK,1
+       CALL    WORD-PRINT,?TMP1,STACK
+       RSTACK  
+
+
+       .FUNCT  PREP-PRINT,PREP,WRD
+       ZERO?   PREP /FALSE
+       PRINTI  " "
+       CALL    PREP-FIND,PREP >WRD
+       PRINTB  WRD
+       RTRUE   
+
+
+       .FUNCT  CLAUSE-COPY,BPTR,EPTR,INSRT=0,BEG,END
+       GET     P-CCSRC,BPTR >BEG
+       GET     P-CCSRC,EPTR >END
+       GET     P-OCLAUSE,P-MATCHLEN
+       MUL     STACK,P-LEXELEN
+       ADD     STACK,2
+       ADD     P-OCLAUSE,STACK
+       PUT     P-OTBL,BPTR,STACK
+?PRG1: EQUAL?  BEG,END \?ELS5
+       GET     P-OCLAUSE,P-MATCHLEN
+       MUL     STACK,P-LEXELEN
+       ADD     STACK,2
+       ADD     P-OCLAUSE,STACK
+       PUT     P-OTBL,EPTR,STACK
+       RTRUE   
+?ELS5: ZERO?   INSRT /?CND8
+       GET     BEG,0
+       EQUAL?  P-ANAM,STACK \?CND8
+       CALL    CLAUSE-ADD,INSRT
+?CND8: GET     BEG,0
+       CALL    CLAUSE-ADD,STACK
+?CND3: ADD     BEG,P-WORDLEN >BEG
+       JUMP    ?PRG1
+
+
+       .FUNCT  CLAUSE-ADD,WRD,PTR
+       GET     P-OCLAUSE,P-MATCHLEN
+       ADD     STACK,2 >PTR
+       SUB     PTR,1
+       PUT     P-OCLAUSE,STACK,WRD
+       PUT     P-OCLAUSE,PTR,0
+       PUT     P-OCLAUSE,P-MATCHLEN,PTR
+       RTRUE   
+
+
+       .FUNCT  PREP-FIND,PREP,CNT=0,SIZE
+       GET     PREPOSITIONS,0
+       MUL     STACK,2 >SIZE
+?PRG1: IGRTR?  'CNT,SIZE /FALSE
+       GET     PREPOSITIONS,CNT
+       EQUAL?  STACK,PREP \?PRG1
+       SUB     CNT,1
+       GET     PREPOSITIONS,STACK
+       RETURN  STACK
+
+
+       .FUNCT  SYNTAX-FOUND,SYN
+       SET     'P-SYNTAX,SYN
+       GETB    SYN,P-SACTION >PRSA
+       RETURN  PRSA
+
+
+       .FUNCT  GWIM,GBIT,LBIT,PREP,OBJ
+       EQUAL?  GBIT,RMUNGBIT \?CND1
+       RETURN  ROOMS
+?CND1: SET     'P-GWIMBIT,GBIT
+       SET     'P-SLOCBITS,LBIT
+       PUT     P-MERGE,P-MATCHLEN,0
+       CALL    GET-OBJECT,P-MERGE,FALSE-VALUE
+       ZERO?   STACK /?ELS8
+       SET     'P-GWIMBIT,0
+       GET     P-MERGE,P-MATCHLEN
+       EQUAL?  STACK,1 \FALSE
+       GET     P-MERGE,1 >OBJ
+       PRINTI  "("
+       ZERO?   PREP /?CND16
+       CALL    PREP-FIND,PREP
+       PRINTB  STACK
+       PRINTI  " the "
+?CND16:        PRINTD  OBJ
+       PRINTI  ")"
+       CRLF    
+       RETURN  OBJ
+?ELS8: SET     'P-GWIMBIT,0
+       RFALSE  
+
+
+       .FUNCT  SNARF-OBJECTS,PTR
+       GET     P-ITBL,P-NC1 >PTR
+       ZERO?   PTR /?CND1
+       GETB    P-SYNTAX,P-SLOC1 >P-SLOCBITS
+       GET     P-ITBL,P-NC1L
+       CALL    SNARFEM,PTR,STACK,P-PRSO
+       ZERO?   STACK /FALSE
+       GET     P-BUTS,P-MATCHLEN
+       ZERO?   STACK /?CND1
+       CALL    BUT-MERGE,P-PRSO >P-PRSO
+?CND1: GET     P-ITBL,P-NC2 >PTR
+       ZERO?   PTR /TRUE
+       GETB    P-SYNTAX,P-SLOC2 >P-SLOCBITS
+       GET     P-ITBL,P-NC2L
+       CALL    SNARFEM,PTR,STACK,P-PRSI
+       ZERO?   STACK /FALSE
+       GET     P-BUTS,P-MATCHLEN
+       ZERO?   STACK /TRUE
+       GET     P-PRSI,P-MATCHLEN
+       EQUAL?  STACK,1 \?ELS18
+       CALL    BUT-MERGE,P-PRSO >P-PRSO
+       RTRUE   
+?ELS18:        CALL    BUT-MERGE,P-PRSI >P-PRSI
+       RTRUE   
+
+
+       .FUNCT  BUT-MERGE,TBL,LEN,BUTLEN,CNT=1,MATCHES=0,OBJ,NTBL
+       GET     TBL,P-MATCHLEN >LEN
+       PUT     P-MERGE,P-MATCHLEN,0
+?PRG1: DLESS?  'LEN,0 \?ELS5
+       JUMP    ?REP2
+?ELS5: GET     TBL,CNT >OBJ
+       CALL    ZMEMQ,OBJ,P-BUTS
+       ZERO?   STACK /?ELS7
+       JUMP    ?CND3
+?ELS7: ADD     MATCHES,1
+       PUT     P-MERGE,STACK,OBJ
+       INC     'MATCHES
+?CND3: INC     'CNT
+       JUMP    ?PRG1
+?REP2: PUT     P-MERGE,P-MATCHLEN,MATCHES
+       SET     'NTBL,P-MERGE
+       SET     'P-MERGE,TBL
+       RETURN  NTBL
+
+
+       .FUNCT  SNARFEM,PTR,EPTR,TBL,BUT=0,LEN,WV,WRD,NW
+       SET     'P-GETFLAGS,0
+       SET     'P-CSPTR,PTR
+       SET     'P-CEPTR,EPTR
+       PUT     P-BUTS,P-MATCHLEN,0
+       PUT     TBL,P-MATCHLEN,0
+       GET     PTR,0 >WRD
+?PRG1: EQUAL?  PTR,EPTR \?ELS5
+       ZERO?   BUT /?ORP9
+       PUSH    BUT
+       JUMP    ?THN6
+?ORP9: PUSH    TBL
+?THN6: CALL    GET-OBJECT,STACK
+       RETURN  STACK
+?ELS5: GET     PTR,P-LEXELEN >NW
+       EQUAL?  WRD,W?ALL \?ELS14
+       SET     'P-GETFLAGS,P-ALL
+       EQUAL?  NW,W?OF \?CND12
+       ADD     PTR,P-WORDLEN >PTR
+       JUMP    ?CND12
+?ELS14:        EQUAL?  WRD,W?BUT,W?EXCEPT \?ELS19
+       ZERO?   BUT /?ORP25
+       PUSH    BUT
+       JUMP    ?THN22
+?ORP25:        PUSH    TBL
+?THN22:        CALL    GET-OBJECT,STACK
+       ZERO?   STACK /FALSE
+       SET     'BUT,P-BUTS
+       PUT     BUT,P-MATCHLEN,0
+       JUMP    ?CND3
+?ELS19:        EQUAL?  WRD,W?A,W?ONE \?ELS27
+       ZERO?   P-ADJ \?ELS30
+       SET     'P-GETFLAGS,P-ONE
+       EQUAL?  NW,W?OF \?CND3
+       ADD     PTR,P-WORDLEN >PTR
+       JUMP    ?CND3
+?ELS30:        SET     'P-NAM,P-ONEOBJ
+       ZERO?   BUT /?ORP41
+       PUSH    BUT
+       JUMP    ?THN38
+?ORP41:        PUSH    TBL
+?THN38:        CALL    GET-OBJECT,STACK
+       ZERO?   STACK /FALSE
+       ZERO?   NW /TRUE
+       JUMP    ?CND3
+?ELS27:        EQUAL?  WRD,W?AND,W?COMMA \?ELS45
+       EQUAL?  NW,W?AND,W?COMMA /?ELS45
+       ZERO?   BUT /?ORP53
+       PUSH    BUT
+       JUMP    ?THN50
+?ORP53:        PUSH    TBL
+?THN50:        CALL    GET-OBJECT,STACK
+       ZERO?   STACK \?CND12
+       RFALSE  
+?ELS45:        CALL    WT?,WRD,PS?BUZZ-WORD
+       ZERO?   STACK /?ELS55
+       JUMP    ?CND3
+?ELS55:        EQUAL?  WRD,W?AND,W?COMMA \?ELS57
+       JUMP    ?CND3
+?ELS57:        EQUAL?  WRD,W?OF \?ELS59
+       ZERO?   P-GETFLAGS \?CND12
+       SET     'P-GETFLAGS,P-INHIBIT
+       JUMP    ?CND12
+?ELS59:        CALL    WT?,WRD,PS?ADJECTIVE,P1?ADJECTIVE >WV
+       ZERO?   WV /?ELS64
+       ZERO?   P-ADJ \?ELS64
+       SET     'P-ADJ,WV
+       SET     'P-ADJN,WRD
+       JUMP    ?CND3
+?ELS64:        CALL    WT?,WRD,PS?OBJECT,P1?OBJECT
+       ZERO?   STACK /?CND3
+       SET     'P-NAM,WRD
+       SET     'P-ONEOBJ,WRD
+?CND12:        
+?CND3: EQUAL?  PTR,EPTR /?PRG1
+       ADD     PTR,P-WORDLEN >PTR
+       SET     'WRD,NW
+       JUMP    ?PRG1
+
+
+       .FUNCT  GET-OBJECT,TBL,VRB=1,BTS,LEN,XBITS,TLEN,GCHECK=0,OLEN=0
+       SET     'XBITS,P-SLOCBITS
+       GET     TBL,P-MATCHLEN >TLEN
+       BTST    P-GETFLAGS,P-INHIBIT /TRUE
+       ZERO?   P-NAM \?CND4
+       ZERO?   P-ADJ /?CND4
+       CALL    WT?,P-ADJN,PS?OBJECT,P1?OBJECT
+       ZERO?   STACK /?ELS11
+       SET     'P-NAM,P-ADJN
+       SET     'P-ADJ,FALSE-VALUE
+       JUMP    ?CND4
+?ELS11:        CALL    WT?,P-ADJN,PS?DIRECTION,P1?DIRECTION >BTS
+       ZERO?   BTS /?CND4
+       SET     'P-ADJ,FALSE-VALUE
+       PUT     TBL,P-MATCHLEN,1
+       PUT     TBL,1,INTDIR
+       SET     'P-DIRECTION,BTS
+       RTRUE   
+?CND4: ZERO?   P-NAM \?CND14
+       ZERO?   P-ADJ \?CND14
+       EQUAL?  P-GETFLAGS,P-ALL /?CND14
+       ZERO?   P-GWIMBIT \?CND14
+       ZERO?   VRB /FALSE
+       PRINTI  "There seems to be a noun missing in that sentence!"
+       CRLF    
+       RFALSE  
+?CND14:        EQUAL?  P-GETFLAGS,P-ALL \?THN28
+       ZERO?   P-SLOCBITS \?CND25
+?THN28:        SET     'P-SLOCBITS,-1
+?CND25:        SET     'P-TABLE,TBL
+?PRG30:        ZERO?   GCHECK /?ELS34
+       CALL    GLOBAL-CHECK,TBL
+       JUMP    ?CND32
+?ELS34:        ZERO?   LIT /?CND38
+       CALL    DO-SL,HERE,SOG,SIR
+?CND38:        CALL    DO-SL,WINNER,SH,SC
+       EQUAL?  WINNER,PLAYER /?CND32
+       CALL    DO-SL,PLAYER,SH,SC
+?CND32:        GET     TBL,P-MATCHLEN
+       SUB     STACK,TLEN >LEN
+       BTST    P-GETFLAGS,P-ALL \?ELS47
+       JUMP    ?CND45
+?ELS47:        BTST    P-GETFLAGS,P-ONE \?ELS49
+       ZERO?   LEN /?ELS49
+       EQUAL?  LEN,1 /?CND52
+       RANDOM  LEN
+       GET     TBL,STACK
+       PUT     TBL,1,STACK
+       PRINTI  "(How about the "
+       GET     TBL,1
+       PRINTD  STACK
+       PRINTI  "?)"
+       CRLF    
+?CND52:        PUT     TBL,P-MATCHLEN,1
+       JUMP    ?CND45
+?ELS49:        GRTR?   LEN,1 /?THN61
+       ZERO?   LEN \?ELS60
+       EQUAL?  P-SLOCBITS,-1 /?ELS60
+?THN61:        EQUAL?  P-SLOCBITS,-1 \?ELS67
+       SET     'P-SLOCBITS,XBITS
+       SET     'OLEN,LEN
+       GET     TBL,P-MATCHLEN
+       SUB     STACK,LEN
+       PUT     TBL,P-MATCHLEN,STACK
+       JUMP    ?PRG30
+?ELS67:        ZERO?   LEN \?CND70
+       SET     'LEN,OLEN
+?CND70:        ZERO?   VRB /?ELS75
+       ZERO?   P-NAM /?ELS75
+       CALL    WHICH-PRINT,TLEN,LEN,TBL
+       EQUAL?  TBL,P-PRSO \?ELS82
+       PUSH    P-NC1
+       JUMP    ?CND78
+?ELS82:        PUSH    P-NC2
+?CND78:        SET     'P-ACLAUSE,STACK
+       SET     'P-AADJ,P-ADJ
+       SET     'P-ANAM,P-NAM
+       CALL    ORPHAN,FALSE-VALUE,FALSE-VALUE
+       SET     'P-OFLAG,TRUE-VALUE
+       JUMP    ?CND73
+?ELS75:        ZERO?   VRB /?CND73
+       PRINTI  "There seems to be a noun missing in that sentence!"
+       CRLF    
+?CND73:        SET     'P-NAM,FALSE-VALUE
+       SET     'P-ADJ,FALSE-VALUE
+       RFALSE  
+?ELS60:        ZERO?   LEN \?ELS91
+       ZERO?   GCHECK /?ELS91
+       ZERO?   VRB /?CND94
+       EQUAL?  WINNER,PLAYER /?ELS100
+       PRINTI  """I can't see that here!"""
+       CRLF    
+       JUMP    ?CND94
+?ELS100:       ZERO?   LIT /?ELS104
+       PRINTI  "You can't see any"
+       ZERO?   P-OFLAG /?ELS110
+       ZERO?   P-ADJ /?CND112
+       PRINTI  " "
+       PRINTB  P-ADJN
+?CND112:       ZERO?   P-NAM /?CND108
+       PRINTI  " "
+       PRINTB  P-NAM
+       JUMP    ?CND108
+?ELS110:       CALL    BUFFER-PRINT,P-CSPTR,P-CEPTR,FALSE-VALUE
+?CND108:       PRINTI  " here."
+       CRLF    
+       JUMP    ?CND94
+?ELS104:       PRINTI  "It's too dark to see."
+       CRLF    
+?CND94:        SET     'P-NAM,FALSE-VALUE
+       SET     'P-ADJ,FALSE-VALUE
+       RFALSE  
+?ELS91:        ZERO?   LEN \?CND45
+       SET     'GCHECK,TRUE-VALUE
+       JUMP    ?PRG30
+?CND45:        SET     'P-ADJ,FALSE-VALUE
+       SET     'P-NAM,FALSE-VALUE
+       SET     'P-SLOCBITS,XBITS
+       RTRUE   
+
+
+       .FUNCT  WHICH-PRINT,TLEN,LEN,TBL,OBJ,RLEN
+       SET     'RLEN,LEN
+       PRINTI  "Which "
+       PRINTB  P-NAM
+       PRINTI  " do you mean, "
+?PRG5: INC     'TLEN
+       GET     TBL,TLEN >OBJ
+       PRINTI  "the "
+       PRINTD  OBJ
+       EQUAL?  LEN,2 \?ELS11
+       EQUAL?  RLEN,2 /?CND12
+       PRINTI  ","
+?CND12:        PRINTI  " or "
+       JUMP    ?CND9
+?ELS11:        GRTR?   LEN,2 \?CND9
+       PRINTI  ", "
+?CND9: DLESS?  'LEN,1 \?PRG5
+       PRINTR  "?"
+
+
+       .FUNCT  GLOBAL-CHECK,TBL,LEN,RMG,RMGL,CNT=0,OBJ,OBITS,FOO
+       GET     TBL,P-MATCHLEN >LEN
+       SET     'OBITS,P-SLOCBITS
+       GETPT   HERE,P?GLOBAL >RMG
+       ZERO?   RMG /?CND1
+       PTSIZE  RMG
+       SUB     STACK,1 >RMGL
+?PRG4: GETB    RMG,CNT >OBJ
+       CALL    THIS-IT?,OBJ,TBL
+       ZERO?   STACK /?CND6
+       CALL    OBJ-FOUND,OBJ,TBL
+?CND6: IGRTR?  'CNT,RMGL \?PRG4
+?CND1: GETPT   HERE,P?PSEUDO >RMG
+       ZERO?   RMG /?CND12
+       PTSIZE  RMG
+       DIV     STACK,4
+       SUB     STACK,1 >RMGL
+       SET     'CNT,0
+?PRG15:        MUL     CNT,2
+       GET     RMG,STACK
+       EQUAL?  P-NAM,STACK \?ELS19
+       MUL     CNT,2
+       ADD     STACK,1
+       GET     RMG,STACK
+       PUTP    PSEUDO-OBJECT,P?ACTION,STACK
+       GETPT   PSEUDO-OBJECT,P?ACTION
+       SUB     STACK,5 >FOO
+       GET     P-NAM,0
+       PUT     FOO,0,STACK
+       GET     P-NAM,1
+       PUT     FOO,1,STACK
+       CALL    OBJ-FOUND,PSEUDO-OBJECT,TBL
+       JUMP    ?CND12
+?ELS19:        IGRTR?  'CNT,RMGL \?PRG15
+?CND12:        GET     TBL,P-MATCHLEN
+       EQUAL?  STACK,LEN \FALSE
+       SET     'P-SLOCBITS,-1
+       SET     'P-TABLE,TBL
+       CALL    DO-SL,GLOBAL-OBJECTS,1,1
+       SET     'P-SLOCBITS,OBITS
+       GET     TBL,P-MATCHLEN
+       ZERO?   STACK \FALSE
+       EQUAL?  PRSA,V?LOOK-INSIDE,V?SEARCH,V?EXAMINE \FALSE
+       CALL    DO-SL,ROOMS,1,1
+       RSTACK  
+
+
+       .FUNCT  DO-SL,OBJ,BIT1,BIT2,BTS
+       ADD     BIT1,BIT2
+       BTST    P-SLOCBITS,STACK \?ELS5
+       CALL    SEARCH-LIST,OBJ,P-TABLE,P-SRCALL
+       RSTACK  
+?ELS5: BTST    P-SLOCBITS,BIT1 \?ELS12
+       CALL    SEARCH-LIST,OBJ,P-TABLE,P-SRCTOP
+       RSTACK  
+?ELS12:        BTST    P-SLOCBITS,BIT2 \TRUE
+       CALL    SEARCH-LIST,OBJ,P-TABLE,P-SRCBOT
+       RSTACK  
+
+
+       .FUNCT  SEARCH-LIST,OBJ,TBL,LVL,FLS,NOBJ
+       FIRST?  OBJ >OBJ \FALSE
+?PRG6: EQUAL?  LVL,P-SRCBOT /?CND8
+       GETPT   OBJ,P?SYNONYM
+       ZERO?   STACK /?CND8
+       CALL    THIS-IT?,OBJ,TBL
+       ZERO?   STACK /?CND8
+       CALL    OBJ-FOUND,OBJ,TBL
+?CND8: EQUAL?  LVL,P-SRCTOP \?THN18
+       FSET?   OBJ,SEARCHBIT /?THN18
+       FSET?   OBJ,SURFACEBIT \?CND13
+?THN18:        FIRST?  OBJ >NOBJ \?CND13
+       FSET?   OBJ,OPENBIT /?THN20
+       FSET?   OBJ,TRANSBIT \?CND13
+?THN20:        FSET?   OBJ,SURFACEBIT \?ELS26
+       PUSH    P-SRCALL
+       JUMP    ?CND22
+?ELS26:        FSET?   OBJ,SEARCHBIT \?ELS28
+       PUSH    P-SRCALL
+       JUMP    ?CND22
+?ELS28:        PUSH    P-SRCTOP
+?CND22:        CALL    SEARCH-LIST,OBJ,TBL,STACK >FLS
+?CND13:        NEXT?   OBJ >OBJ /?PRG6
+       RTRUE   
+
+
+       .FUNCT  OBJ-FOUND,OBJ,TBL,PTR
+       GET     TBL,P-MATCHLEN >PTR
+       ADD     PTR,1
+       PUT     TBL,STACK,OBJ
+       ADD     PTR,1
+       PUT     TBL,P-MATCHLEN,STACK
+       RTRUE   
+
+
+       .FUNCT  TAKE-CHECK
+       GETB    P-SYNTAX,P-SLOC1
+       CALL    ITAKE-CHECK,P-PRSO,STACK
+       ZERO?   STACK /FALSE
+       GETB    P-SYNTAX,P-SLOC2
+       CALL    ITAKE-CHECK,P-PRSI,STACK
+       RSTACK  
+
+
+       .FUNCT  ITAKE-CHECK,TBL,BTS,PTR,OBJ,TAKEN
+       GET     TBL,P-MATCHLEN >PTR
+       ZERO?   PTR /TRUE
+       BTST    BTS,STAKE \TRUE
+?PRG8: DLESS?  'PTR,0 /TRUE
+       ADD     PTR,1
+       GET     TBL,STACK >OBJ
+       EQUAL?  OBJ,IT \?CND15
+       SET     'OBJ,P-IT-OBJECT
+?CND15:        IN?     OBJ,WINNER /?PRG8
+       SET     'PRSO,OBJ
+       FSET?   OBJ,TRYTAKEBIT \?ELS23
+       SET     'TAKEN,TRUE-VALUE
+       JUMP    ?CND21
+?ELS23:        CALL    ITAKE,FALSE-VALUE
+       EQUAL?  STACK,TRUE-VALUE \?ELS25
+       SET     'TAKEN,FALSE-VALUE
+       JUMP    ?CND21
+?ELS25:        SET     'TAKEN,TRUE-VALUE
+?CND21:        ZERO?   TAKEN /?ELS30
+       BTST    BTS,SHAVE \?ELS30
+       PRINTI  "You don't have the "
+       PRINTD  OBJ
+       PRINTI  "."
+       CRLF    
+       RFALSE  
+?ELS30:        ZERO?   TAKEN \?PRG8
+       PRINTI  "(Taken)"
+       CRLF    
+       JUMP    ?PRG8
+
+
+       .FUNCT  MANY-CHECK,LOSS=0,TMP,?TMP1
+       GET     P-PRSO,P-MATCHLEN
+       GRTR?   STACK,1 \?ELS3
+       GETB    P-SYNTAX,P-SLOC1
+       BTST    STACK,SMANY /?ELS3
+       SET     'LOSS,1
+       JUMP    ?CND1
+?ELS3: GET     P-PRSI,P-MATCHLEN
+       GRTR?   STACK,1 \?CND1
+       GETB    P-SYNTAX,P-SLOC2
+       BTST    STACK,SMANY /?CND1
+       SET     'LOSS,2
+?CND1: ZERO?   LOSS /TRUE
+       PRINTI  "You can't use multiple "
+       EQUAL?  LOSS,2 \?CND18
+       PRINTI  "in"
+?CND18:        PRINTI  "direct objects with """
+       GET     P-ITBL,P-VERBN >TMP
+       ZERO?   TMP \?ELS27
+       PRINTI  "tell"
+       JUMP    ?CND25
+?ELS27:        ZERO?   P-OFLAG \?THN32
+       ZERO?   P-MERGED /?ELS31
+?THN32:        GET     TMP,0
+       PRINTB  STACK
+       JUMP    ?CND25
+?ELS31:        GETB    TMP,2 >?TMP1
+       GETB    TMP,3
+       CALL    WORD-PRINT,?TMP1,STACK
+?CND25:        PRINTI  """."
+       CRLF    
+       RFALSE  
+
+
+       .FUNCT  ZMEMQ,ITM,TBL,SIZE=-1,CNT=1
+       ZERO?   TBL /FALSE
+       LESS?   SIZE,0 /?ELS6
+       SET     'CNT,0
+       JUMP    ?CND4
+?ELS6: GET     TBL,0 >SIZE
+?CND4: 
+?PRG9: GET     TBL,CNT
+       EQUAL?  ITM,STACK /TRUE
+       IGRTR?  'CNT,SIZE \?PRG9
+       RFALSE  
+
+
+       .FUNCT  ZMEMQB,ITM,TBL,SIZE,CNT=0
+?PRG1: GETB    TBL,CNT
+       EQUAL?  ITM,STACK /TRUE
+       IGRTR?  'CNT,SIZE \?PRG1
+       RFALSE  
+
+
+       .FUNCT  LIT?,RM,OHERE,LIT=0
+       SET     'P-GWIMBIT,ONBIT
+       SET     'OHERE,HERE
+       SET     'HERE,RM
+       FSET?   RM,ONBIT \?ELS3
+       SET     'LIT,TRUE-VALUE
+       JUMP    ?CND1
+?ELS3: PUT     P-MERGE,P-MATCHLEN,0
+       SET     'P-TABLE,P-MERGE
+       SET     'P-SLOCBITS,-1
+       EQUAL?  OHERE,RM \?CND6
+       CALL    DO-SL,WINNER,1,1
+?CND6: CALL    DO-SL,RM,1,1
+       GET     P-TABLE,P-MATCHLEN
+       GRTR?   STACK,0 \?CND1
+       SET     'LIT,TRUE-VALUE
+?CND1: SET     'HERE,OHERE
+       SET     'P-GWIMBIT,0
+       RETURN  LIT
+
+
+       .FUNCT  PRSO-PRINT,PTR
+       ZERO?   P-MERGED \?THN6
+       GET     P-ITBL,P-NC1 >PTR
+       GET     PTR,0
+       EQUAL?  STACK,W?IT \?ELS5
+?THN6: PRINTI  " "
+       PRINTD  PRSO
+       RTRUE   
+?ELS5: GET     P-ITBL,P-NC1L
+       CALL    BUFFER-PRINT,PTR,STACK,FALSE-VALUE
+       RSTACK  
+
+
+       .FUNCT  PRSI-PRINT,PTR
+       ZERO?   P-MERGED \?THN6
+       GET     P-ITBL,P-NC2 >PTR
+       GET     PTR,0
+       EQUAL?  STACK,W?IT \?ELS5
+?THN6: PRINTI  " "
+       PRINTD  PRSO
+       RTRUE   
+?ELS5: GET     P-ITBL,P-NC2L
+       CALL    BUFFER-PRINT,PTR,STACK,FALSE-VALUE
+       RSTACK  
+
+
+       .FUNCT  THIS-IT?,OBJ,TBL,SYNS,?TMP1
+       FSET?   OBJ,INVISIBLE /FALSE
+       ZERO?   P-NAM /?ELS5
+       GETPT   OBJ,P?SYNONYM >SYNS
+       PTSIZE  SYNS
+       DIV     STACK,2
+       SUB     STACK,1
+       CALL    ZMEMQ,P-NAM,SYNS,STACK
+       ZERO?   STACK /FALSE
+?ELS5: ZERO?   P-ADJ /?ELS9
+       GETPT   OBJ,P?ADJECTIVE >SYNS
+       ZERO?   SYNS /FALSE
+       PTSIZE  SYNS
+       SUB     STACK,1
+       CALL    ZMEMQB,P-ADJ,SYNS,STACK
+       ZERO?   STACK /FALSE
+?ELS9: ZERO?   P-GWIMBIT /TRUE
+       FSET?   OBJ,P-GWIMBIT /TRUE
+       RFALSE  
+
+       .ENDI
diff --git a/parser.zil b/parser.zil
new file mode 100644 (file)
index 0000000..336994b
--- /dev/null
@@ -0,0 +1,1135 @@
+"Parser global variable convention:  All parser globals will 
+  begin with 'P-'.  Local variables are not restricted in any
+  way.
+" 
+<SETG SIBREAKS ".,\"">
+<GLOBAL GWIM-DISABLE <>> 
+<GLOBAL PRSA 0>
+<GLOBAL PRSI 0>
+
+<GLOBAL PRSO 0>
+
+<GLOBAL P-TABLE 0>  
+<GLOBAL P-ONEOBJ 0> 
+<GLOBAL P-SYNTAX 0> 
+<GLOBAL P-CCSRC 0>  
+<GLOBAL P-LEN 0>    
+<GLOBAL P-DIR 0>    
+<GLOBAL HERE 0>
+<GLOBAL WINNER 0>   
+<GLOBAL P-LEXV <ITABLE BYTE 120>>
+;"INBUF - Input buffer for READ"   
+<GLOBAL P-INBUF <ITABLE BYTE 100>>
+;"Parse-cont variable"  
+<GLOBAL P-CONT <>>  
+<GLOBAL P-IT-OBJECT <>>
+<GLOBAL P-IT-LOC <>>
+
+;"Orphan flag" 
+<GLOBAL P-OFLAG <>> 
+<GLOBAL P-MERGED <>>
+
+<GLOBAL P-ACLAUSE <>>    
+<GLOBAL P-ANAM <>>  
+<GLOBAL P-AADJ <>>
+;"Parser variables and temporaries"
+<CONSTANT P-PHRLEN 3>    
+<CONSTANT P-ORPHLEN 7>   
+<CONSTANT P-RTLEN 3>
+;"Byte offset to # of entries in LEXV"
+\f
+<CONSTANT P-LEXWORDS 1>
+;"Word offset to start of LEXV entries" 
+<CONSTANT P-LEXSTART 1>
+;"Number of words per LEXV entry"  
+<CONSTANT P-LEXELEN 2>   
+<CONSTANT P-WORDLEN 4>
+;"Offset to parts of speech byte"   
+<CONSTANT P-PSOFF 4>
+;"Offset to first part of speech"
+<CONSTANT P-P1OFF 5>
+;"First part of speech bit mask in PSOFF byte"  
+<CONSTANT P-P1BITS 3>    
+<CONSTANT P-ITBLLEN 9>   
+<GLOBAL P-ITBL <TABLE 0 0 0 0 0 0 0 0 0 0>>  
+<GLOBAL P-OTBL <TABLE 0 0 0 0 0 0 0 0 0 0>>  
+<GLOBAL P-VTBL <TABLE 0 0 0 0>>
+
+<GLOBAL P-NCN 0>    
+<CONSTANT P-VERB 0> 
+<CONSTANT P-VERBN 1>
+<CONSTANT P-PREP1 2>
+<CONSTANT P-PREP1N 3>    
+<CONSTANT P-PREP2 4>
+<CONSTANT P-PREP2N 5>    
+<CONSTANT P-NC1 6>  
+<CONSTANT P-NC1L 7> 
+<CONSTANT P-NC2 8>  
+<CONSTANT P-NC2L 9> 
+<GLOBAL QUOTE-FLAG <>>
+
+" Grovel down the input finding the verb, prepositions, and noun clauses.
+   If the input is <direction> or <walk> <direction>, fall out immediately
+   setting PRSA to ,V?WALK and PRSO to <direction>.  Otherwise, perform
+   all required orphaning, syntax checking, and noun clause lookup."   
+\f
+<ROUTINE PARSER ("AUX" (PTR ,P-LEXSTART) WRD (VAL 0) (VERB <>)
+                      LEN (DIR <>) (NW 0) (LW 0) NUM SCNT (CNT -1)) 
+       <REPEAT ()
+               <COND (<G? <SET CNT <+ .CNT 1>> ,P-ITBLLEN> <RETURN>)
+                     (T <PUT ,P-ITBL .CNT 0>)>>
+       <SETG P-ADVERB <>>
+       <SETG P-MERGED <>>
+       <PUT ,P-PRSO ,P-MATCHLEN 0>
+       <PUT ,P-PRSI ,P-MATCHLEN 0>
+       <PUT ,P-BUTS ,P-MATCHLEN 0>
+       <COND (<AND <NOT ,QUOTE-FLAG> <N==? ,WINNER ,PLAYER>>
+              <SETG WINNER ,PLAYER>
+              <COND (<NOT <FSET? <LOC ,WINNER> ,VEHBIT>>
+                     <SETG HERE <LOC ,WINNER>>)>)>
+       <COND (,P-CONT
+              <SET PTR ,P-CONT>
+              <COND (<AND <NOT ,SUPER-BRIEF> <==? ,PLAYER ,WINNER>>
+                     <CRLF>)>
+              <SETG P-CONT <>>)
+             (T
+              <SETG WINNER ,PLAYER>
+              <SETG QUOTE-FLAG <>>
+              <COND (<NOT <FSET? <LOC ,WINNER> ,VEHBIT>>
+                     <SETG HERE <LOC ,WINNER>>)>
+              <COND (<NOT ,SUPER-BRIEF> <CRLF>)>
+              <TELL ">">
+              <READ ,P-INBUF ,P-LEXV>)>
+       <SETG P-LEN <GETB ,P-LEXV ,P-LEXWORDS>>
+       <COND (<0? ,P-LEN> <TELL "I beg your pardon?" CR> <RFALSE>)>
+       <SET LEN ,P-LEN>
+       <SETG P-DIR <>>
+       <SETG P-NCN 0>
+       <SETG P-GETFLAGS 0>
+       <REPEAT ()
+               <COND (<L? <SETG P-LEN <- ,P-LEN 1>> 0>
+                      <SETG QUOTE-FLAG <>>
+                      <RETURN>)
+                     (<OR <SET WRD <GET ,P-LEXV .PTR>>
+                          <SET WRD <NUMBER? .PTR>>>
+                      <COND (<AND <==? .WRD ,W?TO>
+                                  <EQUAL? .VERB ,ACT?TELL ;,ACT?ASK>>
+                             <SET WRD ,W?QUOTE>)
+                            (<AND <==? .WRD ,W?THEN>
+                                  <NOT .VERB>>
+                             <PUT ,P-ITBL ,P-VERB ,ACT?TELL>
+                             <PUT ,P-ITBL ,P-VERBN 0>
+                             <SET WRD ,W?QUOTE>)>
+                      <COND ;(<AND <EQUAL? .WRD ,W?PERIOD>
+                                  <EQUAL? .LW ,W?MRS ,W?MR ,W?MS>>
+                             <SET LW 0>)
+                            (<OR <EQUAL? .WRD ,W?THEN ,W?PERIOD>
+                                 <EQUAL? .WRD ,W?QUOTE>> 
+                             <COND (<EQUAL? .WRD ,W?QUOTE>
+                                    <COND (,QUOTE-FLAG
+                                           <SETG QUOTE-FLAG <>>)
+                                          (T <SETG QUOTE-FLAG T>)>)>
+                             <OR <0? ,P-LEN>
+                                 <SETG P-CONT <+ .PTR ,P-LEXELEN>>>
+                             <PUTB ,P-LEXV ,P-LEXWORDS ,P-LEN>
+                             <RETURN>)
+                            (<AND <SET VAL
+                                       <WT? .WRD
+                                            ,PS?DIRECTION
+                                            ,P1?DIRECTION>>
+                                  <EQUAL? .VERB <> ,ACT?WALK>
+                                  <OR <==? .LEN 1>
+                                      <AND <==? .LEN 2> <==? .VERB ,ACT?WALK>>
+                                      <AND <EQUAL? <SET NW
+                                                    <GET ,P-LEXV
+                                                         <+ .PTR ,P-LEXELEN>>>
+                                                   ,W?THEN
+                                                   ,W?PERIOD
+                                                   ,W?QUOTE>
+                                           <NOT <L? .LEN 2>>>
+                                      <AND ,QUOTE-FLAG
+                                           <==? .LEN 2>
+                                           <EQUAL? .NW ,W?QUOTE>>
+                                      <AND <G? .LEN 2>
+                                           <EQUAL? .NW ,W?COMMA ,W?AND>>>>
+                             <SET DIR .VAL>
+                             <COND (<EQUAL? .NW ,W?COMMA ,W?AND>
+                                    <PUT ,P-LEXV
+                                         <+ .PTR ,P-LEXELEN>
+                                         ,W?THEN>)>
+                             <COND (<NOT <G? .LEN 2>>
+                                    <SETG QUOTE-FLAG <>>
+                                    <RETURN>)>)
+                            (<AND <SET VAL <WT? .WRD ,PS?VERB ,P1?VERB>>
+                                  <NOT .VERB> ;<OR <NOT .VERB>
+                                      <EQUAL? .VERB ,ACT?WHAT>>>
+                             <SET VERB .VAL>
+                             <PUT ,P-ITBL ,P-VERB .VAL>
+                             <PUT ,P-ITBL ,P-VERBN ,P-VTBL>
+                             <PUT ,P-VTBL 0 .WRD>
+                             <PUTB ,P-VTBL 2 <GETB ,P-LEXV
+                                                   <SET NUM
+                                                        <+ <* .PTR 2> 2>>>>
+                             <PUTB ,P-VTBL 3 <GETB ,P-LEXV <+ .NUM 1>>>)
+                            (<OR <SET VAL <WT? .WRD ,PS?PREPOSITION 0>>
+                                 <AND <OR <EQUAL? .WRD ,W?ALL ,W?ONE ,W?A>
+                                          <WT? .WRD ,PS?ADJECTIVE>
+                                          <WT? .WRD ,PS?OBJECT>>
+                                      <SET VAL 0>>>
+                             <COND (<AND <G? ,P-LEN 0>
+                                         <==? <GET ,P-LEXV
+                                                   <+ .PTR ,P-LEXELEN>>
+                                              ,W?OF>
+                                         ;<NOT <EQUAL? .VERB ,ACT?ACCUSE>>
+                                         <0? .VAL>
+                                         <NOT
+                                          <EQUAL? .WRD ,W?ALL ,W?ONE ,W?A>>>)
+                                   (<AND <NOT <0? .VAL>>
+                                         <OR <0? ,P-LEN>
+                                             <EQUAL? <GET ,P-LEXV <+ .PTR 2>>
+                                                     ,W?THEN ,W?PERIOD>>>
+                                    <COND (<L? ,P-NCN 2>
+                                           <PUT ,P-ITBL ,P-PREP1 .VAL>
+                                           <PUT ,P-ITBL ,P-PREP1N .WRD>)>)
+                                   (<==? ,P-NCN 2>
+                                    <TELL
+"There were too many nouns in that sentence." CR>
+                                    <RFALSE>)
+                                   (T
+                                    <SETG P-NCN <+ ,P-NCN 1>>
+                                    <OR <SET PTR <CLAUSE .PTR .VAL .WRD>>
+                                        <RFALSE>>
+                                    <COND (<L? .PTR 0>
+                                           <SETG QUOTE-FLAG <>>
+                                           <RETURN>)>)>)
+                            ;(<OR <EQUAL? .WRD ,W?CAREFULLY ,W?QUIETLY>
+                                 <EQUAL? .WRD ,W?SLOWLY ,W?QUICKLY
+                                               ,W?BRIEFLY>>
+                             <SETG P-ADVERB .WRD>)
+                            (<WT? .WRD ,PS?BUZZ-WORD>)
+                            (T
+                             <CANT-USE .PTR>
+                             <RFALSE>)>)
+                     (T
+                      <UNKNOWN-WORD .PTR>
+                      <RFALSE>)>
+               <SET LW .WRD>
+               <SET PTR <+ .PTR ,P-LEXELEN>>>
+       <COND (.DIR
+              <SETG PRSA ,V?WALK>
+              <SETG PRSO .DIR>
+              <SETG P-WALK-DIR .DIR>
+              <RETURN T>)>
+       <SETG P-WALK-DIR <>>
+       <COND (,P-OFLAG <ORPHAN-MERGE>)>
+       ;<COND (<==? <GET ,P-ITBL ,P-VERB> 0> <PUT ,P-ITBL ,P-VERB ,ACT?CALL>)>
+       <COND (<AND <SYNTAX-CHECK> <SNARF-OBJECTS> <TAKE-CHECK> <MANY-CHECK>>
+              T)>>
+
+
+<GLOBAL P-WALK-DIR <>>
+
+;"Check whether word pointed at by PTR is the correct part of speech.
+   The second argument is the part of speech (,PS?<part of speech>).  The
+   3rd argument (,P1?<part of speech>), if given, causes the value
+   for that part of speech to be returned." 
+\f
+<ROUTINE WT? (PTR BIT "OPTIONAL" (B1 5) "AUX" (OFFS ,P-P1OFF) TYP) 
+       <COND (<BTST <SET TYP <GETB .PTR ,P-PSOFF>> .BIT>
+              <COND (<G? .B1 4> <RTRUE>)
+                    (T
+                     <SET TYP <BAND .TYP ,P-P1BITS>>
+                     <COND (<NOT <==? .TYP .B1>> <SET OFFS <+ .OFFS 1>>)>
+                     <GETB .PTR .OFFS>)>)>>
+;" Scan through a noun clause, leave a pointer to its starting location"
+<ROUTINE CLAUSE (PTR VAL WRD "AUX" OFF NUM (ANDFLG <>) (FIRST?? T) NW (LW 0)) 
+       #DECL ((PTR VAL OFF NUM) FIX (WRD NW) <OR FALSE FIX TABLE>
+              (ANDFLG FIRST??) <OR ATOM FALSE>)
+       <SET OFF <* <- ,P-NCN 1> 2>>
+       <COND (<NOT <==? .VAL 0>>
+              <PUT ,P-ITBL <SET NUM <+ ,P-PREP1 .OFF>> .VAL>
+              <PUT ,P-ITBL <+ .NUM 1> .WRD>
+              <SET PTR <+ .PTR ,P-LEXELEN>>)
+             (T <SETG P-LEN <+ ,P-LEN 1>>)>
+       <COND (<0? ,P-LEN> <SETG P-NCN <- ,P-NCN 1>> <RETURN -1>)>
+       <PUT ,P-ITBL <SET NUM <+ ,P-NC1 .OFF>> <REST ,P-LEXV <* .PTR 2>>>
+       <COND (<EQUAL? <GET ,P-LEXV .PTR> ,W?THE ,W?A ,W?AN>
+              <PUT ,P-ITBL .NUM <REST <GET ,P-ITBL .NUM> 4>>)>
+       <REPEAT ()
+               <COND (<L? <SETG P-LEN <- ,P-LEN 1>> 0>
+                      <PUT ,P-ITBL <+ .NUM 1> <REST ,P-LEXV <* .PTR 2>>>
+                      <RETURN -1>)>
+               <COND (<OR <SET WRD <GET ,P-LEXV .PTR>>
+                          <SET WRD <NUMBER? .PTR>>>
+                      <COND (<0? ,P-LEN> <SET NW 0>)
+                            (T <SET NW <GET ,P-LEXV <+ .PTR ,P-LEXELEN>>>)>
+                      ;<COND (<AND <==? .WRD ,W?OF>
+                                  <==? <GET ,P-ITBL ,P-VERB> ,ACT?ACCUSE>>
+                             <PUT ,P-LEXV .PTR ,W?WITH>
+                             <SET WRD ,W?WITH>)>
+                      <COND ;(<AND <EQUAL? .WRD ,W?PERIOD>
+                                  <EQUAL? .LW ,W?MRS ,W?MR ,W?MS>>
+                             <SET LW 0>)
+                            (<EQUAL? .WRD ,W?AND ,W?COMMA> <SET ANDFLG T>)
+                            (<EQUAL? .WRD ,W?ALL ,W?ONE>
+                             <COND (<==? .NW ,W?OF>
+                                    <SETG P-LEN <- ,P-LEN 1>>
+                                    <SET PTR <+ .PTR ,P-LEXELEN>>)>)
+                            (<OR <EQUAL? .WRD ,W?THEN ,W?PERIOD>
+                                 <AND <WT? .WRD ,PS?PREPOSITION>
+                                      <NOT .FIRST??>>>
+                             <SETG P-LEN <+ ,P-LEN 1>>
+                             <PUT ,P-ITBL
+                                  <+ .NUM 1>
+                                  <REST ,P-LEXV <* .PTR 2>>>
+                             <RETURN <- .PTR ,P-LEXELEN>>)
+                            (<WT? .WRD ,PS?OBJECT>
+                             <COND (<AND <WT? .WRD
+                                              ,PS?ADJECTIVE
+                                              ,P1?ADJECTIVE>
+                                         <NOT <==? .NW 0>>
+                                         <WT? .NW ,PS?OBJECT>>)
+                                   (<AND <NOT .ANDFLG>
+                                         <NOT <EQUAL? .NW ,W?BUT ,W?EXCEPT>>
+                                         <NOT <EQUAL? .NW ,W?AND ,W?COMMA>>>
+                                    <PUT ,P-ITBL
+                                         <+ .NUM 1>
+                                         <REST ,P-LEXV <* <+ .PTR 2> 2>>>
+                                    <RETURN .PTR>)
+                                   (T <SET ANDFLG <>>)>)
+                            (<OR <WT? .WRD ,PS?ADJECTIVE>
+                                 <WT? .WRD ,PS?BUZZ-WORD>>)
+                            (<AND .ANDFLG
+                                  <OR <WT? .WRD ,PS?DIRECTION>
+                                      <WT? .WRD ,PS?VERB>>>
+                             <SET PTR <- .PTR 4>>
+                             <PUT ,P-LEXV <+ .PTR 2> ,W?THEN>
+                             <SETG P-LEN <+ ,P-LEN 2>>)
+                            (<WT? .WRD ,PS?PREPOSITION> T)
+                            (T
+                             <CANT-USE .PTR>
+                             <RFALSE>)>)
+                     (T <UNKNOWN-WORD .PTR> <RFALSE>)>
+               <SET LW .WRD>
+               <SET FIRST?? <>>
+               <SET PTR <+ .PTR ,P-LEXELEN>>>> 
+
+<ROUTINE NUMBER? (PTR "AUX" CNT BPTR CHR (SUM 0) (TIM <>))
+        <SET CNT <GETB <REST ,P-LEXV <* .PTR 2>> 2>>
+        <SET BPTR <GETB <REST ,P-LEXV <* .PTR 2>> 3>>
+        <REPEAT ()
+                <COND (<L? <SET CNT <- .CNT 1>> 0> <RETURN>)
+                      (T
+                       <SET CHR <GETB ,P-INBUF .BPTR>>
+                       <COND (<==? .CHR 58>
+                              <SET TIM .SUM>
+                              <SET SUM 0>)
+                             (<G? .SUM 10000> <RFALSE>)
+                             (<AND <L? .CHR 58> <G? .CHR 47>>
+                              <SET SUM <+ <* .SUM 10> <- .CHR 48>>>)
+                             (T <RFALSE>)>
+                       <SET BPTR <+ .BPTR 1>>)>>
+        <PUT ,P-LEXV .PTR ,W?INTNUM>
+        <COND (<G? .SUM 1000> <RFALSE>)
+              (.TIM
+               <COND (<L? .TIM 8> <SET TIM <+ .TIM 12>>)
+                     (<G? .TIM 23> <RFALSE>)>
+               <SET SUM <+ .SUM <* .TIM 60>>>)>
+        <SETG P-NUMBER .SUM>
+        ,W?INTNUM>
+
+<GLOBAL P-NUMBER 0>
+<GLOBAL P-DIRECTION 0>
+
+\f
+<ROUTINE ORPHAN-MERGE ("AUX" (CNT -1) TEMP VERB BEG END (ADJ <>) WRD) 
+   #DECL ((CNT TEMP VERB) FIX (BEG END) <PRIMTYPE VECTOR> (WRD) TABLE)
+   <SETG P-OFLAG <>>
+   <COND
+    (<AND <NOT <0? <SET VERB <GET ,P-ITBL ,P-VERB>>>>
+         <NOT <==? .VERB <GET ,P-OTBL ,P-VERB>>>>
+     <RFALSE>)
+    (<==? ,P-NCN 2>
+     <RFALSE>)
+    (<==? <GET ,P-OTBL ,P-NC1> 1>
+     <COND (<OR <==? <SET TEMP <GET ,P-ITBL ,P-PREP1>> <GET ,P-OTBL ,P-PREP1>>
+               <0? .TEMP>>
+           <PUT ,P-OTBL ,P-NC1 <GET ,P-ITBL ,P-NC1>>
+           <PUT ,P-OTBL ,P-NC1L <GET ,P-ITBL ,P-NC1L>>)
+          (T <RFALSE>)>)
+    (<==? <GET ,P-OTBL ,P-NC2> 1>
+     <COND (<OR <==? <SET TEMP <GET ,P-ITBL ,P-PREP1>> <GET ,P-OTBL ,P-PREP2>>
+               <0? .TEMP>>
+           <PUT ,P-OTBL ,P-NC2 <GET ,P-ITBL ,P-NC1>>
+           <PUT ,P-OTBL ,P-NC2L <GET ,P-ITBL ,P-NC1L>>
+           <SETG P-NCN 2>)
+          (T <RFALSE>)>)
+    (,P-ACLAUSE
+     <COND
+      (<NOT <==? ,P-NCN 1>> <SETG P-ACLAUSE <>> <RFALSE>)
+      (T
+       <SET BEG <GET ,P-ITBL ,P-NC1>>
+       <SET END <GET ,P-ITBL ,P-NC1L>>
+       <REPEAT ()
+              <COND (<==? .BEG .END>
+                     <COND (.ADJ
+                            <ACLAUSE-WIN .ADJ>
+                            <RETURN>)
+                           (T
+                            <SETG P-ACLAUSE <>>
+                            <RFALSE>)>)
+                    (<AND <NOT .ADJ>
+                          <BTST <GETB <SET WRD <GET .BEG 0>> ,P-PSOFF>
+                                ,PS?ADJECTIVE>>
+                     <SET ADJ .WRD>)
+                    (<OR <BTST <GETB .WRD ,P-PSOFF> ,PS?OBJECT>
+                         <==? .WRD ,W?ONE>>
+                     <COND (<NOT <EQUAL? .WRD ,P-ANAM ,W?ONE>> <RFALSE>)
+                           (T
+                            <ACLAUSE-WIN .ADJ>
+                            <RETURN>)>)>
+              <SET BEG <REST .BEG ,P-WORDLEN>>>)>)>
+   <REPEAT ()
+          <COND (<G? <SET CNT <+ .CNT 1>> ,P-ITBLLEN>
+                 <SETG P-MERGED T>
+                 <RTRUE>)
+                (T <PUT ,P-ITBL .CNT <GET ,P-OTBL .CNT>>)>>
+   T>
+
+<ROUTINE ACLAUSE-WIN (ADJ)
+        <SETG P-CCSRC ,P-OTBL>
+        <CLAUSE-COPY ,P-ACLAUSE <+ ,P-ACLAUSE 1> .ADJ>
+        <AND <NOT <==? <GET ,P-OTBL ,P-NC2> 0>>
+             <SETG P-NCN 2>>
+        <SETG P-ACLAUSE <>>
+        <RTRUE>>
+
+;"Print undefined word in input.
+   PTR points to the unknown word in P-LEXV"   
+\f
+<ROUTINE WORD-PRINT (CNT BUF)
+        <REPEAT ()
+                <COND (<DLESS? CNT 0> <RETURN>)
+                      (ELSE
+                       <PRINTC <GETB ,P-INBUF .BUF>>
+                       <SET BUF <+ .BUF 1>>)>>>
+
+<ROUTINE UNKNOWN-WORD (PTR "AUX" BUF) 
+       #DECL ((PTR BUF) FIX)
+       <COND (<VERB? SAY>
+              <TELL "Nothing happens." CR>
+              <RFALSE>)>
+       <TELL "I don't know the word \"">
+       <WORD-PRINT <GETB <REST ,P-LEXV <SET BUF <* .PTR 2>>> 2>
+                   <GETB <REST ,P-LEXV .BUF> 3>>
+       <TELL "\"." CR>
+       <SETG QUOTE-FLAG <>>
+       <SETG P-OFLAG <>>>
+
+<ROUTINE CANT-USE (PTR "AUX" BUF) 
+       #DECL ((PTR BUF) FIX)
+       <COND (<VERB? SAY>
+              <TELL "Nothing happens." CR>
+              <RFALSE>)>
+       <TELL "You used the word \"">
+       <WORD-PRINT <GETB <REST ,P-LEXV <SET BUF <* .PTR 2>>> 2>
+                   <GETB <REST ,P-LEXV .BUF> 3>>
+       <TELL "\" in a way that I don't understand." CR>
+       <SETG QUOTE-FLAG <>>
+       <SETG P-OFLAG <>>>
+
+;" Perform syntax matching operations, using P-ITBL as the source of
+   the verb and adjectives for this input.  Returns false if no
+   syntax matches, and does it's own orphaning.  If return is true,
+   the syntax is saved in P-SYNTAX."   
+<GLOBAL P-SLOCBITS 0>    
+<CONSTANT P-SYNLEN 8>    
+<CONSTANT P-SBITS 0>
+<CONSTANT P-SPREP1 1>    
+<CONSTANT P-SPREP2 2>    
+<CONSTANT P-SFWIM1 3>    
+<CONSTANT P-SFWIM2 4>    
+<CONSTANT P-SLOC1 5>
+<CONSTANT P-SLOC2 6>
+<CONSTANT P-SACTION 7>   
+<CONSTANT P-SONUMS 3>    
+\f
+<ROUTINE SYNTAX-CHECK ("AUX" SYN LEN NUM OBJ (DRIVE1 <>) (DRIVE2 <>) PREP VERB TMP) 
+       #DECL ((DRIVE1 DRIVE2) <OR FALSE <PRIMTYPE VECTOR>>
+              (SYN) <PRIMTYPE VECTOR> (LEN NUM VERB PREP) FIX
+              (OBJ) <OR FALSE OBJECT>)
+       <COND (<0? <SET VERB <GET ,P-ITBL ,P-VERB>>>
+              <TELL "There was no verb in that sentence!" CR>
+              <RFALSE>)>
+       <SET SYN <GET ,VERBS <- 255 .VERB>>>
+       <SET LEN <GETB .SYN 0>>
+       <SET SYN <REST .SYN>>
+       <REPEAT ()
+               <SET NUM <BAND <GETB .SYN ,P-SBITS> ,P-SONUMS>>
+               <COND (<AND <NOT <L? .NUM 1>>
+                           <0? ,P-NCN>
+                           <OR <0? <SET PREP <GET ,P-ITBL ,P-PREP1>>>
+                               <==? .PREP <GETB .SYN ,P-SPREP1>>>>
+                      <SET DRIVE1 .SYN>)
+                     (<==? <GETB .SYN ,P-SPREP1> <GET ,P-ITBL ,P-PREP1>>
+                      <COND (<AND <==? .NUM 2> <==? ,P-NCN 1>>
+                             <SET DRIVE2 .SYN>)
+                            (<==? <GETB .SYN ,P-SPREP2> <GET ,P-ITBL ,P-PREP2>>
+                             <SYNTAX-FOUND .SYN>
+                             <RTRUE>)>)>
+               <COND (<DLESS? LEN 1>
+                      <COND (<OR .DRIVE1 .DRIVE2> <RETURN>)
+                            (T
+                             <TELL "That sentence isn't one I recognize." CR>
+                             <RFALSE>)>)
+                     (T <SET SYN <REST .SYN ,P-SYNLEN>>)>>
+       <COND (<AND .DRIVE1
+                   <SET OBJ
+                        <GWIM <GETB .DRIVE1 ,P-SFWIM1>
+                              <GETB .DRIVE1 ,P-SLOC1>
+                              <GETB .DRIVE1 ,P-SPREP1>>>>
+              <PUT ,P-PRSO ,P-MATCHLEN 1>
+              <PUT ,P-PRSO 1 .OBJ>
+              <SYNTAX-FOUND .DRIVE1>)
+             (<AND .DRIVE2
+                   <SET OBJ
+                        <GWIM <GETB .DRIVE2 ,P-SFWIM2>
+                              <GETB .DRIVE2 ,P-SLOC2>
+                              <GETB .DRIVE2 ,P-SPREP2>>>>
+              <PUT ,P-PRSI ,P-MATCHLEN 1>
+              <PUT ,P-PRSI 1 .OBJ>
+              <SYNTAX-FOUND .DRIVE2>)
+             (<EQUAL? .VERB ,ACT?FIND ;,ACT?WHAT>
+          &