-
Notifications
You must be signed in to change notification settings - Fork 38
/
verbs.zap
1991 lines (1630 loc) · 36 KB
/
verbs.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
.FUNCT V-VERBOSE
SET 'VERBOSE,TRUE-VALUE
SET 'SUPER-BRIEF,FALSE-VALUE
PRINTR "Maximum verbosity."
.FUNCT V-BRIEF
SET 'VERBOSE,FALSE-VALUE
SET 'SUPER-BRIEF,FALSE-VALUE
PRINTR "Brief descriptions."
.FUNCT V-SUPER-BRIEF
SET 'SUPER-BRIEF,TRUE-VALUE
PRINTR "Super-brief descriptions."
.FUNCT V-LOOK
CALL DESCRIBE-ROOM,TRUE-VALUE
ZERO? STACK /FALSE
CALL DESCRIBE-OBJECTS,TRUE-VALUE
RSTACK
.FUNCT V-FIRST-LOOK
CALL DESCRIBE-ROOM
ZERO? STACK /FALSE
ZERO? SUPER-BRIEF \FALSE
CALL DESCRIBE-OBJECTS
RSTACK
.FUNCT V-EXAMINE
GETP PRSO,P?TEXT
ZERO? STACK /?ELS5
GETP PRSO,P?TEXT
PRINT STACK
CRLF
RTRUE
?ELS5: FSET? PRSO,CONTBIT /?THN10
FSET? PRSO,DOORBIT \?ELS9
?THN10: CALL V-LOOK-INSIDE
RSTACK
?ELS9: PRINTI "I see nothing special about the "
PRINTD PRSO
PRINTR "."
.FUNCT DESCRIBE-ROOM,LOOK?=0,V?,STR,AV
ZERO? LOOK? /?ORP4
PUSH LOOK?
JUMP ?THN1
?ORP4: PUSH VERBOSE
?THN1: POP 'V?
ZERO? LIT \?CND5
PRINTI "It is pitch black."
ZERO? SPRAYED? \?CND10
PRINTI " You are likely to be eaten by a grue."
?CND10: CRLF
EQUAL? HERE,DARK-2 \?CND15
PRINTI "The ground continues to slope upwards away from the lake. You can barely detect a dim light from the east."
CRLF
RETURN FALSE-VALUE
?CND15: RETURN FALSE-VALUE
?CND5: FSET? HERE,TOUCHBIT /?CND20
FSET HERE,TOUCHBIT
SET 'V?,TRUE-VALUE
?CND20: IN? HERE,ROOMS \?CND23
PRINTD HERE
CRLF
?CND23: ZERO? LOOK? \?THN31
ZERO? SUPER-BRIEF \TRUE
?THN31: LOC WINNER >AV
FSET? AV,VEHBIT \?CND33
PRINTI "(You are in the "
PRINTD AV
PRINTI ".)"
CRLF
?CND33: ZERO? V? /?ELS40
GETP HERE,P?ACTION
CALL STACK,M-LOOK
ZERO? STACK \TRUE
?ELS40: ZERO? V? /?ELS44
GETP HERE,P?LDESC >STR
ZERO? STR /?ELS44
PRINT STR
CRLF
JUMP ?CND38
?ELS44: GETP HERE,P?ACTION
CALL STACK,M-FLASH
?CND38: EQUAL? HERE,AV /TRUE
FSET? AV,VEHBIT \TRUE
GETP AV,P?ACTION
CALL STACK,M-LOOK
RTRUE
.FUNCT DESCRIBE-OBJECTS,V?=0
ZERO? LIT /?ELS5
FIRST? HERE \FALSE
ZERO? V? /?ORP15
PUSH V?
JUMP ?THN12
?ORP15: PUSH VERBOSE
?THN12: POP 'V?
CALL PRINT-CONT,HERE,V?,-1
RSTACK
?ELS5: PRINTR "I can't see anything in the dark."
.FUNCT DESCRIBE-OBJECT,OBJ,V?,LEVEL,STR=0,AV
SET 'DESC-OBJECT,OBJ
ZERO? LEVEL \?ELS3
GETP OBJ,P?DESCFCN
CALL STACK,M-OBJDESC
ZERO? STACK \TRUE
?ELS3: ZERO? LEVEL \?ELS7
FSET? OBJ,TOUCHBIT /?ELS13
GETP OBJ,P?FDESC >STR
ZERO? STR \?THN10
?ELS13: GETP OBJ,P?LDESC >STR
ZERO? STR /?ELS7
?THN10: PRINT STR
JUMP ?CND1
?ELS7: ZERO? LEVEL \?ELS17
PRINTI "There is a "
PRINTD OBJ
PRINTI " here."
JUMP ?CND1
?ELS17: GET INDENTS,LEVEL
PRINT STACK
PRINTI "A "
PRINTD OBJ
FSET? OBJ,WEARBIT \?CND1
PRINTI " (being worn)"
?CND1: ZERO? LEVEL \?CND31
LOC WINNER >AV
ZERO? AV /?CND31
FSET? AV,VEHBIT \?CND31
PRINTI " (outside the "
PRINTD AV
PRINTI ")"
?CND31: CRLF
CALL SEE-INSIDE?,OBJ
ZERO? STACK /FALSE
FIRST? OBJ \FALSE
CALL PRINT-CONT,OBJ,V?,LEVEL
RSTACK
.FUNCT PRINT-CONT,OBJ,V?=0,LEVEL=0,Y,1ST?,AV,STR,PV?=0,INV?=0
FIRST? OBJ >Y \TRUE
LOC WINNER >AV
ZERO? AV /?ELS6
FSET? AV,VEHBIT \?ELS6
JUMP ?CND4
?ELS6: SET 'AV,FALSE-VALUE
?CND4: SET '1ST?,TRUE-VALUE
LOC OBJ
EQUAL? WINNER,OBJ,STACK \?ELS13
SET 'INV?,TRUE-VALUE
JUMP ?CND11
?ELS13:
?PRG16: ZERO? Y \?ELS20
JUMP ?CND11
?ELS20: EQUAL? Y,AV \?ELS22
SET 'PV?,TRUE-VALUE
JUMP ?CND18
?ELS22: EQUAL? Y,WINNER \?ELS24
JUMP ?CND18
?ELS24: FSET? Y,INVISIBLE /?CND18
FSET? Y,TOUCHBIT /?CND18
GETP Y,P?FDESC >STR
ZERO? STR /?CND18
FSET? Y,NDESCBIT /?CND29
PRINT STR
CRLF
?CND29: CALL SEE-INSIDE?,Y
ZERO? STACK /?CND18
LOC Y
GETP STACK,P?DESCFCN
ZERO? STACK \?CND18
FIRST? Y \?CND18
CALL PRINT-CONT,Y,V?,0
?CND18: NEXT? Y >Y /?KLU76
?KLU76: JUMP ?PRG16
?CND11: FIRST? OBJ >Y /?KLU77
?KLU77:
?PRG39: ZERO? Y \?ELS43
ZERO? PV? /?CND44
ZERO? AV /?CND44
FIRST? AV \?CND44
CALL PRINT-CONT,AV,V?,LEVEL
?CND44: ZERO? 1ST? \?PRD49
PUSH 1
RETURN STACK
?PRD49: PUSH 0
RETURN STACK
?ELS43: EQUAL? Y,AV,ADVENTURER \?ELS52
JUMP ?CND41
?ELS52: FSET? Y,INVISIBLE /?CND41
ZERO? INV? \?THN57
FSET? Y,TOUCHBIT /?THN57
GETP Y,P?FDESC
ZERO? STACK \?CND41
?THN57: FSET? Y,NDESCBIT /?ELS61
ZERO? 1ST? /?CND62
CALL FIRSTER,OBJ,LEVEL
ZERO? STACK /?CND66
LESS? LEVEL,0 \?CND66
SET 'LEVEL,0
?CND66: INC 'LEVEL
SET '1ST?,FALSE-VALUE
?CND62: CALL DESCRIBE-OBJECT,Y,V?,LEVEL
JUMP ?CND41
?ELS61: FIRST? Y \?CND41
CALL SEE-INSIDE?,Y
ZERO? STACK /?CND41
CALL PRINT-CONT,Y,V?,LEVEL
?CND41: NEXT? Y >Y /?KLU78
?KLU78: JUMP ?PRG39
.FUNCT FIRSTER,OBJ,LEVEL
EQUAL? OBJ,WINNER \?ELS5
PRINTR "You are carrying:"
?ELS5: IN? OBJ,ROOMS /FALSE
GRTR? LEVEL,0 \?CND10
GET INDENTS,LEVEL
PRINT STACK
?CND10: FSET? OBJ,SURFACEBIT \?ELS19
PRINTI "Sitting on the "
PRINTD OBJ
PRINTR " is:"
?ELS19: PRINTI "The "
PRINTD OBJ
PRINTR " contains:"
.FUNCT V-SCORE,ASK?=1
PRINTI "Your potential is "
PRINTN SCORE
PRINTI " of a possible "
PRINTN SCORE-MAX
PRINTI ", in "
PRINTN MOVES
EQUAL? MOVES,1 \?ELS9
PRINTI " move."
JUMP ?CND7
?ELS9: PRINTI " moves."
?CND7: CRLF
RETURN SCORE
.FUNCT FINISH
CALL V-SCORE
QUIT
RTRUE
.FUNCT V-QUIT,ASK?=1,SCOR
CALL V-SCORE
ZERO? ASK? /?ELS9
PRINTI "Do you wish to leave the game? (Y is affirmative): "
CALL YES?
ZERO? STACK \?THN6
?ELS9: ZERO? ASK? \?ELS5
?THN6: QUIT
RTRUE
?ELS5: PRINTR "Ok."
.FUNCT YES?
PRINTI ">"
READ P-INBUF,P-LEXV
GET P-LEXV,1
EQUAL? STACK,W?YES,W?Y \FALSE
RTRUE
.FUNCT V-VERSION,CNT=17
PRINTI "ZORK III: The Dungeon Master
Copyright 1982 by Infocom, Inc. All rights reserved.
ZORK is a trademark of Infocom, Inc.
Release "
GET 0,1
BAND STACK,2047
PRINTN STACK
PRINTI " / Serial number "
?PRG5: IGRTR? 'CNT,23 \?ELS9
JUMP ?REP6
?ELS9: GETB 0,CNT
PRINTC STACK
JUMP ?PRG5
?REP6: CRLF
RTRUE
.FUNCT IN-HERE?,OBJ
IN? OBJ,HERE /TRUE
CALL GLOBAL-IN?,OBJ,HERE
RSTACK
.FUNCT V-AGAIN,OBJ
EQUAL? L-PRSA,V?WALK \?ELS5
CALL PERFORM,L-PRSA,L-PRSO
RSTACK
?ELS5: ZERO? L-PRSO /?ELS12
LOC L-PRSO
ZERO? STACK \?ELS12
PUSH L-PRSO
JUMP ?CND8
?ELS12: ZERO? L-PRSI /?PRD10
LOC L-PRSO
ZERO? STACK \?PRD10
PUSH L-PRSI
JUMP ?CND8
?PRD10: PUSH 0
?CND8: SET 'OBJ,STACK
ZERO? OBJ /?ELS23
PRINTI "I can't see the "
PRINTD OBJ
PRINTI " anymore."
CRLF
RETURN 2
?ELS23: CALL PERFORM,L-PRSA,L-PRSO,L-PRSI
RSTACK
.FUNCT JIGS-UP,DESC,PLAYER?=0
SET 'SWORD-STATE,0
SET 'P-STRENGTH,5
SET 'S-STRENGTH,5
PRINT DESC
CRLF
EQUAL? YEAR,YEAR-PRESENT /?CND3
QUIT
?CND3: EQUAL? ADVENTURER,WINNER /?CND6
PRINTI "
**** The "
PRINTD WINNER
PRINTI " has died ****
"
REMOVE WINNER
SET 'WINNER,ADVENTURER
LOC WINNER >HERE
RETURN 2
?CND6: PRINTI "
**** You have died ****
"
IGRTR? 'DEATHS,3 \?ELS17
PRINTI "You feel yourself disembodied in a deep blackness. A voice from the void speaks: ""I have waited a long age for you, my friend, but perhaps it has been another that I have been seeking. Good night, oh worthy adventurer!"" It is the last you hear."
CRLF
QUIT
JUMP ?CND15
?ELS17: PRINTI "You find yourself deep within the earth in a barren prison cell. Outside the iron-barred window, you can see a great, fiery pit. Flames leap up and very nearly sear your flesh. After a while, footfalls can be heard in the distance, then closer and closer.... The door swings open, and in walks an old man.
He is dressed simply in a hood and cloak, wearing a few simple jewels, carrying something under one arm, and leaning on a wooden staff. A single key, as if to a massive prison cell, hangs from his belt.
He raises the staff toward you and you hear him speak, as if in a dream: ""I await you, though your journey be long and full of peril. Go then, and let me not wait long!"" You feel some great power well up inside you and you fall to the floor. The next moment, you are awakening, as if from a deep slumber."
CRLF
?CND15: MOVE CURRENT-LAMP,ZORK2-STAIR
IN? KEY,WINNER \?CND24
EQUAL? HERE,DARK-1,DARK-2,KEY-ROOM /?THN29
EQUAL? HERE,AQ-1,AQ-2 \?CND24
?THN29: MOVE KEY,KEY-ROOM
?CND24: CRLF
CALL GOTO,ZORK2-STAIR
SET 'P-CONT,FALSE-VALUE
CALL RANDOMIZE-OBJECTS
CALL KILL-INTERRUPTS
RETURN 2
.FUNCT RANDOMIZE-OBJECTS,R=0,F,N,L
FIRST? WINNER >N /?KLU6
?KLU6:
?PRG1: SET 'F,N
ZERO? F /TRUE
NEXT? F >N /?KLU7
?KLU7: CALL PICK-ONE,DEAD-OBJ-LOCS
MOVE F,STACK
JUMP ?PRG1
.FUNCT KILL-INTERRUPTS
CALL INT,I-MAN-LEAVES
PUT STACK,0,0
CALL INT,I-MAN-RETURNS
PUT STACK,0,0
CALL INT,I-VIEW-SNAP
PUT STACK,0,0
CALL INT,I-FOLIN
PUT STACK,0,0
RTRUE
.FUNCT V-RESTORE
RESTORE \?ELS5
PRINTI "Ok."
CRLF
CALL V-FIRST-LOOK
RSTACK
?ELS5: PRINTR "Failed."
.FUNCT V-SAVE
SAVE \?ELS5
PRINTR "Ok."
?ELS5: PRINTR "Failed."
.FUNCT V-RESTART
CALL V-SCORE,TRUE-VALUE
PRINTI "Do you wish to restart? (Y is affirmative): "
CALL YES?
ZERO? STACK /FALSE
PRINTI "Restarting."
CRLF
RESTART
PRINTR "Failed."
.FUNCT V-WALK-AROUND
PRINTR "Use directions for movement here."
.FUNCT V-LAUNCH
FSET? PRSO,VEHBIT \?ELS5
PRINTR "You can't launch that by saying ""launch""!"
?ELS5: PRINTR "How in blazes does one launch that?"
.FUNCT GO-NEXT,TBL,VAL
CALL LKP,HERE,TBL >VAL
ZERO? VAL /FALSE
CALL GOTO,VAL
RSTACK
.FUNCT LKP,ITM,TBL,CNT=0,LEN
GET TBL,0 >LEN
?PRG1: IGRTR? 'CNT,LEN /FALSE
GET TBL,CNT
EQUAL? STACK,ITM \?PRG1
EQUAL? CNT,LEN /FALSE
ADD CNT,1
GET TBL,STACK
RETURN STACK
.FUNCT V-WALK,PT,PTS,STR,OBJ,RM
ZERO? P-WALK-DIR \?ELS5
CALL PERFORM,V?WALK-TO,PRSO
RTRUE
?ELS5: GETPT HERE,PRSO >PT
ZERO? PT /?ELS7
PTSIZE PT >PTS
EQUAL? PTS,UEXIT \?ELS12
GETB PT,REXIT
CALL GOTO,STACK
RSTACK
?ELS12: EQUAL? PTS,NEXIT \?ELS14
GET PT,NEXITSTR
PRINT STACK
CRLF
RETURN 2
?ELS14: EQUAL? PTS,FEXIT \?ELS20
GET PT,FEXITFCN
CALL STACK >RM
ZERO? RM /?ELS25
CALL GOTO,RM
RSTACK
?ELS25: EQUAL? HERE,CP \?ELS27
ZERO? CP-MOVED \TRUE
?ELS27: RETURN 2
?ELS20: EQUAL? PTS,CEXIT \?ELS35
GETB PT,CEXITFLAG
VALUE STACK
ZERO? STACK /?ELS40
GETB PT,REXIT
CALL GOTO,STACK
RSTACK
?ELS40: GET PT,CEXITSTR >STR
ZERO? STR /?ELS42
PRINT STR
CRLF
RETURN 2
?ELS42: PRINTI "You can't go that way."
CRLF
RETURN 2
?ELS35: EQUAL? PTS,DEXIT \FALSE
GETB PT,DEXITOBJ >OBJ
FSET? OBJ,OPENBIT \?ELS59
GETB PT,REXIT
CALL GOTO,STACK
RSTACK
?ELS59: GET PT,DEXITSTR >STR
ZERO? STR /?ELS61
PRINT STR
CRLF
RETURN 2
?ELS61: PRINTI "The "
PRINTD OBJ
PRINTI " is closed."
CRLF
CALL THIS-IS-IT,OBJ
RETURN 2
?ELS7: ZERO? LIT \?ELS73
RANDOM 100
GRTR? 90,STACK \?ELS73
ZERO? SPRAYED? /?ELS80
PRINTI "There are odd noises in the darkness, and there is no exit in that direction."
CRLF
RETURN 2
?ELS80: EQUAL? HERE,DARK-1,DARK-2 \?ELS87
CALL JIGS-UP,STR?22
RSTACK
?ELS87: CALL JIGS-UP,STR?23
RSTACK
?ELS73: PRINTI "You can't go that way."
CRLF
RETURN 2
.FUNCT THIS-IS-IT,OBJ
SET 'P-IT-OBJECT,OBJ
SET 'P-IT-LOC,HERE
RETURN P-IT-LOC
.FUNCT V-INVENTORY
FIRST? WINNER \?ELS5
CALL PRINT-CONT,WINNER
RSTACK
?ELS5: PRINTR "You are empty handed."
.FUNCT PRE-TAKE
IN? PRSO,WINNER \?ELS5
FSET? PRSO,WEARBIT \?ELS10
PRINTR "You are already wearing it."
?ELS10: PRINTR "You already have it."
?ELS5: LOC PRSO
FSET? STACK,CONTBIT \?ELS18
LOC PRSO
FSET? STACK,OPENBIT /?ELS18
PRINTR "You can't reach that."
?ELS18: ZERO? PRSI /?ELS24
LOC PRSO
EQUAL? PRSI,STACK /?ELS30
PRINTI "The "
PRINTD PRSO
PRINTI " isn't in the "
PRINTD PRSI
PRINTR "."
?ELS30: SET 'PRSI,FALSE-VALUE
RFALSE
?ELS24: LOC WINNER
EQUAL? PRSO,STACK \FALSE
PRINTR "You are in it, loser!"
.FUNCT V-TAKE
CALL ITAKE
EQUAL? STACK,TRUE-VALUE \FALSE
FSET? PRSO,WEARBIT \?ELS10
PRINTI "You are now wearing the "
PRINTD PRSO
PRINTR "."
?ELS10: PRINTR "Taken."
.FUNCT ITAKE,VB=1,CNT,OBJ,?TMP1
FSET? PRSO,TAKEBIT /?ELS5
ZERO? VB /FALSE
CALL PICK-ONE,YUKS
PRINT STACK
CRLF
RFALSE
?ELS5: LOC PRSO
IN? STACK,WINNER /?ELS13
CALL WEIGHT,PRSO >?TMP1
CALL WEIGHT,WINNER
ADD ?TMP1,STACK
GRTR? STACK,LOAD-ALLOWED \?ELS13
ZERO? VB /?CND16
PRINTI "Your load is too heavy"
LESS? LOAD-ALLOWED,LOAD-MAX \?ELS24
PRINTI ", especially in light of your condition."
JUMP ?CND22
?ELS24: PRINTI "."
?CND22: CRLF
?CND16: RETURN 2
?ELS13: CALL CCOUNT,WINNER >CNT
GRTR? CNT,FUMBLE-NUMBER \?ELS34
MUL CNT,FUMBLE-PROB >?TMP1
RANDOM 100
GRTR? ?TMP1,STACK \?ELS34
FIRST? WINNER >OBJ /?KLU48
?KLU48:
?PRG37: NEXT? OBJ >OBJ /?KLU49
?KLU49: FSET? OBJ,WEARBIT /?PRG37
PRINTI "Oh, no. The "
PRINTD OBJ
PRINTI " slips from your arms while taking the "
PRINTD PRSO
PRINTI " and both tumble to the ground."
CRLF
CALL PERFORM,V?DROP,OBJ
RETURN 2
?ELS34: MOVE PRSO,WINNER
FSET PRSO,TOUCHBIT
RTRUE
.FUNCT V-PUT-ON
FSET? PRSI,SURFACEBIT \?ELS5
CALL V-PUT
RSTACK
?ELS5: PRINTI "There's no good surface on the "
PRINTD PRSI
PRINTR "."
.FUNCT PRE-PUT
EQUAL? PRSO,SHORT-POLE /FALSE
IN? PRSO,GLOBAL-OBJECTS /?THN8
FSET? PRSO,TAKEBIT /FALSE
?THN8: PRINTR "Nice try."
.FUNCT V-PUT,?TMP1
FSET? PRSI,OPENBIT /?CND1
FSET? PRSI,DOORBIT /?THN6
FSET? PRSI,CONTBIT /?CND1
?THN6: FSET? PRSI,VEHBIT \?ELS3
JUMP ?CND1
?ELS3: PRINTR "I can't do that."
?CND1: FSET? PRSI,OPENBIT /?ELS16
PRINTI "The "
PRINTD PRSI
PRINTR " isn't open."
?ELS16: EQUAL? PRSI,PRSO \?ELS20
PRINTR "How can you do that?"
?ELS20: IN? PRSO,PRSI \?ELS24
PRINTI "The "
PRINTD PRSO
PRINTI " is already in the "
PRINTD PRSI
PRINTR "."
?ELS24: CALL WEIGHT,PRSI >?TMP1
CALL WEIGHT,PRSO
ADD ?TMP1,STACK >?TMP1
GETP PRSI,P?SIZE
SUB ?TMP1,STACK >?TMP1
GETP PRSI,P?CAPACITY
GRTR? ?TMP1,STACK \?ELS28
PRINTR "There's no room."
?ELS28: CALL HELD?,PRSO
ZERO? STACK \?ELS32
CALL ITAKE
ZERO? STACK /TRUE
?ELS32: MOVE PRSO,PRSI
FSET PRSO,TOUCHBIT
PRINTR "Done."
.FUNCT PRE-DROP
LOC WINNER
EQUAL? PRSO,STACK \FALSE
CALL PERFORM,V?DISEMBARK,PRSO
RTRUE
.FUNCT PRE-GIVE
CALL HELD?,PRSO
ZERO? STACK \FALSE
PRINTR "That's easy for you to say since you don't even have it."
.FUNCT PRE-SGIVE
CALL PERFORM,V?GIVE,PRSI,PRSO
RTRUE
.FUNCT HELD?,OBJ
IN? OBJ,WINNER /TRUE
IN? OBJ,ROOMS /FALSE
IN? OBJ,GLOBAL-OBJECTS /FALSE
ZERO? OBJ /FALSE
LOC OBJ
CALL HELD?,STACK
RSTACK
.FUNCT V-GIVE
FSET? PRSI,VICBIT /?ELS5
PRINTI "You can't give a "
PRINTD PRSO
PRINTI " to a "
PRINTD PRSI
PRINTR "!"
?ELS5: PRINTI "The "
PRINTD PRSI
PRINTR " refuses it politely."
.FUNCT V-SGIVE
PRINTR "FOOOO!!"
.FUNCT V-DROP
CALL IDROP
ZERO? STACK /FALSE
PRINTR "Dropped."
.FUNCT V-THROW
CALL IDROP
ZERO? STACK /FALSE
PRINTR "Thrown."
.FUNCT IDROP
IN? PRSO,WINNER /?ELS5
LOC PRSO
IN? STACK,WINNER /?ELS5
PRINTI "You're not carrying the "
PRINTD PRSO
PRINTI "."
CRLF
RFALSE
?ELS5: IN? PRSO,WINNER /?ELS11
LOC PRSO
FSET? STACK,OPENBIT /?ELS11
PRINTI "The "
PRINTD PRSO
PRINTI " is closed."
CRLF
RFALSE
?ELS11: LOC WINNER
MOVE PRSO,STACK
RTRUE
.FUNCT V-OPEN,F,STR
FSET? PRSO,CONTBIT /?ELS5
PRINTI "You must tell me how to do that to a "
PRINTD PRSO
PRINTR "."
?ELS5: GETP PRSO,P?CAPACITY
ZERO? STACK /?ELS9
FSET? PRSO,OPENBIT \?ELS14
PRINTR "It is already open."
?ELS14: FSET PRSO,OPENBIT
FIRST? PRSO \?THN24
FSET? PRSO,TRANSBIT \?ELS23
?THN24: PRINTR "Opened."
?ELS23: FIRST? PRSO >F \?ELS29
NEXT? F /?ELS29
GETP F,P?FDESC >STR
ZERO? STR /?ELS29
PRINTI "The "
PRINTD PRSO
PRINTI " opens."
CRLF
PRINT STR
CRLF
RTRUE
?ELS29: PRINTI "Opening the "
PRINTD PRSO
PRINTI " reveals "
CALL PRINT-CONTENTS,PRSO
PRINTR "."
?ELS9: FSET? PRSO,DOORBIT \?ELS43
FSET? PRSO,OPENBIT \?ELS48
PRINTR "It is already open."
?ELS48: PRINTI "The "
PRINTD PRSO
PRINTI " opens."
CRLF
FSET PRSO,OPENBIT
RTRUE
?ELS43: PRINTI "The "
PRINTD PRSO
PRINTR " fails to open."
.FUNCT PRINT-CONTENTS,OBJ,F,N,1ST?=1
FIRST? OBJ >F \FALSE
?PRG6: NEXT? F >N /?KLU26
?KLU26: ZERO? 1ST? /?ELS10
SET '1ST?,FALSE-VALUE
JUMP ?CND8
?ELS10: PRINTI ", "
ZERO? N \?CND8
PRINTI "and "
?CND8: PRINTI "a "
PRINTD F
SET 'F,N
ZERO? F \?PRG6
RTRUE
.FUNCT V-CLOSE
FSET? PRSO,CONTBIT /?ELS5
PRINTI "You must tell me how to do that to a "
PRINTD PRSO
PRINTR "."
?ELS5: FSET? PRSO,SURFACEBIT /?ELS9
GETP PRSO,P?CAPACITY
ZERO? STACK /?ELS9
FSET? PRSO,OPENBIT \?ELS16
FCLEAR PRSO,OPENBIT
PRINTR "Closed."
?ELS16: PRINTR "It is already closed."
?ELS9: FSET? PRSO,DOORBIT \?ELS24
FSET? PRSO,OPENBIT \?ELS29
PRINTI "The "
PRINTD PRSO
PRINTI " is now closed."
CRLF
FCLEAR PRSO,OPENBIT
RTRUE
?ELS29: PRINTR "It is already closed."
?ELS24: PRINTR "You cannot close that."
.FUNCT CCOUNT,OBJ,CNT=0,X
FIRST? OBJ >X \?CND1
?PRG4: FSET? X,WEARBIT /?CND6
INC 'CNT
?CND6: NEXT? X >X /?PRG4
?CND1: RETURN CNT
.FUNCT WEIGHT,OBJ,CONT,WT=0
FIRST? OBJ >CONT \?CND1
?PRG4: EQUAL? OBJ,PLAYER \?ELS8
FSET? CONT,WEARBIT \?ELS8
INC 'WT
JUMP ?CND6
?ELS8: CALL WEIGHT,CONT
ADD WT,STACK >WT
?CND6: NEXT? CONT >CONT /?PRG4
?CND1: GETP OBJ,P?SIZE
ADD WT,STACK
RSTACK
.FUNCT V-BUG
PRINTR "If there is a problem here, it is unintentional. You may report your problem to the address provided in your documentation."
.FUNCT V-SCRIPT
GET 0,8
BOR STACK,1
PUT 0,8,STACK
PRINTI "Here begins"
PRINT COPR-NOTICE
CRLF
RTRUE
.FUNCT V-UNSCRIPT
PRINTI "Here ends"
PRINT COPR-NOTICE
CRLF
GET 0,8
BAND STACK,-2
PUT 0,8,STACK
RTRUE
.FUNCT PRE-MOVE
CALL HELD?,PRSO
ZERO? STACK /FALSE
PRINTR "I don't juggle objects!"
.FUNCT V-MOVE
FSET? PRSO,TAKEBIT \?ELS5
PRINTI "Moving the "
PRINTD PRSO
PRINTR " reveals nothing."
?ELS5: PRINTI "You can't move the "
PRINTD PRSO
PRINTR "."
.FUNCT V-LAMP-ON
FSET? PRSO,LIGHTBIT \?ELS3
FSET? PRSO,ONBIT \?ELS6
PRINTR "It is already on."
?ELS6: FSET PRSO,ONBIT
PRINTI "The "
PRINTD PRSO
PRINTI " is now on."
CRLF
ZERO? LIT \TRUE
CALL LIT?,HERE >LIT
CRLF
CALL V-LOOK
RTRUE
?ELS3: PRINTR "You can't turn that on."
.FUNCT V-LAMP-OFF
FSET? PRSO,LIGHTBIT \?ELS3
FSET? PRSO,ONBIT /?ELS6
PRINTR "It is already off."
?ELS6: FCLEAR PRSO,ONBIT
ZERO? LIT /?CND11
CALL LIT?,HERE >LIT
?CND11: PRINTI "The "
PRINTD PRSO
PRINTI " is now off."
CRLF
CALL LIT?,HERE >LIT
ZERO? LIT \TRUE
PRINTI "It is now pitch black."
CRLF
RTRUE
?ELS3: PRINTR "You can't turn that off."
.FUNCT V-WAIT,NUM=3
PRINTI "Time passes..."
CRLF
?PRG3: DLESS? 'NUM,0 \?ELS7
JUMP ?REP4
?ELS7: CALL CLOCKER
ZERO? STACK /?CND5
JUMP ?REP4
?CND5: INC 'MOVES
JUMP ?PRG3
?REP4: SET 'CLOCK-WAIT,TRUE-VALUE
RETURN CLOCK-WAIT
.FUNCT PRE-BOARD,AV
LOC WINNER >AV
EQUAL? PRSO,WATER-CHANNEL /FALSE
FSET? PRSO,VEHBIT \?ELS5
FSET? AV,VEHBIT \FALSE
PRINTI "You are already in the "
PRINTD AV
PRINTI ", cretin!"
CRLF
RETURN 2
?ELS5: PRINTI "I suppose you have a theory on boarding a "
PRINTD PRSO
PRINTI "."
CRLF
RETURN 2
.FUNCT V-BOARD,AV
PRINTI "You are now in the "
PRINTD PRSO
PRINTI "."
CRLF
MOVE WINNER,PRSO
GETP PRSO,P?ACTION
CALL STACK,M-ENTER
RTRUE
.FUNCT V-DISEMBARK
LOC WINNER
EQUAL? STACK,PRSO /?ELS5
PRINTI "You're not in that!"
CRLF
RETURN 2
?ELS5: FSET? HERE,RLANDBIT \?ELS11
PRINTI "You are on your own feet again."
CRLF
MOVE WINNER,HERE
RTRUE
?ELS11: PRINTI "You realize, just in time, that getting out here would probably be fatal."
CRLF
RETURN 2
.FUNCT V-BLAST
PRINTR "You can't blast anything by using words."
.FUNCT GOTO,RM,V?=1,LB,WLOC,AV=0,OLIT
FSET? RM,RLANDBIT /?PRD1
PUSH 0
JUMP ?PRD2
?PRD1: PUSH 1
?PRD2: SET 'LB,STACK