-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathgeneric.zap
301 lines (274 loc) · 5.6 KB
/
generic.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
.FUNCT RT-GN-PAPER,TBL,LEN,PTR,OBJ,PAPER,CONT,C-PAPER,HELD,H-PAPER,GND,G-PAPER
ZERO? LEN \?CND1
GET TBL,0 >LEN
?CND1: ADD TBL,2 >PTR
INTBL? GL-P-IT-OBJECT,PTR,LEN \?PRG6
PRINTC 91
ICALL2 RT-CTHEO-PRINT,GL-P-IT-OBJECT
PRINTC 93
CRLF
RETURN GL-P-IT-OBJECT
?PRG6: MUL LEN,2
ADD TBL,STACK
GRTR? PTR,STACK /?REP7
GET PTR,0 >OBJ
LOC OBJ
FSET? STACK,FL-SURFACE /?REP7
LOC OBJ
EQUAL? STACK,CH-PLAYER \?CCL15
ZERO? HELD \?CCL18
SET 'HELD,TRUE-VALUE
SET 'H-PAPER,OBJ
JUMP ?CND11
?CCL18: SET 'H-PAPER,FALSE-VALUE
JUMP ?CND11
?CCL15: LOC OBJ
EQUAL? STACK,GL-PLACE-CUR \?CCL20
ZERO? GND \?CCL23
SET 'GND,TRUE-VALUE
SET 'G-PAPER,OBJ
JUMP ?CND11
?CCL23: SET 'G-PAPER,FALSE-VALUE
JUMP ?CND11
?CCL20: ZERO? CONT \?CCL25
LOC OBJ
FSET? STACK,FL-CONTAINER \?CCL25
LOC OBJ >CONT
SET 'C-PAPER,OBJ
JUMP ?CND11
?CCL25: LOC OBJ
FSET? STACK,FL-CONTAINER \?CND11
ZERO? CONT /?CND11
LOC OBJ
EQUAL? STACK,CONT /?CND11
SET 'C-PAPER,FALSE-VALUE
?CND11: ADD PTR,2 >PTR
JUMP ?PRG6
?REP7: ZERO? OBJ /?CCL34
LOC OBJ
FSET? STACK,FL-SURFACE \?CCL34
SET 'PAPER,OBJ
JUMP ?CND32
?CCL34: ZERO? H-PAPER /?CCL38
SET 'PAPER,H-PAPER
JUMP ?CND32
?CCL38: ZERO? G-PAPER /?CCL40
SET 'PAPER,G-PAPER
JUMP ?CND32
?CCL40: ZERO? C-PAPER /FALSE
SET 'PAPER,C-PAPER
?CND32: PRINTC 91
ICALL2 RT-CTHEO-PRINT,PAPER
PRINTC 93
CRLF
CRLF
RETURN PAPER
.FUNCT RT-GN-GEM,TBL,LEN,PTR,OBJ,GEM,CONT,C-GEM,HELD,H-GEM,GND,G-GEM
ZERO? LEN \?CND1
GET TBL,0 >LEN
?CND1: ADD TBL,2 >PTR
INTBL? GL-P-IT-OBJECT,PTR,LEN \?CCL5
PRINTC 91
ICALL2 RT-CTHEO-PRINT,GL-P-IT-OBJECT
PRINTC 93
CRLF
CRLF
RETURN GL-P-IT-OBJECT
?CCL5: EQUAL? GL-PLACE-CUR,RM-CLOCK-TOWER \?PRG10
IN? TH-SAPPHIRE,TH-CLAPPER \?PRG10
RETURN TH-SAPPHIRE
?PRG10: MUL LEN,2
ADD TBL,STACK
GRTR? PTR,STACK /?REP11
GET PTR,0 >OBJ
LOC OBJ
EQUAL? STACK,CH-PLAYER \?CCL17
ZERO? HELD \?CCL20
SET 'HELD,TRUE-VALUE
SET 'H-GEM,OBJ
JUMP ?CND15
?CCL20: SET 'H-GEM,FALSE-VALUE
JUMP ?CND15
?CCL17: LOC OBJ
EQUAL? STACK,GL-PLACE-CUR \?CCL22
ZERO? GND \?CCL25
SET 'GND,TRUE-VALUE
SET 'G-GEM,OBJ
JUMP ?CND15
?CCL25: SET 'G-GEM,FALSE-VALUE
JUMP ?CND15
?CCL22: LOC OBJ
ZERO? STACK /?CCL27
ZERO? CONT \?CCL27
LOC OBJ
FSET? STACK,FL-CONTAINER \?CCL27
LOC OBJ >CONT
SET 'C-GEM,OBJ
JUMP ?CND15
?CCL27: LOC OBJ
ZERO? STACK /?CND15
LOC OBJ
FSET? STACK,FL-CONTAINER \?CND15
ZERO? CONT /?CND15
LOC OBJ
EQUAL? STACK,CONT /?CND15
SET 'C-GEM,FALSE-VALUE
?CND15: ADD PTR,2 >PTR
JUMP ?PRG10
?REP11: ZERO? H-GEM /?CCL38
SET 'GEM,H-GEM
JUMP ?CND36
?CCL38: ZERO? G-GEM /?CCL40
SET 'GEM,G-GEM
JUMP ?CND36
?CCL40: ZERO? C-GEM /FALSE
SET 'GEM,C-GEM
?CND36: PRINTC 91
ICALL2 RT-CTHEO-PRINT,GEM
PRINTC 93
CRLF
CRLF
RETURN GEM
.FUNCT RT-GN-PIGEON,TBL,LEN
FSET? CH-TRAINED-PIGEON,FL-ALIVE /?CCL3
PRINTC 91
ICALL2 RT-CTHEO-PRINT,TH-DEAD-PIGEON
PRINTC 93
CRLF
CRLF
RETURN TH-DEAD-PIGEON
?CCL3: PRINTC 91
ICALL2 RT-CTHEO-PRINT,CH-TRAINED-PIGEON
PRINTC 93
CRLF
CRLF
RETURN CH-TRAINED-PIGEON
.FUNCT RT-GN-OAR,TBL,LEN
EQUAL? GL-P-IT-OBJECT,TH-OAR-1,TH-OAR-2 \?CCL3
PRINTC 91
ICALL2 RT-CTHEO-PRINT,GL-P-IT-OBJECT
PRINTC 93
CRLF
CRLF
RETURN GL-P-IT-OBJECT
?CCL3: PRINTC 91
ICALL2 RT-CTHEO-PRINT,TH-OAR-2
PRINTC 93
CRLF
CRLF
RETURN TH-OAR-2
.FUNCT RT-GN-BOX,TBL,LEN,PTR
ZERO? LEN \?CND1
GET TBL,0 >LEN
?CND1: ADD TBL,2 >PTR
INTBL? GL-P-IT-OBJECT,PTR,LEN \FALSE
PRINTC 91
ICALL2 RT-CTHEO-PRINT,GL-P-IT-OBJECT
PRINTC 93
CRLF
CRLF
RETURN GL-P-IT-OBJECT
.FUNCT RT-GN-DOOR,TBL,LEN,PTR,OBJ,DOOR
ZERO? LEN \?CND1
GET TBL,0 >LEN
?CND1: ADD TBL,2 >PTR
?PRG3: MUL LEN,2
ADD TBL,STACK
GRTR? PTR,STACK /?REP4
GET PTR,0 >OBJ
EQUAL? GL-PRSA,V?OPEN \?CCL10
FSET? OBJ,FL-OPENED /?CND8
ZERO? DOOR \FALSE
SET 'DOOR,OBJ
JUMP ?CND8
?CCL10: EQUAL? GL-PRSA,V?CLOSE \?CND8
FSET? OBJ,FL-OPENED \?CND8
ZERO? DOOR \FALSE
SET 'DOOR,OBJ
?CND8: ADD PTR,2 >PTR
JUMP ?PRG3
?REP4: ZERO? DOOR /?CND22
PRINTC 91
ICALL2 RT-CTHEO-PRINT,DOOR
PRINTC 93
CRLF
CRLF
?CND22: RETURN DOOR
.FUNCT RT-GN-BOTTLE,TBL,LEN,PTR,OBJ,BOTTLE
ZERO? LEN \?CND1
GET TBL,0 >LEN
?CND1: ADD TBL,2 >PTR
?PRG3: MUL LEN,2
ADD TBL,STACK
GRTR? PTR,STACK /?REP4
GET PTR,0 >OBJ
EQUAL? GL-PRSA,V?OPEN \?PRD11
ZERO? GL-NOW-PRSI? \?PRD11
FSET? OBJ,FL-OPENED \?CCL9
?PRD11: EQUAL? GL-PRSA,V?CLOSE \?PRD15
ZERO? GL-NOW-PRSI? \?PRD15
FSET? OBJ,FL-OPENED /?CCL9
?PRD15: EQUAL? GL-PRSA,V?PUT \?CND8
ZERO? GL-NOW-PRSI? /?CND8
FSET? OBJ,FL-OPENED \?CND8
?CCL9: ZERO? BOTTLE \FALSE
SET 'BOTTLE,OBJ
?CND8: ADD PTR,2 >PTR
JUMP ?PRG3
?REP4: ZERO? BOTTLE /?CND25
PRINTC 91
ICALL2 RT-CTHEO-PRINT,BOTTLE
PRINTC 93
CRLF
CRLF
?CND25: RETURN BOTTLE
.FUNCT RT-GN-PILL,TBL,LEN,PTR,OBJ,PILL
ZERO? LEN \?CND1
GET TBL,0 >LEN
?CND1: ADD TBL,2 >PTR
CALL1 RT-TOUCH-VERB?
ZERO? STACK /?CND3
?PRG5: MUL LEN,2
ADD TBL,STACK
GRTR? PTR,STACK /?CND3
GET PTR,0 >OBJ
CALL2 RT-ACCESSIBLE?,OBJ
ZERO? STACK /?CND10
ZERO? PILL \FALSE
SET 'PILL,OBJ
?CND10: ADD PTR,2 >PTR
JUMP ?PRG5
?CND3: ZERO? PILL /?CND15
PRINTC 91
ICALL2 RT-CTHEO-PRINT,PILL
PRINTC 93
CRLF
CRLF
?CND15: RETURN PILL
.FUNCT RT-GN-TH-CLOTHES,TBL,LEN
RETURN TH-CLOTHES
.FUNCT RT-GN-BODY,TBL,LEN,PTR,OBJ
ZERO? LEN \?CND1
GET TBL,0 >LEN
?CND1: ADD TBL,2 >PTR
INTBL? TH-CLOTHES,PTR,LEN \?PRG5
RETURN TH-CLOTHES
?PRG5: ZERO? LEN /FALSE
GET PTR,0 >OBJ
FSET? OBJ,FL-BODYPART \?CND7
RETURN OBJ
?CND7: ADD PTR,2 >PTR
DEC 'LEN
JUMP ?PRG5
.FUNCT RT-GN-INTNUM,TBL,LEN
EQUAL? GL-PRSA,V?WAIT,V?WAIT-FOR /?CTR2
RETURN TH-SAFETY-DEPOSIT-BOX
?CTR2: RETURN TH-INTNUM
.FUNCT RT-GN-ETHERIUM,TBL,LEN
EQUAL? GL-PRSA,V?SMELL,V?INHALE \?CCL3
RETURN TH-ETHERIUM-GAS
?CCL3: EQUAL? GL-PRSA,V?MUNG,V?OPEN,V?LOOK-INSIDE \FALSE
RETURN TH-ETHERIUM-AMPOULE
.FUNCT RT-GN-TOWER,TBL,LEN
RETURN LG-TOWER
.ENDI