File: main.t2

For general comments see here
LineAddressObject Code LabelF1N1BF2N2CommentsCheck
1 0  ; tape1.d/main.t2
2 0  ;----------------
3 0  ;
4 0  =3939 
5 3939  main::; 
6 3939  ;
7 3939  ; start translation here from EP9
8 3939  ;
9 3939 0607524.tran:lod ocdflg   ;owncode flag @3939
10 3939+0401425 sto errsw   ;copy owncode flag to errsw
11 3940 1047550 jz .ocd   ;skip if O/C requested @3940
12 3940+ ;
13 3940+ ; setup for compile&go
14 3940+ ;
15 3940+ .notape:; 
16 3940+0600013 lod Memtop   ;=7437[t1] @3940+
17 3941 0127536 sub K250   ;less 250 @3941
18 3941+0407525 sto stkbase   ; stack base? @3941+
19 3942 0402151 sto stkp   ; stack pointer
20 3942+0607532 lod FreeMemPtr   ;=4630
21 3943 0401421 sto W785   ;
22 3943+1107552 jmp .both   ;
23 3944  ;
24 3944  ; Owncode setup
25 3944  ;
26 3944 0607532.ocd:lod FreeMemPtr   ;=4630 @3944
27 3944+0402151 sto stkp   ;
28 3945 0210000 exa +4096   ;check for small model
29 3945+0210000 exa +4096   ;
30 3946 1147600 jz .4K   ;setup for 4096 words
31 3946+ ;
32 3946+ ; common to both incore/owncode compiles
33 3946+ ;
34 3946+0602205.both:lod K2a   ;=2 @3946+
35 3947 1007554 jmp .skp   ;skip next instn
36 3947+ ;
37 3947+ .back:; 
38 3947+0607537 lod K4098   ;=4098 @3947+
39 3948  ;
40 3948  .skp:; 
41 3948 0160013 bus Memtop   ;7437-? [7435] @3948
42 3948+0402160 sto dicpt   ;
43 3949 0607530 lod W3928   ;=016000000
44 3949+0402143 sto W1123   ;
45 3950 0607531 lod W3929   ;=06000000 @3950
46 3950+0402145 sto ObjPC   ;
47 3951 0542144 cls W1124   ; set zero
48 3951+0542147 cls W1127   ; set zero
49 3952 0607533 lod W3931   ;=026000005 @3952
50 3952+0402152 sto W1130   ;
51 3953 0540574 cls currchar   ; set zero
52 3953+1110661 jmp .1   ;-->>
53 3954  =4529+ 
54 4529+ .1:; 
55 4529+0610655 lod getchar.ipnorm   ;=
56 4530 0340604 stc getchar.ent   ;reset getchar @4530
57 4530+1110745 jmp .2   ;-->>
58 4531  =4581+ 
59 4581+ .2:; 
60 4581+0607524 lod ocdflg   ;owncode flag
61 4582   jnn     ;-> if not negative @4582
61+14582 1030747 jn .1    
61+24582+1010677 jmp main.3    
61+34583  .1:; 
62 4583 0427524 stn ocdflg   ;owncode flag
63 4583+0601513 lod putcode.ret   ;=
64 4584 1110677 jmp .3a   ;-->> @4584
65 4584+ =4543 
66 4543  .3:; 
67 4543 0601501 lod putcode.pat+1   ;=<44 833 : 30 780>
68 4543+ .3a:; 
69 4543+0341500 stc putcode.pat   ; open gate to generation routine
70 4544 1007602 jmp .4   ;return @4544
71 4544+ =3970 
72 3970  .4:; 
73 3970 0542153 cls W1131   ; @3970
74 3970+0544302 cls W2242   ;
75 3971 0540602 cls incomment   ; reset comment flag
76 3971+0040000 o02 0   ;
77 3972 0541437 cls W799   ; reset film switch @3972
78 3972+1007562 jmp .5   ;
79 3973  =3954 
80 3954  .5:; 
81 3954 0010702420001 o00 dicpt/stn 1; @3954
82 3955 0607535 lod Initwsp   ;=0280000
83 3955+0402161 sto wsptr   ;
84 3956 0540575 cls ipshift   ; @3956
85 3956+0602151 lod stkp   ;
86 3957   call     ;save & copy title
86+13957 7336515007414 lnk Title.lnk:jmp Title.ent 
87 3958 0607515 lod titleptr   ; @3958
88 3958+0402151 sto stkp   ;
89 3959   call     ;initialise Putcode working variables
89+13959 7306371001536 lnk InitPutCode.lnk:jmp InitPutCode.ent 
90 3960 0600612 lod getchar.fsw   ;default switch for fig shift @3960
91 3960+0400605 sto getchara.ent   ;
92 3961   call     ;
92+13961 7322411004503 lnk advance.lnk:jmp advance.ent 
93 3962 1007573 jmp .6   ;-->> @3962
94 3962+  pad     ;
94+13962+0000000 00 0    
95 3963  .6:; 
96 3963   call     ;compile statement
96+13963 7310611003254 lnk statement.lnk:jmp statement.ent 
97 3964 0603544 lod GPs+63   ;=GP2F 28,40 @3964
98 3964+  pad     ;
98+13964+0000000 00 0    
99 3965   call     ;
99+13965 7320121004033 lnk gencode.lnk:jmp gencode.ent 
100 3966   call     ; @3966
100+13966 7310611110710 lnk L4552P.lnk:jmp L4552P.ent 
101 3967   call     ;
101+13967 7336515007465 lnk L3893.lnk:jmp L3893.ent 
102 3968 1007721 jmp .compdone   ;end compilation @3968
103 3968+ ;
104 3968+ ; setup for 4K words
105 3968+ ;
106 3968+ .4K:; 
107 3968+0607534 lod W3932   ;
108 3969 0402151 sto stkp   ;
109 3969+1107553 jmp .back   ;goto 3947+
110 3970  ;--------------------------------------------------------------------
111 3970  ; tape 1 default entry point (from bootstrap)
112 3970  ;
113 3970  =4030 
114 4030  .Entry:; 
115 4030   call     ;call pause @4030
115+14030 7336515107714 lnk pause.lnk:jmp pause.ent 
116 4031  .loadtape2:; 
117 4031 0607676 lod .Entry   ;=
118 4031+0400010 sto EP8   ;set EP8
119 4032 0210000 exa +4096   ;test for small memory @4032
120 4032+0210000 exa +4096   ;
121 4033 1040007 jz EP7   ;only 4096, loop stop at 7
122 4033+0607540 lod setep7   ;=<73 ocdflg : 40 9>
123 4034 0400007 sto 7   ;set EP7 @4034
124 4034+0607541 lod setep18   ;=<40 Ep18 : 40 Ep18P>
125 4035 0400022 sto EP18   ;
126 4035+1107740 jmp .10   ;goto 4064+
127 4036  ; set Ep19 before loading tape2
128 4036  =4064+ 
129 4064+ .10:; 
130 4064+0607542 lod setep19   ;=40 Ep19 : jmp Ep19P
131 4065 0340023 stc EP19   ;store in loc 19
132 4065+1007704 jmp .11   ;back to load tape2
133 4066  ;
134 4066  ; skip first part of tape2 (up to >28 blanks) then load remainder
135 4066  ;
136 4066  =4036 
137 4036  .11:; 
138 4036 1620000 inp 0    
139 4036+1047704 jz .11   ;skip header
140 4037  .12:; 
141 4037 0140000 cla 0   ;clr acc
142 4037+1620000 inp 0   ;get next char
143 4038 1047707 jz .13   ;if zero, break out @4038
144 4038+1007705 jmp .12   ;repeat until zero
145 4039  ;
146 4039  .13:; 
147 4039 0044342 o02 K27   ;=27 +1
148 4039+0427523 stn Link33   ;set count=-28
149 4040  .14:; 
150 4040 0140000 cla 0   ;clr acc @4040
151 4040+1620000 inp 0   ;get nxt char
152 4041   jnz     ;back to repeat
152+14041 1047712 jz .1    
152+24041+1007705 jmp main.12    
152+34042  .1:; 
153 4042 0647523 lis Link33   ;increment count @4042
154 4042+1027710 jn .14   ;repeat if still negative
155 4043 1667524 lnk ocdflg   ;set owncode flag off
156 4043+1667526 lnk W3926   ;set relocation indicator non-zero
157 4044 1117771 jmp L8185P   ;re-enter checking loader @4044
158 4044+ ; ;to read remainder of tape2
159 4044+ ; ;tape 2 ends with jump to EP8
160 4044+ ;
161 4044+ ;pause: ;wait for operator to flip sign bit
162 4044+ ;
163 4044+ pause.ent:; 
164 4044+1600000 kbd 0   ;read WG for initial setting @4044+
165 4045 1027717 jn .p2   ;jump if negative
166 4045+ .p1:; 
167 4045+1600000 kbd 0   ;read again
168 4046 1027720 jn .pret   ;exit if negative @4046
169 4046+1107715 jmp .p1   ;repeat until it is
170 4047  ;
171 4047  .p2:; 
172 4047 1600000 kbd 0   ;read again
173 4047+1027717 jn .p2   ;loop while negative
174 4048  .pret:; 
175 4048   ret     ; @4048
175+14048 0036517000001 o00 main.lnk/jmp 1 
176 4049  ;---------------------------------------------------
177 4049  ;end of compilation
178 4049  ;
179 4049  .compdone:; 
180 4049   nop     ;goto next instn
180+14049 1107721 jmp .1    
180+24049+ .1:; 
181 4049+0607524 lod ocdflg   ;owncode flag
182 4050  .hlt:; 
183 4050 1047722 jz .hlt   ;loop stop if owncode only @4050
184 4050+0601425 lod errsw   ;errors detected?
185 4051 1040010 jz EP8   ;back for next compile run
186 4051+0747526 lzs W3926   ;check if relocation needed, resetting
187 4052 1047733 jz .relskp   ;skip relocation @4052
188 4052+0600012 lod T2VEC   ; tape2 base address
189 4053 0500524 ads W340   ; modify 2nd instn of pair
190 4053+1320024 sll 20   ; shift to top half
191 4054  ; ; following modify first
192 4054  ; ; instruction of pair
193 4054 0500520 ads W336   ; @4054
194 4054+0500527 ads W343   ;
195 4055 0500075 ads EP6SK   ;
196 4055+0500536 ads W350   ;
197 4056 0500537 ads W351   ; @4056
198 4056+0100012 add T2VEC   ; add in to modify both
199 4057  ; ; instructions of the following pairs
200 4057 0500522 ads W338   ;
201 4057+0500525 ads W341   ;
202 4058 0500530 ads W344   ; @4058
203 4058+0500534 ads W348   ;
204 4059  .relskp:; 
205 4059 0601437 lod W799   ;film switch
206 4059+1047735 jz .tocore   ; to core
207 4060 1107767 jmp .tofilm   ; to film @4060
208 4060+  pad     ;
208+14060+0000000 00 0    
209 4061  ;
210 4061  .tocore:; 
211 4061 0607532 lod FreeMemPtr   ;=4630
212 4061+0400072 sto LoMeM   ;
213 4062 0601421 lod W785   ; @4062
214 4062+0122205 sub K2a   ;
215 4063 2000232600001 sto OcdRdP/lod 1;
216 4064 1000224 jmp loadit.ent   ;consolidate code @4064
217 4064+ ;
218 4064+ =4087+ 
219 4087+ .tofilm:; 
220 4087+0042237 o02 K19b   ;=19+1=20
221 4088 0400072 sto LoMeM   ; @4088
222 4088+1010567 jmp .tf1   ;
223 4089  ;
224 4089  =4470 
225 4470 4002455000574W4470:jmp loadit.err:jmp currchar;patch instruction @4470
226 4471  ;
227 4471  .tf1:; 
228 4471 0610566 lod W4470   ;=
229 4471+0340254 stc loadit.172   ;patch loader
230 4472 0610562 lod loadit.4466   ;move loader patch to lower mem @4472
231 4472+0340574 stc currchar   ;to avoid being overwritten
232 4473 0610563 lod loadit.4466+1   ;
233 4473+0340575 stc currchar+1   ;
234 4474 0610564 lod loadit.4466+2   ; @4474
235 4474+0340576 stc currchar+2   ;
236 4475 1007742 jmp .tf2   ;resume
237 4475+ ;--------------------------------------------------------------------
238 4475+ =4066 
239 4066  .tf2:; 
240 4066 0600107 lod EP8SK   ;=<00 0 : 44 _TAPE2+49> @4066
241 4066+0100012 add T2VEC   ;
242 4067 0400010 sto EP8   ;
243 4067+0400011 sto EP9   ;
244 4068 0600110 lod W72   ; @4068
245 4068+0100012 add T2VEC   ;
246 4069 0400317 sto L207   ;
247 4069+0041435 o02 Work2   ;
248 4070 0400054 sto W44   ; @4070
249 4070+0601474 lod W828   ;
250 4071 2000267742002 sto W45/o76 1026;prepare to search
251 4072 0000263760000 o00 W44/o77 0;do the search @4072
252 4073 0040104 o02 FBuffP   ;
253 4073+0100105 add K63a   ;
254 4074 0400046 sto OcdRdP   ; @4074
255 4074+0607532 lod FreeMemPtr   ;
256 4075 0361434 o17 Work1   ;
257 4075+1047764 jz .tf5   ;
258 4076 0420004 stn 4   ; @4076
259 4076+0440004 inc 4   ;
260 4077 0600104 lod FBuffP   ;
261 4077+0400052 sto fbptr   ;
262 4078  .tf3:; 
263 4078 2206162577777 inc Work1/lod -1; @4078
264 4079 2200252377777 inc fbptr/sto -1;
265 4080 0640004 lis 4   ; @4080
266 4080+1027756 jn .tf3   ;
267 4081 0040000 o02 0   ;=1
268 4081+0160052 bus fbptr   ;
269 4082  .tf4:; 
270 4082 2000252600000 sto fbptr/lod 0; @4082
271 4083 1660053 lnk FilmFlg   ; set film switch
272 4083+1000224 jmp loadit.ent   ;consolidate code
273 4084  ;
274 4084  .tf5:; 
275 4084 0000267742000 o00 W45/o76 1024;prepare to read from film @4084
276 4085 3000423760000 lod FBuffP/o77 0;do read
277 4086 0100105 add K63a   ; @4086
278 4086+0440054 inc W44   ;
279 4087 1007762 jmp .tf4   ;
280 4087+ ;
281 4087+ ;--------------------------------------------------------------------
282 4087+ ;
283 4087+ ; entry to syntax check only
284 4087+ ;
285 4087+ ;main::
286 4087+ ;
287 4087+ =4584+ 
288 4584+ SynChk:; 
289 4584+ .synchk:; 
290 4584+0541425 cls errsw   ;
291 4585 0607523 lod Link33   ;
292 4585+0130503 sub W4419   ;
293 4586 1050754 jz .sc1   ; @4586
294 4586+0040000 o02 0   ;=1
295 4587 0427524 stn ocdflg   ;owncode flag
296 4587+1107544 jmp .notape   ;
297 4588  ;
298 4588  .sc1:; 
299 4588 0601513 lod putcode.ret   ;=<00 830 / jmp 1> @4588
300 4588+0341500 stc putcode.pat   ; close off code generation
301 4589 1010467 jmp Ep18   ;
302 4589+  pad     ;
302+14589+0000000 00 0    
303 4590  ;--------------------------------------------------------------------
304 4590   ;