-
Notifications
You must be signed in to change notification settings - Fork 27
/
top.zap
624 lines (571 loc) · 12.7 KB
/
top.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
.SEGMENT "0"
.FUNCT MORE-SPECIFIC
SET 'CLOCK-WAIT,TRUE-VALUE
PRINTR "[Please be more specific.]"
.FUNCT MAIN-LOOP,X
?PRG1: CALL1 MAIN-LOOP-1 >X
JUMP ?PRG1
.FUNCT DIR-VERB-PRSI?,NP
GET PARSE-RESULT,4
EQUAL? STACK,V?MOVE-DIR,V?RIDE-DIR,V?ROLL-DIR /?PRD3
GET PARSE-RESULT,4
EQUAL? STACK,V?SET-DIR \FALSE
?PRD3: GET NP,3
EQUAL? STACK,INTDIR,LEFT-RIGHT /FALSE
RTRUE
.FUNCT DIR-VERB-WORD?,WD
EQUAL? WD,W?WALK,W?GO,W?RUN /TRUE
RFALSE
.FUNCT MAIN-LOOP-1,ICNT,OCNT,NUM,OBJ,V,OBJ1,NP,NP1,CNT,TOFF,XX,TMP
CALL1 PARSER >P-WON
ZERO? P-WON /?CCL3
DLESS? 'P-ERRS,0 \?PRG6
SET 'P-ERRS,0
?PRG6: GET PARSE-RESULT,4 >PRSA
EQUAL? PRSA,V?UNDO \?CCL10
CALL2 PERFORM,PRSA
RSTACK
?CCL10: ISAVE >P-CAN-UNDO
EQUAL? P-CAN-UNDO,2 \?CND8
EQUAL? PRSA,V?SAVE \?CCL15
ICALL1 CANT-UNDO
RFALSE
?CCL15: SET 'P-CONT,-1
ICALL1 V-$REFRESH
RFALSE
?CND8: GET PARSE-RESULT,5 >P-PRSO
GET PARSE-RESULT,6 >P-PRSI
ZERO? P-PRSO /?CCL19
GET P-PRSO,3
EQUAL? INTDIR,STACK \?CCL19
GET P-PRSO,4
GET STACK,2
GETB STACK,6 >P-DIRECTION
JUMP ?CND17
?CCL19: ZERO? P-PRSI /?CND17
GET P-PRSI,3
EQUAL? INTDIR,STACK \?CND17
GET P-PRSI,4
GET STACK,2
GETB STACK,6 >P-DIRECTION
?CND17: GET PARSE-RESULT,1 >P-PRSA-WORD
SET 'CLOCK-WAIT,FALSE-VALUE
SET 'ICNT,0
SET 'OCNT,0
ZERO? P-PRSI /?CND25
GET P-PRSI,1 >ICNT
ZERO? ICNT /?CND25
SET 'P-MULT,ICNT
?CND25: ZERO? P-PRSO /?CND29
GET P-PRSO,1 >OCNT
ZERO? OCNT /?CND29
SET 'P-MULT,OCNT
?CND29: ZERO? OCNT \?CCL35
ZERO? ICNT /?CND33
?CCL35: EQUAL? PRSA,V?WALK /?CND33
ZERO? P-IT-OBJECT /?CND33
CALL2 ACCESSIBLE?,P-IT-OBJECT
ZERO? STACK /?CND33
ZERO? ICNT /?CND42
SET 'CNT,0
?PRG44: MUL CNT,2
ADD NOUN-PHRASE-HEADER-LEN,STACK >TOFF
GET P-PRSI,TOFF
EQUAL? IT,STACK \?CCL48
PUT P-PRSI,TOFF,P-IT-OBJECT
ICALL TELL-PRONOUN,P-IT-OBJECT,IT
JUMP ?CND42
?CCL48: IGRTR? 'CNT,ICNT \?PRG44
?CND42: ZERO? OCNT /?CND33
SET 'CNT,0
?PRG52: MUL CNT,2
ADD NOUN-PHRASE-HEADER-LEN,STACK >TOFF
GET P-PRSO,TOFF
EQUAL? IT,STACK \?CCL56
PUT P-PRSO,TOFF,P-IT-OBJECT
ICALL TELL-PRONOUN,P-IT-OBJECT,IT
JUMP ?CND33
?CCL56: IGRTR? 'CNT,OCNT \?PRG52
?CND33: ZERO? OCNT \?CCL60
SET 'NUM,OCNT
JUMP ?CND58
?CCL60: GRTR? OCNT,1 \?CCL62
ZERO? ICNT \?CCL65
SET 'OBJ,FALSE-VALUE
JUMP ?CND63
?CCL65: GET P-PRSI,3 >OBJ
GET P-PRSI,4 >NP
?CND63: SET 'NUM,OCNT
JUMP ?CND58
?CCL62: GRTR? ICNT,1 \?CCL69
GET P-PRSO,3 >OBJ
GET P-PRSI,4 >NP
SET 'NUM,ICNT
JUMP ?CND58
?CCL69: SET 'NUM,1
?CND58: ZERO? OBJ \?CND72
EQUAL? ICNT,1 \?CND72
GET P-PRSI,3 >OBJ
GET P-PRSI,4 >NP
?CND72: ZERO? LIT \?CCL80
CALL1 SEE-VERB?
ZERO? STACK /?CCL80
ICALL1 TELL-TOO-DARK
SET 'P-CONT,-1
JUMP ?CND78
?CCL80: EQUAL? PRSA,V?WALK \?CCL84
ZERO? P-WALK-DIR /?PRD87
PUSH P-WALK-DIR
JUMP ?PEN85
?PRD87: GET P-PRSO,3
?PEN85: CALL PERFORM,PRSA,STACK >V
JUMP ?CND78
?CCL84: ZERO? NUM \?CCL89
CALL2 PERFORM,PRSA >V
SET 'PRSO,FALSE-VALUE
SET 'PRSO-NP,FALSE-VALUE
JUMP ?CND78
?CCL89: GRTR? OCNT,1 \?CCL91
EQUAL? PRSA,V?COUNT \?CCL91
CALL PERFORM,PRSA,ROOMS >V
JUMP ?CND78
?CCL91: SET 'CNT,-1
SET 'TMP,0
?PRG94: INC 'CNT
LESS? CNT,NUM /?CND96
ZERO? TMP \?CND78
ICALL1 MORE-SPECIFIC
JUMP ?CND78
?CND96: GRTR? ICNT,1 /?CCL102
MUL CNT,2
ADD STACK,NOUN-PHRASE-HEADER-LEN
GET P-PRSO,STACK >OBJ1
MUL CNT,2
ADD STACK,4
GET P-PRSO,STACK >NP1
JUMP ?CND100
?CCL102: MUL CNT,2
ADD STACK,NOUN-PHRASE-HEADER-LEN
GET P-PRSI,STACK >OBJ1
MUL CNT,2
ADD STACK,4
GET P-PRSI,STACK >NP1
?CND100: GRTR? NUM,1 /?CCL108
GET NP1,3
EQUAL? STACK,NP-QUANT-ALL \?CND107
?CCL108: EQUAL? OBJ1,FALSE-VALUE,NOT-HERE-OBJECT \?CCL113
ICALL2 NP-PRINT,NP1
PRINTI ": "
ICALL2 NP-CANT-SEE,NP1
JUMP ?PRG94
?CCL113: GET NP1,3
EQUAL? STACK,NP-QUANT-ALL \?CCL115
CALL VERB-ALL-TEST,OBJ1,OBJ
ZERO? STACK /?PRG94
?CCL115: CALL2 ACCESSIBLE?,OBJ1
ZERO? STACK /?PRG94
EQUAL? OBJ1,PLAYER /?PRG94
EQUAL? OBJ1,IT \?CCL124
ICALL2 DPRINT,P-IT-OBJECT
JUMP ?CND122
?CCL124: ICALL2 DPRINT,OBJ1
?CND122: PRINTI ": "
?CND107: SET 'TMP,TRUE-VALUE
GRTR? ICNT,1 /?CCL127
SET 'PRSO,OBJ1
SET 'PRSO-NP,NP1
SET 'PRSI,OBJ
SET 'PRSI-NP,NP
JUMP ?CND125
?CCL127: SET 'PRSO,OBJ
SET 'PRSO-NP,NP
SET 'PRSI,OBJ1
SET 'PRSI-NP,NP1
?CND125: EQUAL? IT,PRSI,PRSO \?CND128
CALL FIX-HIM-HER-IT,IT,P-IT-OBJECT
ZERO? STACK /?PRG94
?CND128: EQUAL? HER,PRSI,PRSO \?CND132
CALL FIX-HIM-HER-IT,HER,P-HER-OBJECT
ZERO? STACK /?PRG94
?CND132: EQUAL? HIM,PRSI,PRSO \?CND136
CALL FIX-HIM-HER-IT,HIM,P-HIM-OBJECT
ZERO? STACK /?PRG94
?CND136: ICALL2 QCONTEXT-CHECK,PRSO
GET PARSE-RESULT,3
GETB STACK,5 >XX
ZERO? PRSO /?CND140
BTST XX,128 /?CND140
BTST XX,192 /?CND140
CALL2 META-LOC,PRSO >V
ZERO? V /?CND140
IN? V,ROOMS \?CND140
CALL2 META-LOC,WINNER
CALL GLOBAL-IN?,PRSO,STACK
ZERO? STACK \?CND140
CALL2 META-LOC,WINNER
EQUAL? V,STACK /?CND140
ICALL2 NOT-HERE,PRSO
JUMP ?PRG94
?CND140: ZERO? PRSO /?CND149
BAND 96,XX
ZERO? STACK /?CND149
BTST XX,128 /?CND149
CALL ITAKE-CHECK,PRSO,XX >V
EQUAL? M-FATAL,V /?CND78
ZERO? V \?PRG94
?CND149: ZERO? PRSI /?CND159
GET PARSE-RESULT,3
GETB STACK,9 >XX
BAND 96,XX
ZERO? STACK /?CND159
BTST XX,128 /?CND159
CALL ITAKE-CHECK,PRSI,XX >V
EQUAL? M-FATAL,V /?CND78
ZERO? V \?PRG94
?CND159: CALL PERFORM,PRSA,PRSO,PRSI >V
EQUAL? M-FATAL,V /?CND78
EQUAL? P-CONT,-1 \?PRG94
?CND78: SET 'OPRSO,PRSO
ZERO? CLOCK-WAIT \?CND173
CALL1 GAME-VERB?
ZERO? STACK \?CND173
LOC WINNER >V
ZERO? V /?CND177
IN? V,ROOMS /?CND177
GETP V,P?ACTION
CALL D-APPLY,STR?16,STACK,M-END >V
?CND177: GETP HERE,P?ACTION
CALL D-APPLY,STR?16,STACK,M-END >V
?CND173: EQUAL? M-FATAL,V \?CND181
SET 'P-CONT,-1
?CND181: ZERO? CLOCK-WAIT \?CND183
CALL1 GAME-VERB?
ZERO? STACK \?CND183
SET 'CLOCKER-RUNNING,1
CALL1 CLOCKER >V
SET 'CLOCKER-RUNNING,2
EQUAL? M-FATAL,V \?CND183
SET 'P-CONT,-1
?CND183: GET PARSE-RESULT,12 >V
ZERO? V /?CND1
GET V,1
LESS? 1,STACK \?CND1
EQUAL? P-CONT,-1 /?CND1
CALL2 HACK-TELL-1,V >V
EQUAL? M-FATAL,V \?CCL196
SET 'P-CONT,-1
JUMP ?CND1
?CCL196: ZERO? V /?CND1
JUMP ?PRG6
?CCL3: SET 'CLOCK-WAIT,TRUE-VALUE
SET 'P-CONT,FALSE-VALUE
?CND1: SET 'PRSA,FALSE-VALUE
SET 'PRSO,FALSE-VALUE
SET 'PRSO-NP,FALSE-VALUE
SET 'PRSI,FALSE-VALUE
RETURN PRSI
.FUNCT FIX-HIM-HER-IT,PRON,OBJ
ZERO? OBJ \?CCL3
ICALL1 MORE-SPECIFIC
RFALSE
?CCL3: CALL2 VISIBLE?,OBJ
ZERO? STACK \?CCL5
ICALL2 NOT-HERE,OBJ
RFALSE
?CCL5: EQUAL? PRSO,PRON \?CND6
SET 'PRSO,OBJ
ICALL TELL-PRONOUN,OBJ,PRON
?CND6: EQUAL? PRSI,PRON \TRUE
SET 'PRSI,OBJ
ICALL TELL-PRONOUN,OBJ,PRON
RTRUE
.FUNCT TELL-PRONOUN,OBJ,PRON
FSET? PRON,TOUCHBIT /FALSE
EQUAL? OPRSO,OBJ /FALSE
PRINTI "["""
ICALL2 DPRINT,PRON
PRINTI """ meaning "
ICALL2 TELL-THE,OBJ
PRINTR "]"
.FUNCT FIND-A-WINNER,RM,OTHER,WHO,N
ASSIGNED? 'RM /?CND1
SET 'RM,HERE
?CND1: ZERO? QCONTEXT /?CCL5
IN? QCONTEXT,RM \?CCL5
RETURN QCONTEXT
?CCL5: FIRST? RM >OTHER /?BOGUS8
?BOGUS8: SET 'WHO,FALSE-VALUE
?PRG9: ZERO? OTHER \?CCL13
RETURN WHO
?CCL13: FSET? OTHER,PERSONBIT \?CND11
FSET? OTHER,INVISIBLE /?CND11
EQUAL? OTHER,PLAYER /?CND11
IGRTR? 'N,1 /FALSE
SET 'WHO,OTHER
?CND11: NEXT? OTHER >OTHER /?PRG9
JUMP ?PRG9
.FUNCT QCONTEXT-CHECK,PER,WHO
EQUAL? PRSA,V?TELL-ABOUT,V?SHOW \FALSE
EQUAL? PER,PLAYER \FALSE
CALL2 FIND-A-WINNER,HERE >WHO
ZERO? WHO /?CND7
SET 'QCONTEXT,WHO
?CND7: CALL1 QCONTEXT-GOOD?
ZERO? STACK /FALSE
EQUAL? WINNER,PLAYER \FALSE
SET 'WINNER,QCONTEXT
ICALL2 TELL-SAID-TO,QCONTEXT
RTRUE
.FUNCT TELL-SAID-TO,PER
PRINTI "[said to "
ICALL2 DPRINT,PER
PRINTR "]"
.FUNCT QCONTEXT-GOOD?
ZERO? QCONTEXT /FALSE
FSET? QCONTEXT,PERSONBIT \FALSE
CALL2 META-LOC,QCONTEXT
EQUAL? HERE,STACK \FALSE
RETURN QCONTEXT
.FUNCT META-LOC,OBJ,INV,L
LOC OBJ >L
?PRG1: EQUAL? FALSE-VALUE,OBJ,L /FALSE
EQUAL? L,LOCAL-GLOBALS,GLOBAL-OBJECTS,GENERIC-OBJECTS \?CCL7
RETURN L
?CCL7: IN? OBJ,ROOMS \?CCL9
RETURN OBJ
?CCL9: ZERO? INV /?CND10
FSET? OBJ,INVISIBLE /FALSE
?CND10: SET 'OBJ,L
LOC OBJ >L
JUMP ?PRG1
.FUNCT CANT-UNDO
PRINTR "[I can't undo that now.]"
.FUNCT NOT-HERE-VERB?,V
EQUAL? V,V?WALK-TO,V?RESEARCH /TRUE
RFALSE
.FUNCT SEE-VERB?
EQUAL? PRSA,V?SEARCH,V?READ,V?LOOK-UNDER /TRUE
EQUAL? PRSA,V?LOOK-INSIDE,V?LOOK-DOWN,V?LOOK-BEHIND /TRUE
EQUAL? PRSA,V?LOOK,V?TAKE,V?FIND /TRUE
EQUAL? PRSA,V?EXAMINE,V?COUNT,V?CHASTISE /TRUE
RFALSE
.FUNCT PERFORM,PA,PO,PI,V,OA,OO,OI,OQ,OS,X
SET 'OA,PRSA
SET 'OO,PRSO
SET 'OI,PRSI
ZERO? OO /?CCL3
EQUAL? OO,PI \?CCL3
SET 'OBJ-SWAP,TRUE-VALUE
JUMP ?CND1
?CCL3: ZERO? OI /?CCL7
EQUAL? OI,PO \?CCL7
SET 'OBJ-SWAP,TRUE-VALUE
JUMP ?CND1
?CCL7: SET 'OBJ-SWAP,FALSE-VALUE
?CND1: SET 'PRSA,PA
SET 'PRSI,PI
SET 'PRSO,PO
SET 'V,FALSE-VALUE
ZERO? PRSI /?CND10
ICALL2 THIS-IS-IT,PRSI
?CND10: ZERO? PRSO /?CND12
EQUAL? PRSA,V?WALK /?CND12
ICALL2 THIS-IS-IT,PRSO
?CND12: EQUAL? WINNER,PLAYER /?CND16
ICALL2 THIS-IS-IT,WINNER
?CND16: SET 'PO,PRSO
SET 'PI,PRSI
EQUAL? PRSA,V?STOUCH,V?SWRAP /?CND18
EQUAL? PRSA,V?STHROW,V?SSHOW,V?SPUT-ON /?CND18
EQUAL? PRSA,V?SSEARCH-OBJECT-FOR,V?SRIDE-DIR,V?ASK-ABOUT /?CND18
GETP WINNER,P?ACTION
CALL D-APPLY,STR?17,STACK,M-WINNER >V
?CND18: ZERO? V \?CND24
LOC WINNER
IN? STACK,ROOMS /?CND24
LOC WINNER
GETP STACK,P?ACTION
CALL D-APPLY,STR?18,STACK,M-BEG >V
?CND24: ZERO? V \?CND28
GETP HERE,P?ACTION
CALL D-APPLY,STR?18,STACK,M-BEG >V
?CND28: ZERO? V \?CND30
GET PREACTIONS,PA
CALL D-APPLY,STR?19,STACK >V
?CND30: SET 'NOW-PRSI,1
ZERO? V \?CND33
ZERO? PI /?CND33
EQUAL? PRSA,V?WALK /?CND33
LOC PI
ZERO? STACK /?CND33
LOC PI
GETP STACK,P?CONTFCN >V
ZERO? V /?CND33
CALL D-APPLY,STR?20,V,M-CONTAINER >V
?CND33: ZERO? V \?CND41
ZERO? PI /?CND41
EQUAL? PI,GLOBAL-HERE \?CND45
GETP HERE,P?ACTION
CALL D-APPLY,STR?21,STACK >V
?CND45: ZERO? V \?CND41
GETP PI,P?ACTION
CALL D-APPLY,STR?21,STACK >V
?CND41: SET 'NOW-PRSI,0
ZERO? V \?CND49
ZERO? PO /?CND49
EQUAL? PRSA,V?WALK /?CND49
LOC PO
ZERO? STACK /?CND49
LOC PO
GETP STACK,P?CONTFCN >V
ZERO? V /?CND49
CALL D-APPLY,STR?20,V,M-CONTAINER >V
?CND49: ZERO? V \?CND57
ZERO? PO /?CND57
EQUAL? PRSA,V?WALK /?CND57
EQUAL? PO,GLOBAL-HERE \?CND62
GETP HERE,P?ACTION
CALL D-APPLY,STR?22,STACK >V
?CND62: ZERO? V \?CND57
GETP PO,P?ACTION
CALL D-APPLY,STR?22,STACK >V
?CND57: ZERO? V \?CND66
GET ACTIONS,PA
CALL D-APPLY,FALSE-VALUE,STACK >V
?CND66: EQUAL? M-FATAL,V \?CND69
SET 'P-CONT,-1
?CND69: SET 'PRSA,OA
SET 'PRSO,OO
SET 'PRSI,OI
RETURN V
.FUNCT TELL-TOO-DARK
SET 'P-CONT,-1
PRINT TOO-DARK
EQUAL? PRSA,V?LOOK \?CCL3
CALL1 GRUE-PIT-WARNING
RSTACK
?CCL3: CRLF
RTRUE
.FUNCT ITAKE-CHECK,OBJ,BITS,TAKEN
EQUAL? OBJ,IT \?CND1
SET 'OBJ,P-IT-OBJECT
?CND1: CALL HELD?,OBJ,WINNER
ZERO? STACK \FALSE
EQUAL? OBJ,HANDS,ROOMS /FALSE
FSET? OBJ,TRYTAKEBIT /?CND8
EQUAL? WINNER,PLAYER /?CCL12
SET 'TAKEN,TRUE-VALUE
JUMP ?CND8
?CCL12: BTST BITS,32 \?CND8
CALL ITAKE,FALSE-VALUE,OBJ
EQUAL? STACK,TRUE-VALUE \?CND8
SET 'TAKEN,TRUE-VALUE
?CND8: ZERO? TAKEN \FALSE
BTST BITS,64 \FALSE
BTST BITS,128 /FALSE
PRINTC 91
EQUAL? WINNER,PLAYER \?CCL24
PRINTI "You are"
JUMP ?CND22
?CCL24: ICALL2 TELL-CTHE,WINNER
PRINTI " is"
?CND22: PRINTI "n't holding "
ICALL2 TELL-THE,OBJ
ICALL2 THIS-IS-IT,OBJ
PRINTR "!]"
.FUNCT D-APPLY,STR,FCN,FOO,RES
ZERO? FCN /FALSE
ZERO? FOO /?CCL6
CALL FCN,FOO >RES
RETURN RES
?CCL6: CALL FCN >RES
RETURN RES
.FUNCT NOT-HERE,OBJ,CLOCK
ZERO? CLOCK \?CND1
SET 'CLOCK-WAIT,TRUE-VALUE
PRINTI "[But"
?CND1: PRINTC 32
ICALL2 TELL-THE,OBJ
PRINTI " isn't "
CALL2 VISIBLE?,OBJ
ZERO? STACK /?CCL5
PRINTI "close enough"
CALL1 SPEAKING-VERB?
ZERO? STACK /?CND6
PRINTI " to hear you"
?CND6: PRINTC 46
JUMP ?CND3
?CCL5: PRINTI "here!"
?CND3: ICALL2 THIS-IS-IT,OBJ
ZERO? CLOCK \?CND8
PRINTC 93
?CND8: CRLF
RTRUE
.FUNCT SPEAKING-VERB?,A
ASSIGNED? 'A /?CND1
SET 'A,PRSA
?CND1: EQUAL? A,V?ASK-ABOUT,V?ASK-FOR,V?HELLO /TRUE
EQUAL? A,V?NO,V?TELL,V?TELL-ABOUT /TRUE
EQUAL? A,V?YES /TRUE
RFALSE
.FUNCT GET-OWNER,OBJ,TMP,NP
CALL2 GET-NP,OBJ >NP
ZERO? NP /FALSE
GET NP,4 >TMP
ZERO? TMP \?CTR5
GET NP,1 >TMP
ZERO? TMP /?CCL6
GET TMP,2 >TMP
ZERO? TMP /?CCL6
?CTR5: LESS? 0,TMP \FALSE
GRTR? TMP,LAST-OBJECT /FALSE
RETURN TMP
?CCL6: GETP OBJ,P?OWNER >TMP
ZERO? TMP /FALSE
LESS? 0,TMP \?CCL17
GRTR? TMP,LAST-OBJECT \FALSE
?CCL17: RETURN PLAYER
.FUNCT GET-NP,OBJ,PRSI?
SET 'PRSI?,NOW-PRSI
EQUAL? OBJ,PRSO,PRSI \FALSE
ZERO? OBJ /?CND1
EQUAL? OBJ,PRSO \?CCL7
SET 'PRSI?,FALSE-VALUE
JUMP ?CND1
?CCL7: SET 'PRSI?,TRUE-VALUE
?CND1: ZERO? OBJ-SWAP /?CCL10
ZERO? PRSI? /?CCL13
RETURN PRSO-NP
?CCL13: RETURN PRSI-NP
?CCL10: ZERO? PRSI? /?CCL15
RETURN PRSI-NP
?CCL15: RETURN PRSO-NP
.FUNCT NOUN-USED?,OBJ,WD1,WD2,WD3,X
CALL2 GET-NP,OBJ >X
ZERO? X /FALSE
GET X,2 >X
ZERO? X /FALSE
EQUAL? X,WD1,WD2,WD3 /TRUE
RFALSE
.FUNCT ADJ-USED?,OBJ,WD1,WD2,WD3,NP,CT
CALL2 GET-NP,OBJ >NP
ZERO? NP /FALSE
GET NP,1 >NP
ZERO? NP /FALSE
GET NP,2
EQUAL? PLAYER,STACK \?CCL8
EQUAL? W?MY,WD1,WD2,WD3 \?CCL8
RETURN W?MY
?CCL8: GET NP,4 >CT
GRTR? CT,0 \FALSE
ADD NP,10 >NP
INTBL? WD1,NP,CT \?CCL15
RETURN WD1
?CCL15: ZERO? WD2 /FALSE
INTBL? WD2,NP,CT \?CCL20
RETURN WD2
?CCL20: ZERO? WD3 /FALSE
INTBL? WD3,NP,CT \FALSE
RETURN WD3
.ENDSEG
.ENDI