1 " ***********************************************************
2 " * *
3 " * Copyright, C Honeywell Bull Inc., 1988 *
4 " * *
5 " * Copyright, C Honeywell Information Systems Inc., 1982 *
6 " * *
7 " * Copyright c 1972 by Massachusetts Institute of *
8 " * Technology and Honeywell Information Systems, Inc. *
9 " * *
10 " ***********************************************************
11
12 " name oplook_ Look up op in table and return 645 machine code.
13
14 " Modified on 09/30/80 by E Bush to implement decors.
15 " Modified on 06/15/75 by Eugene E Wiatrowski
16 " Modified on 08/08/73 at 22:20:48 by R F Mabee.
17 " Modified in June 1973 by R F Mabee to add EIS and related instructions.
18 " Modified on 12 November 1972 by R F Mabee to fix short return for followon.
19 " Modified on 08/17/72 at 23:00:38 by R F Mabee. Added 6180 opcodes.
20 " Modified 12 November 1970, R H Campbell, for lam, fstr.
21
22 " The table is maintained alphabetically in two tables.
23 " The first table contains double word entries
24 " of the ASCII opcode, left justified.
25 " The second table contains the binary equivalence,
26 " either as an opcode or a pseudo-op number.
27 " The search procedure is a
28 " binary search with termination on the end of the list.
29
30
31 equ sym,4
32
33 entry oplook_ Entry to find opcode.
34 entry reset Entry to reset at start of each pass.
35 entry redefine Entry to redefine op as macro.
36
37 ^L
38
39 use executable
40
41 oplook_:
42 stz ap|2,* Clear all returned values.
43 stz ap|4,*
44 stz ap|6,*
45
46 tsx7 lookop Look up opcode
47 tra opnfnd Error return.
48 ldx1 valtbl,au Get the type field.
49 sxl1 ap|4,* Deposit it.
50 lxl1 valtbl,au Get the opcode.
51 sxl1 ap|6,* Deposit it.
52 exit: short_return Do a short return because we did no save on entry.
53
54 opnfnd: null Op-code not found.
55 aos ap|2,* Set bad op flag.
56 tra exit Then return to caller.
57
58 ^L
59 lookop: eppbp eb_data_$varcom+sym bp -> symbol for comparison
60 lda bp|0 First word of symbol in A.
61 arl 36-9 Get count field in AL.
62 cmpa 8,dl More than 7 characters?
63 tpl look_long If so, special lookup.
64
65 ldaq bp|0 Symbol to match must be on an even word.
66 lls 9 Shift out the character count.
67 eax0 0 xr0 used as ptr into optable.
68 eax1 cycles xr1 used as ptr into table of xr mods.
69 stepup: adx0 powers,1 Go higher.
70 cmpx0 num_ops*2,du Check for too high.
71 tmi loop If OK try it, otherwise backup.
72 backup: sbx0 powers,1 Go lower.
73 loop: eax1 -1,1 Decrement loop counter.
74 tmi 0,7 Op not found.
75 cmpaq optbl,0 Look for first word of op.
76 tmi backup ASCII symbol < table -- go lower.
77 tnz stepup ASCII symbol > table entry, go higher.
78 " We have the right entry -- get the info on it.
79 eaa 0,0 Move the pointer to a.
80 ars 1 Divide it by two, valtbl entries are one word long.
81 opfnd: sztl ,prau,bool05 Test for redefinition.
82 descb *,0
83 descb lp|undefined_op_list,1
84 tnz 0,7 If redefined, say it's not found.
85 tra 1,7 Take successful return.
86
87 look_long:
88 eax0 n_long_ops*6-6 Initialize table pointer.
89 long_loop:
90 eppbb long_op_table,0 bb -> table entry
91 lda bb|0 Get table entry in AU.
92 cmpc pr,pr compare with symbol
93 desc9a bp|0,20
94 desc9a bb|1,20
95 tze opfnd Got'cha.
96
97 eax0 -6,0 Step to next entry.
98 tpl long_loop If more, loop.
99 tra 0,7 If not, op not found.
100
101 " Table of numbers to increase and decrease index by powers of two.
102
103 powers: zero 0,0 End of the line, not there.
104 zero 2,0
105 zero 4,0
106 zero 8,0
107 zero 16,0
108 zero 32,0
109 zero 64,0
110 zero 128,0
111 zero 256,0
112 zero 512,0
113 zero 1024,0
114 equ cycles,*-powers-1 Maximum number of comparisons.
115
116 ^L
117
118 reset: eax0 num_ops Number of operations in X0.
119 csl ,prrl,bool00 Reset undefined op list.
120 descb *,0
121 descb lp|undefined_op_list,x0
122
123 short_return
124
125
126 redefine: tsx7 lookop Find opcode.
127 tra exit If not found, just return.
128
129 csl ,prau,bool17 Turn on undefined bit.
130 descb *,0
131 descb lp|undefined_op_list,1
132
133 short_return
134
135 ^L
136 " Operations table follows.
137
138 segdef opcode_table
139 opcode_table: " This definition is provided so other tools
140 " can use the assembler's data base.
141 zero 0,num_ops*2
142 zero optbl-opcode_table,valtbl-opcode_table
143
144
145 use op_mnemonic
146 even Make sure we are even for the cmpaq.
147 equ optbl,*-2 Minus 2 because we can't access the first entry.
148
149 use op_value
150 equ valtbl,*-1 Corresponding offset for valtbl.
151
152 use long_ops
153 equ long_op_table,*
154 set n_long_ops,0
155
156
157 " Format of entry:
158 " In op_mnemonic, double word containing first 7 characters
159 " of mnemonic, left justified and zero filled.
160 " In op_value, single word containing 18 bit pseudo-op
161 " index zero for normal instruction, 10 bit opcode written
162 " as 9 + 1 as in 6140 EPS-1, 4 bits of flags, and 4 bits
163 " of decor class. For "desc" instructions, last 4 bits of 10
164 " bit opcode field denote operand formats.
165
166 " The decor class denotes the intersection of decors in which the
167 " instruction is valid.
168
169
170
171
172 " OPCODE DEFINING MACROS.
173
174
175 maclist off
176
177 macro mnem
178 use op_mnemonic
179 maclist on,save
180 aci "&1"
181 maclist object
182 &<=&l1,4& acc ""
183 &
184 &>&l1,8& warn Mnemonic "&1" is longer than 8 characters.
185 &
186 maclist restore
187 &end
188
189 macro defop mnemonic,type,args
190 mnem &1
191 &2op &F3
192 &end
193
194 macro defmac macname,args
195 maclist on,save
196 macro &1op
197 use op_value
198 maclist on,save
199 vfd 18/&2,o9/&3,1/&4,o4/&5,o4/&6
200
201 maclist restore
202 &&end
203
204 maclist restore
205 &end
206
207 defmac ,0,&1,&2,&3,&4 code,bit27,flags,decor_class
208 defmac pseud,&1,0,0,0,&2 value,decor_class
209 defmac rpt,52,&1,0,&2,&3 ,abcbits,decor_class
210 defmac ar,53,&1,1,&2,&3 opcode,flags,decor_class
211 defmac pr,44,0,0,0,&1 decor_class
212 defmac xr,43,0,0,0,&1 decor_class
213 defmac eis,54,&1,1,&2,&3 opcode,bitop,decor_class
214
215 macro longop
216 pseudop &1,&3
217 set op_index,*-valtbl-1
218 use long_ops
219 maclist on,save
220 zero op_index
221 acc "&2"
222 maclist object
223 &<=&l2,11& acc ""
224 &
225 &<=&l2,15& acc ""
226 &
227 &>&l2,19& warn Long mnemonic "&2" is longer than 19 characters.
228 &
229 maclist on
230
231 maclist restore
232 set n_long_ops,n_long_ops+1
233 &end
234
235 macro descop bytesize,type,decor_class
236 use op_value
237 maclist on,save
238 ife &2,a
239 vfd 18/55,o6/0,o4/0,4/&1,o4/&3
240 ifend
241 ife &2,b
242 vfd 18/56,o6/0,o4/0,4/1,o4/&3
243 ifend
244 ife &2,fl
245 vfd 18/57,o6/0,o4/0,4/&1,o4/&3
246 ifend
247 ife &2,ls
248 vfd 18/57,o6/0,o4/1,4/&1,o4/&3
249 ifend
250 ife &2,ts
251 vfd 18/57,o6/0,o4/2,4/&1,o4/&3
252 ifend
253 ife &2,ns
254 vfd 18/57,o6/0,o4/3,4/&1,o4/&3
255 ifend
256
257 maclist restore
258 &end
259
260
261
262
263 ^L
264
265 include defops
266
267
268
269
270
271 use op_mnemonic
272 equ num_ops,*-optbl/2
273
274
275 use static
276 join /link/static
277
278 undefined_op_list:
279 bss ,num_ops+35/36 bit table of redefined ops
280
281
282 end