File: advance.t2

For general comments see here
LineAddressObject Code LabelF1N1BF2N2CommentsCheck
1 0  ; tape1.d/advance.t2
2 0  ;-------------------
3 0  ;
4 0  advance::; 
5 0  ;
6 0  ; process identifer, constant for expressions etc.
7 0  ; advance2, is alternate entry bypassing initial gettoken call
8 0  ; for identifier - lookup in dic and report non-declaration
9 0  ; for FP constants - convert constituents into FP num and store
10 0  ; in constant list
11 0  ; also handles %1 construct, location refs
12 0  ;
13 0  =2371 
14 2371  .ent:; 
15 2371   call     ; @2371
15+12371 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
16 2372  advance2.ent:; 
17 2372 0600600 lod token   ;token (symbol identity) @2372
18 2372+1124513 jn .const   ;constant
19 2373 1044512 jz .ident   ;identifier
20 2373+0124312 sub K20   ;=20
21 2374 1044541 jz .true   ; symbol=TRUE @2374
22 2374+0124313 sub K1b   ;=1
23 2375 1144541 jz .false   ; symbol=FALSE
24 2375+0124314 sub K32a   ;=32
25 2376 1044544 jz .location   ; symbol=LOCATION @2376
26 2376+ ;
27 2376+ ; identifiers come here after calling lookupid
28 2376+ _err20:; 
29 2376+1661044 lnk errlnk   ;error 20: identifier not declared
30 2377 1044772 jz error2   ;error, id not found in dict
31 2377+1104615 jmp .idOK   ; -->>OK, identifier declared
32 2378  ;
33 2378  =2445+ 
34 2445+ .idOK:; 
35 2445+0124313 sub K1b   ;=1
36 2446   jnz     ;
36+12446 1044617 jz .1    
36+22446+1004540 jmp advance.ret    
36+32447  .1:; 
37 2447   call     ; @2447
37+12447 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
38 2448 0040000 o02 0   ; @2448
39 2448+0120576 sub ident   ;
40 2449 1044623 jz .doPC   ;process %1 construct
41 2449+ _err54:; 
42 2449+1661044 lnk errlnk   ;error 54 % not followed by 1 or
43 2450   ;occurrence of # within inner string 
44 2450 1001070 jmp Error   ;call error routine @2450
45 2450+  pad     ;
45+12450+0000000 00 0    
46 2451  =2378 
47 2378  .ident:; 
48 2378   call     ;lookup identifier @2378
48+12378 7316111003423 lnk lookupid.lnk:jmp lookupid.ent 
49 2379 1104510 jmp _err20   ;not declared
50 2379+ ;
51 2379+0040600.const:o02 token   ;token+1
52 2380 1124624 jn .icon   ;integer/boolean @2380
53 2380+  pad     ;
53+12380+0000000 00 0    
54 2381 0604315 lod procbit1   ;
55 2381+0200576 exa ident   ;get packed value
56 2382 1540000 flt 4096   ;convert to floating point @2382
57 2382+0200577 exa decscale   ;exchange with decscale
58 2383 0424305 stn W2245   ;store decimal scale
59 2383+1124520 jn .conneg   ;
60 2384 0020000 neg 0   ; @2384
61 2384+ .conneg:; 
62 2384+1010534 jmp .con1   ;
63 2385  ;
64 2385  =4444 
65 4444  .con1:; 
66 4444 0110554 add K76   ;=76 @4444
67 4444+1130536 jn .con2   ;scale > 76
68 4445 0130554 sub K76   ;=76
69 4445+0124313 sub K1b   ;=1
70 4446 1004521 jmp .con5   ; @4446
71 4446+ ;
72 4446+ .con2:; 
73 4446+0204305 exa W2245   ;
74 4447 1030542 jn .con2a   ;
75 4447+0610557 lod K1EN78   ;
76 4448 1460577 fmu decscale   ; @4448
77 4448+0400577 sto decscale   ;
78 4449 0624305 lcs W2245   ;
79 4449+1010534 jmp .con1   ;
80 4450  ;
81 4450  .con2a:; 
82 4450 0602177 lod MaxInt   ;also = MaxReal @4450
83 4450+1004532 jmp .storeconst   ;
84 4451  ;
85 4451  .con3:; 
86 4451 0604306 lod W2246   ;
87 4451+0070555 and W4461   ;
88 4452 0340004 stc 4   ; @4452
89 4452+0600577 lod decscale   ;
90 4453 0070555 and W4461   ;
91 4453+0100004 add 4   ;
92 4454 0170556 bus W4462   ; @4454
93 4454+ .con4:; 
94 4454+1030542 jn .con2a   ;
95 4455   jnz     ;
95+14455 1050550 jz .1    
95+24455+1004536 jmp advance.con8    
95+34456  .1:; 
96 4456 0604306 lod W2246   ; @4456
97 4456+0520004 sbs 4   ;
98 4457 0600577 lod decscale   ;
99 4457+0070555 and W4461   ;
100 4458 0160577 bus decscale   ; @4458
101 4458+1260004 mur 4   ;
102 4459 1320001 sll 1   ;
103 4459+1110546 jmp .con4   ;
104 4460  =2385 
105 2385  ;
106 2385  .con5:; 
107 2385 1320040 sll 32   ; @2385
108 2385+0344307 stc W2247   ;
109 2386 0604316 lod K1.0   ;=1.0 @2386
110 2386+0344306 stc W2246   ;
111 2387 0124364 sub K7b   ;=7
112 2387+ .con6:; 
113 2387+0204307 exa W2247   ;
114 2388 1124526 jn .con7   ; @2388
115 2388+0204306 exa W2246   ;
116 2389 0021437464402 o00 W2247/fmu W2299+7;
117 2390 0204306 exa W2246   ; @2390
118 2390+ .con7:; 
119 2390+1320001 sll 1   ;
120 2391 0244307 exc W2247   ;
121 2391+1124523 jn .con6   ;
122 2392 0604305 lod W2245   ; @2392
123 2392+1030543 jn .con3   ;
124 2393 0600577 lod decscale   ;
125 2393+1504306 fdv W2246   ;
126 2394  .storeconst:; 
127 2394 0021422340000 o00 constptr/stc 0;store constant in list @2394
128 2395 0040000 o02 0   ;=1
129 2395+0764304 o37 constptr   ;decrement pointer, original in Acc
130 2396 0100576 add ident   ;add type info, saved in ident @2396
131 2396+0343427 stc idptr   ;store info for reference
132 2397 0104502 add advance.lnk   ;load return address
133 2397+1105013 jmp StkCheck   ;and check we haven't wrapped
134 2398  ;
135 2398  .con8:; 
136 2398 0600577 lod decscale   ; @2398
137 2398+1464306 fmu W2246   ;
138 2399 1004532 jmp .storeconst   ;
139 2399+ ;
140 2399+  pad     ;
140+12399+0000000 00 0    
141 2400  ;
142 2400  .ret:; 
143 2400   ret     ; @2400
143+12400 0022413000001 o00 advance.lnk/jmp 1 
144 2401  ;
145 2401  ; TRUE/FALSE comes here
146 2401  ;
147 2401  .true:; true 
148 2401 0604321 lod False   ;=04000000000000 (true)
149 2401+ .false:; false (acc was 0) 
150 2401+0400576 sto ident   ;store value
151 2402 0604322 lod TBool   ;=00100000000000 (boolean) @2402
152 2402+1004625 jmp .bcon   ;
153 2403  ;
154 2403 0000000000000 +0;unreferenced @2403
155 2404  ;
156 2404  .location:; 
157 2404   call     ;
157+12404 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
158 2405 0600600 lod token   ;
159 2405+0124323 sub K47   ;=47 [(]
160 2406 1044550 jz .loc1   ; @2406
161 2406+ .locerr:; 
162 2406+0604340 lod K2b   ;=2
163 2407 1661044_err21:lnk errlnk   ;error 21: location not followed by integer id
164 2407+1001070 jmp Error   ;call error rtne
165 2408  ;
166 2408  .loc1:; 
167 2408   call     ;get identifier @2408
167+12408 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
168 2409 0600600 lod token   ;check token
169 2409+1044553 jz .loc2   ;is identifer, OK
170 2410 0604340 lod K2b   ;=2 @2410
171 2410+1004547 jmp _err21   ;report error
172 2411  ;
173 2411  .loc2:; 
174 2411   call     ;lookup identifier
174+12411 7316111003423 lnk lookupid.lnk:jmp lookupid.ent 
175 2412 1144510 jz _err20   ;not declared @2412
176 2412+0603427 lod idptr   ;
177 2413 0064324 and T_Mask   ;=00700000000000
178 2413+0124320 sub IntBit   ;=00200000000000 type=integer
179 2414   jnz     ;
179+12414 1044557 jz .1    
179+22414+1104546 jmp advance.locerr    
179+32415  .1:; 
180 2415 0603427 lod idptr   ;
181 2415+0064325 and W2261   ;=00001776017777
182 2416 0104326 add W2262   ;=04300001000000 @2416
183 2416+0403427 sto idptr   ;
184 2417   call     ;get closing paren
184+12417 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
185 2418 0740600 lzs token   ;make sure it is @2418
186 2418+0124327 sub K48   ;=48 [)]
187 2419 1044540 jz .ret   ;OK
188 2419+1104546 jmp .locerr   ;shout if not
189 2420  ;
190 2420  =2451 
191 2451  ;
192 2451  .doPC:; 
193 2451   call     ;
193+12451 7312031002420 lnk skipcomment.lnk:jmp skipcomment.ent 
194 2452 1004503 jmp advance.ent   ;and try again @2452
195 2452+ ;
196 2452+ .icon:; 
197 2452+0604320 lod IntBit   ;=00200000000000 (int type bits)
198 2453  .bcon:; 
199 2453 0200576 exa ident   ;get const value, save type
200 2453+1004532 jmp .storeconst   ;