Commit | Line | Data |
---|---|---|
ef79bbde P |
1 | /* Pcsx - Pc Psx Emulator |
2 | * Copyright (C) 1999-2003 Pcsx Team | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA | |
17 | */ | |
18 | ||
19 | #ifndef PGET_H | |
20 | #define PGET_H | |
21 | ||
22 | #ifdef __cplusplus | |
23 | extern "C" { | |
24 | #endif | |
25 | ||
26 | int psxCP2time[64] = { | |
27 | 2, 16 , 1 , 1, 1, 1 , 8, 1, // 00 | |
28 | 1 , 1 , 1 , 1, 6 , 1 , 1 , 1, // 08 | |
29 | 8 , 8, 8, 19, 13 , 1 , 44 , 1, // 10 | |
30 | 1 , 1 , 1 , 17, 11 , 1 , 14 , 1, // 18 | |
31 | 30 , 1 , 1 , 1, 1, 1 , 1 , 1, // 20 | |
32 | 5 , 8 , 17 , 1, 1, 5, 6, 1, // 28 | |
33 | 23 , 1 , 1 , 1, 1, 1 , 1 , 1, // 30 | |
34 | 1 , 1 , 1 , 1, 1, 6 , 5 , 39 // 38 | |
35 | }; | |
36 | ||
37 | #define CP2_FUNC(f) \ | |
38 | void gte##f(); \ | |
39 | static void rec##f() { \ | |
40 | if (pc < cop2readypc) idlecyclecount += (cop2readypc - pc)>>2; \ | |
41 | iFlushRegs(0); \ | |
42 | LIW(0, (u32)psxRegs.code); \ | |
43 | STW(0, OFFSET(&psxRegs, &psxRegs.code), GetHWRegSpecial(PSXREGS)); \ | |
44 | FlushAllHWReg(); \ | |
45 | CALLFunc ((u32)gte##f); \ | |
46 | cop2readypc = pc + psxCP2time[_fFunct_(psxRegs.code)]<<2; \ | |
47 | } | |
48 | ||
49 | #define CP2_FUNCNC(f) \ | |
50 | void gte##f(); \ | |
51 | static void rec##f() { \ | |
52 | if (pc < cop2readypc) idlecyclecount += (cop2readypc - pc)>>2; \ | |
53 | iFlushRegs(0); \ | |
54 | CALLFunc ((u32)gte##f); \ | |
55 | /* branch = 2; */\ | |
56 | cop2readypc = pc + psxCP2time[_fFunct_(psxRegs.code)]; \ | |
57 | } | |
58 | ||
59 | CP2_FUNC(MFC2); | |
60 | CP2_FUNC(MTC2); | |
61 | CP2_FUNC(CFC2); | |
62 | CP2_FUNC(CTC2); | |
63 | CP2_FUNC(LWC2); | |
64 | CP2_FUNC(SWC2); | |
65 | CP2_FUNCNC(RTPS); | |
66 | CP2_FUNC(OP); | |
67 | CP2_FUNCNC(NCLIP); | |
68 | CP2_FUNC(DPCS); | |
69 | CP2_FUNC(INTPL); | |
70 | CP2_FUNC(MVMVA); | |
71 | CP2_FUNCNC(NCDS); | |
72 | CP2_FUNCNC(NCDT); | |
73 | CP2_FUNCNC(CDP); | |
74 | CP2_FUNCNC(NCCS); | |
75 | CP2_FUNCNC(CC); | |
76 | CP2_FUNCNC(NCS); | |
77 | CP2_FUNCNC(NCT); | |
78 | CP2_FUNC(SQR); | |
79 | CP2_FUNC(DCPL); | |
80 | CP2_FUNCNC(DPCT); | |
81 | CP2_FUNCNC(AVSZ3); | |
82 | CP2_FUNCNC(AVSZ4); | |
83 | CP2_FUNCNC(RTPT); | |
84 | CP2_FUNC(GPF); | |
85 | CP2_FUNC(GPL); | |
86 | CP2_FUNCNC(NCCT); | |
87 | ||
88 | #ifdef __cplusplus | |
89 | } | |
90 | #endif | |
91 | #endif |