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 ***************************************************************************/
21 * Internal PSX HLE functions.
27 #define PSXHLE_LOG SysPrintf
29 #define PSXHLE_LOG(...)
32 static void hleDummy() {
33 psxRegs.pc = psxRegs.GPR.n.ra;
39 u32 call = psxRegs.GPR.n.t1 & 0xff;
41 if (biosA0[call]) biosA0[call]();
47 u32 call = psxRegs.GPR.n.t1 & 0xff;
49 if (biosB0[call]) biosB0[call]();
55 u32 call = psxRegs.GPR.n.t1 & 0xff;
57 if (biosC0[call]) biosC0[call]();
62 static void hleBootstrap() { // 0xbfc00000
63 PSXHLE_LOG("hleBootstrap\n");
66 PSXHLE_LOG("CdromLabel: \"%s\": PC = %8.8lx (SP = %8.8lx)\n", CdromLabel, psxRegs.pc, psxRegs.GPR.n.sp);
80 u32 _sp,_fp,_gp,ret,base;
83 static void hleExecRet() {
84 EXEC *header = (EXEC*)PSXM(psxRegs.GPR.n.s0);
86 PSXHLE_LOG("ExecRet %x: %x\n", psxRegs.GPR.n.s0, header->ret);
88 psxRegs.GPR.n.ra = header->ret;
89 psxRegs.GPR.n.sp = header->_sp;
90 psxRegs.GPR.n.s8 = header->_fp;
91 psxRegs.GPR.n.gp = header->_gp;
92 psxRegs.GPR.n.s0 = header->base;
95 psxRegs.pc = psxRegs.GPR.n.ra;
98 const void (*psxHLEt[8])() = {
99 hleDummy, hleA0, hleB0, hleC0,
100 hleBootstrap, hleExecRet,