File: elliott.t2

For general comments see here
LineAddressObject Code LabelF1N1BF2N2CommentsCheck
1 0  ; tape1.d/elliott.t2
2 0  ;-------------------
3 0  ;
4 0  ; call of ELLIOTT procedure to generate code statements
5 0  ;
6 0  =2181 
7 2181  Elliott::; 
8 2181  Elliott:; 
9 2181   call     ;get token @2181
9+12181 7322411004503 lnk advance.lnk:jmp advance.ent 
10 2182 0600600 lod token   ;check it @2182
11 2182+0122204 sub K47a   ;=47, [(]
12 2183 1044210 jz .ok1   ;OK,
13 2183+1004216 jmp _err51   ;missing '('
14 2184  ;
15 2184  .ok1:; 
16 2184   call     ;align to full word @2184
16+12184 7307255001654 lnk putNop.lnk:jmp putNop.ent 
17 2185   call     ;get two-digit opcode
17+12185 7307175004251 lnk GetOpCode.lnk:jmp GetOpCode.ent 
18 2186 0040600 o02 token   ;token+1 @2186
19 2186+0122201 sub K42   ;=42 [,]+1
20 2187 1044214 jz .comma1   ;
21 2187+1004216 jmp _err51   ;
22 2188  ;
23 2188  ; first instruction complete, check for B digit
24 2188  ;
25 2188  .comma1:; 
26 2188   call     ;get next token @2188
26+12188 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
27 2189 0040600 o02 token   ;token+1
28 2189+1024217 jn .ok2   ;integer constant
29 2190  _err51:; 
30 2190 1661044 lnk errlnk   ;error 51: error in ELLIOTT call @2190
31 2190+1001070 jmp Error   ;call error routine
32 2191  ;
33 2191  .ok2:; 
34 2191 0600576 lod ident   ;constant value
35 2191+1144222 jz .Bdigit0   ;B-digit = 0
36 2192 0122207 sub K1c   ;=1 @2192
37 2192+1144221 jz .Bdigit1   ;B-digit = 1
38 2193 1004216 jmp _err51   ;
39 2193+ ;
40 2193+ .Bdigit1:; 
41 2193+0602225 lod Bbit   ;=<000/000>
42 2194 0501423 ads Link9   ;mark instruction to include it @2194
43 2194+ .Bdigit0:; 
44 2194+1004234 jmp .skip1   ;-->>
45 2195  =2204 
46 2204  .skip1:; 
47 2204   call     ;get comma
47+12204 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
48 2205 0040600 o02 token   ;token+1
49 2205+0122201 sub K42   ;=42=>[,]+1 and check it
50 2206 1044237 jz .comma2   ;OK, @2206
51 2206+1004216 jmp _err51   ;missing comma
52 2207  ;
53 2207  .comma2:; 
54 2207 0601423 lod Link9   ;load 1st instruction
55 2207+1004223 jmp .skip2   ;-->>
56 2208  =2195 
57 2195  .skip2:; 
58 2195   call     ;generate ocode for it
58+12195 7307175001640 lnk GenInst.lnk:jmp GenInst.ent 
59 2196   call     ;get second instruction @2196
59+12196 7307175004251 lnk GetOpCode.lnk:jmp GetOpCode.ent 
60 2197 0042204 o02 K47a   ;=47+1=>48, [)]
61 2197+0120600 sub token   ;check delimiter
62 2198 1144227 jz .parenOK   ;OK, @2198
63 2198+1004216 jmp _err51   ;missing ')'
64 2199  ;
65 2199 0000000 o00 0   ;
66 2199+ ;
67 2199+ .parenOK:; 
68 2199+0601423 lod Link9   ;get second instruction
69 2200   call     ;generate ocode for that @2200
69+12200 7307175001640 lnk GenInst.lnk:jmp GenInst.ent 
70 2201   call     ;discard closing paren, get next
70+12201 7322411004503 lnk advance.lnk:jmp advance.ent 
71 2202 1003342 jmp L1762   ;return to statement (proc call)@2202
72 2202+ ;
73 2202+0000000 o00 0   ;
74 2203  ;
75 2203  elliott:; 
76 2203 0455454515764 'ELLIOT';ELLIOT @2203
77 2204  ;--------------------------------------------------------------------
78 2204  ; get single opcode digit - must be 0-7 and followed by a comma
79 2204  ;
80 2204  =2208 
81 2208  GetFnDigit::; 
82 2208  ;
83 2208  .ent:; 
84 2208   call     ; @2208
84+12208 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
85 2209 0040600 o02 token   ;token+1
86 2209+1024277 jn .ok1   ;integer constant
87 2210 1004216 jmp _err51   ;error @2210
88 2210+ ;
89 2210+ =2239 
90 2239  .ok1:; 
91 2239 0600576 lod ident   ;get integer value
92 2239+1104242 jmp .skip1   ;-->>
93 2240  =2210+ 
94 2210+ .skip1:; 
95 2210+0401476 sto putcode.lnk   ;store 1st fn digit @2210+
96 2211 0061454 and K7   ;mask to 3 bits
97 2211+0120576 sub ident   ;check same value
98 2212 1044245 jz .ok2   ; @2212
99 2212+1004216 jmp _err51   ;error
100 2213  ;
101 2213  .ok2:call     ;get following comma @2213
101+12213 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
102 2214 0040600 o02 token   ;token+1 @2214
103 2214+0122201 sub K42   ;=42 => [,]+1
104 2215 1044250 jz .comma1   ;
105 2215+1004216 jmp _err51   ;error
106 2216  ;
107 2216  .comma1:; 
108 2216   ret     ;
108+12216 0020123000001 o00 GetFnDigit.lnk/jmp 1 
109 2217  ;--------------------------------------------------------------------
110 2217  ; get opcode (and address) part of Elliott call
111 2217  ; appears as three argument, first two are opcode digits
112 2217  ; third is the address part
113 2217  ; final delimiter not checked, may be comma or closing paren
114 2217  ;
115 2217  GetOpCode::; 
116 2217  ;
117 2217  .ent:; 
118 2217   call     ;get 1st digit @2217
118+12217 7320121004240 lnk GetFnDigit.lnk:jmp GetFnDigit.ent 
119 2218 0601476 lod putcode.lnk   ;answer saved here @2218
120 2218+0401423 sto Link9   ;save 1st digit
121 2219   call     ;get second digit
121+12219 7320121004240 lnk GetFnDigit.lnk:jmp GetFnDigit.ent 
122 2220 0601423 lod Link9   ;reload 1st digit @2220
123 2220+1320003 sll 3   ;shift left 3 bits
124 2221 0101476 add putcode.lnk   ;and add second digit
125 2221+1320015 sll 13   ;shift result left 13 bits
126 2222 0102226 add K6   ;make type 6 entry for putcode @2222
127 2222+0401423 sto Link9   ;save it.
128 2223   call     ;get next token (address)
128+12223 7305105001222 lnk gettoken.lnk:jmp gettoken.ent 
129 2224 0600600 lod token   ; @2224
130 2224+1044263 jz .ident   ;identifier
131 2225 0102205 add K2a   ;=2
132 2225+1144273 jz .int   ;integer constant
133 2226 1004216 jmp _err51   ;error @2226
134 2226+ ;
135 2226+  pad     ;
135+12226+0000000 00 0    
136 2227  ;
137 2227  .ident:; 
138 2227   call     ;process identifier
138+12227 7322411004504 lnk advance2.lnk:jmp advance2.ent 
139 2228 0603427 lod idptr   ;id information @2228
140 2228+0062242 and W1186   ;=03440000000000
141 2229 0122236 sub Bit33   ;=00100000000000
142 2229+1044216 jz _err51   ;error
143 2230 0603427 lod idptr   ; @2230
144 2230+0062221 and typbits   ;=03700000000000
145 2231 0127032 sub W3610   ;=00400000000000
146 2231+1044216 jz _err51   ;error
147 2232 0603427 lod idptr   ; @2232
148 2232+0062232 and procbit   ;=02000000000000
149 2233 1044272 jz .nonproc   ;not a procedure name
150 2233+1004216 jmp _err51   ;error
151 2234  ;
152 2234  .nonproc:; 
153 2234 0607033 lod W3611   ;=0000036017777 @2234
154 2234+0063427 and idptr   ;mask with id info
155 2235 1104274 jmp .ok   ;store as address part
156 2235+ ;
157 2235+ ; integer constant as address - OK
158 2235+ ;
159 2235+0602225.int:lod Bbit   ;=<000/000> mark as absolute constant?
160 2236 0100576 add ident   ; @2236
161 2236+ .ok:; 
162 2236+0401422 sto GenAdr   ;save address,
163 2237   call     ;get next token
163+12237 7322411004503 lnk advance.lnk:jmp advance.ent 
164 2238   ret     ;and return @2238
164+12238 0007177000001 o00 GetOpCode.lnk/jmp 1 
165 2239  ;
166 2239  ;--------------------------------------------------------------------