File: error.t2

For general comments see here
LineAddressObject Code LabelF1N1BF2N2CommentsCheck
1 0  ; tape1.d/error.t2
2 0  ;-----------------
3 0  ;
4 0  =549 
5 549  Error::; 
6 549 0000003641100.1mill:+1000000; @549
7 550 0000000023220.K9872:+9872; @550
8 551  ;
9 551  .551:; 
10 551 1700034 otp SP   ;space @551
11 551+1101066 jmp .566P   ;
12 552  ;
13 552  .552:; 
14 552 0004107000001 o00 lookupkw.word/jmp 1;return @552
15 553  ;-------------------------------------------------------------------
16 553  Error1:; 
17 553  .553:; 
18 553 0602222 lod K8191   ; @553
19 553+ L553P:; only ref is unreferenced 
20 553+ .553P:; 
21 553+1010272 jmp ErrorHandler.go   ;branch to error handler proper
22 554  ;-------------------------------------------------------------------
23 554  ; no refs
24 554  .554:; 
25 554 1700036 otp LF   ;line feed @554
26 554+1700033 otp FS   ;figure shift
27 555 0000000 o00 0   ;
28 555+0000000 o00 0   ;
29 556 0601044 lod errlnk   ; @556
30 556+0062222 and K8191   ; mask off address bits
31 557 7304105101063 lnk lookupkw.word:jmp L563P;call 563+
32 558  ;-------------------------------------------------------------------
33 558  KbWait:; 
34 558  .558:; 
35 558 1600000 kbd 0   ;read WG @558
36 558+1121060 o45 .560   ;sign bit set?
37 559  .559:; 
38 559 1600000 kbd 0   ;read WG again
39 559+1121061 jn .561   ;set now
40 560 1001057 jmp .559   ;loop back until it is
41 560+ ;
42 560+ .560:; 
43 560+1600000 kbd 0   ;read WG again
44 561 1121060 jn .560   ;still set, loop back
45 561+ .561:; 
46 561+0601020 lod W528   ; can we recover?
47 562 0004223040001 o00 errlnk/jz 1;return to recovery point
48 563  .563:; 
49 563 1001063 jmp .563   ;loop stop if not
50 563+ ;------------------------------------------------
51 563+ ; no refrenced refs
52 563+ L563P:; 
53 563+ .563P:; 
54 563+0401015 sto lookupkw.work   ; @563+
55 564 0602210 lod K7a   ;=7
56 564+0421016 stn W526   ; =-7
57 565 0601106 lod W582   ; @565
58 565+0401076 sto W574   ;
59 566  .566:; 
60 566 0541017 cls W527   ; @566
61 566+ .566P:; 
62 566+0601015 lod lookupkw.work   ;
63 567  .567:; 
64 567 0121045 sub .1mill   ; @567
65 567+1101071 jmp .569P   ;
66 568  ;--------------------------------
67 568 0602222Error:lod K8191   ; @568
68 568+1010272 jmp ErrorHandler.go   ;branch into error handler
69 569  ;--------------------------------
70 569  ; no refs
71 569  .569:; 
72 569 1101051 jmp L553P   ;
73 569+ ;--------------------------------
74 569+ .569P:; 
75 569+1021073 jn .571   ;
76 570 0441017 inc W527   ; @570
77 570+1001067 jmp .567   ;
78 571  ;
79 571  .571:; 
80 571 0101045 add .1mill   ;
81 571+0401015 sto lookupkw.work   ;
82 572 0501015 ads lookupkw.work   ;\ @572
83 572+1320003 sll 3   ; \
84 573 0501015 ads lookupkw.work   ; *10
85 573+0441016 inc W526   ;
86 574 0000000W574:o00 0   ;may be patched to: @574
87 574+0000000 o00 0   ;lod W527 : jz .580P
88 575  W575:; 
89 575 0601046.575:lod .K9872   ; @575
90 575+0000020 o00 +16   ;in-line constant used below
91 576 0004077220000 o00 W527/srl 0;
92 577 0061077 and W575   ;=16
93 577+0541076 cls W574   ;convert back to nops
94 578 2404077700000 ads W527/otp 0; @578
95 579 0601016 lod W526   ;
96 579+1021066 jn .566   ;
97 580 1001050 jmp .552   ; @580
98 580+ ;
99 580+ .580P:; 
100 580+0601016 lod W526   ;
101 581 1021047 jn .551   ;
102 581+1001077 jmp .575   ;
103 582  ;
104 582 3004075141104W582:lod W527:jz .580P;to be stored in W574 above @582
105 583  ;
106 583  L583.ent:; 
107 583 0541020 cls W528   ;indicate return possible
108 583+1001056 jmp KbWait   ;
109 584  ;-------------------------------------------------------------------
110 584  ErrorHandler::; 
111 584  ;
112 584  =4250 
113 4250  .report:; 
114 4250 1714035 otp TP+CR   ; @4250
115 4250+1714036 otp TP+LF   ;
116 4251 1220000 srl 0   ;clear AR
117 4251+0541415 cls work1   ;clear index
118 4252  ; from 4254+
119 4252 2206066610322.loop0:inc work1/lod errtab;get possible value @4252
120 4253 1030271 jn .crash   ;end of list, system error
121 4253+0121044 sub errlnk   ;error address
122 4254 1050663 jz L4531   ;match - goto patched bit @4254
123 4254+1010234 jmp .loop0   ;continue loop
124 4255  ;
125 4255  ;------------------------------------------------------------
126 4255  =4531 
127 4531  ; found match in error table
128 4531  ;
129 4531  L4531:; 
130 4531 0601513.4531:lod putcode.ret   ;=<00 .lnk / jmp 1> return
131 4531+0341500 stc putcode.pat   ;close off generate routine
132 4532 0550624 cls W4500   ; @4532
133 4532+1010237 jmp L4255   ;back to error routine
134 4533  =4255 
135 4255  ; match above comes here after patched bit
136 4255  L4255:; 
137 4255  .4255:; 
138 4255 0610306 lod errmsg   ;="ERROR " @4255
139 4255+1200036 sra 30   ;shift into AR
140 4256   call     ; display word @4256
140+14256 7306155010274 lnk dispwd.lnk:jmp dispwd.ent 
141 4257 0610307 lod errmsg+1   ;="NO. ~~"
142 4257+1200036 sra 30   ;shift into AR
143 4258   call     ; display word @4258
143+14258 7306155010274 lnk dispwd.lnk:jmp dispwd.ent 
144 4259 0604312 lod K20   ;=20
145 4259+0121415 sub work1   ;check for error 20
146 4260 1010734 jmp L4572   ;turn off code gen, etc. @4260
147 4260+ ; return here if not error 20
148 4260+ L4260P:; 
149 4260+ .4260P:; 
150 4260+0540576 cls ident    
151 4261  ; from 4572
152 4261  L4261:; 
153 4261  .4261:; 
154 4261 1220000 srl 0   ;clear AR
155 4261+ ; loop from 4266+
156 4261+ .loop1:; 
157 4261+0741415 lzs work1   ;get index, clr mem
158 4262 1050253 jz .done   ;zero, finished @4262
159 4262+ ; from 4264
160 4262+ .loop2:; 
161 4262+0124331 sub K10a   ;=10
162 4263 1130250 jn .brk1   ; break if negative
163 4263+0441415 inc work1   ;increment tens
164 4264 1110246 jmp .loop2   ;loop back @4264
165 4264+ ;
166 4264+ .brk1:; 
167 4264+0104331 add K10a   ;add back the ten
168 4265 1600022110310 stc 4/add digits;convert to character
169 4266 1200006 sra 6   ;shift into AR @4266
170 4266+1110245 jmp .loop1   ;loop back and do tens
171 4267  ;
172 4267  .done:call     ;discard acc then
172+14267 7306155010303 lnk dispwdb.lnk:jmp dispwdb.ent 
173 4268  ; ;display contents of AR
174 4268 0600576 lod ident   ;identifier @4268
175 4268+1050260 jz .skip   ;none, skip
176 4269 1200044 sra 36   ;shift into AR
177 4269+ ; loop until non-blank char found
178 4269+1300006.loop3:sla 6   ;shift first char back
179 4270 1150255 jz .loop3   ;skip leading nulls @4270
180 4270+1714034 otp TP+' '   ;display SP
181 4271   call     ;display wd
181+14271 7306155010275 lnk dispwda.lnk:jmp dispwda.ent 
182 4272  ; from 4268+
183 4272  .skip:; 
184 4272 1714035 otp TP+CR   ;display CR @4272
185 4272+1714036 otp TP+LF   ;display LF
186 4273 0600576 lod ident   ;identfier?
187 4273+1050665 jz L4533   ;no, skip
188 4274 0600574 lod currchar   ; @4274
189 4274+0000000 o00 0   ;
190 4275   call     ;
190+14275 7303015000605 lnk getchara.lnk:jmp getchara.ent 
191 4276 1010722 jmp L4562   ; @4276
192 4276+1010722 jmp L4562   ;
193 4277 1010722 jmp L4562   ;
194 4277+1010722 jmp L4562   ;
195 4278 1010267 jmp .4279   ; @4278
196 4278+1000604 jmp getchar.ent   ;
197 4279  ;
198 4279  .4279:; 
199 4279 0042245 o02 K16   ;=16
200 4279+0120574 sub currchar   ;
201 4280 1150732 jz L4570P   ; @4280
202 4280+1010722 jmp L4562    
203 4281  ;
204 4281  ; compiler error, punch continuous '.'s
205 4281  ;
206 4281 1700016.crash:otp '.'   ;punch '.'
207 4281+1010271 jmp .crash   ; loop until reset
208 4282  ;
209 4282  ; entry from main body - acc should contain 8191
210 4282 0461044.go:ans errlnk   ; eliminate higher bits
211 4282+0541435 cls Work2   ; assume fig shift on printer
212 4283 1010232 jmp .report   ; produce error message etc.
213 4283+ ;
214 4283+0000000 o00 0    
215 4284  ;------------------------------------------------------------------
216 4284  ; display word in ACC:AR
217 4284  ; keeping track of shifts of course
218 4284  ;
219 4284  dispwd::; 
220 4284  ;
221 4284  .ent:; 
222 4284 0006157040001 o00 .lnk/jz 1;return +1 if =0 @4284
223 4285  ;
224 4285  dispwda.ent:; 
225 4285 0401434 sto Work1   ;save character for display
226 4285+0064314 and K32a   ;=32 mask off letter/fig bit
227 4286 0201435 exa Work2   ;present setting @4286
228 4286+0121435 sub Work2   ; == present setting
229 4287 1050302 jz .noshift   ;yes, punch character
230 4287+0601435 lod Work2   ;reload setting
231 4288 1050301 jz .fs   ;, zero, display FS @4288
232 4288+0604347 lod K4a   ;=4, modify to LS
233 4289  .fs:; 
234 4289 1600023714033 stc 4/otp TP+FS;6K+FS (or LS if modified)
235 4290  .noshift:; 
236 4290 0006163714000 o00 Work1/otp TP;6K+char @4290
237 4291  ;
238 4291  dispwdb.ent:; 
239 4291 1300006 sla 6   ;shift next char from AR to ACC
240 4291+1010274 jmp .ent   ;and loop back
241 4292  ;
242 4292  dispwdc.ent:; 
243 4292 0541435 cls Work2   ; @4292
244 4292+1200036 sra 30   ;
245 4293 1010274 jmp dispwd.ent   ; jump back into dispwd
246 4293+ ;
247 4293+0000000 o00 0    
248 4294  ;--------------------------------------------------------------------
249 4294 0456262576234errmsg:'ERROR\34'; @4294
250 4295 0565716340000 'NO. \00\00';
251 4296  ;
252 4296 0000000000031digits:'0','1','2','3','4','5','6','7','8','9' 
253 4306  ;
254 4306  errtab:; 
255 4306 0000000002403 +0,+_err01,+_err02,+_err03;0,1,2,3, ;@4306
256 4310 0000000002541 +_err04,+_err05,+_err06,+_err07;4,5,6,7, ;@4310
257 4314 0000000002757 +_err08,+_err09,+_err10,+_err11;8,9,10,11, ;@4314
258 4318 0000000003217 +_err12,+_err13,+_err14,+_err15;12,13,14,15, ;@4318
259 4322 0000000004445 +_err16,+_err17,+_err18,+_err19;16,17,18,19, ;@4322
260 4326 0000000004454 +_err20,+_err21,+_err22,+2348;20,21,22,23, ;@4326
261 4330 0000000005155 +_err24,+_err25,+_err26,+_err27;24,25,26,27, ;@4330
262 4334 0000000005373 +_err28,+_err29,+_err30,+_err31;28,29,30,31, ;@4334
263 4338 0000000005672 +_err32,+_err33,+_err34,+_err35;32,33,34,35, ;@4338
264 4342 0000000007636 +_err36,+_err37,+_err38,+_err39;36,37,38,39, ;@4342
265 4346 0000000006613 +_err40,+_err41,+_err42,+_err43;40,41,42,43, ;@4346
266 4350 0000000007240 +_err44,+_err45,+_err46,+_err47;44,45,46,47, ;@4350
267 4354 0000000004216 +_err48,+_err49,+_err50,+_err51;48,49,50,51, ;@4354
268 4358 7777777777777 +_err52,+_err53,+_err54,-1;52,53,54,--- ;@4358
269 4362  ;-------------------------------------------------------------
270 4362  =4514 
271 4514  ;
272 4514  ; comes here when finished error recovery
273 4514  ;
274 4514  L4514:; 
275 4514  .4514:call     ; @4514
275+14514 7336515107714 lnk pause.lnk:jmp pause.ent 
276 4515 0610655 lod getchar.ipnorm   ;=<06 0:71 0>
277 4515+0340604 stc getchar.ent   ;reset getchar
278 4516 0541425 cls errsw   ; @4516
279 4516+0540602 cls incomment   ;reset comment flag
280 4517 0610622 lod W4498   ;
281 4517+0342151 stc stkp   ;
282 4518 0043107010651 o00 W4497/jmp .sw4519+2;re-enter compiler @4518
283 4519  ;
284 4519  .sw4519:; 
285 4519 4011260000000 jmp declaration.loop:o00 0;-2 @4519
286 4520 4011510000000 jmp declaration.idlst:o00 0;-1 @4520
287 4521 4015340000000 jmp L1720:o00 0;0 @4521
288 4522 4011414000000 jmp declaration.recover:o00 0;+1 @4522
289 4523  ;
290 4523  L4523:; 
291 4523 0570622.4523:o27 W4498   ; @4523
292 4523+0167525 bus stkbase   ;
293 4524 1102027 jmp L1047P   ; @4524
294 4524+ ;
295 4524+0000000 o00 0   ;
296 4525  ;
297 4525  =4533 
298 4533  ;------------------------------------------------------------
299 4533  ; skip source code to suitable point, copying
300 4533  Recovery::; 
301 4533  L4533:; 
302 4533  .4533:; 
303 4533   call     ;call 4558+
303+14533 7343115110716 lnk L4558P.lnk:jmp L4558P.ent 
304 4534  .4534:; 
305 4534   call     ; @4534
305+14534 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
306 4535  .4535:; 
307 4535 0600600 lod token   ;token
308 4535+0122211 sub K4   ;=4 [end]
309 4536 1050675 jz .4541   ; check for end of copy @4536
310 4536+0124340 sub K2b   ;=2 [begin]
311 4537 1050674 jz .4540   ; count it
312 4537+0124340 sub K2b   ;=2 [']
313 4538 1050707 jz .4551   ; check for end of copy @4538
314 4538+0122223 sub K31b   ;=31 [else]
315 4539 1050666 jz .4534   ;ignore
316 4539+1010666 jmp .4534   ;continue copy
317 4540  ;
318 4540  ; token=[begin], bump nesting count
319 4540  .4540:; 
320 4540 0450624 inc W4500   ;increment count @4540
321 4540+1010666 jmp .4534   ;continue copy
322 4541  ;
323 4541  ; token=[end], decrement nesting count
324 4541  .4541:; 
325 4541 0040000 o02 0   ;=1
326 4541+0770624 o37 W4500   ;decrement count
327 4542 1050642 jz L4514   ;exit if zero @4542
328 4542+1010666 jmp .4534   ;continue loop
329 4543  ;
330 4543  =4544+ 
331 4544+ ;
332 4544+ ; from 4551+, non-nested [']
333 4544+ .4544P:; 
334 4544+0610625 lod W4501   ;is flag set?
335 4545 1050642 jz L4514   ;no, finished copying
336 4545+0402160 sto dicpt   ;
337 4546   call     ; @4546
337+14546 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
338 4547 0600600 lod token   ;token
339 4547+0122176 sub K9a   ;=9
340 4548 1030706 jn .4550   ;statement starter @4548
341 4548+0162240 bus K10b   ;=10
342 4549 1030706 jn .4550   ;declaration
343 4549+1010666 jmp .4534   ;nonsense, more errors
344 4550  ;
345 4550  .4550:; 
346 4550 0550625 cls W4501   ;reset flag @4550
347 4550+1010667 jmp .4535   ;re-enter scan
348 4551  ;
349 4551  ; token=['], check if nested
350 4551  .4551:; 
351 4551 0610624 lod W4500   ;nesting count
352 4551+1150700 jz .4544P   ;zero, we can finish
353 4552 1010666 jmp .4534   ;non-zero, continue scan @4552
354 4552+ ;--------------------------------------------------------------------
355 4552+ ;
356 4552+ L4552P.ent:; 
357 4552+0601500 lod putcode.pat   ;check gate to codegen
358 4553 0121501 sub putcode.pat+1   ;open state?
359 4553+1041571 jz GenFinish.1   ;yes->
360 4554 0227524 o11 ocdflg   ;owncode flag @4554
361 4554+1030715 jn .4557   ;
362 4555 0607521 lod titleend   ;
363 4555+0347525 stc stkbase   ;
364 4556 0607515 lod titleptr   ; @4556
365 4556+0342151 stc stkp   ;
366 4557  .4557:; 
367 4557   call     ;
367+14557 7336515107503 lnk L3907P.lnk:jmp L3907P.ent 
368 4558  L4558:; 
369 4558  .4558:; 
370 4558 1010716 jmp L4558   ;dynamic halt
371 4558+ ;--------------------------------------------------------------------
372 4558+ ;
373 4558+ L4558P::; 
374 4558+ ;
375 4558+ .ent:; 
376 4558+1660602 lnk incomment   ;set comment flag != 0 @4558+
377 4559 0450623 inc Link33a   ;
378 4559+1110737 jmp .4575P   ;
379 4560  ;
380 4560 4200012000000W4560:+04200012000000;42 2 / 00 0 @4560
381 4561 5200012000000W4561:+05200012000000;52 2 / 00 0 @4561
382 4562  ;
383 4562  L4562:; 
384 4562 0610720.4562:lod W4560   ; @4562
385 4562+1110723 jmp .4563P   ;
386 4563  ;
387 4563  .4563:; 
388 4563 0610721 lod W4561   ; @4563
389 4563+ .4563P:; 
390 4563+0343427 stc idptr   ;
391 4564 0600576 lod ident   ; @4564
392 4564+0541425 cls errsw   ;
393 4565   call     ;
393+14565 7312031002407 lnk addtodic.lnk:jmp addtodic.ent 
394 4566 0603427 lod idptr   ; @4566
395 4566+0000000 o00 0   ;
396 4567   call     ;
396+14567 7312031002407 lnk addtodic.lnk:jmp addtodic.ent 
397 4568 0610655 lod getchar.ipnorm   ;=<06 0:71 0> @4568
398 4568+0340604 stc getchar.ent   ;reset getchar
399 4569 0604340 lod K2b   ;=2
400 4569+0564304 o27 constptr   ;
401 4570 1004540 jmp advance.ret   ; @4570
402 4570+ ;
403 4570+ L4570P:; 
404 4570+0602160.4570P:lod dicpt   ;
405 4571 0343430 stc W1816   ;
406 4571+1010723 jmp .4563   ;
407 4572  ;-------------------------------------------------------------------
408 4572  L4572:; 
409 4572 1050245.4572:jz L4261   ; error 20 -> do ident
410 4572+0124341 sub K3a   ;=3
411 4573 1050736 jz .4574   ; error 17 ->
412 4573+1010744 jmp .4580   ;set up input trace
413 4574  ;
414 4574  ; error 17, missing ; or end, missing : after label, garbage statement
415 4574 0602142.4574:lod Link15d   ; modify return address
416 4574+0342154 stc W1132   ; to aid recovery in statement
417 4575 1010744 jmp .4580   ;set up input trace
418 4575+ ;
419 4575+ .4575P:; 
420 4575+0600575 lod ipshift   ;
421 4576 1050741 jz .4577   ; @4576
422 4576+0604347 lod K4a   ;=4
423 4577  .4577:; 
424 4577 1600023714033 stc 4/otp TP+FS;display character
425 4578 3002763714000 lod currchar/otp TP;6K @4578
426 4579   ret     ;o00 4499 /jmp 1
426+14579 0043117000001 o00 L4558P.lnk/jmp 1 
427 4580  ;
428 4580  .4580:; 
429 4580 0610656 lod getchar.iptrace   ;= @4580
430 4580+0340604 stc getchar.ent   ;modify getchar to copy
431 4581 1110244 jmp L4260P   ;
432 4581+ ;