Create Xref-Html Frames Remove All Frames
file:/home/jivera/wd/pcsx/sh4/sh4.h (Tue Nov 25 22:46:15 2003
)
1: /* Pcsx - Pc Psx Emulator
2: * Copyright (C) 1999-2002 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: #ifndef __SH4_H__
20: #define __SH4_H__
21:
22: // Basic types
23: #include "PsxCommon.h"
24:
25: /* general defines */
26:
27: s8 *x86Ptr;
28: u8 *j8Ptr[32];
29: u16 *j16Ptr[32];
30: u8 *immPtr[256];
31: u32 immData[256]; // immediate values
32: u32 immCount; // Counts the number of immediate values
33:
34: float rMatrix[16] __attribute__ ((aligned (32))); // keeps the rotation matrix
35: float lMatrix[16] __attribute__ ((aligned (32))); // keeps the light matrix
36: float cMatrix[16] __attribute__ ((aligned (32))); // keeps the color matrix
37: float trVector[4] __attribute__ ((aligned (32))); // translation vector
38: float bkVector[4] __attribute__ ((aligned (32))); // background vector
39: float fcVector[4] __attribute__ ((aligned (32))); // far color vector
40: float control[7] __attribute__ ((aligned (32))); // rest of the control register
41:
42: float ir[4] __attribute__ ((aligned (32))); // ir vector (clipped)
43: float mac[4] __attribute__ ((aligned (32))); // mac vector
44:
45: void x86Init(char *ptr);
46: void x86Shutdown();
47: void shSetBx(u8 *j8);
48: void shSetBRA(u16 *j16);
49: void Align4();
50: void Align32();
51:
52: #define R0 0
53: #define R1 1
54: #define R2 2
55: #define R3 3
56: #define R4 4
57: #define R5 5
58: #define R6 6
59: #define R7 7
60: #define R8 8
61: #define R15 15
62:
63: #define FR0 0
64: #define FR1 1
65: #define FR2 2
66: #define FR3 3
67:
68: /*******************/
69: /* SH4 intructions */
70: /*******************/
71:
72: /* Transfer Instructions */
73:
74: /* mov Rm,Rn */
75: void MOV(int m, int n);
76: /* mov #imm, Rn */
77: void MOVI(int i, int n);
78: /* mov.l @(disp,PC),Rn */
79: u8* MOVLI(int d, int n);
80: /* mov.l @Rm,Rn */
81: void MOVLL(int m, int n);
82: /* mov.l @(disp,GBR),R0 */
83: u8* MOVLLG(int d);
84: /* mov.l R0,@(disp,GBR) */
85: u8* MOVLSG(int d);
86: /* mov.l Rm,@Rn */
87: void MOVLS(int m, int n);
88: /* mov.l Rm,@-Rn */
89: void MOVLM(int m, int n);
90: /* mov.l @Rm+,Rn */
91: void MOVLP(int m, int n);
92: /* movt Rn */
93: void MOVT(int n);
94: /* swap.w Rm,Rn */
95: void SWAPW(int m, int n);
96:
97: /* Branch instructions */
98:
99: /* bra disp */
100: u16* BRA(int disp);
101: /* bt disp */
102: u8* BT(int disp);
103: /* bf disp */
104: u8* BF(int disp);
105: /* jsr @Rn */
106: void JSR(int n);
107: /* ret */
108: void RET();
109:
110: /* Logical Instructions */
111:
112: /* and Rm, Rn */
113: void AND(int m, int n);
114: /* and #imm, R0 */
115: void ANDI(int i);
116: /* xor Rm, Rn */
117: void XOR(int m, int n);
118: /* xor #imm, R0 */
119: void XORI(int i);
120: /* or Rm, Rn */
121: void OR(int m, int n);
122: /* not Rm, Rn */
123: void NOT(int m, int n);
124: /* tst Rm, Rn */
125: void TST(int m, int n);
126:
127: /* Arithmetic Instructions */
128:
129: /* add Rm, Rn */
130: void ADD(int m, int n);
131: /* sub Rm, Rn */
132: void SUB(int m, int n);
133: /* neg Rm, Rn */
134: void NEG(int m, int n);
135: /* cmp/eq Rm, Rn */
136: void CMPEQ(int m, int n);
137: /* cmp/gt Rm, Rn */
138: void CMPGT(int m, int n);
139: /* cmp/ge Rm, Rn */
140: void CMPGE(int m, int n);
141: /* cmp/hi Rm, Rn */
142: void CMPHI(int m, int n);
143: /* mul.l Rm, Rn */
144: void MULL(int m, int n);
145: /* dmuls.l Rm, Rn */
146: void DMULS(int m, int n);
147: /* dmulu.l Rm, Rn */
148: void DMULU(int m, int n);
149: /* exts.b Rm, Rn */
150: void EXTSB(int m, int n);
151: /* exts.w Rm, Rn */
152: void EXTSW(int m, int n);
153: /* extu.b Rm, Rn */
154: void EXTUB(int m, int n);
155: /* extu.w Rm, Rn */
156: void EXTUW(int m, int n);
157:
158: /* Shift Instructions */
159:
160: /* shld Rm, Rn */
161: void SHLD(int m, int n);
162: /* shad Rm, Rn */
163: void SHAD(int m, int n);
164: /* shlr2 Rm, Rn */
165: void SHLR2(int n);
166: /* shll8 Rm, Rn */
167: void SHLL8(int n);
168: /* shlr16 Rm, Rn */
169: void SHLR16(int n);
170:
171: /* System Control Instructions */
172:
173: /* stc.l gbr,@-Rn */
174: void STCMGBR(int n);
175: /* ldc.l @Rm+,gbr */
176: void LDCMGBR(int m);
177: /* ldc Rm,gbr */
178: void LDCGBR(int m);
179: /* sts.l pr,@-Rn */
180: void STSMPR(int n);
181: /* lds.l @Rm+,pr */
182: void LDSMPR(int m);
183: /* sts.l macl,Rn */
184: void STSMACL(int n);
185: /* sts.l mach,Rn */
186: void STSMACH(int n);
187: /* nop */
188: void NOP();
189:
190: /* Floating-Point Instructions */
191:
192: /* fmov.s FRm, @Rn */
193: void FMOV_STORE(int m, int n);
194: /* float fpul, FRn */
195: void FLOAT(int n);
196: /* fdiv FRm, FRn */
197: void FDIV(int m, int n);
198: /* fmul FRm, FRn */
199: void FMUL(int m, int n);
200: /* ftrc FRm, fpul */
201: void FTRC(int m);
202: /* fmov.s FRm, @-Rn */
203: void FMOV_SAVE(int m, int n);
204: /* fmov.s @Rm+, FRn */
205: void FMOV_RESTORE(int m, int n);
206:
207: /* Floating-Point Control Instructions */
208:
209: /* lds Rm,fpscr */
210: void LDSFPSCR(int m);
211: /* lds Rm,fpul */
212: void LDSFPUL(int m);
213: /* sts.l fpul,Rn */
214: void STSFPUL(int n);
215: /* sts.l fpscr,Rn */
216: void STSFPSCR(int n);
217:
218: /* call func */
219: void CALLFunc(u32 func);
220:
221: void LoadImmediate32(u32 imm, u32 reg);
222: void UpdateImmediate32(u32 force);
223:
224: void LoadMatrixElement(u32 r4, u32 r5, u32 r6, u32 r7);
225: u32 asmTransformVector(u32 ir, u32 mac, u32 clip);
226: u32 asmColorCalc(float *ir_t, float *mac_t, u32 lim);
227: void asmStore32(float *vec, u32 *addr);
228: void asmLoad16 (s32 *addr, float *vec);
229: void asmLoadVec(s16 *addr, float *vec);
230: void asmNCLIP(u32 data);
231: void mat_vec_load(float *matrix, float *vector);
232: void mat_zero_load(float *matrix);
233:
234: #endif /* __SH4_H__ */
235: /* arch-tag: Matthew Dempsky Wed Oct 15 10:35:08 CST 2003 (sh4/sh4.h)
236: */
237:
Html form generated by Xrefactory version 1.6.4 on Fri Dec 12 20:52:56 2003
Trial version.