-
Notifications
You must be signed in to change notification settings - Fork 8
/
hints.zap
267 lines (242 loc) · 4.6 KB
/
hints.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
.FUNCT V-HINT:ANY:0:0,CHR,MAXC,C,Q,WHO
?FCN: PRINTR "Hints are not in this version."
?PRG9: INPUT 1 >CHR
EQUAL? CHR,81,113 \?CCL13
SET 'Q,TRUE-VALUE
JUMP ?REP10
?CCL13: EQUAL? CHR,78,110 \?CCL15
EQUAL? CHAPT-NUM,MAXC /?PRG9
ICALL1 ERASE-CURSOR
INC 'CUR-POS
INC 'CHAPT-NUM
ICALL1 NEW-CURSOR
SET 'QUEST-NUM,1
JUMP ?PRG9
?CCL15: EQUAL? CHR,80,112 \?CCL19
EQUAL? CHAPT-NUM,1 /?PRG9
ICALL1 ERASE-CURSOR
DEC 'CUR-POS
DEC 'CHAPT-NUM
ICALL1 NEW-CURSOR
SET 'QUEST-NUM,1
JUMP ?PRG9
?CCL19: EQUAL? CHR,13,10 \?PRG9
ICALL1 PICK-QUESTION
?REP10: ZERO? Q /?FCN
SPLIT 0
CLEAR -1
ICALL1 INIT-STATUS-LINE
RETURN 2
.FUNCT PICK-QUESTION:ANY:0:0,CHR,MAXQ,Q
?FCN: ICALL2 INIT-HINT-SCREEN,FALSE-VALUE
ICALL LEFT-LINE,3,STR?407,18
ICALL RIGHT-LINE,3,STR?408,13
GET HINTS,CHAPT-NUM
GET STACK,0
SUB STACK,1 >MAXQ
CURSET 5,1
ICALL1 PUT-UP-QUESTIONS
SUB QUEST-NUM,1 >CUR-POS
ICALL1 NEW-CURSOR
?PRG1: INPUT 1 >CHR
EQUAL? CHR,81,113 \?CCL5
SET 'Q,TRUE-VALUE
JUMP ?REP2
?CCL5: EQUAL? CHR,78,110 \?CCL7
EQUAL? QUEST-NUM,MAXQ /?PRG1
ICALL1 ERASE-CURSOR
INC 'CUR-POS
INC 'QUEST-NUM
ICALL1 NEW-CURSOR
JUMP ?PRG1
?CCL7: EQUAL? CHR,80,112 \?CCL11
EQUAL? QUEST-NUM,1 /?PRG1
ICALL1 ERASE-CURSOR
DEC 'CUR-POS
DEC 'QUEST-NUM
ICALL1 NEW-CURSOR
JUMP ?PRG1
?CCL11: EQUAL? CHR,13,10 \?PRG1
ICALL1 DISPLAY-HINT
?REP2: ZERO? Q /?FCN
RFALSE
.FUNCT ERASE-CURSOR:ANY:0:0,?TMP1
GET LINE-TABLE,CUR-POS >?TMP1
GET COLUMN-TABLE,CUR-POS
SUB STACK,2
CURSET ?TMP1,STACK
PRINTC 32
RTRUE
.FUNCT NEW-CURSOR:ANY:0:0,?TMP1
GET LINE-TABLE,CUR-POS >?TMP1
GET COLUMN-TABLE,CUR-POS
SUB STACK,2
CURSET ?TMP1,STACK
PRINTC 62
RTRUE
.FUNCT INVERSE-LINE:ANY:0:0,CENTER-HALF
HLIGHT H-INVERSE
GETB 0,33
ICALL2 PRINT-SPACES,STACK
HLIGHT H-NORMAL
RTRUE
.FUNCT DISPLAY-HINT:ANY:0:0,H,MX,CNT,CHR,FLG,N,?TMP1
SET 'CNT,2
SET 'FLG,TRUE-VALUE
SPLIT 0
CLEAR -1
SPLIT 3
SCREEN S-WINDOW
CURSET 1,1
ICALL1 INVERSE-LINE
ICALL CENTER-LINE,1,STR?409,16
CURSET 3,1
ICALL1 INVERSE-LINE
ICALL LEFT-LINE,3,STR?410
ICALL RIGHT-LINE,3,STR?411,17
HLIGHT H-BOLD
GET HINTS,CHAPT-NUM >?TMP1
ADD QUEST-NUM,1
GET ?TMP1,STACK >H
GET H,1
ICALL CENTER-LINE,2,STACK
HLIGHT H-NORMAL
GET H,0 >MX
SCREEN S-TEXT
CRLF
?PRG1: ZERO? FLG /?CND3
SUB MX,CNT
ADD STACK,1 >N
PRINTC 91
PRINTN N
PRINTI " hint"
EQUAL? N,1 /?CND5
PRINTC 115
?CND5: PRINTI " left.]"
CRLF
CRLF
PRINTI " -> "
SET 'FLG,FALSE-VALUE
?CND3: INPUT 1 >CHR
EQUAL? CHR,81,113 /TRUE
EQUAL? CHR,13,10 \?PRG1
GRTR? CNT,MX /?PRG1
SET 'FLG,TRUE-VALUE
GET H,CNT
PRINT STACK
CRLF
CRLF
IGRTR? 'CNT,MX \?PRG1
SET 'FLG,FALSE-VALUE
PRINTI "[Final hint]"
CRLF
JUMP ?PRG1
.FUNCT PUT-UP-QUESTIONS:ANY:0:0,ST,MXQ,MXL,?TMP1
SET 'ST,1
GET HINTS,CHAPT-NUM
GET STACK,0
SUB STACK,1 >MXQ
GETB 0,32
SUB STACK,1 >MXL
?PRG1: GRTR? ST,MXQ /TRUE
SUB ST,1
GET LINE-TABLE,STACK >?TMP1
SUB ST,1
GET COLUMN-TABLE,STACK
SUB STACK,1
CURSET ?TMP1,STACK
PRINTC 32
GET HINTS,CHAPT-NUM >?TMP1
ADD ST,1
GET ?TMP1,STACK
GET STACK,1
PRINT STACK
INC 'ST
JUMP ?PRG1
.FUNCT PUT-UP-CHAPTERS:ANY:0:0,ST,MXC,MXL,?TMP1
SET 'ST,1
GET HINTS,0 >MXC
GETB 0,32
SUB STACK,1 >MXL
?PRG1: GRTR? ST,MXC /TRUE
SUB ST,1
GET LINE-TABLE,STACK >?TMP1
SUB ST,1
GET COLUMN-TABLE,STACK
SUB STACK,1
CURSET ?TMP1,STACK
PRINTC 32
GET HINTS,ST
GET STACK,1
PRINT STACK
INC 'ST
JUMP ?PRG1
.FUNCT INIT-HINT-SCREEN:ANY:0:1,THIRD,WID,LEN
ASSIGNED? 'THIRD /?CND1
SET 'THIRD,TRUE-VALUE
?CND1: GETB 0,33 >WID
SPLIT 0
CLEAR -1
GETB 0,32
SUB STACK,1
SPLIT STACK
SCREEN S-WINDOW
CURSET 1,1
ICALL1 INVERSE-LINE
CURSET 2,1
ICALL1 INVERSE-LINE
CURSET 3,1
ICALL1 INVERSE-LINE
ICALL CENTER-LINE,1,STR?409,16
ICALL LEFT-LINE,2,STR?774
ICALL RIGHT-LINE,2,STR?775,12
ZERO? THIRD /FALSE
ICALL LEFT-LINE,3,STR?776
CALL RIGHT-LINE,3,STR?777,16
RSTACK
.FUNCT CENTER-LINE:ANY:2:4,LN,STR,LEN,INV
ASSIGNED? 'INV /?CND1
SET 'INV,TRUE-VALUE
?CND1: ZERO? LEN \?CND3
DIROUT D-TABLE-ON,DIROUT-TBL
PRINT STR
DIROUT D-TABLE-OFF
GET DIROUT-TBL,0 >LEN
?CND3: GETB 0,33
SUB STACK,LEN
DIV STACK,2
CURSET LN,STACK
ZERO? INV /?CND5
HLIGHT H-INVERSE
?CND5: PRINT STR
ZERO? INV /FALSE
HLIGHT H-NORMAL
RTRUE
.FUNCT LEFT-LINE:ANY:2:3,LN,STR,INV
ASSIGNED? 'INV /?CND1
SET 'INV,TRUE-VALUE
?CND1: CURSET LN,1
ZERO? INV /?CND3
HLIGHT H-INVERSE
?CND3: PRINT STR
ZERO? INV /FALSE
HLIGHT H-NORMAL
RTRUE
.FUNCT RIGHT-LINE:ANY:2:4,LN,STR,LEN,INV
ASSIGNED? 'INV /?CND1
SET 'INV,TRUE-VALUE
?CND1: ZERO? LEN \?CND3
DIROUT 3,DIROUT-TBL
PRINT STR
DIROUT -3
GET DIROUT-TBL,0 >LEN
?CND3: GETB 0,33
SUB STACK,LEN
CURSET LN,STACK
ZERO? INV /?CND5
HLIGHT H-INVERSE
?CND5: PRINT STR
ZERO? INV /FALSE
HLIGHT H-NORMAL
RTRUE
.ENDI