1 /***************************************************************************
2 * Copyright (C) 2007 Ryan Schultz, PCSX-df Team, PCSX team *
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. *
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. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
18 ***************************************************************************/
27 #include "psxcommon.h"
29 #include "psxcounters.h"
33 R3000ACPU_NOTIFY_CACHE_ISOLATED = 0,
34 R3000ACPU_NOTIFY_CACHE_UNISOLATED = 1,
40 void (*Execute)(); /* executes up to a break */
41 void (*ExecuteBlock)(); /* executes up to a jump */
42 void (*Clear)(u32 Addr, u32 Size);
43 void (*Notify)(int note, void *data);
44 void (*ApplyConfig)();
48 extern R3000Acpu *psxCpu;
49 extern R3000Acpu psxInt;
50 extern R3000Acpu psxRec;
53 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
54 struct { u8 h3, h2, h, l; } b;
55 struct { s8 h3, h2, h, l; } sb;
56 struct { u16 h, l; } w;
57 struct { s16 h, l; } sw;
59 struct { u8 l, h, h2, h3; } b;
60 struct { u16 l, h; } w;
61 struct { s8 l, h, h2, h3; } sb;
62 struct { s16 l, h; } sw;
68 u32 r0, at, v0, v1, a0, a1, a2, a3,
69 t0, t1, t2, t3, t4, t5, t6, t7,
70 s0, s1, s2, s3, s4, s5, s6, s7,
71 t8, t9, k0, k1, gp, sp, s8, ra, lo, hi;
73 u32 r[34]; /* Lo, Hi in r[32] and r[33] */
79 u32 Index, Random, EntryLo0, EntryLo1,
80 Context, PageMask, Wired, Reserved0,
81 BadVAddr, Count, EntryHi, Compare,
82 Status, Cause, EPC, PRid,
83 Config, LLAddr, WatchLO, WatchHI,
84 XContext, Reserved1, Reserved2, Reserved3,
85 Reserved4, Reserved5, ECC, CacheErr,
86 TagLo, TagHi, ErrorEPC, Reserved6;
109 unsigned char r, g, b, c;
113 short m11, m12, m13, m21, m22, m23, m31, m32, m33, pad;
118 SVector3D v0, v1, v2;
121 s32 ir0, ir1, ir2, ir3;
122 SVector2D sxy0, sxy1, sxy2, sxyp;
123 SVector2Dz sz0, sz1, sz2, sz3;
124 CBGR rgb0, rgb1, rgb2;
126 s32 mac0, mac1, mac2, mac3;
166 PSXINT_CDRPLAY_OLD, /* unused */
171 typedef struct psxCP2Regs {
172 psxCP2Data CP2D; /* Cop2 data registers */
173 psxCP2Ctrl CP2C; /* Cop2 control registers */
177 psxGPRRegs GPR; /* General Purpose Registers */
178 psxCP0Regs CP0; /* Coprocessor0 Registers */
181 psxCP2Data CP2D; /* Cop2 data registers */
182 psxCP2Ctrl CP2C; /* Cop2 control registers */
186 u32 pc; /* Program counter */
187 u32 code; /* The instruction */
190 struct { u32 sCycle, cycle; } intCycle[32];
193 u32 subCycle; /* interpreter cycle counting */
197 // warning: changing anything in psxRegisters requires update of all
198 // asm in libpcsxcore/new_dynarec/
201 extern psxRegisters psxRegs;
203 /* new_dynarec stuff */
204 extern u32 event_cycles[PSXINT_COUNT];
205 extern u32 next_interupt;
207 void new_dyna_before_save(void);
208 void new_dyna_after_save(void);
209 void new_dyna_freeze(void *f, int mode);
211 #define new_dyna_set_event_abs(e, abs) { \
213 s32 di_ = next_interupt - abs_; \
214 event_cycles[e] = abs_; \
216 /*printf("%u: next_interupt %u -> %u\n", psxRegs.cycle, next_interupt, abs_);*/ \
217 next_interupt = abs_; \
221 #define new_dyna_set_event(e, c) \
222 new_dyna_set_event_abs(e, psxRegs.cycle + (c))
227 void psxException(u32 code, u32 bd);
228 void psxBranchTest();
229 void psxExecuteBios();