enchanter/main.zap
historicalsource fc9385cb7d Final Revision
2019-04-13 21:05:06 -04:00

326 lines
8.1 KiB
Plaintext

.FUNCT GO
START::
?FCN: PUTB P-LEXV,0,59
CALL QUEUE,I-TIRED,MOVES-PER-DAY
PUT STACK,0,1
CALL QUEUE,I-THIRST,41
PUT STACK,0,1
CALL QUEUE,I-HUNGER,67
PUT STACK,0,1
CALL QUEUE,I-TIME,-1
PUT STACK,0,1
CALL QUEUE,I-SCURRY,5
PUT STACK,0,1
CALL QUEUE,I-MUNG-ROOM,50
PUT STACK,0,1
CALL QUEUE,I-GUARDS-ARRIVE,0
PUT STACK,0,1
CALL QUEUE,I-ADVENTURER,0
PUT STACK,0,1
SET 'LIT,TRUE-VALUE
SET 'WINNER,PLAYER
SET 'HERE,WEST-FORK
SET 'P-IT-OBJECT,FALSE-VALUE
FSET? HERE,TOUCHBIT /?CND1
PRINTI "It must be the warlock Krill. The odd disappearances, the mysterious dissolution of regions sacred to the Circle, the lessening of the Powers -- these could only be his handiwork. The Circle gathers and its leader, the esteemed Belboz, reveals to them an ancient document which portends evil days much like our own.
""Krill's evil must be unmade,"" he begins, ""but to send a powerful Enchanter is ill-omened. It would be ruinous to reveal oversoon our full powers."" A ripple of concern spreads over the face of each Enchanter. Belboz pauses, and collects his resolve. ""Have hope! This has been written by a hand far wiser than mine!""
He recites a short spell and you appear. Belboz approaches, transfixing you with his gaze, and hands you the document. The other Enchanters await his decree. ""These words, written ages ago, can have only one meaning. You, a novice Enchanter with but a few simple spells in your Book, must seek out Krill, explore the Castle he has overthrown, and learn his secrets. Only then may his vast evil be lessened or, with good fortune, destroyed.""
The Circle rises and intones a richly woven spell, whose many textures imbue the small, darkened chamber with warmth and hope. There is a surge of power; you are Sent."
CRLF
CRLF
CALL V-VERSION
CRLF
?CND1: MOVE WINNER,HERE
CALL V-LOOK
CALL MAIN-LOOP
JUMP ?FCN
.FUNCT MAIN-LOOP,TRASH
?PRG1: CALL MAIN-LOOP-1 >TRASH
JUMP ?PRG1
.FUNCT MAIN-LOOP-1,ICNT,OCNT,NUM,CNT,OBJ,TBL,V,PTBL,OBJ1,TMP,?TMP1
SET 'CNT,0
SET 'OBJ,FALSE-VALUE
SET 'PTBL,TRUE-VALUE
CALL PARSER >P-WON
ZERO? P-WON /?ELS3
GET P-PRSI,P-MATCHLEN >ICNT
GET P-PRSO,P-MATCHLEN >OCNT
ZERO? P-IT-OBJECT /?CND4
CALL ACCESSIBLE?,P-IT-OBJECT
ZERO? STACK /?CND4
SET 'TMP,FALSE-VALUE
?PRG9: IGRTR? 'CNT,ICNT \?ELS13
JUMP ?REP10
?ELS13: GET P-PRSI,CNT
EQUAL? STACK,IT \?PRG9
PUT P-PRSI,CNT,P-IT-OBJECT
SET 'TMP,TRUE-VALUE
?REP10: ZERO? TMP \?CND19
SET 'CNT,0
?PRG22: IGRTR? 'CNT,OCNT \?ELS26
JUMP ?CND19
?ELS26: GET P-PRSO,CNT
EQUAL? STACK,IT \?PRG22
PUT P-PRSO,CNT,P-IT-OBJECT
?CND19: SET 'CNT,0
?CND4: ZERO? OCNT \?ELS36
PUSH OCNT
JUMP ?CND32
?ELS36: GRTR? OCNT,1 \?ELS38
SET 'TBL,P-PRSO
ZERO? ICNT \?ELS41
SET 'OBJ,FALSE-VALUE
JUMP ?CND39
?ELS41: GET P-PRSI,1 >OBJ
?CND39: PUSH OCNT
JUMP ?CND32
?ELS38: GRTR? ICNT,1 \?ELS45
SET 'PTBL,FALSE-VALUE
SET 'TBL,P-PRSI
GET P-PRSO,1 >OBJ
PUSH ICNT
JUMP ?CND32
?ELS45: PUSH 1
?CND32: SET 'NUM,STACK
ZERO? OBJ \?CND48
EQUAL? ICNT,1 \?CND48
GET P-PRSI,1 >OBJ
?CND48: EQUAL? PRSA,V?WALK \?ELS55
CALL PERFORM,PRSA,PRSO >V
JUMP ?CND53
?ELS55: ZERO? NUM \?ELS57
GETB P-SYNTAX,P-SBITS
BAND STACK,P-SONUMS
ZERO? STACK \?ELS60
CALL PERFORM,PRSA >V
SET 'PRSO,FALSE-VALUE
JUMP ?CND53
?ELS60: ZERO? LIT \?ELS62
PRINTI "It's too dark to see."
CRLF
JUMP ?CND53
?ELS62: PRINTI "There isn't anything to "
GET P-ITBL,P-VERBN >TMP
ZERO? P-OFLAG \?THN72
ZERO? P-MERGED /?ELS71
?THN72: GET TMP,0
PRINTB STACK
JUMP ?CND69
?ELS71: GETB TMP,2 >?TMP1
GETB TMP,3
CALL WORD-PRINT,?TMP1,STACK
?CND69: PRINTI "!"
CRLF
SET 'V,FALSE-VALUE
JUMP ?CND53
?ELS57: SET 'P-NOT-HERE,0
SET 'P-MULT,FALSE-VALUE
GRTR? NUM,1 \?CND80
SET 'P-MULT,TRUE-VALUE
?CND80: SET 'TMP,FALSE-VALUE
?PRG83: IGRTR? 'CNT,NUM \?ELS87
GRTR? P-NOT-HERE,0 \?ELS90
PRINTI "The "
EQUAL? P-NOT-HERE,NUM /?CND93
PRINTI "other "
?CND93: PRINTI "object"
EQUAL? P-NOT-HERE,1 /?CND100
PRINTI "s"
?CND100: PRINTI " that you mentioned "
EQUAL? P-NOT-HERE,1 /?ELS109
PRINTI "are"
JUMP ?CND107
?ELS109: PRINTI "is"
?CND107: PRINTI "n't here."
CRLF
JUMP ?REP84
?ELS90: ZERO? TMP \?REP84
PRINTI "I don't know what you're referring to."
CRLF
JUMP ?REP84
?ELS87: ZERO? PTBL /?ELS126
GET P-PRSO,CNT >OBJ1
JUMP ?CND124
?ELS126: GET P-PRSI,CNT >OBJ1
?CND124: ZERO? PTBL /?ELS134
PUSH OBJ1
JUMP ?CND130
?ELS134: PUSH OBJ
?CND130: SET 'PRSO,STACK
ZERO? PTBL /?ELS142
PUSH OBJ
JUMP ?CND138
?ELS142: PUSH OBJ1
?CND138: SET 'PRSI,STACK
EQUAL? PRSA,V?ERASE-LINE,V?MAKE-LINE \?ELS148
JUMP ?CND146
?ELS148: GRTR? NUM,1 /?THN151
GET P-ITBL,P-NC1
GET STACK,0
EQUAL? STACK,W?ALL \?CND146
?THN151: EQUAL? OBJ1,NOT-HERE-OBJECT \?ELS155
INC 'P-NOT-HERE
JUMP ?PRG83
?ELS155: EQUAL? P-GETFLAGS,P-ALL \?ELS157
EQUAL? PRSA,V?TAKE \?ELS157
LOC OBJ1
EQUAL? STACK,WINNER,HERE,OBJ /?ELS157
JUMP ?PRG83
?ELS157: EQUAL? PRSA,V?TAKE \?ELS161
ZERO? PRSI /?ELS161
GET P-ITBL,P-NC1
GET STACK,0
EQUAL? STACK,W?ALL \?ELS161
IN? PRSO,PRSI /?ELS161
JUMP ?PRG83
?ELS161: EQUAL? OBJ1,IT \?ELS168
PRINTD P-IT-OBJECT
JUMP ?CND166
?ELS168: PRINTD OBJ1
?CND166: PRINTI ": "
?CND146: SET 'TMP,TRUE-VALUE
CALL PERFORM,PRSA,PRSO,PRSI >V
EQUAL? V,M-FATAL \?PRG83
JUMP ?CND53
?REP84:
?CND53: EQUAL? V,M-FATAL /?CND176
LOC WINNER
ZERO? STACK /?CND176
LOC WINNER
GETP STACK,P?ACTION
CALL STACK,M-END >V
?CND176: EQUAL? PRSA,V?SCORE,V?RESTORE,V?SAVE /?CND182
EQUAL? PRSA,V?VERSION \?ELS184
JUMP ?CND182
?ELS184: SET 'L-PRSA,PRSA
SET 'L-PRSO,PRSO
SET 'L-PRSI,PRSI
?CND182: EQUAL? V,M-FATAL \?CND1
SET 'P-CONT,FALSE-VALUE
JUMP ?CND1
?ELS3: SET 'P-CONT,FALSE-VALUE
?CND1: ZERO? P-WON /FALSE
EQUAL? PRSA,V?SUPER-BRIEF,V?BRIEF,V?TELL /TRUE
EQUAL? PRSA,V?VERSION,V?SAVE,V?VERBOSE /TRUE
EQUAL? PRSA,V?RESTART,V?QUIT,V?TIME /TRUE
EQUAL? PRSA,V?UNSCRIPT,V?SCRIPT,V?SCORE /TRUE
EQUAL? PRSA,V?RESTORE /TRUE
CALL CLOCKER >V
RETURN V
.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
CALL ACCESSIBLE?,P-IT-OBJECT
ZERO? STACK \?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
?CND16: SET 'PRSI,I
EQUAL? NOT-HERE-OBJECT,PRSO,PRSI \?ELS23
CALL NOT-HERE-OBJECT-F >V
ZERO? V /?ELS23
SET 'P-WON,FALSE-VALUE
JUMP ?CND21
?ELS23: SET 'O,PRSO
SET 'I,PRSI
GETP WINNER,P?ACTION
CALL STACK >V
ZERO? V /?ELS30
JUMP ?CND21
?ELS30: LOC WINNER
GETP STACK,P?ACTION
CALL STACK,M-BEG >V
ZERO? V /?ELS32
JUMP ?CND21
?ELS32: GET PREACTIONS,A
CALL STACK >V
ZERO? V /?ELS34
JUMP ?CND21
?ELS34: ZERO? I /?ELS36
GETP I,P?ACTION
CALL STACK >V
ZERO? V /?ELS36
JUMP ?CND21
?ELS36: ZERO? O /?ELS40
EQUAL? A,V?WALK /?ELS40
LOC O
ZERO? STACK /?ELS40
LOC O
GETP STACK,P?CONTFCN
CALL STACK >V
ZERO? V /?ELS40
JUMP ?CND21
?ELS40: ZERO? O /?ELS44
EQUAL? A,V?WALK /?ELS44
GETP O,P?ACTION
CALL STACK >V
ZERO? V /?ELS44
JUMP ?CND21
?ELS44: GET ACTIONS,A
CALL STACK >V
ZERO? V /?CND21
?CND21: SET 'PRSA,OA
SET 'PRSO,OO
SET 'PRSI,OI
RETURN V
.FUNCT I-TIME
EQUAL? HASTED?,ME \?ELS3
MOD MOVES,2
ZERO? STACK /TRUE
?ELS3: IGRTR? 'TOD,127 \?CND1
SET 'TOD,0
SUB NIGHTFALL,20 >NIGHTFALL
INC 'LOSSAGE
SUB DUSK,20 >DUSK
ADD MOLESTED,5 >MOLESTED
ADD MUNCHED,5 >MUNCHED
LESS? NIGHTFALL,0 \?CND1
PRINTI "Belboz appears before you, in a magical sending. He speaks, his voice soft and saddened. ""You have failed. Universal night has now fallen. Krill and his creatures now may freely roam the earth. The power of the Circle is diminished, if not broken. I go to prepare the last defense."" The sending vanishes."
CRLF
CALL FINISH
?CND1: EQUAL? TOD,NIGHTFALL \?ELS17
LOC PLAYER
FSET? STACK,ONBIT \?ELS17
PRINTI "The darkened sky is now full of bright stars. It is night."
CRLF
LESS? NIGHTFALL,97 \TRUE
PRINTR "Today seemed shorter than yesterday, somehow."
?ELS17: EQUAL? TOD,SUNRISE \?ELS28
LOC PLAYER
FSET? STACK,ONBIT \?ELS28
PRINTR "The sun has now risen above the hills."
?ELS28: EQUAL? TOD,DUSK \FALSE
LOC PLAYER
FSET? STACK,ONBIT \FALSE
PRINTI "The sun starts to set behind the Lonely Mountain in the west."
CRLF
LESS? NIGHTFALL,97 \TRUE
PRINTR "The day is coming to an end earlier than you would have expected."
.ENDI