/[pcsx2_0.9.7]/trunk/pcsx2/DebugTools/DisR5900asm.cpp
ViewVC logotype

Contents of /trunk/pcsx2/DebugTools/DisR5900asm.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (show annotations) (download)
Mon Sep 6 11:40:06 2010 UTC (9 years, 5 months ago) by william
File size: 81289 byte(s)
exported r3113 from ./upstream/trunk
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16
17 #include "PrecompiledHeader.h"
18
19 #ifdef __LINUX__
20 #include <cstdarg>
21 #endif
22
23 #include "Debug.h"
24 #include "R5900.h"
25 #include "DisASM.h"
26 #include "R5900OpcodeTables.h"
27
28 unsigned long opcode_addr;
29
30 using namespace std;
31
32 namespace R5900
33 {
34
35 /*
36 //DECODE PROCUDURES
37
38 //cop0
39 #define DECODE_FS (DECODE_RD)
40 #define DECODE_FT (DECODE_RT)
41 #define DECODE_FD (DECODE_SA)
42 /// ********
43
44 #define DECODE_FUNCTION ((cpuRegs.code) & 0x3F)
45 #define DECODE_RD ((cpuRegs.code >> 11) & 0x1F) // The rd part of the instruction register
46 #define DECODE_RT ((cpuRegs.code >> 16) & 0x1F) // The rt part of the instruction register
47 #define DECODE_RS ((cpuRegs.code >> 21) & 0x1F) // The rs part of the instruction register
48 #define DECODE_SA ((cpuRegs.code >> 6) & 0x1F) // The sa part of the instruction register
49 #define DECODE_IMMED ( cpuRegs.code & 0xFFFF) // The immediate part of the instruction register
50 #define DECODE_OFFSET ((((short)DECODE_IMMED * 4) + opcode_addr + 4))
51 #define DECODE_JUMP (opcode_addr & 0xf0000000)|((cpuRegs.code&0x3ffffff)<<2)
52 #define DECODE_SYSCALL ((opcode_addr & 0x03FFFFFF) >> 6)
53 #define DECODE_BREAK (DECODE_SYSCALL)
54 #define DECODE_C0BC ((cpuRegs.code >> 16) & 0x03)
55 #define DECODE_C1BC ((cpuRegs.code >> 16) & 0x03)
56 #define DECODE_C2BC ((cpuRegs.code >> 16) & 0x03)
57 */
58 /*************************CPUS REGISTERS**************************/
59 static const char * const GPR_REG[32] = {
60 "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
61 "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
62 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
63 "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra"
64 };
65 static const char * const COP0_REG[32] ={
66 "Index","Random","EntryLo0","EntryLo1","Context","PageMask",
67 "Wired","C0r7","BadVaddr","Count","EntryHi","Compare","Status",
68 "Cause","EPC","PRId","Config","C0r17","C0r18","C0r19","C0r20",
69 "C0r21","C0r22","C0r23","Debug","Perf","C0r26","C0r27","TagLo",
70 "TagHi","ErrorPC","C0r31"
71 };
72 //floating point cop1 Floating point reg
73 static const char * const COP1_REG_FP[32] ={
74 "f00","f01","f02","f03","f04","f05","f06","f07",
75 "f08","f09","f10","f11","f12","f13","f14","f15",
76 "f16","f17","f18","f19","f20","f21","f21","f23",
77 "f24","f25","f26","f27","f28","f29","f30","f31"
78 };
79 //floating point cop1 control registers
80 static const char * const COP1_REG_FCR[32] ={
81 "fcr00","fcr01","fcr02","fcr03","fcr04","fcr05","fcr06","fcr07",
82 "fcr08","fcr09","fcr10","fcr11","fcr12","fcr13","fcr14","fcr15",
83 "fcr16","fcr17","fcr18","fcr19","fcr20","fcr21","fcr21","fcr23",
84 "fcr24","fcr25","fcr26","fcr27","fcr28","fcr29","fcr30","fcr31"
85 };
86
87 //floating point cop2 reg
88 static const char * const COP2_REG_FP[32] ={
89 "vf00","vf01","vf02","vf03","vf04","vf05","vf06","vf07",
90 "vf08","vf09","vf10","vf11","vf12","vf13","vf14","vf15",
91 "vf16","vf17","vf18","vf19","vf20","vf21","vf21","vf23",
92 "vf24","vf25","vf26","vf27","vf28","vf29","vf30","vf31"
93 };
94 //cop2 control registers
95
96 static const char * const COP2_REG_CTL[32] ={
97 "vi00","vi01","vi02","vi03","vi04","vi05","vi06","vi07",
98 "vi08","vi09","vi10","vi11","vi12","vi13","vi14","vi15",
99 "Status","MACflag","ClipFlag","c2c19","R","I","Q","c2c23",
100 "c2c24","c2c25","TPC","CMSAR0","FBRST","VPU-STAT","c2c30","CMSAR1"
101 };
102
103 void P_COP2_Unknown( string& output );
104 void P_COP2_SPECIAL2( string& output );
105 void P_COP2_SPECIAL( string& output );
106 void P_COP2_BC2( string& output );
107
108 //****************************************************************************
109 //** COP2 - (VU0) **
110 //****************************************************************************
111 void P_QMFC2( string& output );
112 void P_CFC2( string& output );
113 void P_QMTC2( string& output );
114 void P_CTC2( string& output );
115 void P_BC2F( string& output );
116 void P_BC2T( string& output );
117 void P_BC2FL( string& output );
118 void P_BC2TL( string& output );
119 //*****************SPECIAL 1 VUO TABLE*******************************
120 void P_VADDx( string& output );
121 void P_VADDy( string& output );
122 void P_VADDz( string& output );
123 void P_VADDw( string& output );
124 void P_VSUBx( string& output );
125 void P_VSUBy( string& output );
126 void P_VSUBz( string& output );
127 void P_VSUBw( string& output );
128 void P_VMADDx( string& output );
129 void P_VMADDy( string& output );
130 void P_VMADDz( string& output );
131 void P_VMADDw( string& output );
132 void P_VMSUBx( string& output );
133 void P_VMSUBy( string& output );
134 void P_VMSUBz( string& output );
135 void P_VMSUBw( string& output );
136 void P_VMAXx( string& output );
137 void P_VMAXy( string& output );
138 void P_VMAXz( string& output );
139 void P_VMAXw( string& output );
140 void P_VMINIx( string& output );
141 void P_VMINIy( string& output );
142 void P_VMINIz( string& output );
143 void P_VMINIw( string& output );
144 void P_VMULx( string& output );
145 void P_VMULy( string& output );
146 void P_VMULz( string& output );
147 void P_VMULw( string& output );
148 void P_VMULq( string& output );
149 void P_VMAXi( string& output );
150 void P_VMULi( string& output );
151 void P_VMINIi( string& output );
152 void P_VADDq( string& output );
153 void P_VMADDq( string& output );
154 void P_VADDi( string& output );
155 void P_VMADDi( string& output );
156 void P_VSUBq( string& output );
157 void P_VMSUBq( string& output );
158 void P_VSUbi( string& output );
159 void P_VMSUBi( string& output );
160 void P_VADD( string& output );
161 void P_VMADD( string& output );
162 void P_VMUL( string& output );
163 void P_VMAX( string& output );
164 void P_VSUB( string& output );
165 void P_VMSUB( string& output );
166 void P_VOPMSUB( string& output );
167 void P_VMINI( string& output );
168 void P_VIADD( string& output );
169 void P_VISUB( string& output );
170 void P_VIADDI( string& output );
171 void P_VIAND( string& output );
172 void P_VIOR( string& output );
173 void P_VCALLMS( string& output );
174 void P_CALLMSR( string& output );
175 //***********************************END OF SPECIAL1 VU0 TABLE*****************************
176 //******************************SPECIAL2 VUO TABLE*****************************************
177 void P_VADDAx( string& output );
178 void P_VADDAy( string& output );
179 void P_VADDAz( string& output );
180 void P_VADDAw( string& output );
181 void P_VSUBAx( string& output );
182 void P_VSUBAy( string& output );
183 void P_VSUBAz( string& output );
184 void P_VSUBAw( string& output );
185 void P_VMADDAx( string& output );
186 void P_VMADDAy( string& output );
187 void P_VMADDAz( string& output );
188 void P_VMADDAw( string& output );
189 void P_VMSUBAx( string& output );
190 void P_VMSUBAy( string& output );
191 void P_VMSUBAz( string& output );
192 void P_VMSUBAw( string& output );
193 void P_VITOF0( string& output );
194 void P_VITOF4( string& output );
195 void P_VITOF12( string& output );
196 void P_VITOF15( string& output );
197 void P_VFTOI0( string& output );
198 void P_VFTOI4( string& output );
199 void P_VFTOI12( string& output );
200 void P_VFTOI15( string& output );
201 void P_VMULAx( string& output );
202 void P_VMULAy( string& output );
203 void P_VMULAz( string& output );
204 void P_VMULAw( string& output );
205 void P_VMULAq( string& output );
206 void P_VABS( string& output );
207 void P_VMULAi( string& output );
208 void P_VCLIPw( string& output );
209 void P_VADDAq( string& output );
210 void P_VMADDAq( string& output );
211 void P_VADDAi( string& output );
212 void P_VMADDAi( string& output );
213 void P_VSUBAq( string& output );
214 void P_VMSUBAq( string& output );
215 void P_VSUBAi( string& output );
216 void P_VMSUBAi( string& output );
217 void P_VADDA( string& output );
218 void P_VMADDA( string& output );
219 void P_VMULA( string& output );
220 void P_VSUBA( string& output );
221 void P_VMSUBA( string& output );
222 void P_VOPMULA( string& output );
223 void P_VNOP( string& output );
224 void P_VMONE( string& output );
225 void P_VMR32( string& output );
226 void P_VLQI( string& output );
227 void P_VSQI( string& output );
228 void P_VLQD( string& output );
229 void P_VSQD( string& output );
230 void P_VDIV( string& output );
231 void P_VSQRT( string& output );
232 void P_VRSQRT( string& output );
233 void P_VWAITQ( string& output );
234 void P_VMTIR( string& output );
235 void P_VMFIR( string& output );
236 void P_VILWR( string& output );
237 void P_VISWR( string& output );
238 void P_VRNEXT( string& output );
239 void P_VRGET( string& output );
240 void P_VRINIT( string& output );
241 void P_VRXOR( string& output );
242 //************************************END OF SPECIAL2 VUO TABLE****************************
243
244
245 /*
246 CPU: Instructions encoded by opcode field.
247 31---------26---------------------------------------------------0
248 | opcode | |
249 ------6----------------------------------------------------------
250 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
251 000 | *1 | *2 | J | JAL | BEQ | BNE | BLEZ | BGTZ |
252 001 | ADDI | ADDIU | SLTI | SLTIU | ANDI | ORI | XORI | LUI |
253 010 | *3 | *4 | *5 | --- | BEQL | BNEL | BLEZL | BGTZL |
254 011 | DADDI |DADDIU | LDL | LDR | *6 | --- | LQ | SQ |
255 100 | LB | LH | LWL | LW | LBU | LHU | LWR | LWU |
256 101 | SB | SH | SWL | SW | SDL | SDR | SWR | CACHE |
257 110 | --- | LWC1 | --- | PREF | --- | --- | LQC2 | LD |
258 111 | --- | SWC1 | --- | --- | --- | --- | SQC2 | SD |
259 hi |-------|-------|-------|-------|-------|-------|-------|-------|
260 *1 = SPECIAL, see SPECIAL list *2 = REGIMM, see REGIMM list
261 *3 = COP0 *4 = COP1
262 *5 = COP2 *6 = MMI table
263 */
264
265 /*
266 SPECIAL: Instr. encoded by function field when opcode field = SPECIAL
267 31---------26------------------------------------------5--------0
268 | = SPECIAL | | function|
269 ------6----------------------------------------------------6-----
270 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
271 000 | SLL | --- | SRL | SRA | SLLV | --- | SRLV | SRAV |
272 001 | JR | JALR | MOVZ | MOVN |SYSCALL| BREAK | --- | SYNC |
273 010 | MFHI | MTHI | MFLO | MTLO | DSLLV | --- | DSRLV | DSRAV |
274 011 | MULT | MULTU | DIV | DIVU | ---- | --- | ---- | ----- |
275 100 | ADD | ADDU | SUB | SUBU | AND | OR | XOR | NOR |
276 101 | MFSA | MTSA | SLT | SLTU | DADD | DADDU | DSUB | DSUBU |
277 110 | TGE | TGEU | TLT | TLTU | TEQ | --- | TNE | --- |
278 111 | DSLL | --- | DSRL | DSRA |DSLL32 | --- |DSRL32 |DSRA32 |
279 hi |-------|-------|-------|-------|-------|-------|-------|-------|
280 */
281
282 /*
283 REGIMM: Instructions encoded by the rt field when opcode field = REGIMM.
284 31---------26----------20-------16------------------------------0
285 | = REGIMM | | rt | |
286 ------6---------------------5------------------------------------
287 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
288 00 | BLTZ | BGEZ | BLTZL | BGEZL | --- | --- | --- | --- |
289 01 | TGEI | TGEIU | TLTI | TLTIU | TEQI | --- | TNEI | --- |
290 10 | BLTZAL| BGEZAL|BLTZALL|BGEZALL| --- | --- | --- | --- |
291 11 | MTSAB | MTSAH | --- | --- | --- | --- | --- | --- |
292 hi |-------|-------|-------|-------|-------|-------|-------|-------|
293 */
294
295 /*
296 MMI: Instr. encoded by function field when opcode field = MMI
297 31---------26------------------------------------------5--------0
298 | = MMI | | function|
299 ------6----------------------------------------------------6-----
300 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
301 000 | MADD | MADDU | --- | --- | PLZCW | --- | --- | --- |
302 001 | *1 | *2 | --- | --- | --- | --- | --- | --- |
303 010 | MFHI1 | MTHI1 | MFLO1 | MTLO1 | --- | --- | --- | --- |
304 011 | MULT1 | MULTU1| DIV1 | DIVU1 | --- | --- | --- | --- |
305 100 | MADD1 | MADDU1| --- | --- | --- | --- | --- | --- |
306 101 | *3 | *4 | --- | --- | --- | --- | --- | --- |
307 110 | PMFHL | PMTHL | --- | --- | PSLLH | --- | PSRLH | PSRAH |
308 111 | --- | --- | --- | --- | PSLLW | --- | PSRLW | PSRAW |
309 hi |-------|-------|-------|-------|-------|-------|-------|-------|
310
311 *1 = see MMI0 table *2 = see MMI2 Table
312 *3 = see MMI1 table *4 = see MMI3 Table
313 */
314
315 /*
316 MMI0: Instr. encoded by function field when opcode field = MMI & MMI0
317
318 31---------26------------------------------10--------6-5--------0
319 | | |function | MMI0 |
320 ------6----------------------------------------------------6-----
321 |--000--|--001--|--010--|--011--| lo
322 000 |PADDW | PSUBW | PCGTW | PMAXW |
323 001 |PADDH | PSUBH | PCGTH | PMAXH |
324 010 |PADDB | PSUBB | PCGTB | --- |
325 011 | --- | --- | --- | --- |
326 100 |PADDSW |PSUBSW |PEXTLW | PPACW |
327 101 |PADDSH |PSUBSH |PEXTLH | PPACH |
328 110 |PADDSB |PSUBSB |PEXTLB | PPACB |
329 111 | --- | --- | PEXT5 | PPAC5 |
330 hi |-------|-------|-------|-------|
331 */
332
333 /*
334 MMI1: Instr. encoded by function field when opcode field = MMI & MMI1
335
336 31---------26------------------------------------------5--------0
337 | | |function | MMI1 |
338 ------6----------------------------------------------------6-----
339 |--000--|--001--|--010--|--011--| lo
340 000 | --- | PABSW | PCEQW | PMINW |
341 001 |PADSBH | PABSH | PCEQH | PMINH |
342 010 | --- | --- | PCEQB | --- |
343 011 | --- | --- | --- | --- |
344 100 |PADDUW |PSUBUW |PEXTUW | --- |
345 101 |PADDUH |PSUBUH |PEXTUH | --- |
346 110 |PADDUB |PSUBUB |PEXTUB | QFSRV |
347 111 | --- | --- | --- | --- |
348 hi |-------|-------|-------|-------|
349 */
350
351 /*
352 MMI2: Instr. encoded by function field when opcode field = MMI & MMI2
353
354 31---------26------------------------------------------5--------0
355 | | |function | MMI2 |
356 ------6----------------------------------------------------6-----
357 |--000--|--001--|--010--|--011--| lo
358 000 |PMADDW | --- |PSLLVW |PSRLVW |
359 001 |PMSUBW | --- | --- | --- |
360 010 |PMFHI |PMFLO |PINTH | --- |
361 011 |PMULTW |PDIVW |PCPYLD | --- |
362 100 |PMADDH |PHMADH | PAND | PXOR |
363 101 |PMSUBH |PHMSBH | --- | --- |
364 110 | --- | --- | PEXEH | PREVH |
365 111 |PMULTH |PDIVBW | PEXEW |PROT3W |
366 hi |-------|-------|-------|-------|
367 */
368
369 /*
370 MMI3: Instr. encoded by function field when opcode field = MMI & MMI3
371 31---------26------------------------------------------5--------0
372 | | |function | MMI3 |
373 ------6----------------------------------------------------6-----
374 |--000--|--001--|--010--|--011--| lo
375 000 |PMADDUW| --- | --- |PSRAVW |
376 001 | --- | --- | --- | --- |
377 010 |PMTHI | PMTLO |PINTEH | --- |
378 011 |PMULTUW| PDIVUW|PCPYUD | --- |
379 100 | --- | --- | POR | PNOR |
380 101 | --- | --- | --- | --- |
381 110 | --- | --- | PEXCH | PCPYH |
382 111 | --- | --- | PEXCW | --- |
383 hi |-------|-------|-------|-------|
384 */
385
386 /*
387 COP0: Instructions encoded by the rs field when opcode = COP0.
388 31--------26-25------21 ----------------------------------------0
389 | = COP0 | fmt | |
390 ------6----------5-----------------------------------------------
391 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
392 00 | MFC0 | --- | --- | --- | MTC0 | --- | --- | --- |
393 01 | *1 | --- | --- | --- | --- | --- | --- | --- |
394 10 | *2 | --- | --- | --- | --- | --- | --- | --- |
395 11 | --- | --- | --- | --- | --- | --- | --- | --- |
396 hi |-------|-------|-------|-------|-------|-------|-------|-------|
397 *1=BC See BC0 list *2 = TLB instr, see TLB list
398 */
399 /*
400 BC0: Instructions encoded by the rt field when opcode = COP0 & rs field=BC0
401 31--------26-25------21 ----------------------------------------0
402 | = COP0 | fmt | |
403 ------6----------5-----------------------------------------------
404 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
405 00 | BC0F | BC0T | BC0FL | BC0TL | --- | --- | --- | --- |
406 01 | --- | --- | --- | --- | --- | --- | --- | --- |
407 10 | --- | --- | --- | --- | --- | --- | --- | --- |
408 11 | --- | --- | --- | --- | --- | --- | --- | --- |
409 hi |-------|-------|-------|-------|-------|-------|-------|-------|
410 */
411 /*
412 C0=Instructions encode by function field when Opcode field=COP0 & rs field=C0
413 31---------26------------------------------------------5--------0
414 | | | |
415 ------6----------------------------------------------------6-----
416 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
417 000 | --- | TLBR | TLBWI | --- | --- | --- | TLBWR | --- |
418 001 | TLBP | --- | --- | --- | --- | --- | --- | --- |
419 010 | --- | --- | --- | --- | --- | --- | --- | --- |
420 011 | ERET | --- | --- | --- | --- | --- | --- | --- |
421 100 | --- | --- | --- | --- | --- | --- | --- | --- |
422 101 | --- | --- | --- | --- | --- | --- | --- | --- |
423 110 | --- | --- | --- | --- | --- | --- | --- | --- |
424 111 | EI | DI | --- | --- | --- | --- | --- | --- |
425 hi |-------|-------|-------|-------|-------|-------|-------|-------|
426 */
427 /*
428 COP1: Instructions encoded by the fmt field when opcode = COP1.
429 31--------26-25------21 ----------------------------------------0
430 | = COP1 | fmt | |
431 ------6----------5-----------------------------------------------
432 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
433 00 | MFC1 | --- | CFC1 | --- | MTC1 | --- | CTC1 | --- |
434 01 | *1 | --- | --- | --- | --- | --- | --- | --- |
435 10 | *2 | --- | --- | --- | *3 | --- | --- | --- |
436 11 | --- | --- | --- | --- | --- | --- | --- | --- |
437 hi |-------|-------|-------|-------|-------|-------|-------|-------|
438 *1 = BC instructions, see BC1 list *2 = S instr, see FPU list
439 *3 = W instr, see FPU list
440 */
441 /*
442 BC1: Instructions encoded by the rt field when opcode = COP1 & rs field=BC1
443 31--------26-25------21 ----------------------------------------0
444 | = COP1 | fmt | |
445 ------6----------5-----------------------------------------------
446 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
447 00 | BC1F | BC1T | BC1FL | BC1TL | --- | --- | --- | --- |
448 01 | --- | --- | --- | --- | --- | --- | --- | --- |
449 10 | --- | --- | --- | --- | --- | --- | --- | --- |
450 11 | --- | --- | --- | --- | --- | --- | --- | --- |
451 hi |-------|-------|-------|-------|-------|-------|-------|-------|
452 */
453 /*
454 FPU: Instructions encoded by the function field when opcode = COP1
455 and rs = S
456 31--------26-25------21 -------------------------------5--------0
457 | = COP1 | = S | | function|
458 ------6----------5-----------------------------------------6-----
459 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
460 000 | ADD.S | SUB.S | MUL.S | DIV.S | SQRT.S| ABS.S | MOV.S | NEG.S |
461 001 | --- | --- | --- | --- | --- | --- | --- | --- |
462 010 | --- | --- | --- | --- | --- | --- |RSQRT.S| --- |
463 011 | ADDA.S| SUBA.S| MULA.S| --- | MADD.S| MSUB.S|MADDA.S|MSUBA.S|
464 100 | --- | --- | --- | --- | CVT.W | --- | --- | --- |
465 101 | MAX.S | MIN.S | --- | --- | --- | --- | --- | --- |
466 110 | C.F | --- | C.EQ | --- | C.LT | --- | C.LE | --- |
467 111 | --- | --- | --- | --- | --- | --- | --- | --- |
468 hi |-------|-------|-------|-------|-------|-------|-------|-------|
469 */
470 /*
471 FPU: Instructions encoded by the function field when opcode = COP1
472 and rs = W
473 31--------26-25------21 -------------------------------5--------0
474 | = COP1 | = W | | function|
475 ------6----------5-----------------------------------------6-----
476 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
477 000 | --- | --- | --- | --- | --- | --- | --- | --- |
478 001 | --- | --- | --- | --- | --- | --- | --- | --- |
479 010 | --- | --- | --- | --- | --- | --- | --- | --- |
480 011 | --- | --- | --- | --- | --- | --- | --- | --- |
481 100 | CVT.S | --- | --- | --- | --- | --- | --- | --- |
482 101 | --- | --- | --- | --- | --- | --- | --- | --- |
483 110 | --- | --- | --- | --- | --- | --- | --- | --- |
484 111 | --- | --- | --- | --- | --- | --- | --- | --- |
485 hi |-------|-------|-------|-------|-------|-------|-------|-------|
486 */
487
488 //*************************************************************
489 // COP2 TABLES :) [VU0 as a Co-Processor to the EE]
490 //*************************************************************
491 /*
492 COP2: Instructions encoded by the fmt field when opcode = COP2.
493 31--------26-25------21 ----------------------------------------0
494 | = COP2 | fmt | |
495 ------6----------5-----------------------------------------------
496 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
497 00 | --- | QMFC2 | CFC2 | --- | --- | QMTC2 | CTC2 | --- |
498 01 | *1 | --- | --- | --- | --- | --- | --- | --- |
499 10 | *2 | *2 | *2 | *2 | *2 | *2 | *2 | *2 |
500 11 | *2 | *2 | *2 | *2 | *2 | *2 | *2 | *2 |
501 hi |-------|-------|-------|-------|-------|-------|-------|-------|
502 *1 = BC instructions, see BC2 list *2 =see special1 table
503 */
504 void (*COP2PrintTable[32])( string& output ) = {
505 P_COP2_Unknown, P_QMFC2, P_CFC2, P_COP2_Unknown, P_COP2_Unknown, P_QMTC2, P_CTC2, P_COP2_Unknown,
506 P_COP2_BC2, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown,
507 P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL,
508 P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL, P_COP2_SPECIAL,
509
510
511 };
512 /*
513 BC2: Instructions encoded by the rt field when opcode = COP2 & rs field=BC1
514 31--------26-25------21 ----------------------------------------0
515 | = COP2 | rs=BC2| |
516 ------6----------5-----------------------------------------------
517 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
518 00 | BC2F | BC2T | BC2FL | BC2TL | --- | --- | --- | --- |
519 01 | --- | --- | --- | --- | --- | --- | --- | --- |
520 10 | --- | --- | --- | --- | --- | --- | --- | --- |
521 11 | --- | --- | --- | --- | --- | --- | --- | --- |
522 hi |-------|-------|-------|-------|-------|-------|-------|-------|
523 */
524 void (*COP2BC2PrintTable[32])( string& output ) = {
525 P_BC2F, P_BC2T, P_BC2FL, P_BC2TL, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown,
526 P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown,
527 P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown,
528 P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown, P_COP2_Unknown,
529 };
530 /*
531 Special1 table : instructions encode by function field when opcode=COP2 & rs field=Special1
532 31---------26---------------------------------------------------0
533 | =COP2 | rs=Special |
534 ------6----------------------------------------------------------
535 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
536 000 |VADDx |VADDy |VADDz |VADDw |VSUBx |VSUBy |VSUBz |VSUBw |
537 001 |VMADDx |VMADDy |VMADDz |VMADDw |VMSUBx |VMSUBy |VMSUBz |VMSUBw |
538 010 |VMAXx |VMAXy |VMAXz |VMAXw |VMINIx |VMINIy |VMINIz |VMINIw |
539 011 |VMULx |VMULy |VMULz |VMULw |VMULq |VMAXi |VMULi |VMINIi |
540 100 |VADDq |VMADDq |VADDi |VMADDi |VSUBq |VMSUBq |VSUbi |VMSUBi |
541 101 |VADD |VMADD |VMUL |VMAX |VSUB |VMSUB |VOPMSUB|VMINI |
542 110 |VIADD |VISUB |VIADDI | --- |VIAND |VIOR | --- | --- |
543 111 |VCALLMS|CALLMSR| --- | --- | *1 | *1 | *1 | *1 |
544 hi |-------|-------|-------|-------|-------|-------|-------|-------|
545 *1=see special2 table
546 */
547 void (*COP2SPECIAL1PrintTable[64])( string& output ) =
548 {
549 P_VADDx, P_VADDy, P_VADDz, P_VADDw, P_VSUBx, P_VSUBy, P_VSUBz, P_VSUBw,
550 P_VMADDx, P_VMADDy, P_VMADDz, P_VMADDw, P_VMSUBx, P_VMSUBy, P_VMSUBz, P_VMSUBw,
551 P_VMAXx, P_VMAXy, P_VMAXz, P_VMAXw, P_VMINIx, P_VMINIy, P_VMINIz, P_VMINIw,
552 P_VMULx, P_VMULy, P_VMULz, P_VMULw, P_VMULq, P_VMAXi, P_VMULi, P_VMINIi,
553 P_VADDq, P_VMADDq, P_VADDi, P_VMADDi, P_VSUBq, P_VMSUBq, P_VSUbi, P_VMSUBi,
554 P_VADD, P_VMADD, P_VMUL, P_VMAX, P_VSUB, P_VMSUB, P_VOPMSUB, P_VMINI,
555 P_VIADD, P_VISUB, P_VIADDI, P_COP2_Unknown,P_VIAND, P_VIOR, P_COP2_Unknown, P_COP2_Unknown,
556 P_VCALLMS, P_CALLMSR, P_COP2_Unknown,P_COP2_Unknown,P_COP2_SPECIAL2,P_COP2_SPECIAL2,P_COP2_SPECIAL2,P_COP2_SPECIAL2,
557
558 };
559 /*
560 Special2 table : instructions encode by function field when opcode=COp2 & rs field=Special2
561
562 31---------26---------------------------------------------------0
563 | =COP2 | rs=Special2 |
564 ------6----------------------------------------------------------
565 |--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
566 0000 |VADDAx |VADDAy |VADDAz |VADDAw |VSUBAx |VSUBAy |VSUBAz |VSUBAw |
567 0001 |VMADDAx|VMADDAy|VMADDAz|VMADDAw|VMSUBAx|VMSUBAy|VMSUBAz|VMSUBAw|
568 0010 |VITOF0 |VITOF4 |VITOF12|VITOF15|VFTOI0 |VFTOI4 |VFTOI12|VFTOI15|
569 0011 |VMULAx |VMULAy |VMULAz |VMULAw |VMULAq |VABS |VMULAi |VCLIPw |
570 0100 |VADDAq |VMADDAq|VADDAi |VMADDAi|VSUBAq |VMSUBAq|VSUBAi |VMSUBAi|
571 0101 |VADDA |VMADDA |VMULA | --- |VSUBA |VMSUBA |VOPMULA|VNOP |
572 0110 |VMONE |VMR32 | --- | --- |VLQI |VSQI |VLQD |VSQD |
573 0111 |VDIV |VSQRT |VRSQRT |VWAITQ |VMTIR |VMFIR |VILWR |VISWR |
574 1000 |VRNEXT |VRGET |VRINIT |VRXOR | --- | --- | --- | --- |
575 1001 | --- | --- | --- | --- | --- | --- | --- | --- |
576 1010 | --- | --- | --- | --- | --- | --- | --- | --- |
577 1011 | --- | --- | --- | --- | --- | --- | --- | --- |
578 1100 | --- | --- | --- | --- | --- | --- | --- | --- |
579 1101 | --- | --- | --- | --- | --- | --- | --- | --- |
580 1110 | --- | --- | --- | --- | --- | --- | --- | --- |
581 1111 | --- | --- | --- | --- | --- | --- | --- | --- |
582 hi |-------|-------|-------|-------|-------|-------|-------|-------|
583 */
584 void (*COP2SPECIAL2PrintTable[128])( string& output ) =
585 {
586 P_VADDAx ,P_VADDAy ,P_VADDAz ,P_VADDAw ,P_VSUBAx ,P_VSUBAy ,P_VSUBAz ,P_VSUBAw,
587 P_VMADDAx ,P_VMADDAy ,P_VMADDAz ,P_VMADDAw ,P_VMSUBAx ,P_VMSUBAy ,P_VMSUBAz ,P_VMSUBAw,
588 P_VITOF0 ,P_VITOF4 ,P_VITOF12 ,P_VITOF15 ,P_VFTOI0 ,P_VFTOI4 ,P_VFTOI12 ,P_VFTOI15,
589 P_VMULAx ,P_VMULAy ,P_VMULAz ,P_VMULAw ,P_VMULAq ,P_VABS ,P_VMULAi ,P_VCLIPw,
590 P_VADDAq ,P_VMADDAq ,P_VADDAi ,P_VMADDAi ,P_VSUBAq ,P_VMSUBAq ,P_VSUBAi ,P_VMSUBAi,
591 P_VADDA ,P_VMADDA ,P_VMULA ,P_COP2_Unknown,P_VSUBA ,P_VMSUBA ,P_VOPMULA ,P_VNOP,
592 P_VMONE ,P_VMR32 ,P_COP2_Unknown,P_COP2_Unknown,P_VLQI ,P_VSQI ,P_VLQD ,P_VSQD,
593 P_VDIV ,P_VSQRT ,P_VRSQRT ,P_VWAITQ ,P_VMTIR ,P_VMFIR ,P_VILWR ,P_VISWR,
594 P_VRNEXT ,P_VRGET ,P_VRINIT ,P_VRXOR ,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,
595 P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,
596 P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,
597 P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,
598 P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,
599 P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,
600 P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,
601 P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,P_COP2_Unknown,
602 };
603
604 //**************************TABLES CALLS***********************
605
606
607 void disR5900Fasm( string& output, u32 code, u32 pc )
608 {
609 string dbuf;
610 char obuf[48];
611
612 const u32 scode = cpuRegs.code;
613 opcode_addr = pc;
614 cpuRegs.code = code;
615
616 sprintf(obuf, "%08X:\t", pc );
617 output.assign( obuf );
618 GetCurrentInstruction().disasm( output );
619
620 cpuRegs.code = scode;
621 }
622
623 //*************************************************************
624 //************************COP2**********************************
625 void P_COP2_BC2( string& output )
626 {
627 COP2BC2PrintTable[DECODE_C2BC]( output );
628 }
629 void P_COP2_SPECIAL( string& output )
630 {
631 COP2SPECIAL1PrintTable[DECODE_FUNCTION ]( output );
632 }
633 void P_COP2_SPECIAL2( string& output )
634 {
635 COP2SPECIAL2PrintTable[(cpuRegs.code & 0x3) | ((cpuRegs.code >> 4) & 0x7c)]( output );
636 }
637
638 //**************************UNKNOWN****************************
639 void P_COP2_Unknown( string& output )
640 {
641 output += "COP2 ??";
642 }
643
644
645 //*************************************************************
646
647 //*****************SOME DECODE STUFF***************************
648
649 void label_decode( string& output, u32 addr )
650 {
651 string buf;
652 ssprintf(buf, "0x%08X", addr);
653 const char* label = disR5900GetSym( addr );
654
655 if( label != NULL )
656 {
657 output += label;
658 output += ' ';
659 }
660
661 output += buf;
662 }
663
664 void jump_decode( string& output )
665 {
666 label_decode( output, DECODE_JUMP );
667 }
668
669 void offset_decode( string& output )
670 {
671 label_decode( output, DECODE_OFFSET );
672 }
673
674 //*********************END OF DECODE ROUTINES******************
675
676 namespace OpcodeDisasm
677 {
678
679 void COP2( string& output )
680 {
681 COP2PrintTable[DECODE_RS]( output );
682 }
683
684 // Unkown Opcode!
685 void Unknown( string& output )
686 {
687 output += "?????";
688 }
689
690 void MMI_Unknown( string& output )
691 {
692 output += "MMI ??";
693 }
694
695 void COP0_Unknown( string& output )
696 {
697 output += "COP0 ??";
698 }
699
700 void COP1_Unknown( string& output )
701 {
702 output += "FPU ??";
703 }
704
705 // sap! it stands for string append. It's not a friendly name but for now it makes
706 // the copy-paste marathon of code below more readable!
707 #define _sap( str ) ssappendf( output, str,
708
709 //********************* Standard Opcodes***********************
710 void J( string& output ) { output += "j\t"; jump_decode(output);}
711 void JAL( string& output ) { output += "jal\t"; jump_decode(output);}
712 void BEQ( string& output ) { _sap("beq\t%s, %s, ") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); offset_decode(output); }
713 void BNE( string& output ) { _sap("bne\t%s, %s, ") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); offset_decode(output); }
714 void BLEZ( string& output ) { _sap("blez\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
715 void BGTZ( string& output ) { _sap("bgtz\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
716 void ADDI( string& output ) { _sap("addi\t%s, %s, 0x%04X") GPR_REG[DECODE_RT], GPR_REG[DECODE_RS], DECODE_IMMED);}
717 void ADDIU( string& output ) { _sap("addiu\t%s, %s, 0x%04X") GPR_REG[DECODE_RT], GPR_REG[DECODE_RS], DECODE_IMMED);}
718 void SLTI( string& output ) { _sap("slti\t%s, %s, 0x%04X") GPR_REG[DECODE_RT], GPR_REG[DECODE_RS], DECODE_IMMED); }
719 void SLTIU( string& output ) { _sap("sltiu\t%s, %s, 0x%04X") GPR_REG[DECODE_RT], GPR_REG[DECODE_RS], DECODE_IMMED); }
720 void ANDI( string& output ) { _sap("andi\t%s, %s, 0x%04X") GPR_REG[DECODE_RT], GPR_REG[DECODE_RS], DECODE_IMMED);}
721 void ORI( string& output ) { _sap("ori\t%s, %s, 0x%04X") GPR_REG[DECODE_RT], GPR_REG[DECODE_RS], DECODE_IMMED); }
722 void XORI( string& output ) { _sap("xori\t%s, %s, 0x%04X") GPR_REG[DECODE_RT], GPR_REG[DECODE_RS], DECODE_IMMED); }
723 void LUI( string& output ) { _sap("lui\t%s, 0x%04X") GPR_REG[DECODE_RT], DECODE_IMMED); }
724 void BEQL( string& output ) { _sap("beql\t%s, %s, ") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); offset_decode(output); }
725 void BNEL( string& output ) { _sap("bnel\t%s, %s, ") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); offset_decode(output); }
726 void BLEZL( string& output ) { _sap("blezl\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
727 void BGTZL( string& output ) { _sap("bgtzl\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
728 void DADDI( string& output ) { _sap("daddi\t%s, %s, 0x%04X") GPR_REG[DECODE_RT], GPR_REG[DECODE_RS], DECODE_IMMED); }
729 void DADDIU( string& output ) { _sap("daddiu\t%s, %s, 0x%04X") GPR_REG[DECODE_RT], GPR_REG[DECODE_RS], DECODE_IMMED); }
730 void LDL( string& output ) { _sap("ldl\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
731 void LDR( string& output ) { _sap("ldr\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
732 void LB( string& output ) { _sap("lb\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
733 void LH( string& output ) { _sap("lh\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
734 void LWL( string& output ) { _sap("lwl\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
735 void LW( string& output ) { _sap("lw\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
736 void LBU( string& output ) { _sap("lbu\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
737 void LHU( string& output ) { _sap("lhu\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
738 void LWR( string& output ) { _sap("lwr\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
739 void LWU( string& output ) { _sap("lwu\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
740 void SB( string& output ) { _sap("sb\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
741 void SH( string& output ) { _sap("sh\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
742 void SWL( string& output ) { _sap("swl\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
743 void SW( string& output ) { _sap("sw\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
744 void SDL( string& output ) { _sap("sdl\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
745 void SDR( string& output ) { _sap("sdr\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
746 void SWR( string& output ) { _sap("swr\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
747 void LD( string& output ) { _sap("ld\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
748 void SD( string& output ) { _sap("sd\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
749 void LQ( string& output ) { _sap("lq\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
750 void SQ( string& output ) { _sap("sq\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
751 void SWC1( string& output ) { _sap("swc1\t%s, 0x%04X(%s)") COP1_REG_FP[DECODE_FT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
752 void SQC2( string& output ) { _sap("sqc2\t%s, 0x%04X(%s)") COP2_REG_FP[DECODE_FT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
753 void PREF( string& output ) { output += "pref ---"; /*_sap("PREF\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[RS]); */}
754 void LWC1( string& output ) { _sap("lwc1\t%s, 0x%04X(%s)") COP1_REG_FP[DECODE_FT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
755 void LQC2( string& output ) { _sap("lqc2\t%s, 0x%04X(%s)") COP2_REG_FP[DECODE_FT], DECODE_IMMED, GPR_REG[DECODE_RS]); }
756 //********************END OF STANDARD OPCODES*************************
757
758 void SLL( string& output )
759 {
760 if (cpuRegs.code == 0x00000000)
761 output += "nop";
762 else
763 _sap("sll\t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA);
764 }
765
766 void SRL( string& output ) { _sap("srl\t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA); }
767 void SRA( string& output ) { _sap("sra\t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA); }
768 void SLLV( string& output ) { _sap("sllv\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], GPR_REG[DECODE_RS]); }
769 void SRLV( string& output ) { _sap("srlv\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], GPR_REG[DECODE_RS]);}
770 void SRAV( string& output ) { _sap("srav\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], GPR_REG[DECODE_RS]); }
771 void JR( string& output ) { _sap("jr\t%s") GPR_REG[DECODE_RS]); }
772
773 void JALR( string& output )
774 {
775 int rd = DECODE_RD;
776
777 if (rd == 31)
778 _sap("jalr\t%s") GPR_REG[DECODE_RS]);
779 else
780 _sap("jalr\t%s, %s") GPR_REG[rd], GPR_REG[DECODE_RS]);
781 }
782
783
784 void SYNC( string& output ) { output += "SYNC"; }
785 void MFHI( string& output ) { _sap("mfhi\t%s") GPR_REG[DECODE_RD]); }
786 void MTHI( string& output ) { _sap("mthi\t%s") GPR_REG[DECODE_RS]); }
787 void MFLO( string& output ) { _sap("mflo\t%s") GPR_REG[DECODE_RD]); }
788 void MTLO( string& output ) { _sap("mtlo\t%s") GPR_REG[DECODE_RS]); }
789 void DSLLV( string& output ) { _sap("dsllv\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], GPR_REG[DECODE_RS]); }
790 void DSRLV( string& output ) { _sap("dsrlv\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], GPR_REG[DECODE_RS]); }
791 void DSRAV( string& output ) { _sap("dsrav\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], GPR_REG[DECODE_RS]); }
792 void MULT( string& output ) { _sap("mult\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]);}
793 void MULTU( string& output ) { _sap("multu\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]);}
794 void DIV( string& output ) { _sap("div\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
795 void DIVU( string& output ) { _sap("divu\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
796 void ADD( string& output ) { _sap("add\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
797 void ADDU( string& output ) { _sap("addu\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
798 void SUB( string& output ) { _sap("sub\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
799 void SUBU( string& output ) { _sap("subu\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
800 void AND( string& output ) { _sap("and\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
801 void OR( string& output ) { _sap("or\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
802 void XOR( string& output ) { _sap("xor\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
803 void NOR( string& output ) { _sap("nor\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
804 void SLT( string& output ) { _sap("slt\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
805 void SLTU( string& output ) { _sap("sltu\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
806 void DADD( string& output ) { _sap("dadd\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
807 void DADDU( string& output ) { _sap("daddu\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
808 void DSUB( string& output ) { _sap("dsub\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
809 void DSUBU( string& output ) { _sap("dsubu\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
810 void TGE( string& output ) { _sap("tge\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
811 void TGEU( string& output ) { _sap("tgeu\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
812 void TLT( string& output ) { _sap("tlt\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
813 void TLTU( string& output ) { _sap("tltu\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
814 void TEQ( string& output ) { _sap("teq\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
815 void TNE( string& output ) { _sap("tne\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
816 void DSLL( string& output ) { _sap("dsll\t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA); }
817 void DSRL( string& output ) { _sap("dsrl\t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA); }
818 void DSRA( string& output ) { _sap("dsra\t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA); }
819 void DSLL32( string& output ) { _sap("dsll32\t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA); }
820 void DSRL32( string& output ) { _sap("dsrl32\t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA); }
821 void DSRA32( string& output ) { _sap("dsra32\t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA); }
822 void MOVZ( string& output ) { _sap("movz\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
823 void MOVN( string& output ) { _sap("movn\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
824 void MFSA( string& output ) { _sap("mfsa\t%s") GPR_REG[DECODE_RD]);}
825 void MTSA( string& output ) { _sap("mtsa\t%s") GPR_REG[DECODE_RS]);}
826 //*** unsupport (yet) cpu opcodes
827 void SYSCALL( string& output ) { output +="syscall ---";/*_sap("syscall\t0x%05X") DECODE_SYSCALL);*/}
828 void BREAK( string& output ) { output += "break ---";/*_sap("break\t0x%05X") DECODE_BREAK); */}
829 void CACHE( string& output ) { output += "cache ---";/*_sap("cache\t%s, 0x%04X(%s)") GPR_REG[DECODE_RT], DECODE_IMMED, GPR_REG[DECODE_RS]); */}
830 //************************REGIMM OPCODES***************************
831 void BLTZ( string& output ) { _sap("bltz\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
832 void BGEZ( string& output ) { _sap("bgez\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
833 void BLTZL( string& output ) { _sap("bltzl\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
834 void BGEZL( string& output ) { _sap("bgezl\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
835 void TGEI( string& output ) { _sap("tgei\t%s, 0x%04X") GPR_REG[DECODE_RS], DECODE_IMMED); }
836 void TGEIU( string& output ) { _sap("tgeiu\t%s,0x%04X") GPR_REG[DECODE_RS], DECODE_IMMED); }
837 void TLTI( string& output ) { _sap("tlti\t%s, 0x%04X") GPR_REG[DECODE_RS], DECODE_IMMED); }
838 void TLTIU( string& output ) { _sap("tltiu\t%s,0x%04X") GPR_REG[DECODE_RS], DECODE_IMMED); }
839 void TEQI( string& output ) { _sap("teqi\t%s, 0x%04X") GPR_REG[DECODE_RS], DECODE_IMMED); }
840 void TNEI( string& output ) { _sap("tnei\t%s, 0x%04X") GPR_REG[DECODE_RS], DECODE_IMMED); }
841 void BLTZAL( string& output ) { _sap("bltzal\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
842 void BGEZAL( string& output ) { _sap("bgezal\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
843 void BLTZALL( string& output ) { _sap("bltzall\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
844 void BGEZALL( string& output ) { _sap("bgezall\t%s, ") GPR_REG[DECODE_RS]); offset_decode(output); }
845 void MTSAB( string& output ) { _sap("mtsab\t%s, 0x%04X") GPR_REG[DECODE_RS], DECODE_IMMED);}
846 void MTSAH( string& output ) { _sap("mtsah\t%s, 0x%04X") GPR_REG[DECODE_RS], DECODE_IMMED);}
847
848
849 //***************************SPECIAL 2 CPU OPCODES*******************
850 const char* pmfhl_sub[] = { "lw", "uw", "slw", "lh", "sh" };
851
852 void MADD( string& output ) { _sap("madd\t%s, %s %s") GPR_REG[DECODE_RD],GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
853 void MADDU( string& output ) { _sap("maddu\t%s, %s %s") GPR_REG[DECODE_RD],GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]);}
854 void PLZCW( string& output ) { _sap("plzcw\t%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS]); }
855 void MADD1( string& output ) { _sap("madd1\t%s, %s %s") GPR_REG[DECODE_RD],GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
856 void MADDU1( string& output ) { _sap("maddu1\t%s, %s %s") GPR_REG[DECODE_RD],GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
857 void MFHI1( string& output ) { _sap("mfhi1\t%s") GPR_REG[DECODE_RD]); }
858 void MTHI1( string& output ) { _sap("mthi1\t%s") GPR_REG[DECODE_RS]); }
859 void MFLO1( string& output ) { _sap("mflo1\t%s") GPR_REG[DECODE_RD]); }
860 void MTLO1( string& output ) { _sap("mtlo1\t%s") GPR_REG[DECODE_RS]); }
861 void MULT1( string& output ) { _sap("mult1\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
862 void MULTU1( string& output ) { _sap("multu1\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]);}
863 void DIV1( string& output ) { _sap("div1\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
864 void DIVU1( string& output ) { _sap("divu1\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
865 //that have parametres that i haven't figure out how to display...
866 void PMFHL( string& output ) { _sap("pmfhl.%s \t%s") pmfhl_sub[DECODE_SA], GPR_REG[DECODE_RD]); }
867 void PMTHL( string& output ) { _sap("pmthl.%s \t%s") pmfhl_sub[DECODE_SA], GPR_REG[DECODE_RS]); }
868 void PSLLH( string& output ) { _sap("psllh \t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA); }
869 void PSRLH( string& output ) { _sap("psrlh \t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA);}
870 void PSRAH( string& output ) { _sap("psrah \t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA);}
871 void PSLLW( string& output ) { _sap( "psllw \t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA);}
872 void PSRLW( string& output ) { _sap( "psrlw \t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA);}
873 void PSRAW( string& output ) { _sap( "psraw \t%s, %s, 0x%02X") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], DECODE_SA);}
874 //***************************END OF SPECIAL OPCODES******************
875 //*************************MMI0 OPCODES************************
876
877 void PADDW( string& output ){ _sap( "paddw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
878 void PSUBW( string& output ){ _sap( "psubw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
879 void PCGTW( string& output ){ _sap( "pcgtw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
880 void PMAXW( string& output ){ _sap( "pmaxw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
881 void PADDH( string& output ){ _sap( "paddh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
882 void PSUBH( string& output ){ _sap( "psubh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
883 void PCGTH( string& output ){ _sap( "pcgth\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
884 void PMAXH( string& output ){ _sap( "pmaxh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
885 void PADDB( string& output ){ _sap( "paddb\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
886 void PSUBB( string& output ){ _sap( "psubb\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
887 void PCGTB( string& output ){ _sap( "pcgtb\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
888 void PADDSW( string& output ){ _sap( "paddsw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
889 void PSUBSW( string& output ){ _sap( "psubsw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
890 void PEXTLW( string& output ){ _sap( "pextlw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
891 void PPACW( string& output ) { _sap( "ppacw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
892 void PADDSH( string& output ){ _sap( "paddsh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
893 void PSUBSH( string& output ){ _sap( "psubsh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
894 void PEXTLH( string& output ){ _sap( "pextlh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
895 void PPACH( string& output ) { _sap( "ppach\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
896 void PADDSB( string& output ){ _sap( "paddsb\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
897 void PSUBSB( string& output ){ _sap( "psubsb\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
898 void PEXTLB( string& output ){ _sap( "pextlb\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
899 void PPACB( string& output ) { _sap( "ppacb\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
900 void PEXT5( string& output ) { _sap( "pext5\t%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]); }
901 void PPAC5( string& output ) { _sap( "ppac5\t%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]); }
902 //**********END OF MMI0 OPCODES*********************************
903 //**********MMI1 OPCODES**************************************
904 void PABSW( string& output ){ _sap( "pabsw%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]); }
905 void PCEQW( string& output ){ _sap( "pceqw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
906 void PMINW( string& output ){ _sap( "pminw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
907 void PADSBH( string& output ){ _sap( "padsbh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
908 void PABSH( string& output ){ _sap( "pabsh%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]); }
909 void PCEQH( string& output ){ _sap( "pceqh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
910 void PMINH( string& output ){ _sap( "pminh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
911 void PCEQB( string& output ){ _sap( "pceqb\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
912 void PADDUW( string& output ){ _sap( "padduw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
913 void PSUBUW( string& output ){ _sap( "psubuw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
914 void PEXTUW( string& output ){ _sap( "pextuw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
915 void PADDUH( string& output ){ _sap( "padduh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
916 void PSUBUH( string& output ){ _sap( "psubuh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
917 void PEXTUH( string& output ){ _sap( "pextuh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
918 void PADDUB( string& output ){ _sap( "paddub\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
919 void PSUBUB( string& output ){ _sap( "psubub\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
920 void PEXTUB( string& output ){ _sap( "pextub\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
921 void QFSRV( string& output ) { _sap( "qfsrv\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
922 //********END OF MMI1 OPCODES***********************************
923 //*********MMI2 OPCODES***************************************
924 void PMADDW( string& output ){ _sap( "pmaddw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
925 void PSLLVW( string& output ){ _sap( "psllvw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
926 void PSRLVW( string& output ){ _sap( "psrlvw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
927 void PMSUBW( string& output ){ _sap( "msubw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
928 void PMFHI( string& output ){ _sap( "pmfhi\t%s") GPR_REG[DECODE_RD]); }
929 void PMFLO( string& output ){ _sap( "pmflo\t%s") GPR_REG[DECODE_RD]); }
930 void PINTH( string& output ){ _sap( "pinth\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
931 void PMULTW( string& output ){ _sap( "pmultw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
932 void PDIVW( string& output ){ _sap( "pdivw\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
933 void PCPYLD( string& output ){ _sap( "pcpyld\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
934 void PMADDH( string& output ){ _sap( "pmaddh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
935 void PHMADH( string& output ){ _sap( "phmadh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
936 void PAND( string& output ){ _sap( "pand\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
937 void PXOR( string& output ){ _sap( "pxor\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
938 void PMSUBH( string& output ){ _sap( "pmsubh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
939 void PHMSBH( string& output ){ _sap( "phmsbh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
940 void PEXEH( string& output ){ _sap( "pexeh\t%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]); }
941 void PREVH( string& output ){ _sap( "prevh\t%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]); }
942 void PMULTH( string& output ){ _sap( "pmulth\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
943 void PDIVBW( string& output ){ _sap( "pdivbw\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
944 void PEXEW( string& output ){ _sap( "pexew\t%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]); }
945 void PROT3W( string& output ){ _sap( "prot3w\t%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]); }
946 //*****END OF MMI2 OPCODES***********************************
947 //*************************MMI3 OPCODES************************
948 void PMADDUW( string& output ){ _sap("pmadduw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], GPR_REG[DECODE_RS]); }
949 void PSRAVW( string& output ){ _sap("psravw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT], GPR_REG[DECODE_RS]); }
950 void PMTHI( string& output ){ _sap("pmthi\t%s") GPR_REG[DECODE_RS]); }
951 void PMTLO( string& output ){ _sap("pmtlo\t%s") GPR_REG[DECODE_RS]); }
952 void PINTEH( string& output ){ _sap("pinteh\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
953 void PMULTUW( string& output ){ _sap("pmultuw\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
954 void PDIVUW( string& output ){ _sap("pdivuw\t%s, %s") GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
955 void PCPYUD( string& output ){ _sap("pcpyud\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
956 void POR( string& output ){ _sap("por\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
957 void PNOR( string& output ){ _sap("pnor\t%s, %s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RS], GPR_REG[DECODE_RT]); }
958 void PEXCH( string& output ){ _sap("pexch\t%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]);}
959 void PCPYH( string& output ){ _sap("pcpyh\t%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]);}
960 void PEXCW( string& output ){ _sap("pexcw\t%s, %s") GPR_REG[DECODE_RD], GPR_REG[DECODE_RT]);}
961 //**********************END OF MMI3 OPCODES********************
962
963 //****************************************************************************
964 //** COP0 **
965 //****************************************************************************
966 void MFC0( string& output ){ _sap("mfc0\t%s, %s") GPR_REG[DECODE_RT], COP0_REG[DECODE_FS]); }
967 void MTC0( string& output ){ _sap("mtc0\t%s, %s") GPR_REG[DECODE_RT], COP0_REG[DECODE_FS]); }
968 void BC0F( string& output ){ output += "bc0f\t"; offset_decode(output); }
969 void BC0T( string& output ){ output += "bc0t\t"; offset_decode(output); }
970 void BC0FL( string& output ){ output += "bc0fl\t"; offset_decode(output); }
971 void BC0TL( string& output ){ output += "bc0tl\t"; offset_decode(output); }
972 void TLBR( string& output ){ output += "tlbr";}
973 void TLBWI( string& output ){ output += "tlbwi";}
974 void TLBWR( string& output ){ output += "tlbwr";}
975 void TLBP( string& output ){ output += "tlbp";}
976 void ERET( string& output ){ output += "eret";}
977 void DI( string& output ){ output += "di";}
978 void EI( string& output ){ output += "ei";}
979 //****************************************************************************
980 //** END OF COP0 **
981 //****************************************************************************
982 //****************************************************************************
983 //** COP1 - Floating Point Unit (FPU) **
984 //****************************************************************************
985 void MFC1( string& output ){ _sap("mfc1\t%s, %s") GPR_REG[DECODE_RT], COP1_REG_FP[DECODE_FS]); }
986 void CFC1( string& output ){ _sap("cfc1\t%s, %s") GPR_REG[DECODE_RT], COP1_REG_FCR[DECODE_FS]); }
987 void MTC1( string& output ){ _sap("mtc1\t%s, %s") GPR_REG[DECODE_RT], COP1_REG_FP[DECODE_FS]); }
988 void CTC1( string& output ){ _sap("ctc1\t%s, %s") GPR_REG[DECODE_RT], COP1_REG_FCR[DECODE_FS]); }
989 void BC1F( string& output ){ output += "bc1f\t"; offset_decode(output); }
990 void BC1T( string& output ){ output += "bc1t\t"; offset_decode(output); }
991 void BC1FL( string& output ){ output += "bc1fl\t"; offset_decode(output); }
992 void BC1TL( string& output ){ output += "bc1tl\t"; offset_decode(output); }
993 void ADD_S( string& output ){ _sap("add.s\t%s, %s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]);}
994 void SUB_S( string& output ){ _sap("sub.s\t%s, %s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]);}
995 void MUL_S( string& output ){ _sap("mul.s\t%s, %s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]);}
996 void DIV_S( string& output ){ _sap("div.s\t%s, %s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
997 void SQRT_S( string& output ){ _sap("sqrt.s\t%s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FT]); }
998 void ABS_S( string& output ){ _sap("abs.s\t%s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS]); }
999 void MOV_S( string& output ){ _sap("mov.s\t%s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS]); }
1000 void NEG_S( string& output ){ _sap("neg.s\t%s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS]);}
1001 void RSQRT_S( string& output ){_sap("rsqrt.s\t%s, %s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]);}
1002 void ADDA_S( string& output ){ _sap("adda.s\t%s, %s") COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1003 void SUBA_S( string& output ){ _sap("suba.s\t%s, %s") COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1004 void MULA_S( string& output ){ _sap("mula.s\t%s, %s") COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1005 void MADD_S( string& output ){ _sap("madd.s\t%s, %s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1006 void MSUB_S( string& output ){ _sap("msub.s\t%s, %s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1007 void MADDA_S( string& output ){_sap("madda.s\t%s, %s") COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1008 void MSUBA_S( string& output ){_sap("msuba.s\t%s, %s") COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1009 void CVT_W( string& output ){ _sap("cvt.w.s\t%s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS]); }
1010 void MAX_S( string& output ){ _sap("max.s\t%s, %s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]);}
1011 void MIN_S( string& output ){ _sap("min.s\t%s, %s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]);}
1012 void C_F( string& output ){ _sap("c.f.s\t%s, %s") COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1013 void C_EQ( string& output ){ _sap("c.eq.s\t%s, %s") COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1014 void C_LT( string& output ){ _sap("c.lt.s\t%s, %s") COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1015 void C_LE( string& output ){ _sap("c.le.s\t%s, %s") COP1_REG_FP[DECODE_FS], COP1_REG_FP[DECODE_FT]); }
1016 void CVT_S( string& output ){ _sap("cvt.s.w\t%s, %s") COP1_REG_FP[DECODE_FD], COP1_REG_FP[DECODE_FS]); }
1017 //****************************************************************************
1018 //** END OF COP1 **
1019 //****************************************************************************
1020
1021 } // End namespace R5900::OpcodeDisasm
1022
1023 //****************************************************************************
1024 //** COP2 - (VU0) **
1025 //****************************************************************************
1026 void P_QMFC2( string& output ){ _sap("qmfc2\t%s, %s") GPR_REG[DECODE_RT], COP2_REG_FP[DECODE_FS]); }
1027 void P_CFC2( string& output ){ _sap("cfc2\t%s, %s") GPR_REG[DECODE_RT], COP2_REG_CTL[DECODE_FS]); }
1028 void P_QMTC2( string& output ){ _sap("qmtc2\t%s, %s") GPR_REG[DECODE_RT], COP2_REG_FP[DECODE_FS]); }
1029 void P_CTC2( string& output ){ _sap("ctc2\t%s, %s") GPR_REG[DECODE_RT], COP2_REG_CTL[DECODE_FS]); }
1030 void P_BC2F( string& output ){ output += "bc2f\t"; offset_decode(output); }
1031 void P_BC2T( string& output ){ output += "bc2t\t"; offset_decode(output); }
1032 void P_BC2FL( string& output ){ output += "bc2fl\t"; offset_decode(output); }
1033 void P_BC2TL( string& output ){ output += "bc2tl\t"; offset_decode(output); }
1034 //******************************SPECIAL 1 VUO TABLE****************************************
1035 #define _X ((cpuRegs.code>>24) & 1)
1036 #define _Y ((cpuRegs.code>>23) & 1)
1037 #define _Z ((cpuRegs.code>>22) & 1)
1038 #define _W ((cpuRegs.code>>21) & 1)
1039
1040 const char *dest_string(void)
1041 {
1042 static char str[5];
1043 int i = 0;
1044
1045 if(_X) str[i++] = 'x';
1046 if(_Y) str[i++] = 'y';
1047 if(_Z) str[i++] = 'z';
1048 if(_W) str[i++] = 'w';
1049 str[i++] = 0;
1050
1051 return (const char *)str;
1052 }
1053
1054 char dest_fsf()
1055 {
1056 const char arr[4] = { 'x', 'y', 'z', 'w' };
1057 return arr[(cpuRegs.code>>21)&3];
1058 }
1059
1060 char dest_ftf()
1061 {
1062 const char arr[4] = { 'x', 'y', 'z', 'w' };
1063 return arr[(cpuRegs.code>>23)&3];
1064 }
1065
1066 void P_VADDx( string& output ){_sap("vaddx.%s %s, %s, %sx") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1067 void P_VADDy( string& output ){_sap("vaddy.%s %s, %s, %sy") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1068 void P_VADDz( string& output ){_sap("vaddz.%s %s, %s, %sz") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1069 void P_VADDw( string& output ){_sap("vaddw.%s %s, %s, %sw") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1070 void P_VSUBx( string& output ){_sap("vsubx.%s %s, %s, %sx") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1071 void P_VSUBy( string& output ){_sap("vsuby.%s %s, %s, %sy") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1072 void P_VSUBz( string& output ){_sap("vsubz.%s %s, %s, %sz") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1073 void P_VSUBw( string& output ){_sap("vsubw.%s %s, %s, %sw") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1074 void P_VMADDx( string& output ){_sap("vmaddx.%s %s, %s, %sx") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1075 void P_VMADDy( string& output ){_sap("vmaddy.%s %s, %s, %sy") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1076 void P_VMADDz( string& output ){_sap("vmaddz.%s %s, %s, %sz") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1077 void P_VMADDw( string& output ){_sap("vmaddw.%s %s, %s, %sw") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1078 void P_VMSUBx( string& output ){_sap("vmsubx.%s %s, %s, %sx") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1079 void P_VMSUBy( string& output ){_sap("vmsuby.%s %s, %s, %sy") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1080 void P_VMSUBz( string& output ){_sap("vmsubz.%s %s, %s, %sz") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1081 void P_VMSUBw( string& output ){_sap("vmsubw.%s %s, %s, %sw") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1082 void P_VMAXx( string& output ){_sap("vmaxx.%s %s, %s, %sx") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1083 void P_VMAXy( string& output ){_sap("vmaxy.%s %s, %s, %sy") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1084 void P_VMAXz( string& output ){_sap("vmaxz.%s %s, %s, %sz") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1085 void P_VMAXw( string& output ){_sap("vmaxw.%s %s, %s, %sw") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1086 void P_VMINIx( string& output ){_sap("vminix.%s %s, %s, %sx") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1087 void P_VMINIy( string& output ){_sap("vminiy.%s %s, %s, %sy") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); ;}
1088 void P_VMINIz( string& output ){_sap("vminiz.%s %s, %s, %sz") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1089 void P_VMINIw( string& output ){_sap("vminiw.%s %s, %s, %sw") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1090 void P_VMULx( string& output ){_sap("vmulx.%s %s,%s,%sx") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1091 void P_VMULy( string& output ){_sap("vmuly.%s %s,%s,%sy") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1092 void P_VMULz( string& output ){_sap("vmulz.%s %s,%s,%sz") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1093 void P_VMULw( string& output ){_sap("vmulw.%s %s,%s,%sw") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1094 void P_VMULq( string& output ){_sap("vmulq.%s %s,%s,Q") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1095 void P_VMAXi( string& output ){_sap("vmaxi.%s %s,%s,I") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1096 void P_VMULi( string& output ){_sap("vmuli.%s %s,%s,I") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1097 void P_VMINIi( string& output ){_sap("vminii.%s %s,%s,I") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1098 void P_VADDq( string& output ){_sap("vaddq.%s %s,%s,Q") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1099 void P_VMADDq( string& output ){_sap("vmaddq.%s %s,%s,Q") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1100 void P_VADDi( string& output ){_sap("vaddi.%s %s,%s,I") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1101 void P_VMADDi( string& output ){_sap("vmaddi.%s %s,%s,I") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1102 void P_VSUBq( string& output ){_sap("vsubq.%s %s,%s,Q") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1103 void P_VMSUBq( string& output ){_sap("vmsubq.%s %s,%s,Q") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1104 void P_VSUbi( string& output ){_sap("vsubi.%s %s,%s,I") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1105 void P_VMSUBi( string& output ){_sap("vmsubi.%s %s,%s,I") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS]); }
1106 void P_VADD( string& output ){_sap("vadd.%s %s, %s, %s") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1107 void P_VMADD( string& output ){_sap("vmadd.%s %s, %s, %s") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1108 void P_VMUL( string& output ){_sap("vmul.%s %s, %s, %s") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1109 void P_VMAX( string& output ){_sap("vmax.%s %s, %s, %s") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1110 void P_VSUB( string& output ){_sap("vsub.%s %s, %s, %s") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1111 void P_VMSUB( string& output ){_sap("vmsub.%s %s, %s, %s") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1112 void P_VOPMSUB( string& output ){_sap("vopmsub.xyz %s, %s, %s") COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1113 void P_VMINI( string& output ){_sap("vmini.%s %s, %s, %s") dest_string(),COP2_REG_FP[DECODE_FD], COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1114 void P_VIADD( string& output ){_sap("viadd %s, %s, %s") COP2_REG_CTL[DECODE_SA], COP2_REG_CTL[DECODE_FS], COP2_REG_CTL[DECODE_FT]);}
1115 void P_VISUB( string& output ){_sap("visub %s, %s, %s") COP2_REG_CTL[DECODE_SA], COP2_REG_CTL[DECODE_FS], COP2_REG_CTL[DECODE_FT]);}
1116 void P_VIADDI( string& output ){_sap("viaddi %s, %s, 0x%x") COP2_REG_CTL[DECODE_FT], COP2_REG_CTL[DECODE_FS], DECODE_SA);}
1117 void P_VIAND( string& output ){_sap("viand %s, %s, %s") COP2_REG_CTL[DECODE_SA], COP2_REG_CTL[DECODE_FS], COP2_REG_CTL[DECODE_FT]);}
1118 void P_VIOR( string& output ){_sap("vior %s, %s, %s") COP2_REG_CTL[DECODE_SA], COP2_REG_CTL[DECODE_FS], COP2_REG_CTL[DECODE_FT]);}
1119 void P_VCALLMS( string& output ){output += "vcallms";}
1120 void P_CALLMSR( string& output ){output += "callmsr";}
1121 //***********************************END OF SPECIAL1 VU0 TABLE*****************************
1122 //******************************SPECIAL2 VUO TABLE*****************************************
1123 void P_VADDAx( string& output ){_sap("vaddax.%s ACC,%s,%sx") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1124 void P_VADDAy( string& output ){_sap("vadday.%s ACC,%s,%sy") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1125 void P_VADDAz( string& output ){_sap("vaddaz.%s ACC,%s,%sz") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1126 void P_VADDAw( string& output ){_sap("vaddaw.%s ACC,%s,%sw") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1127 void P_VSUBAx( string& output ){_sap("vsubax.%s ACC,%s,%sx") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1128 void P_VSUBAy( string& output ){_sap("vsubay.%s ACC,%s,%sy") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1129 void P_VSUBAz( string& output ){_sap("vsubaz.%s ACC,%s,%sz") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1130 void P_VSUBAw( string& output ){_sap("vsubaw.%s ACC,%s,%sw") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1131 void P_VMADDAx( string& output ){_sap("vmaddax.%s ACC,%s,%sx") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1132 void P_VMADDAy( string& output ){_sap("vmadday.%s ACC,%s,%sy") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1133 void P_VMADDAz( string& output ){_sap("vmaddaz.%s ACC,%s,%sz") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1134 void P_VMADDAw( string& output ){_sap("vmaddaw.%s ACC,%s,%sw") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1135 void P_VMSUBAx( string& output ){_sap("vmsubax.%s ACC,%s,%sx") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1136 void P_VMSUBAy( string& output ){_sap("vmsubay.%s ACC,%s,%sy") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1137 void P_VMSUBAz( string& output ){_sap("vmsubaz.%s ACC,%s,%sz") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1138 void P_VMSUBAw( string& output ){_sap("vmsubaw.%s ACC,%s,%sw") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1139 void P_VITOF0( string& output ){_sap("vitof0.%s %s, %s") dest_string(),COP2_REG_FP[DECODE_FT], COP2_REG_FP[DECODE_FS]); }
1140 void P_VITOF4( string& output ){_sap("vitof4.%s %s, %s") dest_string(),COP2_REG_FP[DECODE_FT], COP2_REG_FP[DECODE_FS]); }
1141 void P_VITOF12( string& output ){_sap("vitof12.%s %s, %s") dest_string(),COP2_REG_FP[DECODE_FT], COP2_REG_FP[DECODE_FS]); }
1142 void P_VITOF15( string& output ){_sap("vitof15.%s %s, %s") dest_string(),COP2_REG_FP[DECODE_FT], COP2_REG_FP[DECODE_FS]); }
1143 void P_VFTOI0( string& output ) {_sap("vftoi0.%s %s, %s") dest_string(),COP2_REG_FP[DECODE_FT], COP2_REG_FP[DECODE_FS]); }
1144 void P_VFTOI4( string& output ) {_sap("vftoi4.%s %s, %s") dest_string(),COP2_REG_FP[DECODE_FT], COP2_REG_FP[DECODE_FS]); }
1145 void P_VFTOI12( string& output ){_sap("vftoi12.%s %s, %s") dest_string(),COP2_REG_FP[DECODE_FT], COP2_REG_FP[DECODE_FS]); }
1146 void P_VFTOI15( string& output ){_sap("vftoi15.%s %s, %s") dest_string(),COP2_REG_FP[DECODE_FT], COP2_REG_FP[DECODE_FS]); }
1147 void P_VMULAx( string& output ){_sap("vmulax.%s ACC,%s,%sx") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1148 void P_VMULAy( string& output ){_sap("vmulay.%s ACC,%s,%sy") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1149 void P_VMULAz( string& output ){_sap("vmulaz.%s ACC,%s,%sz") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1150 void P_VMULAw( string& output ){_sap("vmulaw.%s ACC,%s,%sw") dest_string(),COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]);}
1151 void P_VMULAq( string& output ){_sap("vmulaq.%s ACC %s, Q") dest_string(), COP2_REG_FP[DECODE_FS]); }
1152 void P_VABS( string& output ){_sap("vabs.%s %s, %s") dest_string(),COP2_REG_FP[DECODE_FT], COP2_REG_FP[DECODE_FS]);}
1153 void P_VMULAi( string& output ){_sap("vmulaq.%s ACC %s, I") dest_string(), COP2_REG_FP[DECODE_FS]); }
1154 void P_VCLIPw( string& output ){_sap("vclip %sxyz, %sw") COP2_REG_FP[DECODE_FS], COP2_REG_FP[DECODE_FT]);}
1155 void P_VADDAq( string& output ){_sap("vaddaq.%s ACC %s, Q") dest_string(), COP2_REG_FP[DECODE_FS]); }
1156 void P_VMADDAq( string& output ){_sap("vmaddaq.%s ACC %s, Q") dest_string(), COP2_REG_FP[DECODE_FS]); }
1157 void P_VADDAi( string& output ){_sap("vaddai.%s ACC %s, I") dest_string(), COP2_REG_FP[DECODE_FS]); }
1158 void P_VMADDAi( string& output ){_sap("vmaddai.%s ACC %s, Q") dest_string(), COP2_REG_FP[DECODE_FS]); }
1159 void P_VSUBAq( string& output ){_sap("vsubaq.%s ACC %s, Q") dest_string(), COP2_REG_FP[DECODE_FS]); }
1160 void P_VMSUBAq( string& output ){_sap("vmsubaq.%s ACC %s, Q") dest_string(), COP2_REG_FP[DECODE_FS]); }
1161 void P_VSUBAi( string& output ){_sap("vsubai.%s ACC %s, I") dest_string(), COP2_REG_FP[DECODE_FS]); }
1162 void P_VMSUBAi( string& output ){_sap("vmsubai.%s ACC %s, I") dest_string(), COP2_REG_FP[DECODE_FS]); }
1163 void P_VADDA( string& output ){_sap("vadda.%s ACC %s, %s") dest_string(), COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1164 void P_VMADDA( string& output ){_sap("vmadda.%s ACC %s, %s") dest_string(), COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1165 void P_VMULA( string& output ){_sap("vmula.%s ACC %s, %s") dest_string(), COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1166 void P_VSUBA( string& output ){_sap("vsuba.%s ACC %s, %s") dest_string(), COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1167 void P_VMSUBA( string& output ){_sap("vmsuba.%s ACC %s, %s") dest_string(), COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1168 void P_VOPMULA( string& output ){_sap("vopmula.xyz %sxyz, %sxyz") COP2_REG_FP[DECODE_FS],COP2_REG_FP[DECODE_FT]); }
1169 void P_VNOP( string& output ){output += "vnop";}
1170 void P_VMONE( string& output ){_sap("vmove.%s, %s, %s") dest_string(), COP2_REG_FP[DECODE_FT],COP2_REG_FP[DECODE_FS]); }
1171 void P_VMR32( string& output ){_sap("vmr32.%s, %s, %s") dest_string(), COP2_REG_FP[DECODE_FT],COP2_REG_FP[DECODE_FS]); }
1172 void P_VLQI( string& output ){_sap("vlqi %s%s, (%s++)") COP2_REG_FP[DECODE_FT], dest_string(), COP2_REG_CTL[DECODE_FS]);}
1173 void P_VSQI( string& output ){_sap("vsqi %s%s, (%s++)") COP2_REG_FP[DECODE_FS], dest_string(), COP2_REG_CTL[DECODE_FT]);}
1174 void P_VLQD( string& output ){_sap("vlqd %s%s, (--%s)") COP2_REG_FP[DECODE_FT], dest_string(), COP2_REG_CTL[DECODE_FS]);}
1175 void P_VSQD( string& output ){_sap("vsqd %s%s, (--%s)") COP2_REG_FP[DECODE_FS], dest_string(), COP2_REG_CTL[DECODE_FT]);}
1176 void P_VDIV( string& output ){_sap("vdiv Q, %s%c, %s%c") COP2_REG_FP[DECODE_FS], dest_fsf(), COP2_REG_FP[DECODE_FT], dest_ftf());}
1177 void P_VSQRT( string& output ){_sap("vsqrt Q, %s%c") COP2_REG_FP[DECODE_FT], dest_ftf());}
1178 void P_VRSQRT( string& output ){_sap("vrsqrt Q, %s%c, %s%c") COP2_REG_FP[DECODE_FS], dest_fsf(), COP2_REG_FP[DECODE_FT], dest_ftf());}
1179 void P_VWAITQ( string& output ){output += "vwaitq";}
1180 void P_VMTIR( string& output ){_sap("vmtir %s, %s%c") COP2_REG_CTL[DECODE_FT], COP2_REG_FP[DECODE_FS], dest_fsf());}
1181 void P_VMFIR( string& output ){_sap("vmfir %s%c, %s") COP2_REG_FP[DECODE_FT], dest_string(), COP2_REG_CTL[DECODE_FS]);}
1182 void P_VILWR( string& output ){_sap("vilwr %s, (%s)%s") COP2_REG_CTL[DECODE_FT], COP2_REG_CTL[DECODE_FS], dest_string());}
1183 void P_VISWR( string& output ){_sap("viswr %s, (%s)%s") COP2_REG_CTL[DECODE_FT], COP2_REG_CTL[DECODE_FS], dest_string());}
1184 void P_VRNEXT( string& output ){_sap("vrnext %s%s, R") COP2_REG_CTL[DECODE_FT], dest_string());}
1185 void P_VRGET( string& output ){_sap("vrget %s%s, R") COP2_REG_CTL[DECODE_FT], dest_string());}
1186 void P_VRINIT( string& output ){_sap("vrinit R, %s%s") COP2_REG_CTL[DECODE_FS], dest_string());}
1187 void P_VRXOR( string& output ){_sap("vrxor R, %s%s") COP2_REG_CTL[DECODE_FS], dest_string());}
1188 //************************************END OF SPECIAL2 VUO TABLE****************************
1189
1190 }

  ViewVC Help
Powered by ViewVC 1.1.22