/[pcsx2_0.9.7]/trunk/pcsx2/VUflags.cpp
ViewVC logotype

Annotation of /trunk/pcsx2/VUflags.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (hide annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (9 years, 5 months ago) by william
File size: 2908 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 william 31 /* 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     #include "PrecompiledHeader.h"
17     #include "Common.h"
18    
19     #include <cmath>
20     #include <float.h>
21    
22     #include "VUmicro.h"
23    
24     /*****************************************/
25     /* NEW FLAGS */ //By asadr. Thnkx F|RES :p
26     /*****************************************/
27    
28    
29     void vuUpdateDI(VURegs * VU) {
30     // u32 Flag_S = 0;
31     // u32 Flag_I = 0;
32     // u32 Flag_D = 0;
33     //
34     // /*
35     // FLAG D - I
36     // */
37     // Flag_I = (VU->statusflag >> 4) & 0x1;
38     // Flag_D = (VU->statusflag >> 5) & 0x1;
39     //
40     // VU->statusflag|= (Flag_I | (VU0.VI[REG_STATUS_FLAG].US[0] >> 4)) << 10;
41     // VU->statusflag|= (Flag_D | (VU0.VI[REG_STATUS_FLAG].US[0] >> 5)) << 11;
42     }
43    
44 william 62 static __ri u32 VU_MAC_UPDATE( int shift, VURegs * VU, float f )
45 william 31 {
46     u32 v = *(u32*)&f;
47     int exp = (v >> 23) & 0xff;
48     u32 s = v & 0x80000000;
49    
50     if (s)
51     VU->macflag |= 0x0010<<shift;
52     else
53     VU->macflag &= ~(0x0010<<shift);
54    
55     if( f == 0 )
56     {
57     VU->macflag = (VU->macflag & ~(0x1100<<shift)) | (0x0001<<shift);
58     return v;
59     }
60    
61     switch(exp)
62     {
63     case 0:
64     VU->macflag = (VU->macflag&~(0x1000<<shift)) | (0x0101<<shift);
65     return s;
66     case 255:
67     VU->macflag = (VU->macflag&~(0x0100<<shift)) | (0x1000<<shift);
68     return s|0x7f7fffff; /* max allowed */
69     default:
70     VU->macflag = (VU->macflag & ~(0x1101<<shift));
71     return v;
72     }
73     }
74    
75 william 62 __fi u32 VU_MACx_UPDATE(VURegs * VU, float x)
76 william 31 {
77     return VU_MAC_UPDATE(3, VU, x);
78     }
79    
80 william 62 __fi u32 VU_MACy_UPDATE(VURegs * VU, float y)
81 william 31 {
82     return VU_MAC_UPDATE(2, VU, y);
83     }
84    
85 william 62 __fi u32 VU_MACz_UPDATE(VURegs * VU, float z)
86 william 31 {
87     return VU_MAC_UPDATE(1, VU, z);
88     }
89    
90 william 62 __fi u32 VU_MACw_UPDATE(VURegs * VU, float w)
91 william 31 {
92     return VU_MAC_UPDATE(0, VU, w);
93     }
94    
95 william 62 __fi void VU_MACx_CLEAR(VURegs * VU)
96 william 31 {
97     VU->macflag&= ~(0x1111<<3);
98     }
99    
100 william 62 __fi void VU_MACy_CLEAR(VURegs * VU)
101 william 31 {
102     VU->macflag&= ~(0x1111<<2);
103     }
104    
105 william 62 __fi void VU_MACz_CLEAR(VURegs * VU)
106 william 31 {
107     VU->macflag&= ~(0x1111<<1);
108     }
109    
110 william 62 __fi void VU_MACw_CLEAR(VURegs * VU)
111 william 31 {
112     VU->macflag&= ~(0x1111<<0);
113     }
114    
115 william 62 __ri void VU_STAT_UPDATE(VURegs * VU) {
116 william 31 int newflag = 0 ;
117     if (VU->macflag & 0x000F) newflag = 0x1;
118     if (VU->macflag & 0x00F0) newflag |= 0x2;
119     if (VU->macflag & 0x0F00) newflag |= 0x4;
120     if (VU->macflag & 0xF000) newflag |= 0x8;
121     VU->statusflag = (VU->statusflag&0xc30)|newflag|((VU->statusflag&0xf)<<6);
122     }

  ViewVC Help
Powered by ViewVC 1.1.22