convert gitignore files to hgignore files
[hvf.git] / cp / shell / disassm.c
blob3d2be2c4164499aa56bc8d66bb0152b8629643b9
1 /*
2 * (C) Copyright 2007-2010 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
5 * details.
6 */
8 #include <disassm.h>
9 #include <vsprintf.h>
11 static struct disassm_instruction l2_01[256] = { /* 01xx */
12 DA_INST (0x01, E, PR),
13 DA_INST (0x02, E, UPT),
14 DA_INST (0x04, E, PTFF),
15 DA_INST (0x07, E, SCKPF),
16 DA_INST (0x0A, E, PFPO),
17 DA_INST (0x0B, E, TAM),
18 DA_INST (0x0C, E, SAM24),
19 DA_INST (0x0D, E, SAM31),
20 DA_INST (0x0E, E, SAM64),
21 DA_INST (0xFF, E, TRAP2),
24 static struct disassm_instruction l2_a5[16] = { /* A5x */
25 DA_INST (0x0, RI1, IIHH),
26 DA_INST (0x1, RI1, IIHL),
27 DA_INST (0x2, RI1, IILH),
28 DA_INST (0x3, RI1, IILL),
29 DA_INST (0x4, RI1, NIHH),
30 DA_INST (0x5, RI1, NIHL),
31 DA_INST (0x6, RI1, NILH),
32 DA_INST (0x7, RI1, NILL),
33 DA_INST (0x8, RI1, OIHH),
34 DA_INST (0x9, RI1, OIHL),
35 DA_INST (0xA, RI1, OILH),
36 DA_INST (0xB, RI1, OILL),
37 DA_INST (0xC, RI1, LLIHH),
38 DA_INST (0xD, RI1, LLIHL),
39 DA_INST (0xE, RI1, LLILH),
40 DA_INST (0xF, RI1, LLILL),
43 static struct disassm_instruction l2_a7[16] = { /* A7x */
44 DA_INST (0x0, RI1, TMLH),
45 DA_INST (0x1, RI1, TMLL),
46 DA_INST (0x2, RI1, TMHH),
47 DA_INST (0x3, RI1, TMHL),
48 DA_INST (0x4, RI2, BRC),
49 DA_INST (0x5, RI1, BRAS),
50 DA_INST (0x6, RI1, BRCT),
51 DA_INST (0x7, RI1, BRCTG),
52 DA_INST (0x8, RI1, LHI),
53 DA_INST (0x9, RI1, LGHI),
54 DA_INST (0xA, RI1, AHI),
55 DA_INST (0xB, RI1, AGHI),
56 DA_INST (0xC, RI1, MHI),
57 DA_INST (0xD, RI1, MGHI),
58 DA_INST (0xE, RI1, CHI),
59 DA_INST (0xF, RI1, CGHI),
62 static struct disassm_instruction l2_b2[256] = { /* B2xx */
63 DA_INST (0x02, S, STIDP),
64 DA_INST (0x04, S, SCK),
65 DA_INST (0x05, S, STCK),
66 DA_INST (0x06, S, SCKC),
67 DA_INST (0x07, S, STCKC),
68 DA_INST (0x08, S, SPT),
69 DA_INST (0x09, S, STPT),
70 DA_INST (0x0A, S, SPKA),
71 DA_INST (0x0B, S, IPK),
72 DA_INST (0x0D, S, PTLB),
73 DA_INST (0x10, S, SPX),
74 DA_INST (0x11, S, STPX),
75 DA_INST (0x12, S, STAP),
76 DA_INST (0x14, S, SIE),
77 DA_INST (0x18, S, PC),
78 DA_INST (0x19, S, SAC),
79 DA_INST (0x1A, S, CFC),
80 DA_INST (0x21, RRE, IPTE),
81 DA_INST (0x22, RRE, IPM),
82 DA_INST (0x23, RRE, IVSK),
83 DA_INST (0x24, RRE, IAC),
84 DA_INST (0x25, RRE, SSAR),
85 DA_INST (0x26, RRE, EPAR),
86 DA_INST (0x27, RRE, ESAR),
87 DA_INST (0x28, RRE, PT),
88 DA_INST (0x29, RRE, ISKE),
89 DA_INST (0x2A, RRE, RRBE),
90 DA_INST (0x2B, RRF2, SSKE),
91 DA_INST (0x2C, RRE, TB),
92 DA_INST (0x2D, RRE, DXR),
93 DA_INST (0x2E, RRE, PGIN),
94 DA_INST (0x2F, RRE, PGOUT),
95 DA_INST (0x30, S, CSCH),
96 DA_INST (0x31, S, HSCH),
97 DA_INST (0x32, S, MSCH),
98 DA_INST (0x33, S, SSCH),
99 DA_INST (0x34, S, STSCH),
100 DA_INST (0x35, S, TSCH),
101 DA_INST (0x36, S, TPI),
102 DA_INST (0x37, S, SAL),
103 DA_INST (0x38, S, RSCH),
104 DA_INST (0x39, S, STCRW),
105 DA_INST (0x3A, S, STCPS),
106 DA_INST (0x3B, S, RCHP),
107 DA_INST (0x3D, S, SCHM),
108 DA_INST (0x40, RRE, BAKR),
109 DA_INST (0x41, RRE, CKSM),
110 DA_INST (0x44, RRE, SQDR),
111 DA_INST (0x45, RRE, SQER),
112 DA_INST (0x46, RRE, STURA),
113 DA_INST (0x47, RRE, MSTA),
114 DA_INST (0x48, RRE, PALB),
115 DA_INST (0x49, RRE, EREG),
116 DA_INST (0x4A, RRE, ESTA),
117 DA_INST (0x4B, RRE, LURA),
118 DA_INST (0x4C, RRE, TAR),
119 DA_INST (0x4D, RRE, CPYA),
120 DA_INST (0x4E, RRE, SAR),
121 DA_INST (0x4F, RRE, EAR),
122 DA_INST (0x50, RRE, CSP),
123 DA_INST (0x52, RRE, MSR),
124 DA_INST (0x54, RRE, MVPG),
125 DA_INST (0x55, RRE, MVST),
126 DA_INST (0x57, RRE, CUSE),
127 DA_INST (0x58, RRE, BSG),
128 DA_INST (0x5A, RRE, BSA),
129 DA_INST (0x5D, RRE, CLST),
130 DA_INST (0x5E, RRE, SRST),
131 DA_INST (0x63, RRE, CMPSC),
132 DA_INST (0x76, S, XSCH),
133 DA_INST (0x77, S, RP),
134 DA_INST (0x78, S, STCKE),
135 DA_INST (0x79, S, SACF),
136 DA_INST (0x7C, S, STCKF),
137 DA_INST (0x7D, S, STSI),
138 DA_INST (0x99, S, SRNM),
139 DA_INST (0x9C, S, STFPC),
140 DA_INST (0x9D, S, LFPC),
141 DA_INST (0xA5, RRE, TRE),
142 DA_INST (0xA6, RRF2, CUUTF),
143 DA_INST (0xA7, RRF2, CUTFU),
144 DA_INST (0xB0, S, STFLE),
145 DA_INST (0xB1, S, STFL),
146 DA_INST (0xB2, S, LPSWE),
147 DA_INST (0xB9, S, SRNMT),
148 DA_INST (0xBD, S, LFAS),
149 DA_INST (0xFF, S, TRAP4),
152 static struct disassm_instruction l2_b3[256] = { /* B3xx */
153 DA_INST (0x00, RRE, LPEBR),
154 DA_INST (0x01, RRE, LNEBR),
155 DA_INST (0x02, RRE, LTEBR),
156 DA_INST (0x03, RRE, LCEBR),
157 DA_INST (0x04, RRE, LDEBR),
158 DA_INST (0x05, RRE, LXDBR),
159 DA_INST (0x06, RRE, LXEBR),
160 DA_INST (0x07, RRE, MXDBR),
161 DA_INST (0x08, RRE, KEBR),
162 DA_INST (0x09, RRE, CEBR),
163 DA_INST (0x0A, RRE, AEBR),
164 DA_INST (0x0B, RRE, SEBR),
165 DA_INST (0x0C, RRE, MDEBR),
166 DA_INST (0x0D, RRE, DEBR),
167 DA_INST (0x0E, RRF1, MAEBR),
168 DA_INST (0x0F, RRF1, MSEBR),
169 DA_INST (0x10, RRE, LPDBR),
170 DA_INST (0x11, RRE, LNDBR),
171 DA_INST (0x12, RRE, LTDBR),
172 DA_INST (0x13, RRE, LCDBR),
173 DA_INST (0x14, RRE, SQEBR),
174 DA_INST (0x15, RRE, SQDBR),
175 DA_INST (0x16, RRE, SQXBR),
176 DA_INST (0x17, RRE, MEEBR),
177 DA_INST (0x18, RRE, KDBR),
178 DA_INST (0x19, RRE, CDBR),
179 DA_INST (0x1A, RRE, ADBR),
180 DA_INST (0x1B, RRE, SDBR),
181 DA_INST (0x1C, RRE, MDBR),
182 DA_INST (0x1D, RRE, DDBR),
183 DA_INST (0x1E, RRF1, MADBR),
184 DA_INST (0x1F, RRF1, MSDBR),
185 DA_INST (0x24, RRE, LDER),
186 DA_INST (0x25, RRE, LXDR),
187 DA_INST (0x26, RRE, LXER),
188 DA_INST (0x2E, RRF1, MAER),
189 DA_INST (0x2F, RRF1, MSER),
190 DA_INST (0x36, RRE, SQXR),
191 DA_INST (0x37, RRE, MEER),
192 DA_INST (0x38, RRF1, MAYLR),
193 DA_INST (0x39, RRF1, MYLR),
194 DA_INST (0x3A, RRF1, MAYR),
195 DA_INST (0x3B, RRF1, MYR),
196 DA_INST (0x3C, RRF1, MAYHR),
197 DA_INST (0x3D, RRF1, MYHR),
198 DA_INST (0x3E, RRF1, MADR),
199 DA_INST (0x3F, RRF1, MSDR),
200 DA_INST (0x40, RRE, LPXBR),
201 DA_INST (0x41, RRE, LNXBR),
202 DA_INST (0x42, RRE, LTXBR),
203 DA_INST (0x43, RRE, LCXBR),
204 DA_INST (0x44, RRE, LEDBR),
205 DA_INST (0x45, RRE, LDXBR),
206 DA_INST (0x46, RRE, LEXBR),
207 DA_INST (0x47, RRF2, FIXBR),
208 DA_INST (0x48, RRE, KXBR),
209 DA_INST (0x49, RRE, CXBR),
210 DA_INST (0x4A, RRE, AXBR),
211 DA_INST (0x4B, RRE, SXBR),
212 DA_INST (0x4C, RRE, MXBR),
213 DA_INST (0x4D, RRE, DXBR),
214 DA_INST (0x50, RRF2, TBEDR),
215 DA_INST (0x51, RRF2, TBDR),
216 DA_INST (0x53, RRF3, DIEBR),
217 DA_INST (0x57, RRF2, FIEBR),
218 DA_INST (0x58, RRE, THDER),
219 DA_INST (0x59, RRE, THDR),
220 DA_INST (0x5B, RRF3, DIDBR),
221 DA_INST (0x5F, RRF2, FIDBR),
222 DA_INST (0x60, RRE, LPXR),
223 DA_INST (0x61, RRE, LNXR),
224 DA_INST (0x62, RRE, LTXR),
225 DA_INST (0x63, RRE, LCXR),
226 DA_INST (0x65, RRE, LXR),
227 DA_INST (0x66, RRE, LEXR),
228 DA_INST (0x67, RRE, FIXR),
229 DA_INST (0x69, RRE, CXR),
230 DA_INST (0x70, RRE, LPDFR),
231 DA_INST (0x71, RRE, LNDFR),
232 DA_INST (0x72, RRF1, CPSDR),
233 DA_INST (0x73, RRE, LCDFR),
234 DA_INST (0x74, RRE, LZER),
235 DA_INST (0x75, RRE, LZDR),
236 DA_INST (0x76, RRE, LZXR),
237 DA_INST (0x77, RRE, FIER),
238 DA_INST (0x7F, RRE, FIDR),
239 DA_INST (0x84, RRE, SFPC),
240 DA_INST (0x85, RRE, SFASR),
241 DA_INST (0x8C, RRE, EFPC),
242 DA_INST (0x94, RRE, CEFBR),
243 DA_INST (0x95, RRE, CDFBR),
244 DA_INST (0x96, RRE, CXFBR),
245 DA_INST (0x98, RRF2, CFEBR),
246 DA_INST (0x99, RRF2, CFDBR),
247 DA_INST (0x9A, RRF2, CFXBR),
248 DA_INST (0xA4, RRE, CEGBR),
249 DA_INST (0xA5, RRE, CDGBR),
250 DA_INST (0xA6, RRE, CXGBR),
251 DA_INST (0xA8, RRF2, CGEBR),
252 DA_INST (0xA9, RRF2, CGDBR),
253 DA_INST (0xAA, RRF2, CGXBR),
254 DA_INST (0xB4, RRE, CEFR),
255 DA_INST (0xB5, RRE, CDFR),
256 DA_INST (0xB6, RRE, CXFR),
257 DA_INST (0xB8, RRF2, CFER),
258 DA_INST (0xB9, RRF2, CFDR),
259 DA_INST (0xBA, RRF2, CFXR),
260 DA_INST (0xC1, RRE, LDGR),
261 DA_INST (0xC4, RRE, CEGR),
262 DA_INST (0xC5, RRE, CDGR),
263 DA_INST (0xC6, RRE, CXGR),
264 DA_INST (0xC8, RRF2, CGER),
265 DA_INST (0xC9, RRF2, CGDR),
266 DA_INST (0xCA, RRF2, CGXR),
267 DA_INST (0xCD, RRE, LGDR),
268 DA_INST (0xD0, RRR, MDTR),
269 DA_INST (0xD1, RRR, DDTR),
270 DA_INST (0xD2, RRR, ADTR),
271 DA_INST (0xD3, RRR, SDTR),
272 DA_INST (0xD4, RRF3, LDETR),
273 DA_INST (0xD5, RRF3, LEDTR),
274 DA_INST (0xD6, RRE, LTDTR),
275 DA_INST (0xD7, RRF3, FIDTR),
276 DA_INST (0xD8, RRR, MXTR),
277 DA_INST (0xD9, RRR, DXTR),
278 DA_INST (0xDA, RRR, AXTR),
279 DA_INST (0xDB, RRR, SXTR),
280 DA_INST (0xDC, RRF3, LXDTR),
281 DA_INST (0xDD, RRF3, LDXTR),
282 DA_INST (0xDE, RRE, LTXTR),
283 DA_INST (0xDF, RRF3, FIXTR),
284 DA_INST (0xE0, RRE, KDTR),
285 DA_INST (0xE1, RRF2, CGDTR),
286 DA_INST (0xE2, RRE, CUDTR),
287 DA_INST (0xE3, RRF3, CSDTR),
288 DA_INST (0xE4, RRE, CDTR),
289 DA_INST (0xE5, RRE, EEDTR),
290 DA_INST (0xE7, RRE, ESDTR),
291 DA_INST (0xE8, RRE, KXTR),
292 DA_INST (0xE9, RRF2, CGXTR),
293 DA_INST (0xEA, RRE, CUXTR),
294 DA_INST (0xEB, RRF3, CSXTR),
295 DA_INST (0xEC, RRE, CXTR),
296 DA_INST (0xED, RRE, EEXTR),
297 DA_INST (0xEF, RRE, ESXTR),
298 DA_INST (0xF1, RRE, CDGTR),
299 DA_INST (0xF2, RRE, CDUTR),
300 DA_INST (0xF3, RRE, CDSTR),
301 DA_INST (0xF4, RRE, CEDTR),
302 DA_INST (0xF5, RRF3, QADTR),
303 DA_INST (0xF6, RRF3, IEDTR),
304 DA_INST (0xF7, RRF3, RRDTR),
305 DA_INST (0xF9, RRE, CXGTR),
306 DA_INST (0xFA, RRE, CXUTR),
307 DA_INST (0xFB, RRE, CXSTR),
308 DA_INST (0xFC, RRE, CEXTR),
309 DA_INST (0xFD, RRF3, QAXTR),
310 DA_INST (0xFE, RRF3, IEXTR),
311 DA_INST (0xFF, RRF3, RRXTR),
314 static struct disassm_instruction l2_b9[256] = { /* B9xx */
315 DA_INST (0x00, RRE, LPGR),
316 DA_INST (0x01, RRE, LNGR),
317 DA_INST (0x02, RRE, LTGR),
318 DA_INST (0x03, RRE, LCGR),
319 DA_INST (0x04, RRE, LGR),
320 DA_INST (0x05, RRE, LURAG),
321 DA_INST (0x06, RRE, LGBR),
322 DA_INST (0x07, RRE, LGHR),
323 DA_INST (0x08, RRE, AGR),
324 DA_INST (0x09, RRE, SGR),
325 DA_INST (0x0A, RRE, ALGR),
326 DA_INST (0x0B, RRE, SLGR),
327 DA_INST (0x0C, RRE, MSGR),
328 DA_INST (0x0D, RRE, DSGR),
329 DA_INST (0x0E, RRE, EREGG),
330 DA_INST (0x0F, RRE, LRVGR),
331 DA_INST (0x10, RRE, LPGFR),
332 DA_INST (0x11, RRE, LNGFR),
333 DA_INST (0x12, RRE, LTGFR),
334 DA_INST (0x13, RRE, LCGFR),
335 DA_INST (0x14, RRE, LGFR),
336 DA_INST (0x16, RRE, LLGFR),
337 DA_INST (0x17, RRE, LLGTR),
338 DA_INST (0x18, RRE, AGFR),
339 DA_INST (0x19, RRE, SGFR),
340 DA_INST (0x1A, RRE, ALGFR),
341 DA_INST (0x1B, RRE, SLGFR),
342 DA_INST (0x1C, RRE, MSGFR),
343 DA_INST (0x1D, RRE, DSGFR),
344 DA_INST (0x1E, RRE, KMAC),
345 DA_INST (0x1F, RRE, LRVR),
346 DA_INST (0x20, RRE, CGR),
347 DA_INST (0x21, RRE, CLGR),
348 DA_INST (0x25, RRE, STURG),
349 DA_INST (0x26, RRE, LBR),
350 DA_INST (0x27, RRE, LHR),
351 DA_INST (0x2E, RRE, KM),
352 DA_INST (0x2F, RRE, KMC),
353 DA_INST (0x30, RRE, CGFR),
354 DA_INST (0x31, RRE, CLGFR),
355 DA_INST (0x3E, RRE, KIMD),
356 DA_INST (0x3F, RRE, KLMD),
357 DA_INST (0x46, RRE, BCTGR),
358 DA_INST (0x60, RRF2, CGRT),
359 DA_INST (0x61, RRF2, CLGRT),
360 DA_INST (0x72, RRF2, CRT),
361 DA_INST (0x73, RRF2, CLRT),
362 DA_INST (0x80, RRE, NGR),
363 DA_INST (0x81, RRE, OGR),
364 DA_INST (0x82, RRE, XGR),
365 DA_INST (0x83, RRE, FLOGR),
366 DA_INST (0x84, RRE, LLGCR),
367 DA_INST (0x85, RRE, LLGHR),
368 DA_INST (0x86, RRE, MLGR),
369 DA_INST (0x87, RRE, DLGR),
370 DA_INST (0x88, RRE, ALCGR),
371 DA_INST (0x89, RRE, SLBGR),
372 DA_INST (0x8A, RRE, CSPG),
373 DA_INST (0x8D, RRE, EPSW),
374 DA_INST (0x8E, RRF3, IDTE),
375 DA_INST (0x90, RRF2, TRTT),
376 DA_INST (0x91, RRF2, TRTO),
377 DA_INST (0x92, RRF2, TROT),
378 DA_INST (0x93, RRF2, TROO),
379 DA_INST (0x94, RRE, LLCR),
380 DA_INST (0x95, RRE, LLHR),
381 DA_INST (0x96, RRE, MLR),
382 DA_INST (0x97, RRE, DLR),
383 DA_INST (0x98, RRE, ALCR),
384 DA_INST (0x99, RRE, SLBR),
385 DA_INST (0x9A, RRE, EPAIR),
386 DA_INST (0x9B, RRE, ESAIR),
387 DA_INST (0x9D, RRE, ESEA),
388 DA_INST (0x9E, RRE, PTI),
389 DA_INST (0x9F, RRE, SSAIR),
390 DA_INST (0xA2, RRE, PTF),
391 DA_INST (0xAA, RRF3, LPTEA),
392 DA_INST (0xAF, RRE, PFMF),
393 DA_INST (0xB0, RRF2, CU14),
394 DA_INST (0xB1, RRF2, CU24),
395 DA_INST (0xB2, RRE, CU41),
396 DA_INST (0xB3, RRE, CU42),
397 DA_INST (0xBD, RRF2, TRTRE),
398 DA_INST (0xBE, RRE, SRSTU),
399 DA_INST (0xBF, RRF2, TRTE),
402 static struct disassm_instruction l2_c0[16] = { /* C0x */
403 DA_INST (0x0, RIL1, LARL),
404 DA_INST (0x1, RIL1, LGFI),
405 DA_INST (0x4, RIL2, BRCL),
406 DA_INST (0x5, RIL1, BRASL),
407 DA_INST (0x6, RIL1, XIHF),
408 DA_INST (0x7, RIL1, XILF),
409 DA_INST (0x8, RIL1, IIHF),
410 DA_INST (0x9, RIL1, IILF),
411 DA_INST (0xA, RIL1, NIHF),
412 DA_INST (0xB, RIL1, NILF),
413 DA_INST (0xC, RIL1, OIHF),
414 DA_INST (0xD, RIL1, OILF),
415 DA_INST (0xE, RIL1, LLIHF),
416 DA_INST (0xF, RIL1, LLILF),
419 static struct disassm_instruction l2_c2[16] = { /* C2x */
420 DA_INST (0x0, RIL1, MSGFI),
421 DA_INST (0x1, RIL1, MSFI),
422 DA_INST (0x4, RIL1, SLGFI),
423 DA_INST (0x5, RIL1, SLFI),
424 DA_INST (0x8, RIL1, AGFI),
425 DA_INST (0x9, RIL1, AFI),
426 DA_INST (0xA, RIL1, ALGFI),
427 DA_INST (0xB, RIL1, ALFI),
428 DA_INST (0xC, RIL1, CGFI),
429 DA_INST (0xD, RIL1, CFI),
430 DA_INST (0xE, RIL1, CLGFI),
431 DA_INST (0xF, RIL1, CLFI),
434 static struct disassm_instruction l2_c4[16] = { /* C4x */
435 DA_INST (0x2, RIL1, LLHRL),
436 DA_INST (0x4, RIL1, LGHRL),
437 DA_INST (0x5, RIL1, LHRL),
438 DA_INST (0x6, RIL1, LLGHRL),
439 DA_INST (0x7, RIL1, STHRL),
440 DA_INST (0x8, RIL1, LGRL),
441 DA_INST (0xB, RIL1, STGRL),
442 DA_INST (0xC, RIL1, LGFRL),
443 DA_INST (0xD, RIL1, LRL),
444 DA_INST (0xE, RIL1, LLGFRL),
445 DA_INST (0xF, RIL1, STRL),
448 static struct disassm_instruction l2_c6[16] = { /* C6x */
449 DA_INST (0x0, RIL1, EXRL),
450 DA_INST (0x2, RIL2, PFDRL),
451 DA_INST (0x4, RIL1, CGHRL),
452 DA_INST (0x5, RIL1, CHRL),
453 DA_INST (0x6, RIL1, CLGHRL),
454 DA_INST (0x7, RIL1, CLHRL),
455 DA_INST (0x8, RIL1, CGRL),
456 DA_INST (0xA, RIL1, CLGRL),
457 DA_INST (0xC, RIL1, CGFRL),
458 DA_INST (0xD, RIL1, CRL),
459 DA_INST (0xE, RIL1, CLGFRL),
460 DA_INST (0xF, RIL1, CLRL),
463 static struct disassm_instruction l2_c8[16] = { /* C8x */
464 DA_INST (0x0, SSF, MVCOS),
465 DA_INST (0x1, SSF, ECTG),
466 DA_INST (0x2, SSF, CSST),
469 static struct disassm_instruction l2_e3[256] = { /* E3xx */
470 DA_INST (0x02, RXY, LTG),
471 DA_INST (0x03, RXY, LRAG),
472 DA_INST (0x04, RXY, LG),
473 DA_INST (0x06, RXY, CVBY),
474 DA_INST (0x08, RXY, AG),
475 DA_INST (0x09, RXY, SG),
476 DA_INST (0x0A, RXY, ALG),
477 DA_INST (0x0B, RXY, SLG),
478 DA_INST (0x0C, RXY, MSG),
479 DA_INST (0x0D, RXY, DSG),
480 DA_INST (0x0E, RXY, CVBG),
481 DA_INST (0x0F, RXY, LRVG),
482 DA_INST (0x12, RXY, LT),
483 DA_INST (0x13, RXY, LRAY),
484 DA_INST (0x14, RXY, LGF),
485 DA_INST (0x15, RXY, LGH),
486 DA_INST (0x16, RXY, LLGF),
487 DA_INST (0x17, RXY, LLGT),
488 DA_INST (0x18, RXY, AGF),
489 DA_INST (0x19, RXY, SGF),
490 DA_INST (0x1A, RXY, ALGF),
491 DA_INST (0x1B, RXY, SLGF),
492 DA_INST (0x1C, RXY, MSGF),
493 DA_INST (0x1D, RXY, DSGF),
494 DA_INST (0x1E, RXY, LRV),
495 DA_INST (0x1F, RXY, LRVH),
496 DA_INST (0x20, RXY, CG),
497 DA_INST (0x21, RXY, CLG),
498 DA_INST (0x24, RXY, STG),
499 DA_INST (0x26, RXY, CVDY),
500 DA_INST (0x2E, RXY, CVDG),
501 DA_INST (0x2F, RXY, STRVG),
502 DA_INST (0x30, RXY, CGF),
503 DA_INST (0x31, RXY, CLGF),
504 DA_INST (0x32, RXY, LTGF),
505 DA_INST (0x34, RXY, CGH),
506 DA_INST (0x36, RXY, PFD),
507 DA_INST (0x3E, RXY, STRV),
508 DA_INST (0x3F, RXY, STRVH),
509 DA_INST (0x46, RXY, BCTG),
510 DA_INST (0x50, RXY, STY),
511 DA_INST (0x51, RXY, MSY),
512 DA_INST (0x54, RXY, NY),
513 DA_INST (0x55, RXY, CLY),
514 DA_INST (0x56, RXY, OY),
515 DA_INST (0x57, RXY, XY),
516 DA_INST (0x58, RXY, LY),
517 DA_INST (0x59, RXY, CY),
518 DA_INST (0x5A, RXY, AY),
519 DA_INST (0x5B, RXY, SY),
520 DA_INST (0x5C, RXY, MFY),
521 DA_INST (0x5E, RXY, ALY),
522 DA_INST (0x5F, RXY, SLY),
523 DA_INST (0x70, RXY, STHY),
524 DA_INST (0x71, RXY, LAY),
525 DA_INST (0x72, RXY, STCY),
526 DA_INST (0x73, RXY, ICY),
527 DA_INST (0x75, RXY, LAEY),
528 DA_INST (0x76, RXY, LB),
529 DA_INST (0x77, RXY, LGB),
530 DA_INST (0x78, RXY, LHY),
531 DA_INST (0x79, RXY, CHY),
532 DA_INST (0x7A, RXY, AHY),
533 DA_INST (0x7B, RXY, SHY),
534 DA_INST (0x7C, RXY, MHY),
535 DA_INST (0x80, RXY, NG),
536 DA_INST (0x81, RXY, OG),
537 DA_INST (0x82, RXY, XG),
538 DA_INST (0x86, RXY, MLG),
539 DA_INST (0x87, RXY, DLG),
540 DA_INST (0x88, RXY, ALCG),
541 DA_INST (0x89, RXY, SLBG),
542 DA_INST (0x8E, RXY, STPQ),
543 DA_INST (0x8F, RXY, LPQ),
544 DA_INST (0x90, RXY, LLGC),
545 DA_INST (0x91, RXY, LLGH),
546 DA_INST (0x94, RXY, LLC),
547 DA_INST (0x95, RXY, LLH),
548 DA_INST (0x96, RXY, ML),
549 DA_INST (0x97, RXY, DL),
550 DA_INST (0x98, RXY, ALC),
551 DA_INST (0x99, RXY, SLB),
554 static struct disassm_instruction l2_e5[256] = { /* E5xx */
555 DA_INST (0x00, SSE, LASP),
556 DA_INST (0x01, SSE, TPROT),
557 DA_INST (0x02, SSE, STRAG),
558 DA_INST (0x0E, SSE, MVCSK),
559 DA_INST (0x0F, SSE, MVCDK),
560 DA_INST (0x44, SIL, MVHHI),
561 DA_INST (0x48, SIL, MVGHI),
562 DA_INST (0x4C, SIL, MVHI),
563 DA_INST (0x54, SIL, CHHSI),
564 DA_INST (0x55, SIL, CLHHSI),
565 DA_INST (0x58, SIL, CGHSI),
566 DA_INST (0x59, SIL, CLGHSI),
567 DA_INST (0x5C, SIL, CHSI),
568 DA_INST (0x5D, SIL, CLFHSI),
571 static struct disassm_instruction l2_eb[256] = { /* EBxx */
572 DA_INST (0x04, RSY1, LMG),
573 DA_INST (0x0A, RSY1, SRAG),
574 DA_INST (0x0B, RSY1, SLAG),
575 DA_INST (0x0C, RSY1, SRLG),
576 DA_INST (0x0D, RSY1, SLLG),
577 DA_INST (0x0F, RSY1, TRACG),
578 DA_INST (0x14, RSY1, CSY),
579 DA_INST (0x1C, RSY1, RLLG),
580 DA_INST (0x1D, RSY1, RLL),
581 DA_INST (0x20, RSY2, CLMH),
582 DA_INST (0x21, RSY2, CLMY),
583 DA_INST (0x24, RSY1, STMG),
584 DA_INST (0x25, RSY1, STCTG),
585 DA_INST (0x26, RSY1, STMH),
586 DA_INST (0x2C, RSY2, STCMH),
587 DA_INST (0x2D, RSY2, STCMY),
588 DA_INST (0x2F, RSY1, LCTLG),
589 DA_INST (0x30, RSY1, CSG),
590 DA_INST (0x31, RSY1, CDSY),
591 DA_INST (0x3E, RSY1, CDSG),
592 DA_INST (0x44, RSY1, BXHG),
593 DA_INST (0x45, RSY1, BXLEG),
594 DA_INST (0x4C, RSY1, ECAG),
595 DA_INST (0x51, SIY, TMY),
596 DA_INST (0x52, SIY, MVIY),
597 DA_INST (0x54, SIY, NIY),
598 DA_INST (0x55, SIY, CLIY),
599 DA_INST (0x56, SIY, OIY),
600 DA_INST (0x57, SIY, XIY),
601 DA_INST (0x6A, SIY, ASI),
602 DA_INST (0x6E, SIY, ALSI),
603 DA_INST (0x80, RSY2, ICMH),
604 DA_INST (0x81, RSY2, ICMY),
605 DA_INST (0x8E, RSY1, MVCLU),
606 DA_INST (0x8F, RSY1, CLCLU),
607 DA_INST (0x90, RSY1, STMY),
608 DA_INST (0x96, RSY1, LMH),
609 DA_INST (0x98, RSY1, LMY),
610 DA_INST (0x9A, RSY1, LAMY),
611 DA_INST (0x9B, RSY1, STAMY),
612 DA_INST (0xC0, RSL, TP),
615 static struct disassm_instruction l2_ec[256] = { /* ECxx */
616 DA_INST (0x44, RIE, BRXHG),
617 DA_INST (0x45, RIE, BRXLG),
618 DA_INST (0x54, RIE, RNSBG),
619 DA_INST (0x55, RIE, RISBG),
620 DA_INST (0x56, RIE, ROSBG),
621 DA_INST (0x57, RIE, RXSBG),
622 DA_INST (0x64, RIE, CGRJ),
623 DA_INST (0x65, RIE, CLGRJ),
624 DA_INST (0x70, RIE, CGIT),
625 DA_INST (0x71, RIE, CLGIT),
626 DA_INST (0x72, RIE, CIT),
627 DA_INST (0x73, RIE, CLFIT),
628 DA_INST (0x76, RIE, CRJ),
629 DA_INST (0x77, RIE, CLRJ),
630 DA_INST (0x7C, RIE, CGIJ),
631 DA_INST (0x7D, RIE, CLGIJ),
632 DA_INST (0x7E, RIE, CIJ),
633 DA_INST (0x7F, RIE, CLIJ),
634 DA_INST (0xE4, RRS, CGRB),
635 DA_INST (0xE5, RRS, CLGRB),
636 DA_INST (0xF6, RRS, CRB),
637 DA_INST (0xF7, RRS, CLRB),
638 DA_INST (0xFC, RIS, CGIB),
639 DA_INST (0xFD, RIS, CLGIB),
642 static struct disassm_instruction l2_ed[256] = { /* EDxx */
643 DA_INST (0x04, RXE, LDEB),
644 DA_INST (0x05, RXE, LXDB),
645 DA_INST (0x06, RXE, LXEB),
646 DA_INST (0x07, RXE, MXDB),
647 DA_INST (0x08, RXE, KEB),
648 DA_INST (0x09, RXE, CEB),
649 DA_INST (0x0A, RXE, AEB),
650 DA_INST (0x0B, RXE, SEB),
651 DA_INST (0x0C, RXE, MDEB),
652 DA_INST (0x0D, RXE, DEB),
653 DA_INST (0x0E, RXE, MAEB),
654 DA_INST (0x0F, RXE, MSEB),
655 DA_INST (0x10, RXE, TCEB),
656 DA_INST (0x11, RXE, TCDB),
657 DA_INST (0x12, RXE, TCXB),
658 DA_INST (0x14, RXE, SQEB),
659 DA_INST (0x15, RXE, SQDB),
660 DA_INST (0x17, RXE, MEEB),
661 DA_INST (0x18, RXE, KDB),
662 DA_INST (0x19, RXE, CDB),
663 DA_INST (0x1A, RXE, ADB),
664 DA_INST (0x1B, RXE, SDB),
665 DA_INST (0x1C, RXE, MDB),
666 DA_INST (0x1D, RXE, DDB),
667 DA_INST (0x1E, RXF, MADB),
668 DA_INST (0x1F, RXF, MSDB),
669 DA_INST (0x24, RXE, LDE),
670 DA_INST (0x25, RXE, LXD),
671 DA_INST (0x26, RXE, LXE),
672 DA_INST (0x2E, RXF, MAE),
673 DA_INST (0x2F, RXF, MSE),
674 DA_INST (0x34, RXE, SQE),
675 DA_INST (0x35, RXE, SQD),
676 DA_INST (0x37, RXE, MEE),
677 DA_INST (0x38, RXF, MAYL),
678 DA_INST (0x39, RXF, MYL),
679 DA_INST (0x3A, RXF, MAY),
680 DA_INST (0x3B, RXF, MY),
681 DA_INST (0x3C, RXF, MAYH),
682 DA_INST (0x3D, RXF, MYH),
683 DA_INST (0x3E, RXF, MAD),
684 DA_INST (0x3F, RXF, MSD),
685 DA_INST (0x40, RXF, SLDT),
686 DA_INST (0x41, RXF, SRDT),
687 DA_INST (0x48, RXF, SLXT),
688 DA_INST (0x49, RXF, SRXT),
689 DA_INST (0x50, RXE, TDCET),
690 DA_INST (0x51, RXE, TDGET),
691 DA_INST (0x54, RXE, TDCDT),
692 DA_INST (0x55, RXE, TDGDT),
693 DA_INST (0x58, RXE, TDCXT),
694 DA_INST (0x59, RXE, TDGXT),
695 DA_INST (0x64, RXY, LEY),
696 DA_INST (0x65, RXY, LDY),
697 DA_INST (0x66, RXY, STEY),
698 DA_INST (0x67, RXY, STDY),
701 static struct disassm_instruction l1[256] = { /* xx */
702 DA_INST_TBL (0x01, l2_01, 8, 8),
703 DA_INST (0x04, RR, SPM),
704 DA_INST (0x05, RR, BALR),
705 DA_INST (0x06, RR, BCTR),
706 DA_INST (0x07, RR_MASK, BCR),
707 DA_INST (0x0A, I, SVC),
708 DA_INST (0x0B, RR, BSM),
709 DA_INST (0x0C, RR, BASSM),
710 DA_INST (0x0D, RR, BASR),
711 DA_INST (0x0E, RR, MVCL),
712 DA_INST (0x0F, RR, CLCL),
713 DA_INST (0x10, RR, LPR),
714 DA_INST (0x11, RR, LNR),
715 DA_INST (0x12, RR, LTR),
716 DA_INST (0x13, RR, LCR),
717 DA_INST (0x14, RR, NR),
718 DA_INST (0x15, RR, CLR),
719 DA_INST (0x16, RR, OR),
720 DA_INST (0x17, RR, XR),
721 DA_INST (0x18, RR, LR),
722 DA_INST (0x19, RR, CR),
723 DA_INST (0x1A, RR, AR),
724 DA_INST (0x1B, RR, SR),
725 DA_INST (0x1C, RR, MR),
726 DA_INST (0x1D, RR, DR),
727 DA_INST (0x1E, RR, ALR),
728 DA_INST (0x1F, RR, SLR),
729 DA_INST (0x20, RR, LPDR),
730 DA_INST (0x21, RR, LNDR),
731 DA_INST (0x22, RR, LTDR),
732 DA_INST (0x23, RR, LCDR),
733 DA_INST (0x24, RR, HDR),
734 DA_INST (0x25, RR, LDXR),
735 DA_INST (0x26, RR, MXR),
736 DA_INST (0x27, RR, MXDR),
737 DA_INST (0x28, RR, LDR),
738 DA_INST (0x29, RR, CDR),
739 DA_INST (0x2A, RR, ADR),
740 DA_INST (0x2B, RR, SDR),
741 DA_INST (0x2C, RR, MDR),
742 DA_INST (0x2D, RR, DDR),
743 DA_INST (0x2E, RR, AWR),
744 DA_INST (0x2F, RR, SWR),
745 DA_INST (0x30, RR, LPER),
746 DA_INST (0x31, RR, LNER),
747 DA_INST (0x32, RR, LTER),
748 DA_INST (0x33, RR, LCER),
749 DA_INST (0x34, RR, HER),
750 DA_INST (0x35, RR, LEDR),
751 DA_INST (0x36, RR, AXR),
752 DA_INST (0x37, RR, SXR),
753 DA_INST (0x38, RR, LER),
754 DA_INST (0x39, RR, CER),
755 DA_INST (0x3A, RR, AER),
756 DA_INST (0x3B, RR, SER),
757 DA_INST (0x3C, RR, MDER),
758 DA_INST (0x3D, RR, DER),
759 DA_INST (0x3E, RR, AUR),
760 DA_INST (0x3F, RR, SUR),
761 DA_INST (0x40, RX, STH),
762 DA_INST (0x41, RX, LA),
763 DA_INST (0x42, RX, STC),
764 DA_INST (0x43, RX, IC),
765 DA_INST (0x44, RX, EX),
766 DA_INST (0x45, RX, BAL),
767 DA_INST (0x46, RX, BCT),
768 DA_INST (0x47, RX_MASK, BC),
769 DA_INST (0x48, RX, LH),
770 DA_INST (0x49, RX, CH),
771 DA_INST (0x4A, RX, AH),
772 DA_INST (0x4B, RX, SH),
773 DA_INST (0x4C, RX, MH),
774 DA_INST (0x4D, RX, BAS),
775 DA_INST (0x4E, RX, CVD),
776 DA_INST (0x4F, RX, CVB),
777 DA_INST (0x50, RX, ST),
778 DA_INST (0x51, RX, LAE),
779 DA_INST (0x54, RX, N),
780 DA_INST (0x55, RX, CL),
781 DA_INST (0x56, RX, O),
782 DA_INST (0x57, RX, X),
783 DA_INST (0x58, RX, L),
784 DA_INST (0x59, RX, C),
785 DA_INST (0x5A, RX, A),
786 DA_INST (0x5B, RX, S),
787 DA_INST (0x5C, RX, M),
788 DA_INST (0x5D, RX, D),
789 DA_INST (0x5E, RX, AL),
790 DA_INST (0x5F, RX, SL),
791 DA_INST (0x60, RX, STD),
792 DA_INST (0x67, RX, MXD),
793 DA_INST (0x68, RX, LD),
794 DA_INST (0x69, RX, CD),
795 DA_INST (0x6A, RX, AD),
796 DA_INST (0x6B, RX, SD),
797 DA_INST (0x6C, RX, MD),
798 DA_INST (0x6D, RX, DD),
799 DA_INST (0x6E, RX, AW),
800 DA_INST (0x6F, RX, SW),
801 DA_INST (0x70, RX, STE),
802 DA_INST (0x71, RX, MS),
803 DA_INST (0x78, RX, LE),
804 DA_INST (0x79, RX, CE),
805 DA_INST (0x7A, RX, AE),
806 DA_INST (0x7B, RX, SE),
807 DA_INST (0x7C, RX, MDE),
808 DA_INST (0x7D, RX, DE),
809 DA_INST (0x7E, RX, AU),
810 DA_INST (0x7F, RX, SU),
811 DA_INST (0x80, S, SSM),
812 DA_INST (0x82, S, LPSW),
813 DA_INST (0x83, DIAG, DIAG),
814 DA_INST (0x84, RSI, BRXH),
815 DA_INST (0x85, RSI, BRXLE),
816 DA_INST (0x86, RS1, BXH),
817 DA_INST (0x87, RS1, BXLE),
818 DA_INST (0x88, RS1, SRL),
819 DA_INST (0x89, RS1, SLL),
820 DA_INST (0x8A, RS1, SRA),
821 DA_INST (0x8B, RS1, SLA),
822 DA_INST (0x8C, RS1, SRDL),
823 DA_INST (0x8D, RS1, SLDL),
824 DA_INST (0x8E, RS1, SRDA),
825 DA_INST (0x8F, RS1, SLDA),
826 DA_INST (0x90, RS1, STM),
827 DA_INST (0x91, SI, TM),
828 DA_INST (0x92, SI, MVI),
829 DA_INST (0x93, S, TS),
830 DA_INST (0x94, SI, NI),
831 DA_INST (0x95, SI, CLI),
832 DA_INST (0x96, SI, OI),
833 DA_INST (0x97, SI, XI),
834 DA_INST (0x98, RS1, LM),
835 DA_INST (0x99, RS1, TRACE),
836 DA_INST (0x9A, RS1, LAM),
837 DA_INST (0x9B, RS1, STAM),
838 DA_INST_TBL (0xA5, l2_a5, 4, 12),
839 DA_INST_TBL (0xA7, l2_a7, 4, 12),
840 DA_INST (0xA8, RS1, MVCLE),
841 DA_INST (0xA9, RS1, CLCLE),
842 DA_INST (0xAC, SI, STNSM),
843 DA_INST (0xAD, SI, STOSM),
844 DA_INST (0xAE, RS1, SIGP),
845 DA_INST (0xAF, SI, MC),
846 DA_INST (0xB1, RX, LRA),
847 DA_INST_TBL (0xB2, l2_b2, 8, 8),
848 DA_INST_TBL (0xB3, l2_b3, 8, 8),
849 DA_INST (0xB6, RS1, STCTL),
850 DA_INST (0xB7, RS1, LCTL),
851 DA_INST_TBL (0xB9, l2_b9, 8, 8),
852 DA_INST (0xBA, RS1, CS),
853 DA_INST (0xBB, RS1, CDS),
854 DA_INST (0xBD, RS2, CLM),
855 DA_INST (0xBE, RS2, STCM),
856 DA_INST (0xBF, RS2, ICM),
857 DA_INST_TBL (0xC0, l2_c0, 4, 12),
858 DA_INST_TBL (0xC2, l2_c2, 4, 12),
859 DA_INST_TBL (0xC4, l2_c4, 4, 12),
860 DA_INST_TBL (0xC6, l2_c6, 4, 12),
861 DA_INST_TBL (0xC8, l2_c8, 4, 12),
862 DA_INST (0xD0, SS1, TRTR),
863 DA_INST (0xD1, SS1, MVN),
864 DA_INST (0xD2, SS1, MVC),
865 DA_INST (0xD3, SS1, MVZ),
866 DA_INST (0xD4, SS1, NC),
867 DA_INST (0xD5, SS1, CLC),
868 DA_INST (0xD6, SS1, OC),
869 DA_INST (0xD7, SS1, XC),
870 DA_INST (0xD9, SS4, MVCK),
871 DA_INST (0xDA, SS4, MVCP),
872 DA_INST (0xDB, SS4, MVCS),
873 DA_INST (0xDC, SS1, TR),
874 DA_INST (0xDD, SS1, TRT),
875 DA_INST (0xDE, SS1, ED),
876 DA_INST (0xDF, SS1, EDMK),
877 DA_INST (0xE1, SS1, PKU),
878 DA_INST (0xE2, SS1, UNPKU),
879 DA_INST_TBL (0xE3, l2_e3, 8, 40),
880 DA_INST_TBL (0xE5, l2_e5, 8, 8),
881 DA_INST (0xE8, SS1, MVCIN),
882 DA_INST (0xE9, SS1, PKA),
883 DA_INST (0xEA, SS1, UNPKA),
884 DA_INST_TBL (0xEB, l2_eb, 8, 40),
885 DA_INST_TBL (0xEC, l2_ec, 8, 40),
886 DA_INST_TBL (0xED, l2_ed, 8, 40),
887 DA_INST (0xEE, SS5, PLO),
888 DA_INST (0xEF, SS5, LMD),
889 DA_INST (0xF0, SS3, SRP),
890 DA_INST (0xF1, SS2, MVO),
891 DA_INST (0xF2, SS2, PACK),
892 DA_INST (0xF3, SS2, UNPK),
893 DA_INST (0xF8, SS2, ZAP),
894 DA_INST (0xF9, SS2, CP),
895 DA_INST (0xFA, SS2, AP),
896 DA_INST (0xFB, SS2, SP),
897 DA_INST (0xFC, SS2, MP),
898 DA_INST (0xFD, SS2, DP),
901 static int da_snprintf(u8 *bytes, char *buf, int buflen, u8 opcode, struct
902 disassm_instruction *table)
904 #define IPFX "%-6s "
906 int ilc = opcode >> 6;
907 struct disassm_instruction *inst = &table[opcode];
909 switch (inst->fmt) {
910 case IF_INV:
911 snprintf(buf, buflen, "??");
912 break;
913 case IF_VAR:
915 unsigned char subop; /* sub op-code */
917 /* get the right byte */
918 subop = *(bytes+(inst->loc/8));
920 /* shift the needed portion right */
921 subop >>= 8 - inst->len - (inst->loc%8);
923 /* mask out any unneeded high bits */
924 subop &= (1 << inst->len) - 1;
926 snprintf(buf, buflen, "??? (many, X'%02X'+ "
927 "X'%02X', table = %p)", opcode, subop,
928 inst->u.ptr);
929 if (inst->u.ptr)
930 da_snprintf(bytes, buf, buflen, subop, inst->u.ptr);
931 break;
933 case IF_DIAG:
934 snprintf(buf, buflen, IPFX "X'%06X'",
935 inst->u.name,
936 *((u32*)(bytes)) & 0xffffff); /* I */
937 break;
938 case IF_E:
939 snprintf(buf, buflen, IPFX,
940 inst->u.name);
941 break;
942 case IF_I:
943 snprintf(buf, buflen, IPFX "X'%02X'",
944 inst->u.name,
945 *(bytes+1)); /* I */
946 break;
947 case IF_RI1:
948 case IF_RI2:
949 snprintf(buf, buflen, IPFX "%s%d,%d",
950 inst->u.name,
951 (inst->fmt == IF_RI1 ? "R" : ""), /* reg/mask */
952 bytes[1] >> 4, /* R1/M1 */
953 *((u16*)(bytes+2))); /* I2 */
954 break;
955 case IF_RIL1:
956 case IF_RIL2:
957 snprintf(buf, buflen, IPFX "%s%d,%d",
958 inst->u.name,
959 (inst->fmt == IF_RIL1 ? "R" : ""), /* reg/mask */
960 bytes[1] >> 4, /* R1/M1 */
961 *((u32*)(bytes+2))); /* I2 */
962 break;
963 case IF_RR:
964 case IF_RR_MASK:
965 snprintf(buf, buflen, IPFX "%s%d,R%d",
966 inst->u.name,
967 inst->fmt == IF_RR_MASK ? "" : "R",
968 bytes[1] >> 4, /* R1 */
969 bytes[1] & 0xf); /* R2 */
970 break;
971 case IF_RRE:
972 snprintf(buf, buflen, IPFX "R%d,R%d",
973 inst->u.name,
974 bytes[3] >> 4, /* R1 */
975 bytes[3] & 0xf); /* R2 */
976 break;
977 case IF_RS1:
978 case IF_RS2:
979 snprintf(buf, buflen, IPFX "R%d,%s%d,%d(R%d)",
980 inst->u.name,
981 bytes[1] >> 4, /* R1 */
982 (inst->fmt == IF_RS1 ? "R" : ""), /* reg/mask */
983 bytes[1] & 0xf, /* R3/M3 */
984 *((u16*)(bytes+2)) & 0x0fff, /* D2 */
985 bytes[2] >> 4); /* B2 */
986 break;
987 case IF_RSI:
988 snprintf(buf, buflen, IPFX "R%d,R%d,%d",
989 inst->u.name,
990 bytes[1] >> 4, /* R1 */
991 bytes[1] & 0xf, /* R3 */
992 *((u16*)(bytes+2))); /* I2 */
993 break;
994 case IF_RSY1:
995 case IF_RSY2:
996 snprintf(buf, buflen, IPFX "R%d,%s%d,%d(R%d)",
997 inst->u.name,
998 bytes[1] >> 4, /* R1 */
999 (inst->fmt == IF_RSY1 ? "R" : ""), /* reg/mask */
1000 bytes[1] & 0xf, /* R3/M3 */
1001 ((u32)*((u16*)(bytes+2)) & 0x0fff) +
1002 (((u32)*(bytes+4)) << 12), /* D2 */
1003 bytes[2] >> 4); /* B2 */
1004 break;
1005 case IF_RX:
1006 case IF_RX_MASK:
1007 snprintf(buf, buflen, IPFX "%s%d,%d(R%d,R%d)",
1008 inst->u.name,
1009 inst->fmt == IF_RX_MASK ? "" : "R",
1010 bytes[1] >> 4, /* R1 */
1011 *((u16*)(bytes+2)) & 0x0fff, /* D2 */
1012 bytes[1] & 0xf, /* X2 */
1013 bytes[2] >> 4); /* B2 */
1014 break;
1015 case IF_RXY:
1016 snprintf(buf, buflen, IPFX "R%d,%d(R%d,R%d)",
1017 inst->u.name,
1018 bytes[1] >> 4, /* R1 */
1019 ((u32)*((u16*)(bytes+2)) & 0x0fff) +
1020 (((u32)*(bytes+4)) << 12), /* D2 */
1021 bytes[1] & 0xf, /* X2 */
1022 bytes[2] >> 4); /* B2 */
1023 break;
1024 case IF_S:
1025 snprintf(buf, buflen, IPFX "%d(R%d)",
1026 inst->u.name,
1027 *((u16*)(bytes+2)) & 0x0fff, /* D2 */
1028 bytes[2] >> 4); /* B2 */
1029 break;
1030 case IF_SI:
1031 snprintf(buf, buflen, IPFX "%d(R%d),%d",
1032 inst->u.name,
1033 *((u16*)(bytes+2)) & 0x0fff, /* D1 */
1034 bytes[2] >> 4, /* B1 */
1035 bytes[1]); /* I2 */
1036 break;
1037 case IF_SS1:
1038 snprintf(buf, buflen, IPFX "%d(%d,R%d),%d(R%d)",
1039 inst->u.name,
1040 *((u16*)(bytes+2)) & 0x0fff, /* D1 */
1041 bytes[1]+1, /* L */
1042 bytes[2] >> 4, /* B1 */
1043 *((u16*)(bytes+4)) & 0x0fff, /* D2 */
1044 bytes[4] >> 4); /* B2 */
1045 break;
1046 case IF_SS2:
1047 snprintf(buf, buflen, IPFX "%d(%d,R%d),%d(%d,R%d)",
1048 inst->u.name,
1049 *((u16*)(bytes+2)) & 0x0fff, /* D1 */
1050 (bytes[1] >> 4) + 1, /* L1 */
1051 bytes[2] >> 4, /* B1 */
1052 *((u16*)(bytes+4)) & 0x0fff, /* D2 */
1053 (bytes[1] & 0xf) + 1, /* L2 */
1054 bytes[4] >> 4); /* B2 */
1055 break;
1056 case IF_SS3:
1057 snprintf(buf, buflen, IPFX "%d(%d,R%d),%d(R%d),%d",
1058 inst->u.name,
1059 *((u16*)(bytes+2)) & 0x0fff, /* D1 */
1060 (bytes[1] >> 4) + 1, /* L1 */
1061 bytes[2] >> 4, /* B1 */
1062 *((u16*)(bytes+4)) & 0x0fff, /* D2 */
1063 bytes[4] >> 4, /* B2 */
1064 bytes[1] & 0xf); /* I3 */
1065 break;
1066 case IF_SS4:
1067 snprintf(buf, buflen, IPFX "%d(%d,R%d),%d(R%d),R%d",
1068 inst->u.name,
1069 *((u16*)(bytes+2)) & 0x0fff, /* D1 */
1070 (bytes[1] >> 4) + 1, /* L1 */
1071 bytes[2] >> 4, /* B1 */
1072 *((u16*)(bytes+4)) & 0x0fff, /* D2 */
1073 bytes[4] >> 4, /* B2 */
1074 bytes[1] & 0xf); /* R3 */
1075 break;
1076 case IF_SS5:
1077 snprintf(buf, buflen, IPFX "R%d,R%d,%d(R%d),%d(R%d)",
1078 inst->u.name,
1079 bytes[1] >> 4, /* R1 */
1080 bytes[1] & 0xf, /* R3 */
1081 *((u16*)(bytes+2)) & 0x0fff, /* D2 */
1082 bytes[2] >> 4, /* B2 */
1083 *((u16*)(bytes+4)) & 0x0fff, /* D4 */
1084 bytes[4] >> 4); /* B4 */
1085 break;
1086 default:
1087 snprintf(buf, buflen, "%s ???", inst->u.name);
1088 break;
1091 /* return instruction length in bytes */
1092 return 2 * (ilc >= 2 ? ilc : ilc + 1);
1095 int disassm(u8 *bytes, char *buf, int buflen)
1097 return da_snprintf(bytes, buf, buflen, *bytes, l1);