-
Notifications
You must be signed in to change notification settings - Fork 27
/
castle.zap
2732 lines (2407 loc) · 72.2 KB
/
castle.zap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.SEGMENT "CASTLE"
.FUNCT LOWER-HALL-ENTER-F,RARG
FSET? OUTER-GATE,OPENBIT /?CTR2
ZERO? TIME-STOPPED /?CCL3
?CTR2: ZERO? RARG \FALSE
ICALL1 RETURN-FROM-MAP
PRINTI "Near the bottom of the flight, the steps are blocked by newly-fallen rubble!"
CRLF
RFALSE
?CCL3: RETURN LOWER-HALL
.FUNCT PROCLAMATION-F
EQUAL? PRSA,V?TAKE \FALSE
FSET? PROCLAMATION,TRYTAKEBIT \FALSE
CALL2 ITAKE,TRUE-VALUE
EQUAL? STACK,M-FATAL /TRUE
PUTP PROCLAMATION,P?ACTION,FALSE-VALUE
PUTP PROCLAMATION,P?OWNER,FALSE-VALUE
FCLEAR PROCLAMATION,TRYTAKEBIT
PRINTR "You rip the decree from the wall."
.FUNCT ENTRANCE-HALL-F,RARG
EQUAL? RARG,M-LOOK \?CCL3
PRINTI "This is where visitors enter the castle proper, through the wide doorway to the north. "
FSET? PORTCULLIS,OPENBIT /?CND4
PRINTI "The doorway is currently blocked by a sturdy portcullis. "
?CND4: PRINTI "Oddly, there is a doorbell on the inside of the doorway. Other doorways lead east, west, and south."
RTRUE
?CCL3: EQUAL? RARG,M-END \FALSE
IN? JESTER,HERE \FALSE
FSET? PORTCULLIS,OPENBIT /FALSE
CALL2 SETUP-ORPHAN,STR?44
RSTACK
.FUNCT DOORBELL-F
EQUAL? PRSA,V?TOUCH,V?PUSH \FALSE
PRINTI """Ding, dong!"""
CRLF
IN? JESTER,HERE /TRUE
SET 'DO-J,TRUE-VALUE
ICALL2 I-JESTER,TRUE-VALUE
RTRUE
.FUNCT PORTCULLIS-F
EQUAL? PRSA,V?EXAMINE \?CCL3
PRINTI "The portcullis, which is a heavy iron latticework used to block this entrance doorway, is "
ICALL2 OPEN-CLOSED,PORTCULLIS
PRINT PERIOD-CR
RTRUE
?CCL3: EQUAL? PRSA,V?OPEN \?CCL5
FSET? PORTCULLIS,OPENBIT /?CCL5
PRINTR "You try to lift the portcullis, but with no effect (aside from nearly breaking your back)."
?CCL5: EQUAL? PRSA,V?CLOSE \FALSE
FSET? PORTCULLIS,OPENBIT \FALSE
PRINT WONT-BUDGE
RTRUE
.ENDSEG
.SEGMENT "VILLAGE"
.FUNCT MOAT-F
CALL2 TOUCHING?,MOAT
ZERO? STACK /FALSE
EQUAL? HERE,PARAPET,UPPER-BARBICAN \FALSE
CALL2 CANT-REACH,MOAT
RSTACK
.FUNCT INNER-BAILEY-F,RARG
ZERO? DEMO-VERSION? /FALSE
EQUAL? RARG,M-END \FALSE
CALL1 END-DEMO
RSTACK
.SEGMENT "0"
.FUNCT WORM-F
EQUAL? PRSA,V?EAT \?CCL3
EQUAL? TURNED-INTO,ROOSTER \?CCL6
CALL2 GOOD-MEAL,WORM
RSTACK
?CCL6: PRINTR "Yukko!"
?CCL3: EQUAL? PRSA,V?RESEARCH \FALSE
CALL NOUN-USED?,WORM,W?WORM,W?EARTHWORM
ZERO? STACK /FALSE
PRINTR """A low form of ground-dwelling animal life."""
.FUNCT I-W-WORM,L
LOC WORM >L
FSET WORM,ANIMATEDBIT
IN? WORM,LAKE-BOTTOM \?CCL3
REMOVE WORM
RTRUE
?CCL3: CALL2 META-LOC,WORM
EQUAL? STACK,HERE \?CCL5
ICALL1 RETURN-FROM-MAP
PRINTI " The worm "
EQUAL? L,PROTAGONIST,HERE /?CCL8
FSET? L,DROPBIT /?CCL8
MOVE WORM,HERE
FSET L,OPENBIT
PRINTI "wriggles out of"
ICALL2 TPRINT,L
JUMP ?CND6
?CCL8: PRINTI "has resumed wriggling"
?CND6: PRINT PERIOD-CR
RTRUE
?CCL5: CALL2 META-LOC,WORM
MOVE WORM,STACK
RFALSE
.ENDSEG
.SEGMENT "VILLAGE"
.FUNCT TREE-F,ARG
EQUAL? ARG,M-WINNER \?CCL3
CALL1 PLANT-STUNNED
RSTACK
?CCL3: EQUAL? PRSA,V?GET-NEAR \?CCL5
PRINTR "You are now standing at the base of the tree."
?CCL5: EQUAL? PRSA,V?LISTEN \?CCL7
ZERO? PLANT-TALKER /?CCL7
EQUAL? PRSO,MIGHTY-ELM \?CCL12
PRINTR "The mighty elm rumbles in a voice that bespeaks great age and weariness. It seems to be pining for its simple, happier, younger days. Most particularly, it seems to be fondly recalling a playful squirrel named ""Rosebud."""
?CCL12: EQUAL? PRSO,SMALL-ELM \?CCL14
PRINTR "The little elm's roots have, apparently, just reached down to a particularly yummy patch of decayed mulch, and the young elm is humming rhapsodically about the yumminess of the minerals therein."
?CCL14: PRINTR "The two elms are exchanging off-color jokes, most of which seem to involve various methods of pollen transfer."
?CCL7: EQUAL? PRSA,V?CLIMB-UP,V?CLIMB \?CCL16
EQUAL? PRSO,SMALL-ELM \?CCL19
PRINTR "Your weight is too much for this little tree."
?CCL19: PRINT POORLY-CONFIGURED
RTRUE
?CCL16: EQUAL? PRSA,V?LISTEN \?CCL21
ZERO? PLANT-TALKER /?CCL21
PRINTR "The tree's speech is very childlike and difficult to understand, but it seems to be fantasizing about the day when it will be tall enough to see over the castle walls."
?CCL21: EQUAL? PRSA,V?MEASURE \FALSE
PRINTI "You can"
EQUAL? PRSO,MIGHTY-ELM \?CCL28
PRINTI "'t come close to getting"
JUMP ?CND26
?CCL28: EQUAL? PRSO,SMALL-ELM \?CCL31
PRINTI " easily"
JUMP ?CND29
?CCL31: PRINTI " just barely"
?CND29: PRINTI " get"
?CND26: PRINTR " your arms around the tree."
.FUNCT BARBICAN-F,RARG
EQUAL? RARG,M-LOOK \FALSE
PRINTI "This dimly lit room is the bottom level of the gate-tower which guards the castle's drawbridge. It lies at the tip of a peninsula into the moat; the rest of the peninsula is to the southeast. A drawbridge to the northwest is "
ICALL2 OPEN-CLOSED,DRAWBRIDGE
PRINTI ", and a ladder leads to an upper level."
RTRUE
.SEGMENT "0"
.FUNCT CANNONBALL-F
EQUAL? PRSA,V?PUT-ON \FALSE
EQUAL? P-PRSA-WORD,W?DROP \FALSE
EQUAL? PRSO,CANNONBALL \FALSE
MOVE CANNONBALL,HERE
FSET? PRSI,PARTBIT \?CCL9
PRINTR "Ouch!!!"
?CCL9: GETP PRSI,P?SIZE
GRTR? STACK,10 \?CCL11
PRINTR "This has no effect."
?CCL11: PRINTI "Miraculously,"
ICALL1 TPRINT-PRSI
PRINTR " survives."
.ENDSEG
.SEGMENT "VILLAGE"
.FUNCT MURDER-HOLE-F,TAKER
EQUAL? PRSA,V?LOOK-INSIDE \?CCL3
PRINTR "You can just make out the barbican below."
?CCL3: EQUAL? PRSA,V?REACH-IN \?CCL5
PRINT NOTHING-IN-REACH
RTRUE
?CCL5: EQUAL? PRSA,V?PUT-THROUGH,V?PUT \FALSE
EQUAL? PRSI,MURDER-HOLE \FALSE
EQUAL? PRSO,CANNONBALL \?CCL12
CALL2 VISIBLE?,CANDLE
ZERO? STACK /?CCL12
FSET? CANDLE,ONBIT \?CCL12
CALL2 ULTIMATELY-IN?,CANDLE
ZERO? STACK \?CND16
MOVE CANDLE,PROTAGONIST
?CND16: PRINTI "As you drop the cannonball through the murder hole, you hear a sickening ""splat,"" followed by a woman's scream!
""Emily, what is it!""
""It's Victor -- he's been murdered!""
""I'll summon the Inspector! Ah, here he is now!"" You hear whispered questions and answers from the room below, followed by footsteps on the stairs. The jester enters, wearing a trenchcoat and smoking a large pipe.
""I'm afraid I'm going to have to order Sgt. Duffy to place you under arrest, sir."" You grow dizzy with confusion, and your surroundings swirl wildly about you"
PRINT ELLIPSIS
ICALL2 GOTO,DUNGEON
JUMP ?CND10
?CCL12: PRINTI "You hear a ""thunk"" from down below."
CRLF
?CND10: CALL FIND-IN,BARBICAN,WHITEBIT >TAKER
ZERO? TAKER \?CTR19
CALL FIND-IN,BARBICAN,BLACKBIT >TAKER
ZERO? TAKER /?CCL20
?CTR19: MOVE PRSO,TAKER
EQUAL? PRSO,PIGEON \TRUE
ICALL2 MOVE-TO-PERCH,TAKER
RTRUE
?CCL20: MOVE PRSO,BARBICAN
RTRUE
.FUNCT WHEEL-F
EQUAL? PRSA,V?SET-DIR,V?SET \FALSE
FSET? DRAWBRIDGE,OPENBIT \?CCL6
FCLEAR DRAWBRIDGE,OPENBIT
JUMP ?CND4
?CCL6: FSET DRAWBRIDGE,OPENBIT
?CND4: FSET BARBICAN,REDESCBIT
PRINTI "You hear a clattering clanking noise from below."
CRLF
ICALL ROB,DRAWBRIDGE,BARBICAN
RTRUE
.FUNCT DRAWBRIDGE-F,RARG
EQUAL? RARG,M-LOOK \?CCL3
PRINTI "You are standing on a sturdy wooden drawbridge across a moat. "
ZERO? TIME-STOPPED \?CND4
PRINTI "The surface of the moat roils from the thrashing of countless ravenous beasts. "
?CND4: PRINTI "The drawbridge runs from a tall barbican at the southeast to a wide meadow at the northwest."
RTRUE
?CCL3: ZERO? RARG \FALSE
EQUAL? PRSA,V?EXAMINE \?CCL9
PRINTI "The drawbridge is "
ICALL2 OPEN-CLOSED,DRAWBRIDGE
PRINT PERIOD-CR
RTRUE
?CCL9: EQUAL? PRSA,V?LOWER,V?OPEN \?PRD13
FSET? DRAWBRIDGE,OPENBIT \?CCL11
?PRD13: EQUAL? PRSA,V?RAISE,V?CLOSE \FALSE
FSET? DRAWBRIDGE,OPENBIT \FALSE
?CCL11: PRINTR "There's no apparent way to do that."
.ENDSEG
.SEGMENT "CASTLE"
.FUNCT PARLOR-F,RARG
EQUAL? RARG,M-ENTER \FALSE
MOVE SPENSEWEED,FISH-TANK
FCLEAR SPENSEWEED,NDESCBIT
RTRUE
.FUNCT FISH-TANK-F
EQUAL? PRSA,V?TAKE \?CCL3
EQUAL? PRSO,FISH-TANK \?CCL3
ZERO? DESCRIBED-TANK-AS-SMALL /?CCL8
PRINTR "The fish tank is much too large to carry! [Okay, I was exaggerating when I called the tank ""itsy-bitsy.""]"
?CCL8: SET 'DESCRIBED-TANK-AS-LARGE,TRUE-VALUE
PRINTR "This tank is bigger than a lot of swimming pools!"
?CCL3: EQUAL? PRSO,FLAMINGO,ROOSTER,FOX \FALSE
FSET? PRSO,ANIMATEDBIT \FALSE
PRINTI "The "
ICALL2 DPRINT,PRSO
PRINTR " raises such a fuss that it becomes impossible."
.FUNCT SPENSEWEED-F,ARG
EQUAL? ARG,M-WINNER \?CCL3
CALL1 PLANT-STUNNED
RSTACK
?CCL3: IN? PROTAGONIST,DB \?CCL5
CALL2 TOUCHING?,SPENSEWEED
ZERO? STACK /?CCL5
CALL2 CANT-REACH,SPENSEWEED
RSTACK
?CCL5: EQUAL? PRSA,V?DIG,V?TAKE \?CCL9
EQUAL? PRSO,SPENSEWEED \?CCL9
PRINT DEEPLY-ROOTED
RTRUE
?CCL9: EQUAL? PRSA,V?LISTEN \FALSE
ZERO? PLANT-TALKER /FALSE
PRINTR "It's difficult to interpret the gurgly voice of the spenseweed, but it seems to be fretting about the possibility of plant-eating fish being introduced into the aquarium."
.SEGMENT "0"
.FUNCT LOBSTER-F
EQUAL? PRSA,V?RESEARCH \?CCL3
CALL NOUN-USED?,LOBSTER,W?LOBSTER
ZERO? STACK /?CCL3
PRINT STR?304
CRLF
RTRUE
?CCL3: EQUAL? PRSA,V?TAKE \?CCL7
FSET? LOBSTER,ANIMATEDBIT \?CCL7
ZERO? TIME-STOPPED /?CCL12
ICALL QUEUE,I-LOBSTER-PINCH,-1
RFALSE
?CCL12: FSET? GLOVE,WORNBIT \?CCL14
ICALL QUEUE,I-LOBSTER-PINCH,2
MOVE LOBSTER,PROTAGONIST
PRINTR "Your gloved hand moves with blazing speed, lifting the lobster and avoiding its snapping pincers."
?CCL14: PRINTR "The lobster snaps its pincers at you. You snatch your hand away just in time."
?CCL7: EQUAL? PRSA,V?MUNG,V?KILL \?CCL16
EQUAL? PRSI,HAMMER,CANNONBALL \?CCL16
PRINTR "You pulverize the lobster into invisible jelly. Heartless; but then again, I understand there are a large group of people who release boiling these creatures alive."
?CCL16: EQUAL? PRSA,V?EAT \FALSE
FSET? LOBSTER,ANIMATEDBIT \FALSE
PRINTR "1) It's not cooked. 2) It would probably bite your nose off if you tried. 3) You don't have any tableware. 4) You don't have any melted butter. 5) It isn't kosher."
.FUNCT I-W-LOBSTER
ZERO? TIME-STOPPED /?CND1
ICALL QUEUE,I-W-LOBSTER,3
RFALSE
?CND1: FSET LOBSTER,ANIMATEDBIT
IN? LOBSTER,LAKE-BOTTOM \?CCL5
REMOVE LOBSTER
RTRUE
?CCL5: IN? LOBSTER,PROTAGONIST \?CCL7
IN? LOBSTER,WALDO /?CCL7
ICALL1 RETURN-FROM-MAP
PRINTI " Youch! The nutcracker just pinched you! As you drop it, you realize that it has turned back into a lobster."
EQUAL? HERE,HANGING-FROM-ROOTS,UNDER-THE-WORLD \?CCL12
REMOVE LOBSTER
PRINTR " The poor creature plunges into the void."
?CCL12: MOVE LOBSTER,HERE
CRLF
RTRUE
?CCL7: CALL2 VISIBLE?,LOBSTER
ZERO? STACK /FALSE
ICALL1 RETURN-FROM-MAP
PRINTR " You notice the nutcracker waving its pincers. It seems that the nutcracker is once again a lobster."
.FUNCT I-LOBSTER-PINCH
ZERO? TIME-STOPPED \FALSE
FSET? LOBSTER,ANIMATEDBIT \FALSE
ICALL2 DEQUEUE,I-LOBSTER-PINCH
CALL2 ULTIMATELY-IN?,LOBSTER
ZERO? STACK /FALSE
IN? LOBSTER,WALDO /FALSE
ICALL1 RETURN-FROM-MAP
PRINTI " Youch! The lobster gives you a painful nip, and you drop it like a hot potato."
EQUAL? HERE,HANGING-FROM-ROOTS,UNDER-THE-WORLD \?CCL12
REMOVE LOBSTER
PRINTR " The poor creature plunges into the void."
?CCL12: MOVE LOBSTER,HERE
CRLF
RTRUE
.FUNCT STARFISH-F
EQUAL? PRSA,V?RESEARCH \FALSE
CALL NOUN-USED?,STARFISH,W?STARFISH
ZERO? STACK /FALSE
PRINT STR?304
CRLF
RTRUE
.FUNCT I-W-STARFISH
ZERO? TIME-STOPPED /?CND1
ICALL QUEUE,I-W-STARFISH,3
RFALSE
?CND1: FSET STARFISH,ANIMATEDBIT
IN? STARFISH,LAKE-BOTTOM \?CCL5
REMOVE STARFISH
RTRUE
?CCL5: CALL2 VISIBLE?,STARFISH
ZERO? STACK /FALSE
ICALL1 RETURN-FROM-MAP
PRINTR " With the tiniest wiggle, the star gives evidence that it is once again a starfish."
.ENDSEG
.SEGMENT "0"
.SEGMENT "CASTLE"
.FUNCT BICKERING-TORCH-F
EQUAL? PRSA,V?TAKE \?CCL3
ICALL QUEUE,I-BICKERING-TORCH,-1
RFALSE
?CCL3: EQUAL? PRSA,V?BURN,V?ON,V?EXAMINE \FALSE
CALL2 BURNED-OUT,BICKERING-TORCH
RSTACK
.FUNCT BURNED-OUT,OBJ
PRINTI "The "
ICALL2 DPRINT,OBJ
PRINTR " has burned out and cannot be rekindled."
.FUNCT I-BICKERING-TORCH
ZERO? TIME-STOPPED \FALSE
CALL2 ULTIMATELY-IN?,BICKERING-TORCH
ZERO? STACK \?CCL5
ICALL2 DEQUEUE,I-BICKERING-TORCH
RFALSE
?CCL5: RANDOM 100
LESS? 30,STACK /FALSE
EQUAL? CURRENT-SPLIT,MAP-TOP-LEFT-LOC /FALSE
PRINTI " The bickering torch says, """
CALL2 PICK-ONE,BITCHES
PRINT STACK
PRINTR """"
.FUNCT FLICKERING-TORCH-F
EQUAL? PRSA,V?TAKE \?CCL3
FSET? FLICKERING-TORCH,ONBIT \?CCL3
ZERO? FLICKERING-TORCH-COUNT \?CCL3
RANDOM 3
ADD STACK,9 >FLICKERING-TORCH-COUNT
ICALL QUEUE,I-FLICKERING-TORCH,-1
RFALSE
?CCL3: EQUAL? PRSA,V?OFF \?CCL8
FSET? FLICKERING-TORCH,ONBIT \?CCL8
FCLEAR FLICKERING-TORCH,ONBIT
FCLEAR FLICKERING-TORCH,FLAMEBIT
ICALL2 DEQUEUE,I-FLICKERING-TORCH
PRINTI """Pffft."""
CRLF
CALL1 NOW-DARK?
RSTACK
?CCL8: EQUAL? PRSA,V?OFF,V?ON,V?EXAMINE /?PRD14
EQUAL? PRSA,V?BURN \FALSE
?PRD14: FSET? FLICKERING-TORCH,ONBIT /FALSE
CALL2 BURNED-OUT,FLICKERING-TORCH
RSTACK
.FUNCT I-FLICKERING-TORCH
DEC 'FLICKERING-TORCH-COUNT
FSET? FLICKERING-TORCH,ONBIT /?CCL3
PUTP FLICKERING-TORCH,P?SDESC,STR?316
ICALL2 DEQUEUE,I-FLICKERING-TORCH
RFALSE
?CCL3: ZERO? FLICKERING-TORCH-COUNT \?CND1
PUTP FLICKERING-TORCH,P?SDESC,STR?316
FCLEAR FLICKERING-TORCH,ONBIT
FCLEAR FLICKERING-TORCH,FLAMEBIT
ICALL2 DEQUEUE,I-FLICKERING-TORCH
?CND1: CALL2 VISIBLE?,FLICKERING-TORCH
ZERO? STACK /FALSE
FSET? FLICKERING-TORCH,ONBIT /?CCL9
ICALL1 RETURN-FROM-MAP
CALL2 IN-THE-SKY,STR?317
RSTACK
?CCL9: RANDOM 100
LESS? 40,STACK /FALSE
ICALL1 RETURN-FROM-MAP
PRINTR " The flame of the flickering torch dances wildly on the brink of extinction."
.FUNCT IN-THE-SKY,STRING
PRINTI " The "
PRINT STRING
PRINTI "ering torch gives its last "
PRINT STRING
PRINTI "er before going to that great Torch Room in the sky."
CRLF
CALL1 NOW-DARK?
RSTACK
.FUNCT MUTTERING-TORCH-F
EQUAL? PRSA,V?TAKE \?CCL3
ICALL QUEUE,I-MUTTERING-TORCH,-1
RFALSE
?CCL3: EQUAL? PRSA,V?BURN,V?ON,V?EXAMINE \FALSE
CALL2 BURNED-OUT,MUTTERING-TORCH
RSTACK
.FUNCT I-MUTTERING-TORCH
ZERO? TIME-STOPPED \FALSE
CALL2 ULTIMATELY-IN?,MUTTERING-TORCH
ZERO? STACK \?CCL5
ICALL2 DEQUEUE,I-MUTTERING-TORCH
RFALSE
?CCL5: RANDOM 100
LESS? 30,STACK /FALSE
EQUAL? CURRENT-SPLIT,MAP-TOP-LEFT-LOC /FALSE
PRINTI " The muttering torch mutters something about "
CALL2 PICK-ONE,MUTTERS
PRINT STACK
PRINT PERIOD-CR
RTRUE
.FUNCT GUTTERING-TORCH-F
EQUAL? PRSA,V?TAKE \?CCL3
FSET? GUTTERING-TORCH,ONBIT \?CCL3
ZERO? GUTTERING-TORCH-COUNT \?CCL3
RANDOM 3
ADD STACK,9 >GUTTERING-TORCH-COUNT
ICALL QUEUE,I-GUTTERING-TORCH,-1
RFALSE
?CCL3: EQUAL? PRSA,V?OFF \?CCL8
FSET? GUTTERING-TORCH,ONBIT \?CCL8
FCLEAR GUTTERING-TORCH,ONBIT
FCLEAR GUTTERING-TORCH,FLAMEBIT
ICALL2 DEQUEUE,I-GUTTERING-TORCH
PRINTI """Pffft."""
CRLF
CALL1 NOW-DARK?
RSTACK
?CCL8: EQUAL? PRSA,V?OFF,V?ON,V?EXAMINE /?PRD14
EQUAL? PRSA,V?BURN \FALSE
?PRD14: FSET? GUTTERING-TORCH,ONBIT /FALSE
CALL2 BURNED-OUT,GUTTERING-TORCH
RSTACK
.FUNCT I-GUTTERING-TORCH
DEC 'GUTTERING-TORCH-COUNT
FSET? GUTTERING-TORCH,ONBIT /?CCL3
PUTP GUTTERING-TORCH,P?SDESC,STR?324
ICALL2 DEQUEUE,I-GUTTERING-TORCH
RFALSE
?CCL3: ZERO? GUTTERING-TORCH-COUNT \?CND1
PUTP GUTTERING-TORCH,P?SDESC,STR?324
FCLEAR GUTTERING-TORCH,ONBIT
FCLEAR GUTTERING-TORCH,FLAMEBIT
ICALL2 DEQUEUE,I-GUTTERING-TORCH
?CND1: CALL2 VISIBLE?,GUTTERING-TORCH
ZERO? STACK /FALSE
FSET? GUTTERING-TORCH,ONBIT /?CCL9
ICALL1 RETURN-FROM-MAP
CALL2 IN-THE-SKY,STR?325
RSTACK
?CCL9: RANDOM 100
LESS? 40,STACK /FALSE
ICALL1 RETURN-FROM-MAP
PRINTR " The guttering torch sputters on the verge of burning out, but then decides to keep burning for at least another minute."
.ENDSEG
.SEGMENT "CASTLE"
.FUNCT GARDEN-FLOWER-PS
EQUAL? PRSA,V?PICK \?CCL3
PRINTR "Ouch! Thorns!"
?CCL3: EQUAL? PRSA,V?EXAMINE \?CCL5
PRINTR "Breathtakingly beautiful."
?CCL5: EQUAL? PRSA,V?LISTEN \FALSE
ZERO? PLANT-TALKER /FALSE
CALL2 PERFORM-PRSA,FLORA
RSTACK
.FUNCT FLORA-F,ARG
EQUAL? ARG,M-WINNER \?CCL3
CALL1 PLANT-STUNNED
RSTACK
?CCL3: EQUAL? PRSA,V?EXAMINE \?CCL5
PRINTR "Breathtakingly beautiful."
?CCL5: EQUAL? PRSA,V?LISTEN \FALSE
ZERO? PLANT-TALKER /FALSE
PRINTR "The many shrub and trees and flowers create a cacophony of plant-talk that makes it impossible to understand any of it!"
.SEGMENT "0"
.FUNCT FLAMINGO-F,ARG
FSET? FLAMINGO,ANIMATEDBIT \FALSE
EQUAL? PRSA,V?RESEARCH \?CCL5
CALL NOUN-USED?,FLAMINGO,W?FLAMINGO
ZERO? STACK /?CCL5
PRINTR """A common garden animal."""
?CCL5: EQUAL? PRSA,V?FEED \?CCL9
CALL2 ULTIMATELY-IN?,BAR-OF-FOOD
ZERO? STACK /?CCL9
ICALL PERFORM,V?GIVE,BAR-OF-FOOD,FLAMINGO
RTRUE
?CCL9: EQUAL? PRSA,V?SHOW \?CCL13
EQUAL? PRSO,BAR-OF-FOOD \?CCL13
PRINTR "The flamingo feigns disinterest, but vast volumes of drool betray its true feelings."
?CCL13: EQUAL? PRSA,V?GIVE \?CCL17
EQUAL? PRSO,BAR-OF-FOOD \?CCL17
REMOVE BAR-OF-FOOD
PRINTI "The flamingo greedily snatches"
ICALL2 TPRINT,BAR-OF-FOOD
PRINTR " in its beak and gulps it down."
?CCL17: ZERO? TIME-STOPPED \FALSE
EQUAL? PRSA,V?CATCH,V?TAKE \?CCL23
PRINTR "The flamingo prances away, leaving you clutching at air."
?CCL23: EQUAL? PRSA,V?TOUCH \FALSE
PRINTR "The bird nearly nips off a finger."
.FUNCT I-W-FLAMINGO,L
LOC FLAMINGO >L
ZERO? TIME-STOPPED /?CND1
ICALL QUEUE,I-W-FLAMINGO,3
RFALSE
?CND1: FSET FLAMINGO,ANIMATEDBIT
IN? FLAMINGO,LAKE-BOTTOM \?CCL5
REMOVE FLAMINGO
RTRUE
?CCL5: CALL2 META-LOC,FLAMINGO
EQUAL? STACK,HERE \?CCL7
ICALL1 RETURN-FROM-MAP
PRINTI " Based on its angry squawks, the lawn ornament has returned to its former state"
IN? FLAMINGO,FISH-TANK \?CCL10
PRINTI ". The flamingo sprays you with water as it leaps out of the fish tank"
JUMP ?CND8
?CCL10: EQUAL? L,PROTAGONIST,HERE /?CCL12
FSET? L,DROPBIT /?CCL12
MOVE FLAMINGO,HERE
FSET L,OPENBIT
PRINTI " and popped out of"
ICALL2 TPRINT,L
JUMP ?CND8
?CCL12: CALL2 ULTIMATELY-IN?,FLAMINGO
ZERO? STACK /?CND8
IN? FLAMINGO,WALDO /?CND8
PRINTI ". The flamingo gives you a vicious peck and hops to the ground"
?CND8: CALL2 ULTIMATELY-IN?,FLAMINGO
ZERO? STACK /?CCL20
LOC PROTAGONIST
FSET? STACK,DROPBIT \?CCL20
LOC PROTAGONIST
MOVE FLAMINGO,STACK
JUMP ?CND18
?CCL20: LOC FLAMINGO
FSET? STACK,DROPBIT /?CND18
MOVE FLAMINGO,HERE
?CND18: PRINT PERIOD-CR
RTRUE
?CCL7: CALL2 ULTIMATELY-IN?,FLAMINGO
ZERO? STACK /?CCL26
LOC PROTAGONIST
FSET? STACK,DROPBIT \?CCL26
LOC PROTAGONIST
MOVE FLAMINGO,STACK
RFALSE
?CCL26: LOC FLAMINGO
FSET? STACK,DROPBIT /FALSE
CALL2 META-LOC,FLAMINGO
MOVE FLAMINGO,STACK
RFALSE
.ENDSEG
.SEGMENT "CASTLE"
.FUNCT COURTYARD-F,RARG
EQUAL? RARG,M-LOOK \FALSE
PRINTI "This open area is paved with marble and surrounded by imposing stone walls. "
CALL2 RUNNING?,I-PROLOGUE
ZERO? STACK /?CCL6
PRINTI "Servants are cleaning up after a tremendous carnival"
JUMP ?CND4
?CCL6: PRINTI "Dimwit would occasionally order carnivals to be set up in this court, on totally cloudless days"
?CND4: PRINTI ". At the distant edges of the courtyard, you can see exits to the north, west, and southeast."
RTRUE
.FUNCT BANNER-F
EQUAL? PRSA,V?EXAMINE,V?READ \?CCL3
PRINTR "These colorful banners display various royal crests and insignias."
?CCL3: EQUAL? PRSA,V?CLIMB-DOWN \FALSE
PRINTI "Okay, but for future reference, the stairs are easier"
PRINT ELLIPSIS
CALL2 GOTO,GREAT-HALL
RSTACK
.FUNCT REBUS-F,OARG,CNT
CALL2 CCOUNT,REBUS >CNT
ZERO? OARG /?CCL3
EQUAL? OARG,M-OBJDESC? /TRUE
PRINTI " A large framed rebus occupies a central position at the far end of the gallery. It appears to have been recently hung."
GRTR? CNT,0 \TRUE
PRINTI " The rebus is "
GRTR? CNT,3 \?CCL10
PRINTI "mostly"
JUMP ?CND8
?CCL10: PRINTI "partially"
?CND8: PRINTI " obscured by a"
EQUAL? CNT,1 \?CCL13
PRINTI "n animal -- or a representation of an animal"
JUMP ?CND11
?CCL13: PRINTI " number of animals -- or representations of animals"
?CND11: PRINTI " -- which appear"
EQUAL? CNT,1 \?CND14
PRINTC 115
?CND14: PRINTI " to be magically layered onto its surface:"
FCLEAR REBUS-CAMEL,NDESCBIT
FCLEAR REBUS-MOUSE,NDESCBIT
FCLEAR REBUS-GOOSE,NDESCBIT
FCLEAR REBUS-SNAKE,NDESCBIT
FCLEAR REBUS-FISH,NDESCBIT
FCLEAR REBUS-SLIME-MONSTER,NDESCBIT
ICALL D-CONTENTS,REBUS,2
FSET REBUS-CAMEL,NDESCBIT
FSET REBUS-MOUSE,NDESCBIT
FSET REBUS-GOOSE,NDESCBIT
FSET REBUS-SNAKE,NDESCBIT
FSET REBUS-FISH,NDESCBIT
FSET REBUS-SLIME-MONSTER,NDESCBIT
RTRUE
?CCL3: EQUAL? PRSA,V?CLOSE,V?OPEN \?CCL17
PRINT HUH
RTRUE
?CCL17: EQUAL? PRSA,V?PUT-ON,V?PUT \?CCL19
EQUAL? PRSI,REBUS \?CCL19
PRINT HUH
RTRUE
?CCL19: EQUAL? PRSA,V?EXAMINE,V?READ \FALSE
CLEAR -1
SCREEN S-FULL
IN? REBUS-MOUSE,REBUS \?CCL26
PUSH REBUS-6
JUMP ?CND24
?CCL26: IN? REBUS-GOOSE,REBUS \?CCL28
PUSH REBUS-5
JUMP ?CND24
?CCL28: IN? REBUS-SLIME-MONSTER,REBUS \?CCL30
PUSH REBUS-4
JUMP ?CND24
?CCL30: IN? REBUS-CAMEL,REBUS \?CCL32
PUSH REBUS-3
JUMP ?CND24
?CCL32: IN? REBUS-SNAKE,REBUS \?CCL34
PUSH REBUS-2
JUMP ?CND24
?CCL34: IN? REBUS-FISH,REBUS \?CCL36
PUSH REBUS-1
JUMP ?CND24
?CCL36: PUSH REBUS-0
?CND24: DISPLAY STACK,1,1
ZERO? DEMO-VERSION? /?CCL39
ICALL2 INPUT-DEMO,1
JUMP ?CND37
?CCL39: INPUT 1
?CND37: ICALL1 MOUSE-INPUT?
ICALL1 V-$REFRESH
RTRUE
.FUNCT REBUS-ANIMAL-F
EQUAL? PRSA,V?EXAMINE \?CCL3
PRINTI "The "
PRINTD PRSO
PRINTR " seems to be magically flattened upon the rebus surface."
?CCL3: EQUAL? PRSA,V?MOVE,V?TAKE \?CCL5
PRINT WONT-BUDGE
RTRUE
?CCL5: EQUAL? PRSA,V?TOUCH \FALSE
PRINTI "The "
PRINTD PRSO
PRINTR " feels cold to the touch."
.FUNCT PAINTINGS-F
EQUAL? PRSA,V?EXAMINE \?CCL3
PRINTR "These are Leonardo Flathead's famous portraits of the Twelve Flatheads, including his own self-portrait, which been have reproduced in many places [such as the ""Lives of the Twelve Flatheads Calendar"" which you'll find in your Zork Zero package]."
?CCL3: EQUAL? PRSA,V?MOVE,V?TAKE \?CCL5
PRINTR "The portraits are all securely fastened to the wall."
?CCL5: EQUAL? PRSA,V?COUNT \FALSE
PRINTR "12."
.FUNCT PAINTING-F
EQUAL? PRSA,V?MOVE,V?TAKE,V?EXAMINE \?CCL3
CALL2 PERFORM-PRSA,PAINTINGS
RSTACK
?CCL3: EQUAL? PRSA,V?RESEARCH \FALSE
PRINTR """One of the Twelve Flatheads. For more information, we recommend Boswell Barwell's 'The Lives of the Twelve Flatheads.'"" [Excerpts of which can be found in the calendar from your Zork Zero package.]"
.SEGMENT "VILLAGE"
.SEGMENT "LAKE"
.SEGMENT "ORACLE"
.FUNCT REBUS-BUTTON-F
EQUAL? PRSA,V?PUSH \FALSE
FSET? PRSO,TOUCHBIT /?CTR5
ZERO? TIME-STOPPED /?CCL6
?CTR5: PRINT NOTHING-HAPPENS
RTRUE
?CCL6: FSET PRSO,TOUCHBIT
PUTP PRSO,P?SDESC,STR?270
PRINTI "The button produces a "
IN? REBUS-MOUSE,REBUS \?CCL11
REMOVE REBUS-MOUSE
PRINTI "squeak"
JUMP ?CND9
?CCL11: IN? REBUS-GOOSE,REBUS \?CCL13
REMOVE REBUS-GOOSE
PRINTI "honk"
JUMP ?CND9
?CCL13: IN? REBUS-SLIME-MONSTER,REBUS \?CCL15
REMOVE REBUS-SLIME-MONSTER
PRINTI "squish"
JUMP ?CND9
?CCL15: IN? REBUS-CAMEL,REBUS \?CCL17
REMOVE REBUS-CAMEL
PRINTI "bray"
JUMP ?CND9
?CCL17: IN? REBUS-SNAKE,REBUS \?CCL19
REMOVE REBUS-SNAKE
PRINTI "hiss"
JUMP ?CND9
?CCL19: REMOVE REBUS-FISH
PRINTI "splash"
?CND9: PRINTR "ing noise and stops blinking."
.ENDSEG
.SEGMENT "0"
.FUNCT BAG-F
EQUAL? PRSA,V?EXAMINE \FALSE
PRINTI "There's writing on the outside of the bag. "
RFALSE
.FUNCT BAR-OF-FOOD-F
EQUAL? PRSA,V?EAT \FALSE
EQUAL? TURNED-INTO,FLAMINGO \?CCL6
CALL2 GOOD-MEAL,BAR-OF-FOOD
RSTACK
?CCL6: CALL2 JIGS-UP,STR?339
RSTACK
.ENDSEG
.SEGMENT "CASTLE"
.FUNCT TOWER-PS
CALL2 TOUCHING?,PSEUDO-OBJECT
ZERO? STACK /FALSE
CALL2 CANT-REACH,PSEUDO-OBJECT
RSTACK
.FUNCT THRONE-ROOM-F,RARG
EQUAL? RARG,M-LOOK \FALSE
PRINTI "This is a smaller version of the room to the north, meaning that a person can walk all the way across it without stopping to rest. The throne, though smaller and more comfortable looking, is just as gaudy. It is in this chamber that Dimwit would meet with his ""advisors,"" raising taxes and plotting grandiose schemes. A doorway leads north"
ZERO? SECRET-PASSAGE-OPEN /?CND4
PRINTI ", and a secret passage is open to the south"
?CND4: PRINTC 46
RTRUE
.FUNCT THRONE-F,VARG
ZERO? DEMO-VERSION? /?CCL3
EQUAL? VARG,M-ENTER \?CCL3
EQUAL? PRSO,SMALL-THRONE \?CCL3
PRINTC 32
ICALL1 OPEN-SECRET-PASSAGE?
RETURN 2
?CCL3: ZERO? VARG \FALSE
EQUAL? PRSA,V?CLIMB-UP \?CCL12
ICALL PERFORM,V?ENTER,PRSO
RTRUE
?CCL12: EQUAL? PRSA,V?LOOK-BEHIND \FALSE
PRINTI "Behind the throne"
EQUAL? HERE,AUDIENCE-CHAMBER \?CCL17
PRINTR ", a doorway leads south."
?CCL17: ZERO? SECRET-PASSAGE-OPEN /?CCL19
PRINTR ", a secret passage beckons to the south!"
?CCL19: PRINTR " is nothing but a blank wall."
.ENDSEG
.SEGMENT "SECRET"
.FUNCT SECRET-PASSAGE-F,RARG
ZERO? DEMO-VERSION? /FALSE
EQUAL? RARG,M-END \FALSE
CALL1 END-DEMO
RSTACK
.SEGMENT "0"
.FUNCT CANDLE-F,FLAME
EQUAL? PRSA,V?EXAMINE \?CCL3
FSET? CANDLE,ONBIT \?CCL6
PRINTR "The flame burns tall and bright."
?CCL6: PRINTR "The candle has been snuffed."
?CCL3: EQUAL? PRSA,V?ON \FALSE
FSET? CANDLE,FLAMEBIT /FALSE
CALL FIND-IN,HERE,FLAMEBIT,STR?202 >FLAME
ZERO? FLAME /?CCL13
FSET CANDLE,FLAMEBIT
FSET CANDLE,ONBIT
PRINTR "You re-light the candle."
?CCL13: PRINTR "You have no flame to light the candle."
.ENDSEG
.SEGMENT "SECRET"
.FUNCT SOLAR-F,RARG
EQUAL? RARG,M-END \FALSE
IN? EAST-KEY,JESTER \FALSE
IN? JESTER,HERE \FALSE
CALL2 SETUP-ORPHAN,STR?44
RSTACK
.SEGMENT "0"
.FUNCT EAST-KEY-F
EQUAL? PRSA,V?TAKE \FALSE
FSET? EAST-KEY,TRYTAKEBIT \FALSE
IN? EAST-KEY,JESTER \?CCL8
PRINT ANSWER-MY-RIDDLE
RTRUE
?CCL8: PRINTI "You begin reaching for the key..."
CRLF
SET 'DO-J,TRUE-VALUE
CALL1 I-JESTER
RSTACK
.ENDSEG
.SEGMENT "0"
.SEGMENT "SECRET"
.FUNCT CLOAK-F
EQUAL? PRSA,V?EXAMINE \?CCL3
CALL NOUN-USED?,CLOAK,W?CLOAK
ZERO? STACK /?CCL6
PRINTR "The colors of the cloak seem to shimmer like a Mithican chameleon. There's a small label with writing on it."
?CCL6: ICALL PERFORM,V?READ,CLOAK
RTRUE
?CCL3: EQUAL? PRSA,V?READ \?CCL8
PRINTR """Frobozz Magic Cloak Company."""
?CCL8: EQUAL? HERE,OUBLIETTE \?CCL10
EQUAL? PRSA,V?TAKE-OFF,V?WEAR \?CCL10
PRINTR "There's not enough elbow room here."
?CCL10: EQUAL? PRSA,V?WEAR \?CCL14
EQUAL? HERE,PLAIN /?CCL14
FSET? CLOAK,WORNBIT /?CCL14
FSET? OUTER-GATE,OPENBIT /?CCL14
IN? CLOAK,WALDO /?CCL14
ZERO? TIME-STOPPED \?CCL14
EQUAL? HERE,CONSTRUCTION \?CCL23
ICALL STORE,CONSTRUCTION-OFFSET,CONSTRUCTION-LOC,CONSTRUCTION
JUMP ?CND21
?CCL23: EQUAL? HERE,FR-OFFICES \?CCL25
ICALL STORE,OFFICES-OFFSET,FLOOR-NUMBER,FR-OFFICES
JUMP ?CND21
?CCL25: EQUAL? HERE,OFFICES-NORTH \?CCL27
ICALL STORE,OFFICES-N-OFFSET,FLOOR-NUMBER,OFFICES-NORTH
JUMP ?CND21
?CCL27: EQUAL? HERE,OFFICES-SOUTH \?CCL29
ICALL STORE,OFFICES-S-OFFSET,FLOOR-NUMBER,OFFICES-SOUTH
JUMP ?CND21
?CCL29: EQUAL? HERE,OFFICES-EAST \?CCL31
ICALL STORE,OFFICES-E-OFFSET,FLOOR-NUMBER,OFFICES-EAST
JUMP ?CND21
?CCL31: EQUAL? HERE,OFFICES-WEST \?CND21
ICALL STORE,OFFICES-W-OFFSET,FLOOR-NUMBER,OFFICES-WEST
?CND21: FSET CLOAK,WORNBIT
LOC PROTAGONIST
FSET? STACK,TAKEBIT \?CCL35
SET 'CLOAK-LOC,HERE
JUMP ?CND33
?CCL35: LOC PROTAGONIST >CLOAK-LOC
?CND33: MOVE PROTAGONIST,HERE