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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 9 months ago) by william
File size: 4690 byte(s)
committing r3113 initial commit again...
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 #include "Debug.h"
20 #include "VUmicro.h"
21
22 static char ostr[1024];
23
24 // Type deffinition of our functions
25 #define DisFInterface (u32 code, u32 pc)
26 #define DisFInterfaceT (u32, u32)
27 #define DisFInterfaceN (code, pc)
28
29 typedef char* (*TdisR5900F)DisFInterface;
30
31 // These macros are used to assemble the disassembler functions
32 #define MakeDisF(fn, b) \
33 char* fn DisFInterface { \
34 if( !!CpuVU1->IsInterpreter ) sprintf (ostr, "%8.8x %8.8x:", pc, code); \
35 else ostr[0] = 0; \
36 b; /*ostr[(strlen(ostr) - 1)] = 0;*/ return ostr; \
37 }
38
39 //Lower/Upper instructions can use that..
40 #define _Ft_ ((code >> 16) & 0x1F) // The rt part of the instruction register
41 #define _Fs_ ((code >> 11) & 0x1F) // The rd part of the instruction register
42 #define _Fd_ ((code >> 6) & 0x1F) // The sa part of the instruction register
43 #define _It_ (_Ft_ & 15)
44 #define _Is_ (_Fs_ & 15)
45 #define _Id_ (_Fd_ & 15)
46
47 #define dName(i) sprintf(ostr, "%s %-12s", ostr, i); \
48
49 #define dNameU(i) { \
50 char op[256]; sprintf(op, "%s.%s%s%s%s", i, _X ? "x" : "", _Y ? "y" : "", _Z ? "z" : "", _W ? "w" : ""); \
51 sprintf(ostr, "%s %-12s", ostr, op); \
52 }
53
54 #define dCP2128f(i) { \
55 if( !CpuVU1->IsInterpreter ) sprintf(ostr, "%s %s,", ostr, disRNameCP2f[i]); \
56 else sprintf(ostr, "%s w=%f (%8.8x) z=%f (%8.8x) y=%f (%8.8xl) x=%f (%8.8x) (%s),", ostr, VU1.VF[i].f.w, VU1.VF[i].UL[3], VU1.VF[i].f.z, VU1.VF[i].UL[2], VU1.VF[i].f.y, VU1.VF[i].UL[1], VU1.VF[i].f.x, VU1.VF[i].UL[0], disRNameCP2f[i]); \
57 } \
58
59 #define dCP232x(i) { \
60 if( !CpuVU1->IsInterpreter ) sprintf(ostr, "%s %s,", ostr, disRNameCP2f[i]); \
61 else sprintf(ostr, "%s x=%f (%s),", ostr, VU1.VF[i].f.x, disRNameCP2f[i]); \
62 } \
63
64 #define dCP232y(i) { \
65 if( !CpuVU1->IsInterpreter ) sprintf(ostr, "%s %s,", ostr, disRNameCP2f[i]); \
66 else sprintf(ostr, "%s y=%f (%s),", ostr, VU1.VF[i].f.y, disRNameCP2f[i]); \
67 } \
68
69 #define dCP232z(i) { \
70 if( !CpuVU1->IsInterpreter ) sprintf(ostr, "%s %s,", ostr, disRNameCP2f[i]); \
71 else sprintf(ostr, "%s z=%f (%s),", ostr, VU1.VF[i].f.z, disRNameCP2f[i]); \
72 }
73
74 #define dCP232w(i) { \
75 if( !CpuVU1->IsInterpreter ) sprintf(ostr, "%s %s,", ostr, disRNameCP2f[i]); \
76 else sprintf(ostr, "%s w=%f (%s),", ostr, VU1.VF[i].f.w, disRNameCP2f[i]); \
77 }
78
79 #define dCP2ACCf() { \
80 if( !CpuVU1->IsInterpreter ) sprintf(ostr, "%s ACC,", ostr); \
81 else sprintf(ostr, "%s w=%f z=%f y=%f x=%f (ACC),", ostr, VU1.ACC.f.w, VU1.ACC.f.z, VU1.ACC.f.y, VU1.ACC.f.x); \
82 } \
83
84 #define dCP232i(i) { \
85 if( !CpuVU1->IsInterpreter ) sprintf(ostr, "%s %s,", ostr, disRNameCP2i[i]); \
86 else sprintf(ostr, "%s %8.8x (%s),", ostr, VU1.VI[i].UL, disRNameCP2i[i]); \
87 }
88
89 #define dCP232iF(i) { \
90 if( !CpuVU1->IsInterpreter ) sprintf(ostr, "%s %s,", ostr, disRNameCP2i[i]); \
91 else sprintf(ostr, "%s %f (%s),", ostr, VU1.VI[i].F, disRNameCP2i[i]); \
92 }
93
94 #define dCP232f(i, j) { \
95 if( !CpuVU1->IsInterpreter ) sprintf(ostr, "%s %s%s,", ostr, disRNameCP2f[i], CP2VFnames[j]); \
96 else sprintf(ostr, "%s %s=%f (%s),", ostr, CP2VFnames[j], VU1.VF[i].F[j], disRNameCP2f[i]); \
97 }
98
99 #define dImm5() sprintf(ostr, "%s %d,", ostr, (s16)((code >> 6) & 0x10 ? 0xfff0 | ((code >> 6) & 0xf) : (code >> 6) & 0xf))
100 #define dImm11() sprintf(ostr, "%s %d,", ostr, (s16)(code & 0x400 ? 0xfc00 | (code & 0x3ff) : code & 0x3ff))
101 #define dImm15() sprintf(ostr, "%s %d,", ostr, ( ( code >> 10 ) & 0x7800 ) | ( code & 0x7ff ))
102
103 #define _X ((code>>24) & 0x1)
104 #define _Y ((code>>23) & 0x1)
105 #define _Z ((code>>22) & 0x1)
106 #define _W ((code>>21) & 0x1)
107
108 #define _Fsf_ ((code >> 21) & 0x03)
109 #define _Ftf_ ((code >> 23) & 0x03)
110
111 /*********************************************************
112 * Unknown instruction (would generate an exception) *
113 * Format: ? *
114 *********************************************************/
115 //extern char* disNULL DisFInterface;
116 static MakeDisF(disNULL, dName("*** Bad OP ***");)
117
118 #include "DisVUmicro.h"
119 #include "DisVUops.h"
120
121 _disVUOpcodes(VU1);
122 _disVUTables(VU1);
123

  ViewVC Help
Powered by ViewVC 1.1.22