diff --git a/Source/Project64-rsp-core/Project64-rsp-core.vcxproj b/Source/Project64-rsp-core/Project64-rsp-core.vcxproj
index dde7c5380..a5912aa53 100644
--- a/Source/Project64-rsp-core/Project64-rsp-core.vcxproj
+++ b/Source/Project64-rsp-core/Project64-rsp-core.vcxproj
@@ -50,6 +50,7 @@
+
@@ -86,6 +87,7 @@
+
diff --git a/Source/Project64-rsp-core/Project64-rsp-core.vcxproj.filters b/Source/Project64-rsp-core/Project64-rsp-core.vcxproj.filters
index de4e4ec2d..d49022cdb 100644
--- a/Source/Project64-rsp-core/Project64-rsp-core.vcxproj.filters
+++ b/Source/Project64-rsp-core/Project64-rsp-core.vcxproj.filters
@@ -138,6 +138,9 @@
Source Files\hle
+
+ Source Files\cpu
+
@@ -218,5 +221,8 @@
Header Files\hle
+
+ Header Files\cpu
+
\ No newline at end of file
diff --git a/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.cpp b/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.cpp
index 17b4e65da..feb9fc98c 100644
--- a/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.cpp
+++ b/Source/Project64-rsp-core/Recompiler/RspRecompilerCPU.cpp
@@ -33,365 +33,365 @@ uint8_t *pLastSecondary = NULL, *pLastPrimary = NULL;
void BuildRecompilerCPU(void)
{
- RSP_Opcode[0] = Compile_SPECIAL;
- RSP_Opcode[1] = Compile_REGIMM;
- RSP_Opcode[2] = Compile_J;
- RSP_Opcode[3] = Compile_JAL;
- RSP_Opcode[4] = Compile_BEQ;
- RSP_Opcode[5] = Compile_BNE;
- RSP_Opcode[6] = Compile_BLEZ;
- RSP_Opcode[7] = Compile_BGTZ;
- RSP_Opcode[8] = Compile_ADDI;
- RSP_Opcode[9] = Compile_ADDIU;
- RSP_Opcode[10] = Compile_SLTI;
- RSP_Opcode[11] = Compile_SLTIU;
- RSP_Opcode[12] = Compile_ANDI;
- RSP_Opcode[13] = Compile_ORI;
- RSP_Opcode[14] = Compile_XORI;
- RSP_Opcode[15] = Compile_LUI;
- RSP_Opcode[16] = Compile_COP0;
- RSP_Opcode[17] = Compile_UnknownOpcode;
- RSP_Opcode[18] = Compile_COP2;
- RSP_Opcode[19] = Compile_UnknownOpcode;
- RSP_Opcode[20] = Compile_UnknownOpcode;
- RSP_Opcode[21] = Compile_UnknownOpcode;
- RSP_Opcode[22] = Compile_UnknownOpcode;
- RSP_Opcode[23] = Compile_UnknownOpcode;
- RSP_Opcode[24] = Compile_UnknownOpcode;
- RSP_Opcode[25] = Compile_UnknownOpcode;
- RSP_Opcode[26] = Compile_UnknownOpcode;
- RSP_Opcode[27] = Compile_UnknownOpcode;
- RSP_Opcode[28] = Compile_UnknownOpcode;
- RSP_Opcode[29] = Compile_UnknownOpcode;
- RSP_Opcode[30] = Compile_UnknownOpcode;
- RSP_Opcode[31] = Compile_UnknownOpcode;
- RSP_Opcode[32] = Compile_LB;
- RSP_Opcode[33] = Compile_LH;
- RSP_Opcode[34] = Compile_UnknownOpcode;
- RSP_Opcode[35] = Compile_LW;
- RSP_Opcode[36] = Compile_LBU;
- RSP_Opcode[37] = Compile_LHU;
- RSP_Opcode[38] = Compile_UnknownOpcode;
- RSP_Opcode[39] = Compile_LWU;
- RSP_Opcode[40] = Compile_SB;
- RSP_Opcode[41] = Compile_SH;
- RSP_Opcode[42] = Compile_UnknownOpcode;
- RSP_Opcode[43] = Compile_SW;
- RSP_Opcode[44] = Compile_UnknownOpcode;
- RSP_Opcode[45] = Compile_UnknownOpcode;
- RSP_Opcode[46] = Compile_UnknownOpcode;
- RSP_Opcode[47] = Compile_UnknownOpcode;
- RSP_Opcode[48] = Compile_UnknownOpcode;
- RSP_Opcode[49] = Compile_UnknownOpcode;
- RSP_Opcode[50] = Compile_LC2;
- RSP_Opcode[51] = Compile_UnknownOpcode;
- RSP_Opcode[52] = Compile_UnknownOpcode;
- RSP_Opcode[53] = Compile_UnknownOpcode;
- RSP_Opcode[54] = Compile_UnknownOpcode;
- RSP_Opcode[55] = Compile_UnknownOpcode;
- RSP_Opcode[56] = Compile_UnknownOpcode;
- RSP_Opcode[57] = Compile_UnknownOpcode;
- RSP_Opcode[58] = Compile_SC2;
- RSP_Opcode[59] = Compile_UnknownOpcode;
- RSP_Opcode[60] = Compile_UnknownOpcode;
- RSP_Opcode[61] = Compile_UnknownOpcode;
- RSP_Opcode[62] = Compile_UnknownOpcode;
- RSP_Opcode[63] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[0] = Compile_SPECIAL;
+ RSP_Recomp_Opcode[1] = Compile_REGIMM;
+ RSP_Recomp_Opcode[2] = Compile_J;
+ RSP_Recomp_Opcode[3] = Compile_JAL;
+ RSP_Recomp_Opcode[4] = Compile_BEQ;
+ RSP_Recomp_Opcode[5] = Compile_BNE;
+ RSP_Recomp_Opcode[6] = Compile_BLEZ;
+ RSP_Recomp_Opcode[7] = Compile_BGTZ;
+ RSP_Recomp_Opcode[8] = Compile_ADDI;
+ RSP_Recomp_Opcode[9] = Compile_ADDIU;
+ RSP_Recomp_Opcode[10] = Compile_SLTI;
+ RSP_Recomp_Opcode[11] = Compile_SLTIU;
+ RSP_Recomp_Opcode[12] = Compile_ANDI;
+ RSP_Recomp_Opcode[13] = Compile_ORI;
+ RSP_Recomp_Opcode[14] = Compile_XORI;
+ RSP_Recomp_Opcode[15] = Compile_LUI;
+ RSP_Recomp_Opcode[16] = Compile_COP0;
+ RSP_Recomp_Opcode[17] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[18] = Compile_COP2;
+ RSP_Recomp_Opcode[19] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[20] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[21] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[22] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[23] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[24] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[25] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[26] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[27] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[28] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[29] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[30] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[31] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[32] = Compile_LB;
+ RSP_Recomp_Opcode[33] = Compile_LH;
+ RSP_Recomp_Opcode[34] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[35] = Compile_LW;
+ RSP_Recomp_Opcode[36] = Compile_LBU;
+ RSP_Recomp_Opcode[37] = Compile_LHU;
+ RSP_Recomp_Opcode[38] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[39] = Compile_LWU;
+ RSP_Recomp_Opcode[40] = Compile_SB;
+ RSP_Recomp_Opcode[41] = Compile_SH;
+ RSP_Recomp_Opcode[42] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[43] = Compile_SW;
+ RSP_Recomp_Opcode[44] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[45] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[46] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[47] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[48] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[49] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[50] = Compile_LC2;
+ RSP_Recomp_Opcode[51] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[52] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[53] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[54] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[55] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[56] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[57] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[58] = Compile_SC2;
+ RSP_Recomp_Opcode[59] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[60] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[61] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[62] = Compile_UnknownOpcode;
+ RSP_Recomp_Opcode[63] = Compile_UnknownOpcode;
- RSP_Special[0] = Compile_Special_SLL;
- RSP_Special[1] = Compile_UnknownOpcode;
- RSP_Special[2] = Compile_Special_SRL;
- RSP_Special[3] = Compile_Special_SRA;
- RSP_Special[4] = Compile_Special_SLLV;
- RSP_Special[5] = Compile_UnknownOpcode;
- RSP_Special[6] = Compile_Special_SRLV;
- RSP_Special[7] = Compile_Special_SRAV;
- RSP_Special[8] = Compile_Special_JR;
- RSP_Special[9] = Compile_Special_JALR;
- RSP_Special[10] = Compile_UnknownOpcode;
- RSP_Special[11] = Compile_UnknownOpcode;
- RSP_Special[12] = Compile_UnknownOpcode;
- RSP_Special[13] = Compile_Special_BREAK;
- RSP_Special[14] = Compile_UnknownOpcode;
- RSP_Special[15] = Compile_UnknownOpcode;
- RSP_Special[16] = Compile_UnknownOpcode;
- RSP_Special[17] = Compile_UnknownOpcode;
- RSP_Special[18] = Compile_UnknownOpcode;
- RSP_Special[19] = Compile_UnknownOpcode;
- RSP_Special[20] = Compile_UnknownOpcode;
- RSP_Special[21] = Compile_UnknownOpcode;
- RSP_Special[22] = Compile_UnknownOpcode;
- RSP_Special[23] = Compile_UnknownOpcode;
- RSP_Special[24] = Compile_UnknownOpcode;
- RSP_Special[25] = Compile_UnknownOpcode;
- RSP_Special[26] = Compile_UnknownOpcode;
- RSP_Special[27] = Compile_UnknownOpcode;
- RSP_Special[28] = Compile_UnknownOpcode;
- RSP_Special[29] = Compile_UnknownOpcode;
- RSP_Special[30] = Compile_UnknownOpcode;
- RSP_Special[31] = Compile_UnknownOpcode;
- RSP_Special[32] = Compile_Special_ADD;
- RSP_Special[33] = Compile_Special_ADDU;
- RSP_Special[34] = Compile_Special_SUB;
- RSP_Special[35] = Compile_Special_SUBU;
- RSP_Special[36] = Compile_Special_AND;
- RSP_Special[37] = Compile_Special_OR;
- RSP_Special[38] = Compile_Special_XOR;
- RSP_Special[39] = Compile_Special_NOR;
- RSP_Special[40] = Compile_UnknownOpcode;
- RSP_Special[41] = Compile_UnknownOpcode;
- RSP_Special[42] = Compile_Special_SLT;
- RSP_Special[43] = Compile_Special_SLTU;
- RSP_Special[44] = Compile_UnknownOpcode;
- RSP_Special[45] = Compile_UnknownOpcode;
- RSP_Special[46] = Compile_UnknownOpcode;
- RSP_Special[47] = Compile_UnknownOpcode;
- RSP_Special[48] = Compile_UnknownOpcode;
- RSP_Special[49] = Compile_UnknownOpcode;
- RSP_Special[50] = Compile_UnknownOpcode;
- RSP_Special[51] = Compile_UnknownOpcode;
- RSP_Special[52] = Compile_UnknownOpcode;
- RSP_Special[53] = Compile_UnknownOpcode;
- RSP_Special[54] = Compile_UnknownOpcode;
- RSP_Special[55] = Compile_UnknownOpcode;
- RSP_Special[56] = Compile_UnknownOpcode;
- RSP_Special[57] = Compile_UnknownOpcode;
- RSP_Special[58] = Compile_UnknownOpcode;
- RSP_Special[59] = Compile_UnknownOpcode;
- RSP_Special[60] = Compile_UnknownOpcode;
- RSP_Special[61] = Compile_UnknownOpcode;
- RSP_Special[62] = Compile_UnknownOpcode;
- RSP_Special[63] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[0] = Compile_Special_SLL;
+ RSP_Recomp_Special[1] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[2] = Compile_Special_SRL;
+ RSP_Recomp_Special[3] = Compile_Special_SRA;
+ RSP_Recomp_Special[4] = Compile_Special_SLLV;
+ RSP_Recomp_Special[5] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[6] = Compile_Special_SRLV;
+ RSP_Recomp_Special[7] = Compile_Special_SRAV;
+ RSP_Recomp_Special[8] = Compile_Special_JR;
+ RSP_Recomp_Special[9] = Compile_Special_JALR;
+ RSP_Recomp_Special[10] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[11] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[12] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[13] = Compile_Special_BREAK;
+ RSP_Recomp_Special[14] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[15] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[16] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[17] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[18] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[19] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[20] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[21] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[22] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[23] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[24] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[25] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[26] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[27] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[28] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[29] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[30] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[31] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[32] = Compile_Special_ADD;
+ RSP_Recomp_Special[33] = Compile_Special_ADDU;
+ RSP_Recomp_Special[34] = Compile_Special_SUB;
+ RSP_Recomp_Special[35] = Compile_Special_SUBU;
+ RSP_Recomp_Special[36] = Compile_Special_AND;
+ RSP_Recomp_Special[37] = Compile_Special_OR;
+ RSP_Recomp_Special[38] = Compile_Special_XOR;
+ RSP_Recomp_Special[39] = Compile_Special_NOR;
+ RSP_Recomp_Special[40] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[41] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[42] = Compile_Special_SLT;
+ RSP_Recomp_Special[43] = Compile_Special_SLTU;
+ RSP_Recomp_Special[44] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[45] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[46] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[47] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[48] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[49] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[50] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[51] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[52] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[53] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[54] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[55] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[56] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[57] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[58] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[59] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[60] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[61] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[62] = Compile_UnknownOpcode;
+ RSP_Recomp_Special[63] = Compile_UnknownOpcode;
- RSP_RegImm[0] = Compile_RegImm_BLTZ;
- RSP_RegImm[1] = Compile_RegImm_BGEZ;
- RSP_RegImm[2] = Compile_UnknownOpcode;
- RSP_RegImm[3] = Compile_UnknownOpcode;
- RSP_RegImm[4] = Compile_UnknownOpcode;
- RSP_RegImm[5] = Compile_UnknownOpcode;
- RSP_RegImm[6] = Compile_UnknownOpcode;
- RSP_RegImm[7] = Compile_UnknownOpcode;
- RSP_RegImm[8] = Compile_UnknownOpcode;
- RSP_RegImm[9] = Compile_UnknownOpcode;
- RSP_RegImm[10] = Compile_UnknownOpcode;
- RSP_RegImm[11] = Compile_UnknownOpcode;
- RSP_RegImm[12] = Compile_UnknownOpcode;
- RSP_RegImm[13] = Compile_UnknownOpcode;
- RSP_RegImm[14] = Compile_UnknownOpcode;
- RSP_RegImm[15] = Compile_UnknownOpcode;
- RSP_RegImm[16] = Compile_RegImm_BLTZAL;
- RSP_RegImm[17] = Compile_RegImm_BGEZAL;
- RSP_RegImm[18] = Compile_UnknownOpcode;
- RSP_RegImm[19] = Compile_UnknownOpcode;
- RSP_RegImm[20] = Compile_UnknownOpcode;
- RSP_RegImm[21] = Compile_UnknownOpcode;
- RSP_RegImm[22] = Compile_UnknownOpcode;
- RSP_RegImm[23] = Compile_UnknownOpcode;
- RSP_RegImm[24] = Compile_UnknownOpcode;
- RSP_RegImm[25] = Compile_UnknownOpcode;
- RSP_RegImm[26] = Compile_UnknownOpcode;
- RSP_RegImm[27] = Compile_UnknownOpcode;
- RSP_RegImm[28] = Compile_UnknownOpcode;
- RSP_RegImm[29] = Compile_UnknownOpcode;
- RSP_RegImm[30] = Compile_UnknownOpcode;
- RSP_RegImm[31] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[0] = Compile_RegImm_BLTZ;
+ RSP_Recomp_RegImm[1] = Compile_RegImm_BGEZ;
+ RSP_Recomp_RegImm[2] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[3] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[4] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[5] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[6] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[7] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[8] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[9] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[10] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[11] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[12] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[13] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[14] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[15] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[16] = Compile_RegImm_BLTZAL;
+ RSP_Recomp_RegImm[17] = Compile_RegImm_BGEZAL;
+ RSP_Recomp_RegImm[18] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[19] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[20] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[21] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[22] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[23] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[24] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[25] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[26] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[27] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[28] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[29] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[30] = Compile_UnknownOpcode;
+ RSP_Recomp_RegImm[31] = Compile_UnknownOpcode;
- RSP_Cop0[0] = Compile_Cop0_MF;
- RSP_Cop0[1] = Compile_UnknownOpcode;
- RSP_Cop0[2] = Compile_UnknownOpcode;
- RSP_Cop0[3] = Compile_UnknownOpcode;
- RSP_Cop0[4] = Compile_Cop0_MT;
- RSP_Cop0[5] = Compile_UnknownOpcode;
- RSP_Cop0[6] = Compile_UnknownOpcode;
- RSP_Cop0[7] = Compile_UnknownOpcode;
- RSP_Cop0[8] = Compile_UnknownOpcode;
- RSP_Cop0[9] = Compile_UnknownOpcode;
- RSP_Cop0[10] = Compile_UnknownOpcode;
- RSP_Cop0[11] = Compile_UnknownOpcode;
- RSP_Cop0[12] = Compile_UnknownOpcode;
- RSP_Cop0[13] = Compile_UnknownOpcode;
- RSP_Cop0[14] = Compile_UnknownOpcode;
- RSP_Cop0[15] = Compile_UnknownOpcode;
- RSP_Cop0[16] = Compile_UnknownOpcode;
- RSP_Cop0[17] = Compile_UnknownOpcode;
- RSP_Cop0[18] = Compile_UnknownOpcode;
- RSP_Cop0[19] = Compile_UnknownOpcode;
- RSP_Cop0[20] = Compile_UnknownOpcode;
- RSP_Cop0[21] = Compile_UnknownOpcode;
- RSP_Cop0[22] = Compile_UnknownOpcode;
- RSP_Cop0[23] = Compile_UnknownOpcode;
- RSP_Cop0[24] = Compile_UnknownOpcode;
- RSP_Cop0[25] = Compile_UnknownOpcode;
- RSP_Cop0[26] = Compile_UnknownOpcode;
- RSP_Cop0[27] = Compile_UnknownOpcode;
- RSP_Cop0[28] = Compile_UnknownOpcode;
- RSP_Cop0[29] = Compile_UnknownOpcode;
- RSP_Cop0[30] = Compile_UnknownOpcode;
- RSP_Cop0[31] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[0] = Compile_Cop0_MF;
+ RSP_Recomp_Cop0[1] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[2] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[3] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[4] = Compile_Cop0_MT;
+ RSP_Recomp_Cop0[5] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[6] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[7] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[8] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[9] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[10] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[11] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[12] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[13] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[14] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[15] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[16] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[17] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[18] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[19] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[20] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[21] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[22] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[23] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[24] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[25] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[26] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[27] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[28] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[29] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[30] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop0[31] = Compile_UnknownOpcode;
- RSP_Cop2[0] = Compile_Cop2_MF;
- RSP_Cop2[1] = Compile_UnknownOpcode;
- RSP_Cop2[2] = Compile_Cop2_CF;
- RSP_Cop2[3] = Compile_UnknownOpcode;
- RSP_Cop2[4] = Compile_Cop2_MT;
- RSP_Cop2[5] = Compile_UnknownOpcode;
- RSP_Cop2[6] = Compile_Cop2_CT;
- RSP_Cop2[7] = Compile_UnknownOpcode;
- RSP_Cop2[8] = Compile_UnknownOpcode;
- RSP_Cop2[9] = Compile_UnknownOpcode;
- RSP_Cop2[10] = Compile_UnknownOpcode;
- RSP_Cop2[11] = Compile_UnknownOpcode;
- RSP_Cop2[12] = Compile_UnknownOpcode;
- RSP_Cop2[13] = Compile_UnknownOpcode;
- RSP_Cop2[14] = Compile_UnknownOpcode;
- RSP_Cop2[15] = Compile_UnknownOpcode;
- RSP_Cop2[16] = Compile_COP2_VECTOR;
- RSP_Cop2[17] = Compile_COP2_VECTOR;
- RSP_Cop2[18] = Compile_COP2_VECTOR;
- RSP_Cop2[19] = Compile_COP2_VECTOR;
- RSP_Cop2[20] = Compile_COP2_VECTOR;
- RSP_Cop2[21] = Compile_COP2_VECTOR;
- RSP_Cop2[22] = Compile_COP2_VECTOR;
- RSP_Cop2[23] = Compile_COP2_VECTOR;
- RSP_Cop2[24] = Compile_COP2_VECTOR;
- RSP_Cop2[25] = Compile_COP2_VECTOR;
- RSP_Cop2[26] = Compile_COP2_VECTOR;
- RSP_Cop2[27] = Compile_COP2_VECTOR;
- RSP_Cop2[28] = Compile_COP2_VECTOR;
- RSP_Cop2[29] = Compile_COP2_VECTOR;
- RSP_Cop2[30] = Compile_COP2_VECTOR;
- RSP_Cop2[31] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[0] = Compile_Cop2_MF;
+ RSP_Recomp_Cop2[1] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[2] = Compile_Cop2_CF;
+ RSP_Recomp_Cop2[3] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[4] = Compile_Cop2_MT;
+ RSP_Recomp_Cop2[5] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[6] = Compile_Cop2_CT;
+ RSP_Recomp_Cop2[7] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[8] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[9] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[10] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[11] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[12] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[13] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[14] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[15] = Compile_UnknownOpcode;
+ RSP_Recomp_Cop2[16] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[17] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[18] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[19] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[20] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[21] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[22] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[23] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[24] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[25] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[26] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[27] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[28] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[29] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[30] = Compile_COP2_VECTOR;
+ RSP_Recomp_Cop2[31] = Compile_COP2_VECTOR;
- RSP_Vector[0] = Compile_Vector_VMULF;
- RSP_Vector[1] = Compile_Vector_VMULU;
- RSP_Vector[2] = Compile_Vector_VRNDP;
- RSP_Vector[3] = Compile_Vector_VMULQ;
- RSP_Vector[4] = Compile_Vector_VMUDL;
- RSP_Vector[5] = Compile_Vector_VMUDM;
- RSP_Vector[6] = Compile_Vector_VMUDN;
- RSP_Vector[7] = Compile_Vector_VMUDH;
- RSP_Vector[8] = Compile_Vector_VMACF;
- RSP_Vector[9] = Compile_Vector_VMACU;
- RSP_Vector[10] = Compile_Vector_VRNDN;
- RSP_Vector[11] = Compile_Vector_VMACQ;
- RSP_Vector[12] = Compile_Vector_VMADL;
- RSP_Vector[13] = Compile_Vector_VMADM;
- RSP_Vector[14] = Compile_Vector_VMADN;
- RSP_Vector[15] = Compile_Vector_VMADH;
- RSP_Vector[16] = Compile_Vector_VADD;
- RSP_Vector[17] = Compile_Vector_VSUB;
- RSP_Vector[18] = Compile_Vector_Reserved;
- RSP_Vector[19] = Compile_Vector_VABS;
- RSP_Vector[20] = Compile_Vector_VADDC;
- RSP_Vector[21] = Compile_Vector_VSUBC;
- RSP_Vector[22] = Compile_Vector_Reserved;
- RSP_Vector[23] = Compile_Vector_Reserved;
- RSP_Vector[24] = Compile_Vector_Reserved;
- RSP_Vector[25] = Compile_Vector_Reserved;
- RSP_Vector[26] = Compile_Vector_Reserved;
- RSP_Vector[27] = Compile_Vector_Reserved;
- RSP_Vector[28] = Compile_Vector_Reserved;
- RSP_Vector[29] = Compile_Vector_VSAW;
- RSP_Vector[30] = Compile_Vector_Reserved;
- RSP_Vector[31] = Compile_Vector_Reserved;
- RSP_Vector[32] = Compile_Vector_VLT;
- RSP_Vector[33] = Compile_Vector_VEQ;
- RSP_Vector[34] = Compile_Vector_VNE;
- RSP_Vector[35] = Compile_Vector_VGE;
- RSP_Vector[36] = Compile_Vector_VCL;
- RSP_Vector[37] = Compile_Vector_VCH;
- RSP_Vector[38] = Compile_Vector_VCR;
- RSP_Vector[39] = Compile_Vector_VMRG;
- RSP_Vector[40] = Compile_Vector_VAND;
- RSP_Vector[41] = Compile_Vector_VNAND;
- RSP_Vector[42] = Compile_Vector_VOR;
- RSP_Vector[43] = Compile_Vector_VNOR;
- RSP_Vector[44] = Compile_Vector_VXOR;
- RSP_Vector[45] = Compile_Vector_VNXOR;
- RSP_Vector[46] = Compile_Vector_Reserved;
- RSP_Vector[47] = Compile_Vector_Reserved;
- RSP_Vector[48] = Compile_Vector_VRCP;
- RSP_Vector[49] = Compile_Vector_VRCPL;
- RSP_Vector[50] = Compile_Vector_VRCPH;
- RSP_Vector[51] = Compile_Vector_VMOV;
- RSP_Vector[52] = Compile_Vector_VRSQ;
- RSP_Vector[53] = Compile_Vector_VRSQL;
- RSP_Vector[54] = Compile_Vector_VRSQH;
- RSP_Vector[55] = Compile_Vector_VNOOP;
- RSP_Vector[56] = Compile_Vector_Reserved;
- RSP_Vector[57] = Compile_Vector_Reserved;
- RSP_Vector[58] = Compile_Vector_Reserved;
- RSP_Vector[59] = Compile_Vector_Reserved;
- RSP_Vector[60] = Compile_Vector_Reserved;
- RSP_Vector[61] = Compile_Vector_Reserved;
- RSP_Vector[62] = Compile_Vector_Reserved;
- RSP_Vector[63] = Compile_Vector_VNOOP;
+ RSP_Recomp_Vector[0] = Compile_Vector_VMULF;
+ RSP_Recomp_Vector[1] = Compile_Vector_VMULU;
+ RSP_Recomp_Vector[2] = Compile_Vector_VRNDP;
+ RSP_Recomp_Vector[3] = Compile_Vector_VMULQ;
+ RSP_Recomp_Vector[4] = Compile_Vector_VMUDL;
+ RSP_Recomp_Vector[5] = Compile_Vector_VMUDM;
+ RSP_Recomp_Vector[6] = Compile_Vector_VMUDN;
+ RSP_Recomp_Vector[7] = Compile_Vector_VMUDH;
+ RSP_Recomp_Vector[8] = Compile_Vector_VMACF;
+ RSP_Recomp_Vector[9] = Compile_Vector_VMACU;
+ RSP_Recomp_Vector[10] = Compile_Vector_VRNDN;
+ RSP_Recomp_Vector[11] = Compile_Vector_VMACQ;
+ RSP_Recomp_Vector[12] = Compile_Vector_VMADL;
+ RSP_Recomp_Vector[13] = Compile_Vector_VMADM;
+ RSP_Recomp_Vector[14] = Compile_Vector_VMADN;
+ RSP_Recomp_Vector[15] = Compile_Vector_VMADH;
+ RSP_Recomp_Vector[16] = Compile_Vector_VADD;
+ RSP_Recomp_Vector[17] = Compile_Vector_VSUB;
+ RSP_Recomp_Vector[18] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[19] = Compile_Vector_VABS;
+ RSP_Recomp_Vector[20] = Compile_Vector_VADDC;
+ RSP_Recomp_Vector[21] = Compile_Vector_VSUBC;
+ RSP_Recomp_Vector[22] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[23] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[24] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[25] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[26] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[27] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[28] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[29] = Compile_Vector_VSAW;
+ RSP_Recomp_Vector[30] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[31] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[32] = Compile_Vector_VLT;
+ RSP_Recomp_Vector[33] = Compile_Vector_VEQ;
+ RSP_Recomp_Vector[34] = Compile_Vector_VNE;
+ RSP_Recomp_Vector[35] = Compile_Vector_VGE;
+ RSP_Recomp_Vector[36] = Compile_Vector_VCL;
+ RSP_Recomp_Vector[37] = Compile_Vector_VCH;
+ RSP_Recomp_Vector[38] = Compile_Vector_VCR;
+ RSP_Recomp_Vector[39] = Compile_Vector_VMRG;
+ RSP_Recomp_Vector[40] = Compile_Vector_VAND;
+ RSP_Recomp_Vector[41] = Compile_Vector_VNAND;
+ RSP_Recomp_Vector[42] = Compile_Vector_VOR;
+ RSP_Recomp_Vector[43] = Compile_Vector_VNOR;
+ RSP_Recomp_Vector[44] = Compile_Vector_VXOR;
+ RSP_Recomp_Vector[45] = Compile_Vector_VNXOR;
+ RSP_Recomp_Vector[46] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[47] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[48] = Compile_Vector_VRCP;
+ RSP_Recomp_Vector[49] = Compile_Vector_VRCPL;
+ RSP_Recomp_Vector[50] = Compile_Vector_VRCPH;
+ RSP_Recomp_Vector[51] = Compile_Vector_VMOV;
+ RSP_Recomp_Vector[52] = Compile_Vector_VRSQ;
+ RSP_Recomp_Vector[53] = Compile_Vector_VRSQL;
+ RSP_Recomp_Vector[54] = Compile_Vector_VRSQH;
+ RSP_Recomp_Vector[55] = Compile_Vector_VNOOP;
+ RSP_Recomp_Vector[56] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[57] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[58] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[59] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[60] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[61] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[62] = Compile_Vector_Reserved;
+ RSP_Recomp_Vector[63] = Compile_Vector_VNOOP;
- RSP_Lc2[0] = Compile_Opcode_LBV;
- RSP_Lc2[1] = Compile_Opcode_LSV;
- RSP_Lc2[2] = Compile_Opcode_LLV;
- RSP_Lc2[3] = Compile_Opcode_LDV;
- RSP_Lc2[4] = Compile_Opcode_LQV;
- RSP_Lc2[5] = Compile_Opcode_LRV;
- RSP_Lc2[6] = Compile_Opcode_LPV;
- RSP_Lc2[7] = Compile_Opcode_LUV;
- RSP_Lc2[8] = Compile_Opcode_LHV;
- RSP_Lc2[9] = Compile_Opcode_LFV;
- RSP_Lc2[10] = Compile_Opcode_LWV;
- RSP_Lc2[11] = Compile_Opcode_LTV;
- RSP_Lc2[12] = Compile_UnknownOpcode;
- RSP_Lc2[13] = Compile_UnknownOpcode;
- RSP_Lc2[14] = Compile_UnknownOpcode;
- RSP_Lc2[15] = Compile_UnknownOpcode;
- RSP_Lc2[16] = Compile_UnknownOpcode;
- RSP_Lc2[17] = Compile_UnknownOpcode;
- RSP_Lc2[18] = Compile_UnknownOpcode;
- RSP_Lc2[19] = Compile_UnknownOpcode;
- RSP_Lc2[20] = Compile_UnknownOpcode;
- RSP_Lc2[21] = Compile_UnknownOpcode;
- RSP_Lc2[22] = Compile_UnknownOpcode;
- RSP_Lc2[23] = Compile_UnknownOpcode;
- RSP_Lc2[24] = Compile_UnknownOpcode;
- RSP_Lc2[25] = Compile_UnknownOpcode;
- RSP_Lc2[26] = Compile_UnknownOpcode;
- RSP_Lc2[27] = Compile_UnknownOpcode;
- RSP_Lc2[28] = Compile_UnknownOpcode;
- RSP_Lc2[29] = Compile_UnknownOpcode;
- RSP_Lc2[30] = Compile_UnknownOpcode;
- RSP_Lc2[31] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[0] = Compile_Opcode_LBV;
+ RSP_Recomp_Lc2[1] = Compile_Opcode_LSV;
+ RSP_Recomp_Lc2[2] = Compile_Opcode_LLV;
+ RSP_Recomp_Lc2[3] = Compile_Opcode_LDV;
+ RSP_Recomp_Lc2[4] = Compile_Opcode_LQV;
+ RSP_Recomp_Lc2[5] = Compile_Opcode_LRV;
+ RSP_Recomp_Lc2[6] = Compile_Opcode_LPV;
+ RSP_Recomp_Lc2[7] = Compile_Opcode_LUV;
+ RSP_Recomp_Lc2[8] = Compile_Opcode_LHV;
+ RSP_Recomp_Lc2[9] = Compile_Opcode_LFV;
+ RSP_Recomp_Lc2[10] = Compile_Opcode_LWV;
+ RSP_Recomp_Lc2[11] = Compile_Opcode_LTV;
+ RSP_Recomp_Lc2[12] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[13] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[14] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[15] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[16] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[17] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[18] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[19] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[20] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[21] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[22] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[23] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[24] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[25] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[26] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[27] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[28] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[29] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[30] = Compile_UnknownOpcode;
+ RSP_Recomp_Lc2[31] = Compile_UnknownOpcode;
- RSP_Sc2[0] = Compile_Opcode_SBV;
- RSP_Sc2[1] = Compile_Opcode_SSV;
- RSP_Sc2[2] = Compile_Opcode_SLV;
- RSP_Sc2[3] = Compile_Opcode_SDV;
- RSP_Sc2[4] = Compile_Opcode_SQV;
- RSP_Sc2[5] = Compile_Opcode_SRV;
- RSP_Sc2[6] = Compile_Opcode_SPV;
- RSP_Sc2[7] = Compile_Opcode_SUV;
- RSP_Sc2[8] = Compile_Opcode_SHV;
- RSP_Sc2[9] = Compile_Opcode_SFV;
- RSP_Sc2[10] = Compile_Opcode_SWV;
- RSP_Sc2[11] = Compile_Opcode_STV;
- RSP_Sc2[12] = Compile_UnknownOpcode;
- RSP_Sc2[13] = Compile_UnknownOpcode;
- RSP_Sc2[14] = Compile_UnknownOpcode;
- RSP_Sc2[15] = Compile_UnknownOpcode;
- RSP_Sc2[16] = Compile_UnknownOpcode;
- RSP_Sc2[17] = Compile_UnknownOpcode;
- RSP_Sc2[18] = Compile_UnknownOpcode;
- RSP_Sc2[19] = Compile_UnknownOpcode;
- RSP_Sc2[20] = Compile_UnknownOpcode;
- RSP_Sc2[21] = Compile_UnknownOpcode;
- RSP_Sc2[22] = Compile_UnknownOpcode;
- RSP_Sc2[23] = Compile_UnknownOpcode;
- RSP_Sc2[24] = Compile_UnknownOpcode;
- RSP_Sc2[25] = Compile_UnknownOpcode;
- RSP_Sc2[26] = Compile_UnknownOpcode;
- RSP_Sc2[27] = Compile_UnknownOpcode;
- RSP_Sc2[28] = Compile_UnknownOpcode;
- RSP_Sc2[29] = Compile_UnknownOpcode;
- RSP_Sc2[30] = Compile_UnknownOpcode;
- RSP_Sc2[31] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[0] = Compile_Opcode_SBV;
+ RSP_Recomp_Sc2[1] = Compile_Opcode_SSV;
+ RSP_Recomp_Sc2[2] = Compile_Opcode_SLV;
+ RSP_Recomp_Sc2[3] = Compile_Opcode_SDV;
+ RSP_Recomp_Sc2[4] = Compile_Opcode_SQV;
+ RSP_Recomp_Sc2[5] = Compile_Opcode_SRV;
+ RSP_Recomp_Sc2[6] = Compile_Opcode_SPV;
+ RSP_Recomp_Sc2[7] = Compile_Opcode_SUV;
+ RSP_Recomp_Sc2[8] = Compile_Opcode_SHV;
+ RSP_Recomp_Sc2[9] = Compile_Opcode_SFV;
+ RSP_Recomp_Sc2[10] = Compile_Opcode_SWV;
+ RSP_Recomp_Sc2[11] = Compile_Opcode_STV;
+ RSP_Recomp_Sc2[12] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[13] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[14] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[15] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[16] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[17] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[18] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[19] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[20] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[21] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[22] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[23] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[24] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[25] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[26] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[27] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[28] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[29] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[30] = Compile_UnknownOpcode;
+ RSP_Recomp_Sc2[31] = Compile_UnknownOpcode;
BlockID = 0;
ChangedPC = false;
@@ -874,7 +874,7 @@ void CompilerRSPBlock(void)
}
else
{
- RSP_Opcode[RSPOpC.op]();
+ RSP_Recomp_Opcode[RSPOpC.op]();
}
switch (NextInstruction)
diff --git a/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.cpp b/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.cpp
index 47e8aecb2..040e9ad5a 100644
--- a/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.cpp
+++ b/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.cpp
@@ -4,6 +4,7 @@
#include "X86.h"
#include
#include
+#include
#include
#include
#include
@@ -11,6 +12,7 @@
#include
#include
#include
+#include
#include
#pragma warning(disable : 4152) // Non-standard extension, function/data pointer conversion in expression
@@ -87,6 +89,15 @@ uint32_t BranchCompare = 0;
#define CompileSlv
#endif
+p_Recompfunc RSP_Recomp_Opcode[64];
+p_Recompfunc RSP_Recomp_RegImm[32];
+p_Recompfunc RSP_Recomp_Special[64];
+p_Recompfunc RSP_Recomp_Cop0[32];
+p_Recompfunc RSP_Recomp_Cop2[32];
+p_Recompfunc RSP_Recomp_Vector[64];
+p_Recompfunc RSP_Recomp_Lc2[32];
+p_Recompfunc RSP_Recomp_Sc2[32];
+
void Branch_AddRef(uint32_t Target, uint32_t * X86Loc)
{
if (CurrentBlock.ResolveCount >= 150)
@@ -112,17 +123,19 @@ void Branch_AddRef(uint32_t Target, uint32_t * X86Loc)
}
}
-void Cheat_r4300iOpcode(p_func FunctAddress, const char * FunctName)
+void Cheat_r4300iOpcode(RSPOp::Func FunctAddress, const char * FunctName)
{
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
MoveConstToVariable(RSPOpC.Value, &RSPOpC.Value, "RSPOpC.Value");
- Call_Direct((void *)FunctAddress, FunctName);
+ MoveConstToX86reg((uint32_t)&RSPSystem, x86_ECX);
+ Call_Direct(AddressOf(FunctAddress), FunctName);
}
-void Cheat_r4300iOpcodeNoMessage(p_func FunctAddress, const char * FunctName)
+void Cheat_r4300iOpcodeNoMessage(RSPOp::Func FunctAddress, const char * FunctName)
{
MoveConstToVariable(RSPOpC.Value, &RSPOpC.Value, "RSPOpC.Value");
- Call_Direct((void *)FunctAddress, FunctName);
+ MoveConstToX86reg((uint32_t)&RSPSystem, x86_ECX);
+ Call_Direct(AddressOf(FunctAddress), FunctName);
}
void x86_SetBranch8b(void * JumpByte, void * Destination)
@@ -174,12 +187,12 @@ void CompileBranchExit(uint32_t TargetPC, uint32_t ContinuePC)
void Compile_SPECIAL(void)
{
- RSP_Special[RSPOpC.funct]();
+ RSP_Recomp_Special[RSPOpC.funct]();
}
void Compile_REGIMM(void)
{
- RSP_RegImm[RSPOpC.rt]();
+ RSP_Recomp_RegImm[RSPOpC.rt]();
}
void Compile_J(void)
@@ -539,7 +552,7 @@ void Compile_ADDI(void)
return;
}
#ifndef Compile_Immediates
- Cheat_r4300iOpcode(RSP_Opcode_ADDI, "RSP_Opcode_ADDI");
+ Cheat_r4300iOpcode(&RSPOp::ADDI, "RSPOp::ADDI");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -579,7 +592,7 @@ void Compile_ADDIU(void)
return;
}
#ifndef Compile_Immediates
- Cheat_r4300iOpcode(RSP_Opcode_ADDIU, "RSP_Opcode_ADDIU");
+ Cheat_r4300iOpcode(&RSPOp::ADDIU, "RSPOp::ADDIU");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -616,7 +629,7 @@ void Compile_SLTI(void)
return;
}
#ifndef Compile_Immediates
- Cheat_r4300iOpcode(RSP_Opcode_SLTI, "RSP_Opcode_SLTI");
+ Cheat_r4300iOpcode(&RSPOp::SLTI, "&RSPOp::SLTI");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -644,7 +657,7 @@ void Compile_SLTIU(void)
return;
}
#ifndef Compile_Immediates
- Cheat_r4300iOpcode(RSP_Opcode_SLTIU, "RSP_Opcode_SLTIU");
+ Cheat_r4300iOpcode(&RSPOp::SLTIU, "RSPOp::SLTIU");
#else
int Immediate;
@@ -666,7 +679,7 @@ void Compile_ANDI(void)
return;
}
#ifndef Compile_Immediates
- Cheat_r4300iOpcode(RSP_Opcode_ANDI, "RSP_Opcode_ANDI");
+ Cheat_r4300iOpcode(&RSPOp::ANDI, "RSPOp::ANDI");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -701,7 +714,7 @@ void Compile_ORI(void)
return;
}
#ifndef Compile_Immediates
- Cheat_r4300iOpcode(RSP_Opcode_ORI, "RSP_Opcode_ORI");
+ Cheat_r4300iOpcode(&RSPOp::ORI, "RSPOp::ORI");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -734,7 +747,7 @@ void Compile_XORI(void)
return;
}
#ifndef Compile_Immediates
- Cheat_r4300iOpcode(RSP_Opcode_XORI, "RSP_Opcode_XORI");
+ Cheat_r4300iOpcode(&RSPOp::XORI, "RSPOp::XORI");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -767,7 +780,7 @@ void Compile_LUI(void)
return;
}
#ifndef Compile_Immediates
- Cheat_r4300iOpcode(RSP_Opcode_LUI, "RSP_Opcode_LUI");
+ Cheat_r4300iOpcode(&RSPOp::LUI, "RSPOp::LUI");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -778,12 +791,12 @@ void Compile_LUI(void)
void Compile_COP0(void)
{
- RSP_Cop0[RSPOpC.rs]();
+ RSP_Recomp_Cop0[RSPOpC.rs]();
}
void Compile_COP2(void)
{
- RSP_Cop2[RSPOpC.rs]();
+ RSP_Recomp_Cop2[RSPOpC.rs]();
}
void Compile_LB(void)
@@ -794,7 +807,7 @@ void Compile_LB(void)
return;
}
#ifndef Compile_GPRLoads
- Cheat_r4300iOpcode(RSP_Opcode_LB, "RSP_Opcode_LB");
+ Cheat_r4300iOpcode(&RSPOp::LB, "RSPOp::LB");
#else
int Offset = (short)RSPOpC.offset;
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -830,7 +843,7 @@ void Compile_LH(void)
}
#ifndef Compile_GPRLoads
- Cheat_r4300iOpcode(RSP_Opcode_LH, "RSP_Opcode_LH");
+ Cheat_r4300iOpcode(&RSPOp::LH, "RSPOp::LH");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -846,7 +859,7 @@ void Compile_LH(void)
if ((Addr & 2) == 0)
{
CompilerWarning(stdstr_f("Unaligned LH at constant address PC = %04X", CompilePC).c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LH, "RSP_Opcode_LH");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LH, "RSPOp::LH");
}
else
{
@@ -879,7 +892,7 @@ void Compile_LH(void)
CPU_Message(" Unaligned:");
x86_SetBranch32b(Jump[0], RecompPos);
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LH, "RSP_Opcode_LH");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LH, "RSPOp::LH");
JmpLabel32("Done", 0);
Jump[1] = RecompPos - 4;
@@ -905,7 +918,7 @@ void Compile_LW(void)
}
#ifndef Compile_GPRLoads
- Cheat_r4300iOpcode(RSP_Opcode_LW, "RSP_Opcode_LW");
+ Cheat_r4300iOpcode(&RSPOp::LW, "RSPOp::LW");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -918,7 +931,7 @@ void Compile_LW(void)
if ((Addr & 1) != 0)
{
CompilerWarning(stdstr_f("Unaligned LW at constant address PC = %04X", CompilePC).c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LW, "RSP_Opcode_LW");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LW, "RSPOp::LW");
}
else if ((Addr & 2) != 0)
{
@@ -995,7 +1008,7 @@ void Compile_LBU(void)
}
#ifndef Compile_GPRLoads
- Cheat_r4300iOpcode(RSP_Opcode_LBU, "RSP_Opcode_LBU");
+ Cheat_r4300iOpcode(&RSPOp::LBU, "RSPOp::LBU");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1033,7 +1046,7 @@ void Compile_LHU(void)
}
#ifndef Compile_GPRLoads
- Cheat_r4300iOpcode(RSP_Opcode_LHU, "RSP_Opcode_LHU");
+ Cheat_r4300iOpcode(&RSPOp::LHU, "RSPOp::LHU");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1050,7 +1063,7 @@ void Compile_LHU(void)
if ((Addr & 2) == 0)
{
CompilerWarning(stdstr_f("Unaligned LHU at constant address PC = %04X", CompilePC).c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LHU, "RSP_Opcode_LHU");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LHU, "RSPOp::LHU");
}
else
{
@@ -1085,7 +1098,7 @@ void Compile_LHU(void)
CompilerToggleBuffer();
CPU_Message(" Unaligned:");
x86_SetBranch32b(Jump[0], RecompPos);
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LHU, "RSP_Opcode_LHU");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LHU, "RSPOp::LHU");
JmpLabel32("Done", 0);
Jump[1] = RecompPos - 4;
CompilerToggleBuffer();
@@ -1107,13 +1120,13 @@ void Compile_LWU(void)
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
return;
}
- Cheat_r4300iOpcode(RSP_Opcode_LWU, "RSP_Opcode_LWU");
+ Cheat_r4300iOpcode(&RSPOp::LWU, "RSPOp::LWU");
}
void Compile_SB(void)
{
#ifndef Compile_GPRStores
- Cheat_r4300iOpcode(RSP_Opcode_SB, "RSP_Opcode_SB");
+ Cheat_r4300iOpcode(&RSPOp::SB, "RSPOp::SB");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1165,7 +1178,7 @@ void Compile_SB(void)
void Compile_SH(void)
{
#ifndef Compile_GPRStores
- Cheat_r4300iOpcode(RSP_Opcode_SH, "RSP_Opcode_SH");
+ Cheat_r4300iOpcode(&RSPOp::SH, "&RSPOp::SH");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1179,7 +1192,7 @@ void Compile_SH(void)
if ((Offset & 1) != 0)
{
CompilerWarning(stdstr_f("Unaligned SH at constant address PC = %04X", CompilePC).c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SH, "RSP_Opcode_SH");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::SH, "RSPOp::SH");
return;
}
else
@@ -1238,7 +1251,7 @@ void Compile_SH(void)
void Compile_SW(void)
{
#ifndef Compile_GPRStores
- Cheat_r4300iOpcode(RSP_Opcode_SW, "RSP_Opcode_SW");
+ Cheat_r4300iOpcode(&RSPOp::SW, "&RSPOp::SW");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1271,7 +1284,7 @@ void Compile_SW(void)
else
{
CompilerWarning(stdstr_f("Unaligned SW at constant address PC = %04X", CompilePC).c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SW, "RSP_Opcode_SW");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::SW, "RSPOp::SW");
}
return;
}
@@ -1351,12 +1364,12 @@ void Compile_SW(void)
void Compile_LC2(void)
{
- RSP_Lc2[RSPOpC.rd]();
+ RSP_Recomp_Lc2[RSPOpC.rd]();
}
void Compile_SC2(void)
{
- RSP_Sc2[RSPOpC.rd]();
+ RSP_Recomp_Sc2[RSPOpC.rd]();
}
// R4300i Opcodes: Special
@@ -1369,7 +1382,7 @@ void Compile_Special_SLL(void)
return;
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_SLL, "RSP_Special_SLL");
+ Cheat_r4300iOpcode(&RSPOp::Special_SLL, "RSPOp::Special_SLL");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1394,7 +1407,7 @@ void Compile_Special_SRL(void)
return;
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_SRL, "RSP_Special_SRL");
+ Cheat_r4300iOpcode(&RSPOp::Special_SRL, "RSPOp::Special_SRL");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1419,7 +1432,7 @@ void Compile_Special_SRA(void)
return;
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_SRA, "RSP_Special_SRA");
+ Cheat_r4300iOpcode(&RSPOp::Special_SRA, "RSPOp::Special_SRA");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1443,7 +1456,7 @@ void Compile_Special_SLLV(void)
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
return;
}
- Cheat_r4300iOpcode(RSP_Special_SLLV, "RSP_Special_SLLV");
+ Cheat_r4300iOpcode(&RSPOp::Special_SLLV, "RSPOp::Special_SLLV");
}
void Compile_Special_SRLV(void)
@@ -1454,7 +1467,7 @@ void Compile_Special_SRLV(void)
return;
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_SRLV, "RSP_Special_SRLV");
+ Cheat_r4300iOpcode(&RSPOp::Special_SRLV, "RSPOp::Special_SRLV");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1473,7 +1486,7 @@ void Compile_Special_SRAV(void)
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
return;
}
- Cheat_r4300iOpcode(RSP_Special_SRAV, "RSP_Special_SRAV");
+ Cheat_r4300iOpcode(&RSPOp::Special_SRAV, "RSPOp::Special_SRAV");
}
void UpdateAudioTimer()
@@ -1585,7 +1598,7 @@ void Compile_Special_JALR(void)
void Compile_Special_BREAK(void)
{
- Cheat_r4300iOpcode(RSP_Special_BREAK, "RSP_Special_BREAK");
+ Cheat_r4300iOpcode(&RSPOp::Special_BREAK, "RSPOp::Special_BREAK");
if (NextInstruction == RSPPIPELINE_NORMAL)
{
MoveConstToVariable(CompilePC + 4, PrgCount, "RSP PC");
@@ -1611,7 +1624,7 @@ void Compile_Special_ADD(void)
return;
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_ADD, "RSP_Special_ADD");
+ Cheat_r4300iOpcode(&RSPOp::Special_ADD, "RSPOp::Special_ADD");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1658,7 +1671,7 @@ void Compile_Special_ADDU(void)
return;
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_ADDU, "RSP_Special_ADDU");
+ Cheat_r4300iOpcode(&RSPOp::Special_ADDU, "RSPOp::Special_ADDU");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1706,7 +1719,7 @@ void Compile_Special_SUB(void)
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_SUB, "RSP_Special_SUB");
+ Cheat_r4300iOpcode(&RSPOp::Special_SUB, "RSPOp::Special_SUB");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1737,7 +1750,7 @@ void Compile_Special_SUBU(void)
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_SUBU, "RSP_Special_SUBU");
+ Cheat_r4300iOpcode(&RSPOp::Special_SUBU, "RSPOp::Special_SUBU");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1768,7 +1781,7 @@ void Compile_Special_AND(void)
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_AND, "RSP_Special_AND");
+ Cheat_r4300iOpcode(&RSPOp::Special_AND, "RSPOp::Special_AND");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1805,7 +1818,7 @@ void Compile_Special_OR(void)
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_OR, "RSP_Special_OR");
+ Cheat_r4300iOpcode(RSPOp::Special_OR, "RSPOp::Special_OR");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1847,7 +1860,7 @@ void Compile_Special_XOR(void)
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_XOR, "RSP_Special_XOR");
+ Cheat_r4300iOpcode(&RSPOp::Special_XOR, "RSPOp::Special_XOR");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1881,7 +1894,7 @@ void Compile_Special_NOR(void)
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
return;
}
- Cheat_r4300iOpcode(RSP_Special_NOR, "RSP_Special_NOR");
+ Cheat_r4300iOpcode(&RSPOp::Special_NOR, "RSPOp::Special_NOR");
}
void Compile_Special_SLT(void)
@@ -1892,7 +1905,7 @@ void Compile_Special_SLT(void)
return;
}
#ifndef Compile_Special
- Cheat_r4300iOpcode(RSP_Special_SLT, "RSP_Special_SLT");
+ Cheat_r4300iOpcode(&RSPOp::Special_SLT, "RSPOp::Special_SLT");
#else
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -1933,7 +1946,7 @@ void Compile_Special_SLTU(void)
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
return;
}
- Cheat_r4300iOpcode(RSP_Special_SLTU, "RSP_Special_SLTU");
+ Cheat_r4300iOpcode(&RSPOp::Special_SLTU, "RSPOp::Special_SLTU");
}
// R4300i Opcodes: RegImm
@@ -2424,7 +2437,7 @@ void Compile_Cop0_MT(void)
break;
default:
- Cheat_r4300iOpcode(RSP_Cop0_MT, "RSP_Cop0_MT");
+ Cheat_r4300iOpcode(&RSPOp::Cop0_MT, "RSPOp::Cop0_MT");
break;
}
#else
@@ -2596,7 +2609,7 @@ void Compile_Cop2_CT(void)
void Compile_COP2_VECTOR(void)
{
- RSP_Vector[RSPOpC.funct]();
+ RSP_Recomp_Vector[RSPOpC.funct]();
}
// Vector functions
@@ -2791,7 +2804,7 @@ bool Compile_Vector_VMULF_MMX(void)
void Compile_Vector_VMULF(void)
{
#ifndef CompileVmulf
- Cheat_r4300iOpcode(RSP_Vector_VMULF, "RSP_Vector_VMULF");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMULF, "&RSPOp::Vector_VMULF");
#else
char Reg[256];
uint8_t count, el, del;
@@ -2878,22 +2891,22 @@ void Compile_Vector_VMULF(void)
void Compile_Vector_VMULU(void)
{
- Cheat_r4300iOpcode(RSP_Vector_VMULU, "RSP_Vector_VMULU");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMULU, "RSPOp::Vector_VMULU");
}
void Compile_Vector_VRNDN(void)
{
- Cheat_r4300iOpcode(RSP_Vector_VRNDN, "RSP_Vector_VRNDN");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VRNDN, "RSPOp::Vector_VRNDN");
}
void Compile_Vector_VRNDP(void)
{
- Cheat_r4300iOpcode(RSP_Vector_VRNDP, "RSP_Vector_VRNDP");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VRNDP, "RSPOp::Vector_VRNDP");
}
void Compile_Vector_VMULQ(void)
{
- Cheat_r4300iOpcode(RSP_Vector_VMULQ, "RSP_Vector_VMULQ");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMULQ, "&RSPOp::Vector_VMULQ");
}
bool Compile_Vector_VMUDL_MMX(void)
@@ -2956,7 +2969,7 @@ bool Compile_Vector_VMUDL_MMX(void)
void Compile_Vector_VMUDL(void)
{
#ifndef CompileVmudl
- Cheat_r4300iOpcode(RSP_Vector_VMUDL, "RSP_Vector_VMUDL");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMUDL, "&RSPOp::Vector_VMUDL");
#else
char Reg[256];
uint8_t count, el, del;
@@ -3109,7 +3122,7 @@ bool Compile_Vector_VMUDM_MMX(void)
void Compile_Vector_VMUDM(void)
{
#ifndef CompileVmudm
- Cheat_r4300iOpcode(RSP_Vector_VMUDM, "RSP_Vector_VMUDM");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMUDM, "&RSPOp::Vector_VMUDM");
#else
char Reg[256];
uint8_t count, el, del;
@@ -3255,7 +3268,7 @@ bool Compile_Vector_VMUDN_MMX(void)
void Compile_Vector_VMUDN(void)
{
#ifndef CompileVmudn
- Cheat_r4300iOpcode(RSP_Vector_VMUDN, "RSP_Vector_VMUDN");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMUDN, "RSPOp::Vector_VMUDN");
#else
char Reg[256];
uint8_t count, el, del;
@@ -3409,7 +3422,7 @@ bool Compile_Vector_VMUDH_MMX(void)
void Compile_Vector_VMUDH(void)
{
#ifndef CompileVmudh
- Cheat_r4300iOpcode(RSP_Vector_VMUDH, "RSP_Vector_VMUDH");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMUDH, "RSPOp::Vector_VMUDH");
#else
char Reg[256];
uint8_t count, el, del;
@@ -3549,7 +3562,7 @@ void Compile_Vector_VMUDH(void)
void Compile_Vector_VMACF(void)
{
#ifndef CompileVmacf
- Cheat_r4300iOpcode(RSP_Vector_VMACF, "RSP_Vector_VMACF");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMACF, "&RSPOp::Vector_VMACF");
#else
char Reg[256];
uint8_t count, el, del;
@@ -3617,18 +3630,18 @@ void Compile_Vector_VMACF(void)
void Compile_Vector_VMACU(void)
{
- Cheat_r4300iOpcode(RSP_Vector_VMACU, "RSP_Vector_VMACU");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMACU, "&RSPOp::Vector_VMACU");
}
void Compile_Vector_VMACQ(void)
{
- Cheat_r4300iOpcode(RSP_Vector_VMACQ, "RSP_Vector_VMACQ");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMACQ, "RSPOp::Vector_VMACQ");
}
void Compile_Vector_VMADL(void)
{
#ifndef CompileVmadl
- Cheat_r4300iOpcode(RSP_Vector_VMADL, "RSP_Vector_VMADL");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMADL, "&RSPOp::Vector_VMADL");
#else
char Reg[256];
uint8_t count, el, del;
@@ -3704,7 +3717,7 @@ void Compile_Vector_VMADL(void)
void Compile_Vector_VMADM(void)
{
#ifndef CompileVmadm
- Cheat_r4300iOpcode(RSP_Vector_VMADM, "RSP_Vector_VMADM");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMADM, "&RSPOp::Vector_VMADM");
#else
char Reg[256];
uint8_t count, el, del;
@@ -3799,7 +3812,7 @@ void Compile_Vector_VMADM(void)
void Compile_Vector_VMADN(void)
{
#ifndef CompileVmadn
- Cheat_r4300iOpcode(RSP_Vector_VMADN, "RSP_Vector_VMADN");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMADN, "RSPOp::Vector_VMADN");
#else
char Reg[256];
uint8_t count, el, del;
@@ -3879,7 +3892,7 @@ void Compile_Vector_VMADN(void)
void Compile_Vector_VMADH(void)
{
#ifndef CompileVmadh
- Cheat_r4300iOpcode(RSP_Vector_VMADH, "RSP_Vector_VMADH");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMADH, "RSPOp::Vector_VMADH");
#else
char Reg[256];
uint8_t count, el, del;
@@ -4077,7 +4090,7 @@ bool Compile_Vector_VADD_MMX(void)
void Compile_Vector_VADD(void)
{
#ifndef CompileVadd
- Cheat_r4300iOpcode(RSP_Vector_VADD, "RSP_Vector_VADD");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VADD, "RSPOp::Vector_VADD");
#else
char Reg[256];
uint8_t count, el, del;
@@ -4215,7 +4228,7 @@ bool Compile_Vector_VSUB_MMX(void)
void Compile_Vector_VSUB(void)
{
#ifndef CompileVsub
- Cheat_r4300iOpcode(RSP_Vector_VSUB, "RSP_Vector_VSUB");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VSUB, "&RSPOp::Vector_VSUB");
#else
char Reg[256];
uint8_t count, el, del;
@@ -4389,7 +4402,7 @@ bool Compile_Vector_VABS_MMX(void)
void Compile_Vector_VABS(void)
{
#ifndef CompileVabs
- Cheat_r4300iOpcode(RSP_Vector_VABS, "RSP_Vector_VABS");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VABS, "RSPOp::Vector_VABS");
#else
uint8_t count, el, del;
char Reg[256];
@@ -4489,7 +4502,7 @@ void Compile_Vector_VABS(void)
void Compile_Vector_VADDC(void)
{
#ifndef CompileVaddc
- Cheat_r4300iOpcode(RSP_Vector_VADDC, "RSP_Vector_VADDC");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VADDC, "&RSPOp::Vector_VADDC");
#else
char Reg[256];
uint8_t count, el, del;
@@ -4561,7 +4574,7 @@ void Compile_Vector_VADDC(void)
void Compile_Vector_VSUBC(void)
{
#ifndef CompileVsubc
- Cheat_r4300iOpcode(RSP_Vector_VSUBC, "RSP_Vector_VSUBC");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VSUBC, "&RSPOp::Vector_VSUBC");
#else
char Reg[256];
uint8_t count, el, del;
@@ -4629,7 +4642,7 @@ void Compile_Vector_VSUBC(void)
void Compile_Vector_VSAW(void)
{
#ifndef CompileVsaw
- Cheat_r4300iOpcode(RSP_Vector_VSAW, "RSP_Vector_VSAW");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VSAW, "RSPOp::Vector_VSAW");
#else
char Reg[256];
uint32_t Word;
@@ -4684,7 +4697,7 @@ void Compile_Vector_VSAW(void)
void Compile_Vector_VLT(void)
{
#ifndef CompileVlt
- Cheat_r4300iOpcode(RSP_Vector_VLT, "RSP_Vector_VLT");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VLT, "&RSPOp::Vector_VLT");
#else
bool bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC);
bool bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC);
@@ -4785,7 +4798,7 @@ void Compile_Vector_VLT(void)
void Compile_Vector_VEQ(void)
{
#ifndef CompileVeq
- Cheat_r4300iOpcode(RSP_Vector_VEQ, "RSP_Vector_VEQ");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VEQ, "&RSPOp::Vector_VEQ");
#else
bool bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC);
bool bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC);
@@ -4861,7 +4874,7 @@ void Compile_Vector_VEQ(void)
void Compile_Vector_VNE(void)
{
#ifndef CompileVne
- Cheat_r4300iOpcode(RSP_Vector_VNE, "RSP_Vector_VNE");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VNE, "&RSPOp::Vector_VNE");
#else
bool bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC);
bool bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC);
@@ -4977,7 +4990,7 @@ bool Compile_Vector_VGE_MMX(void)
void Compile_Vector_VGE(void)
{
#ifndef CompileVge
- Cheat_r4300iOpcode(RSP_Vector_VGE, "RSP_Vector_VGE");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VGE, "&RSPOp::Vector_VGE");
#else
/*
bool bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC);
@@ -5090,23 +5103,23 @@ void Compile_Vector_VGE(void)
void Compile_Vector_VCL(void)
{
- Cheat_r4300iOpcode(RSP_Vector_VCL, "RSP_Vector_VCL");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VCL, "RSPOp::Vector_VCL");
}
void Compile_Vector_VCH(void)
{
- Cheat_r4300iOpcode(RSP_Vector_VCH, "RSP_Vector_VCH");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VCH, "RSPOp::Vector_VCH");
}
void Compile_Vector_VCR(void)
{
- Cheat_r4300iOpcode(RSP_Vector_VCR, "RSP_Vector_VCR");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VCR, "RSPOp::Vector_VCR");
}
void Compile_Vector_VMRG(void)
{
#ifndef CompileVmrg
- Cheat_r4300iOpcode(RSP_Vector_VMRG, "RSP_Vector_VMRG");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMRG, "&RSPOp::Vector_VMRG");
#else
char Reg[256];
uint8_t count, el, del;
@@ -5190,7 +5203,7 @@ bool Compile_Vector_VAND_MMX(void)
void Compile_Vector_VAND(void)
{
#ifndef CompileVand
- Cheat_r4300iOpcode(RSP_Vector_VAND, "RSP_Vector_VAND");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VAND, "RSPOp::Vector_VAND");
#else
char Reg[256];
uint8_t el, del, count;
@@ -5300,7 +5313,7 @@ bool Compile_Vector_VNAND_MMX(void)
void Compile_Vector_VNAND(void)
{
#ifndef CompileVnand
- Cheat_r4300iOpcode(RSP_Vector_VNAND, "RSP_Vector_VNAND");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VNAND, "&RSPOp::Vector_VNAND");
#else
char Reg[256];
uint8_t el, del, count;
@@ -5412,7 +5425,7 @@ bool Compile_Vector_VOR_MMX(void)
void Compile_Vector_VOR(void)
{
#ifndef CompileVor
- Cheat_r4300iOpcode(RSP_Vector_VOR, "RSP_Vector_VOR");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VOR, "RSPOp::Vector_VOR");
#else
char Reg[256];
uint8_t el, del, count;
@@ -5517,7 +5530,7 @@ bool Compile_Vector_VNOR_MMX(void)
void Compile_Vector_VNOR(void)
{
#ifndef CompileVnor
- Cheat_r4300iOpcode(RSP_Vector_VNOR, "RSP_Vector_VNOR");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VNOR, "&RSPOp::Vector_VNOR");
#else
char Reg[256];
uint8_t el, del, count;
@@ -5662,7 +5675,7 @@ void Compile_Vector_VXOR(void)
}
#endif
- Cheat_r4300iOpcodeNoMessage(RSP_Vector_VXOR, "RSP_Vector_VXOR");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::Vector_VXOR, "RSPOp::Vector_VXOR");
}
bool Compile_Vector_VNXOR_MMX(void)
@@ -5758,13 +5771,13 @@ void Compile_Vector_VNXOR(void)
}
#endif
- Cheat_r4300iOpcode(RSP_Vector_VNXOR, "RSP_Vector_VNXOR");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VNXOR, "RSPOp::Vector_VNXOR");
}
void Compile_Vector_VRCP(void)
{
#ifndef CompileVrcp
- Cheat_r4300iOpcode(RSP_Vector_VRCP, "RSP_Vector_VRCP");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VRCP, "&RSPOp::Vector_VRCP");
#else
char Reg[256];
uint8_t count, el, last;
@@ -5833,7 +5846,7 @@ void Compile_Vector_VRCP(void)
void Compile_Vector_VRCPL(void)
{
#ifndef CompileVrcpl
- Cheat_r4300iOpcode(RSP_Vector_VRCPL, "RSP_Vector_VRCPL");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VRCPL, "RSPOp::Vector_VRCPL");
#else
char Reg[256];
uint8_t count, el, last;
@@ -5909,7 +5922,7 @@ void Compile_Vector_VRCPL(void)
void Compile_Vector_VRCPH(void)
{
#ifndef CompileVrcph
- Cheat_r4300iOpcode(RSP_Vector_VRCPH, "RSP_Vector_VRCPH");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VRCPH, "&RSPOp::Vector_VRCPH");
#else
char Reg[256];
uint8_t count, el, last;
@@ -5952,7 +5965,7 @@ void Compile_Vector_VRCPH(void)
void Compile_Vector_VMOV(void)
{
#ifndef CompileVmov
- Cheat_r4300iOpcode(RSP_Vector_VMOV, "RSP_Vector_VMOV");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VMOV, "&RSPOp::Vector_VMOV");
#else
char Reg[256];
uint8_t el, count;
@@ -5986,19 +5999,19 @@ void Compile_Vector_VMOV(void)
void Compile_Vector_VRSQ(void)
{
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Vector_VRSQ, "RSP_Vector_VRSQ");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::Vector_VRSQ, "RSPOp::Vector_VRSQ");
}
void Compile_Vector_VRSQL(void)
{
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Vector_VRSQL, "RSP_Vector_VRSQL");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::Vector_VRSQL, "RSPOp::Vector_VRSQL");
}
void Compile_Vector_VRSQH(void)
{
#ifndef CompileVrsqh
- Cheat_r4300iOpcode(RSP_Vector_VRSQH, "RSP_Vector_VRSQH");
+ Cheat_r4300iOpcode(&RSPOp::Vector_VRSQH, "RSPOp::Vector_VRSQH");
#else
char Reg[256];
uint8_t count, el, last;
@@ -6044,7 +6057,7 @@ void Compile_Vector_VNOOP(void)
void Compile_Vector_Reserved(void)
{
- Cheat_r4300iOpcode(RSP_Vector_Reserved, "RSP_Vector_Reserved");
+ Cheat_r4300iOpcode(&RSPOp::Vector_Reserved, "&RSPOp::Vector_Reserved");
}
// LC2 functions
@@ -6052,7 +6065,7 @@ void Compile_Vector_Reserved(void)
void Compile_Opcode_LBV(void)
{
#ifndef CompileLbv
- Cheat_r4300iOpcode(RSP_Opcode_LBV, "RSP_Opcode_LBV");
+ Cheat_r4300iOpcode(&RSPOp::LBV, "RSPOp::LBV");
#else
char Reg[256];
int offset = RSPOpC.voffset << 0;
@@ -6074,11 +6087,11 @@ void Compile_Opcode_LBV(void)
void Compile_Opcode_LSV(void)
{
#ifndef CompileLsv
- Cheat_r4300iOpcode(RSP_Opcode_LSV, "RSP_Opcode_LSV");
+ Cheat_r4300iOpcode(&RSPOp::LSV, "RSPOp::LSV");
#else
if (RSPOpC.del > 14)
{
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LSV, "RSP_Opcode_LSV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LSV, "RSPOp::LSV");
return;
}
CPU_Message(" %X %s", CompilePC, RSPInstruction(CompilePC, RSPOpC.Value).NameAndParam().c_str());
@@ -6147,7 +6160,7 @@ void Compile_Opcode_LSV(void)
void Compile_Opcode_LLV(void)
{
#ifndef CompileLlv
- Cheat_r4300iOpcode(RSP_Opcode_LLV, "RSP_Opcode_LLV");
+ Cheat_r4300iOpcode(&RSPOp::LLV, "RSPOp::LLV");
#else
char Reg[256];
int offset = (RSPOpC.voffset << 2);
@@ -6157,7 +6170,7 @@ void Compile_Opcode_LLV(void)
if ((RSPOpC.del & 0x3) != 0)
{
- Cheat_r4300iOpcode(RSP_Opcode_LLV, "RSP_Opcode_LLV");
+ Cheat_r4300iOpcode(&RSPOp::LLV, "RSPOp::LLV");
return;
}
@@ -6168,7 +6181,7 @@ void Compile_Opcode_LLV(void)
if ((Addr & 3) != 0)
{
CompilerWarning("Unaligned LLV at constant address");
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LLV, "RSP_Opcode_LLV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LLV, "RSPOp::LLV");
return;
}
@@ -6192,7 +6205,7 @@ void Compile_Opcode_LLV(void)
CPU_Message(" Unaligned:");
*((uint32_t *)(Jump[0])) = (uint32_t)(RecompPos - Jump[0] - 4);
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LLV, "RSP_Opcode_LLV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LLV, "RSPOp::LLV");
JmpLabel32("Done", 0);
Jump[1] = RecompPos - 4;
@@ -6214,7 +6227,7 @@ void Compile_Opcode_LLV(void)
void Compile_Opcode_LDV(void)
{
#ifndef CompileLdv
- Cheat_r4300iOpcode(RSP_Opcode_LDV, "RSP_Opcode_LDV");
+ Cheat_r4300iOpcode(&RSPOp::LDV, "RSPOp::LDV");
#else
char Reg[256];
int offset = (RSPOpC.voffset << 3), length;
@@ -6229,7 +6242,7 @@ void Compile_Opcode_LDV(void)
if ((RSPOpC.del & 0x3) != 0)
{
CompilerWarning(stdstr_f("LDV's element = %X, PC = %04X", RSPOpC.del, CompilePC).c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LDV, "RSP_Opcode_LDV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LDV, "RSPOp::LDV");
return;
}
@@ -6240,7 +6253,7 @@ void Compile_Opcode_LDV(void)
if ((Addr & 3) != 0)
{
CompilerWarning(stdstr_f("Unaligned LDV at constant address PC = %04X", CompilePC).c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LDV, "RSP_Opcode_LDV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LDV, "RSPOp::LDV");
return;
}
@@ -6271,7 +6284,7 @@ void Compile_Opcode_LDV(void)
CompilerToggleBuffer();
CPU_Message(" Unaligned:");
x86_SetBranch32b(Jump[0], RecompPos);
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LDV, "RSP_Opcode_LDV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LDV, "RSPOp::LDV");
JmpLabel32("Done", 0);
Jump[1] = RecompPos - 4;
CompilerToggleBuffer();
@@ -6295,7 +6308,7 @@ void Compile_Opcode_LDV(void)
void Compile_Opcode_LQV(void)
{
#ifndef CompileLqv
- Cheat_r4300iOpcode(RSP_Opcode_LQV, "RSP_Opcode_LQV");
+ Cheat_r4300iOpcode(&RSPOp::LQV, "RSPOp::LQV");
#else
char Reg[256];
int offset = (RSPOpC.voffset << 4);
@@ -6305,8 +6318,7 @@ void Compile_Opcode_LQV(void)
if (RSPOpC.del != 0)
{
- Cheat_r4300iOpcode(RSP_Opcode_LQV, "RSP_Opcode_LQV");
- return;
+ Cheat_r4300iOpcode(&RSPOp::LQV, "RSPOp::LQV");
return;
}
@@ -6317,7 +6329,7 @@ void Compile_Opcode_LQV(void)
if (Addr & 15)
{
CompilerWarning(stdstr_f("Unaligned LQV at constant address PC = %04X", CompilePC).c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LQV, "RSP_Opcode_LQV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LQV, "RSPOp::LQV");
return;
}
@@ -6367,7 +6379,7 @@ void Compile_Opcode_LQV(void)
CPU_Message(" Unaligned:");
x86_SetBranch32b(Jump[0], RecompPos);
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LQV, "RSP_Opcode_LQV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LQV, "RSPOp::LQV");
JmpLabel32("Done", 0);
Jump[1] = RecompPos - 4;
CompilerToggleBuffer();
@@ -6404,7 +6416,7 @@ void Compile_Opcode_LQV(void)
void Compile_Opcode_LRV(void)
{
#ifndef CompileLrv
- Cheat_r4300iOpcode(RSP_Opcode_LRV, "RSP_Opcode_LRV");
+ Cheat_r4300iOpcode(&RSPOp::LRV, "RSPOp::LRV");
#else
int offset = (RSPOpC.voffset << 4);
uint8_t *Loop, *Jump[2];
@@ -6413,7 +6425,7 @@ void Compile_Opcode_LRV(void)
if (RSPOpC.del != 0)
{
- Cheat_r4300iOpcode(RSP_Opcode_LRV, "RSP_Opcode_LRV");
+ Cheat_r4300iOpcode(&RSPOp::LRV, "RSPOp::LRV");
return;
}
@@ -6432,7 +6444,7 @@ void Compile_Opcode_LRV(void)
CPU_Message(" Unaligned:");
x86_SetBranch32b(Jump[0], RecompPos);
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LRV, "RSP_Opcode_LRV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::LRV, "RSPOp::LRV");
JmpLabel32("Done", 0);
Jump[1] = RecompPos - 4;
@@ -6483,7 +6495,7 @@ void Compile_Opcode_LRV(void)
void Compile_Opcode_LPV(void)
{
#ifndef CompileLpv
- Cheat_r4300iOpcode(RSP_Opcode_LPV, "RSP_Opcode_LPV");
+ Cheat_r4300iOpcode(&RSPOp::LPV, "RSPOp::LPV");
#else
char Reg[256];
int offset = (RSPOpC.voffset << 3);
@@ -6591,7 +6603,7 @@ void Compile_Opcode_LPV(void)
void Compile_Opcode_LUV(void)
{
#ifndef CompileLuv
- Cheat_r4300iOpcode(RSP_Opcode_LUV, "RSP_Opcode_LUV");
+ Cheat_r4300iOpcode(&RSPOp::LUV, "RSPOp::LUV");
#else
char Reg[256];
int offset = (RSPOpC.voffset << 3);
@@ -6699,7 +6711,7 @@ void Compile_Opcode_LUV(void)
void Compile_Opcode_LHV(void)
{
#ifndef CompileLhv
- Cheat_r4300iOpcode(RSP_Opcode_LHV, "RSP_Opcode_LHV");
+ Cheat_r4300iOpcode(&RSPOp::LHV, "RSPOp::LHV");
#else
char Reg[256];
int offset = (RSPOpC.voffset << 4);
@@ -6806,37 +6818,37 @@ void Compile_Opcode_LHV(void)
void Compile_Opcode_LFV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_LFV, "RSP_Opcode_LFV");
+ Cheat_r4300iOpcode(&RSPOp::LFV, "RSPOp::LFV");
}
void Compile_Opcode_LWV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_LWV, "RSP_Opcode_LWV");
+ Cheat_r4300iOpcode(&RSPOp::LWV, "RSPOp::LWV");
}
void Compile_Opcode_LTV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_LTV, "RSP_Opcode_LTV");
+ Cheat_r4300iOpcode(&RSPOp::LTV, "RSPOp::LTV");
}
// SC2 functions
void Compile_Opcode_SBV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_SBV, "RSP_Opcode_SBV");
+ Cheat_r4300iOpcode(&RSPOp::SBV, "RSPOp::SBV");
}
void Compile_Opcode_SSV(void)
{
#ifndef CompileSsv
- Cheat_r4300iOpcode(RSP_Opcode_SSV, "RSP_Opcode_SSV");
+ Cheat_r4300iOpcode(&RSPOp::SSV, "RSPOp::SSV");
#else
char Reg[256];
int offset = (RSPOpC.voffset << 1);
if (RSPOpC.del > 14)
{
- Cheat_r4300iOpcode(RSP_Opcode_SSV, "RSP_Opcode_SSV");
+ Cheat_r4300iOpcode(&RSPOp::SSV, "RSPOp::SSV");
return;
}
@@ -6899,11 +6911,11 @@ void Compile_Opcode_SSV(void)
void Compile_Opcode_SLV(void)
{
#ifndef CompileSlv
- Cheat_r4300iOpcode(RSP_Opcode_SLV, "RSP_Opcode_SLV");
+ Cheat_r4300iOpcode(&RSPOp::SLV, "RSPOp::SLV");
#else
if (RSPOpC.del > 12)
{
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SLV, "RSP_Opcode_SLV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::SLV, "RSPOp::SLV");
return;
}
@@ -6917,7 +6929,7 @@ void Compile_Opcode_SLV(void)
uint32_t Addr = (MipsRegConst(RSPOpC.base) + offset) & 0xfff;
if ((Addr & 3) != 0 || RSPOpC.del > 12)
{
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SLV, "RSP_Opcode_SLV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::SLV, "RSPOp::SLV");
return;
}
@@ -6941,7 +6953,7 @@ void Compile_Opcode_SLV(void)
CPU_Message(" Unaligned:");
*((uint32_t *)(Jump[0])) = (uint32_t)(RecompPos - Jump[0] - 4);
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SLV, "RSP_Opcode_SLV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::SLV, "RSPOp::SLV");
JmpLabel32("Done", 0);
Jump[1] = RecompPos - 4;
@@ -6964,11 +6976,11 @@ void Compile_Opcode_SLV(void)
void Compile_Opcode_SDV(void)
{
#ifndef CompileSdv
- Cheat_r4300iOpcode(RSP_Opcode_SDV, "RSP_Opcode_SDV");
+ Cheat_r4300iOpcode(&RSPOp::SDV, "RSPOp::SDV");
#else
if (RSPOpC.del > 8)
{
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SDV, "RSP_Opcode_SDV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::SDV, "RSPOp::SDV");
return;
}
char Reg[256];
@@ -6989,7 +7001,7 @@ void Compile_Opcode_SDV(void)
if ((Addr & 3) != 0)
{
CompilerWarning(stdstr_f("Unaligned SDV at constant address PC = %04X", CompilePC).c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SDV, "RSP_Opcode_SDV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::SDV, "RSPOp::SDV");
return;
}
@@ -7054,11 +7066,11 @@ void Compile_Opcode_SDV(void)
void Compile_Opcode_SQV(void)
{
#ifndef CompileSqv
- Cheat_r4300iOpcode(RSP_Opcode_SQV, "RSP_Opcode_SQV");
+ Cheat_r4300iOpcode(&RSPOp::SQV, "RSPOp::SQV");
#else
if (RSPOpC.del != 0 && RSPOpC.del != 12)
{
- Cheat_r4300iOpcode(RSP_Opcode_SQV, "RSP_Opcode_SQV");
+ Cheat_r4300iOpcode(&RSPOp::SQV, "RSPOp::SQV");
return;
}
@@ -7075,7 +7087,7 @@ void Compile_Opcode_SQV(void)
if (Addr & 15)
{
CompilerWarning(stdstr_f("Unaligned SQV at constant address %04X", CompilePC).c_str());
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SQV, "RSP_Opcode_SQV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::SQV, "RSPOp::SQV");
return;
}
@@ -7145,7 +7157,7 @@ void Compile_Opcode_SQV(void)
CompilerToggleBuffer();
CPU_Message(" Unaligned:");
x86_SetBranch32b((uint32_t *)Jump[0], (uint32_t *)RecompPos);
- Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SQV, "RSP_Opcode_SQV");
+ Cheat_r4300iOpcodeNoMessage(&RSPOp::SQV, "RSPOp::SQV");
JmpLabel32("Done", 0);
Jump[1] = RecompPos - 4;
CompilerToggleBuffer();
@@ -7202,37 +7214,37 @@ void Compile_Opcode_SQV(void)
void Compile_Opcode_SRV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_SRV, "RSP_Opcode_SRV");
+ Cheat_r4300iOpcode(&RSPOp::SRV, "RSPOp::SRV");
}
void Compile_Opcode_SPV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_SPV, "RSP_Opcode_SPV");
+ Cheat_r4300iOpcode(&RSPOp::SPV, "RSPOp::SPV");
}
void Compile_Opcode_SUV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_SUV, "RSP_Opcode_SUV");
+ Cheat_r4300iOpcode(&RSPOp::SUV, "RSPOp::SUV");
}
void Compile_Opcode_SHV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_SHV, "RSP_Opcode_SHV");
+ Cheat_r4300iOpcode(&RSPOp::SHV, "RSPOp::SHV");
}
void Compile_Opcode_SFV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_SFV, "RSP_Opcode_SFV");
+ Cheat_r4300iOpcode(&RSPOp::SFV, "RSPOp::SFV");
}
void Compile_Opcode_STV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_STV, "RSP_Opcode_STV");
+ Cheat_r4300iOpcode(&RSPOp::STV, "RSPOp::STV");
}
void Compile_Opcode_SWV(void)
{
- Cheat_r4300iOpcode(RSP_Opcode_SWV, "RSP_Opcode_SWV");
+ Cheat_r4300iOpcode(&RSPOp::SWV, "&RSPOp::SWV");
}
// Other functions
@@ -7243,6 +7255,7 @@ void Compile_UnknownOpcode(void)
NextInstruction = RSPPIPELINE_FINISH_BLOCK;
MoveConstToVariable(CompilePC, PrgCount, "RSP PC");
MoveConstToVariable(RSPOpC.Value, &RSPOpC.Value, "RSPOpC.Value");
- Call_Direct((void *)rsp_UnknownOpcode, "rsp_UnknownOpcode");
+ MoveConstToX86reg((uint32_t)&RSPSystem, x86_ECX);
+ Call_Direct(AddressOf(&RSPOp::UnknownOpcode), "&RSPOp::UnknownOpcode");
Ret();
}
diff --git a/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.h b/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.h
index 1d245bccd..3de95718e 100644
--- a/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.h
+++ b/Source/Project64-rsp-core/Recompiler/RspRecompilerOps.h
@@ -151,3 +151,14 @@ void Compile_Opcode_STV(void);
// Other functions
void Compile_UnknownOpcode(void);
+
+typedef void (*p_Recompfunc)(void);
+
+extern p_Recompfunc RSP_Recomp_Opcode[64];
+extern p_Recompfunc RSP_Recomp_RegImm[32];
+extern p_Recompfunc RSP_Recomp_Special[64];
+extern p_Recompfunc RSP_Recomp_Cop0[32];
+extern p_Recompfunc RSP_Recomp_Cop2[32];
+extern p_Recompfunc RSP_Recomp_Vector[64];
+extern p_Recompfunc RSP_Recomp_Lc2[32];
+extern p_Recompfunc RSP_Recomp_Sc2[32];
diff --git a/Source/Project64-rsp-core/cpu/RSPCpu.cpp b/Source/Project64-rsp-core/cpu/RSPCpu.cpp
index 6966ff232..6b8b55dcb 100644
--- a/Source/Project64-rsp-core/cpu/RSPCpu.cpp
+++ b/Source/Project64-rsp-core/cpu/RSPCpu.cpp
@@ -5,6 +5,7 @@
#include
#include
#include
+#include
#include
class RSPRegisterHandler;
@@ -13,16 +14,6 @@ UDWORD EleSpec[16], Indx[16];
RSPOpcode RSPOpC;
uint32_t *PrgCount, NextInstruction, RSP_Running;
-p_func RSP_Opcode[64];
-p_func RSP_RegImm[32];
-p_func RSP_Special[64];
-p_func RSP_Cop0[32];
-p_func RSP_Cop2[32];
-p_func RSP_Vector[64];
-p_func RSP_Lc2[32];
-p_func RSP_Sc2[32];
-
-void BuildInterpreterCPU(void);
void BuildRecompilerCPU(void);
CriticalSection g_CPUCriticalSection;
@@ -40,7 +31,6 @@ void SetCPU(RSPCpuType core)
BuildRecompilerCPU();
break;
case InterpreterCPU:
- BuildInterpreterCPU();
break;
}
}
@@ -196,7 +186,7 @@ uint32_t DoRspCycles(uint32_t Cycles)
RunRecompilerCPU(Cycles);
break;
case InterpreterCPU:
- RunInterpreterCPU(Cycles);
+ RSPSystem.RunInterpreterCPU(Cycles);
break;
}
if (g_RSPDebugger != nullptr)
diff --git a/Source/Project64-rsp-core/cpu/RSPCpu.h b/Source/Project64-rsp-core/cpu/RSPCpu.h
index 2acc473eb..ee74efe53 100644
--- a/Source/Project64-rsp-core/cpu/RSPCpu.h
+++ b/Source/Project64-rsp-core/cpu/RSPCpu.h
@@ -13,16 +13,6 @@ enum RSPCpuType
extern UDWORD EleSpec[16], Indx[16];
-typedef void (*p_func)(void);
-
-extern p_func RSP_Opcode[64];
-extern p_func RSP_RegImm[32];
-extern p_func RSP_Special[64];
-extern p_func RSP_Cop0[32];
-extern p_func RSP_Cop2[32];
-extern p_func RSP_Vector[64];
-extern p_func RSP_Lc2[32];
-extern p_func RSP_Sc2[32];
extern uint32_t *PrgCount, RSP_Running;
extern RSPOpcode RSPOpC;
diff --git a/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.cpp b/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.cpp
index 1d23b67cf..bef254f5c 100644
--- a/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.cpp
+++ b/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.cpp
@@ -2,422 +2,14 @@
#include "RSPCpu.h"
#include "RSPInterpreterOps.h"
#include "RSPRegisters.h"
-#include
-#include
+#include
+#include
+#include
+#include
RSPPIPELINE_STAGE RSP_NextInstruction;
uint32_t RSP_JumpTo;
-void BuildInterpreterCPU(void)
-{
- RSP_Opcode[0] = RSP_Opcode_SPECIAL;
- RSP_Opcode[1] = RSP_Opcode_REGIMM;
- RSP_Opcode[2] = RSP_Opcode_J;
- RSP_Opcode[3] = RSP_Opcode_JAL;
- RSP_Opcode[4] = RSP_Opcode_BEQ;
- RSP_Opcode[5] = RSP_Opcode_BNE;
- RSP_Opcode[6] = RSP_Opcode_BLEZ;
- RSP_Opcode[7] = RSP_Opcode_BGTZ;
- RSP_Opcode[8] = RSP_Opcode_ADDI;
- RSP_Opcode[9] = RSP_Opcode_ADDIU;
- RSP_Opcode[10] = RSP_Opcode_SLTI;
- RSP_Opcode[11] = RSP_Opcode_SLTIU;
- RSP_Opcode[12] = RSP_Opcode_ANDI;
- RSP_Opcode[13] = RSP_Opcode_ORI;
- RSP_Opcode[14] = RSP_Opcode_XORI;
- RSP_Opcode[15] = RSP_Opcode_LUI;
- RSP_Opcode[16] = RSP_Opcode_COP0;
- RSP_Opcode[17] = rsp_UnknownOpcode;
- RSP_Opcode[18] = RSP_Opcode_COP2;
- RSP_Opcode[19] = rsp_UnknownOpcode;
- RSP_Opcode[20] = rsp_UnknownOpcode;
- RSP_Opcode[21] = rsp_UnknownOpcode;
- RSP_Opcode[22] = rsp_UnknownOpcode;
- RSP_Opcode[23] = rsp_UnknownOpcode;
- RSP_Opcode[24] = rsp_UnknownOpcode;
- RSP_Opcode[25] = rsp_UnknownOpcode;
- RSP_Opcode[26] = rsp_UnknownOpcode;
- RSP_Opcode[27] = rsp_UnknownOpcode;
- RSP_Opcode[28] = rsp_UnknownOpcode;
- RSP_Opcode[29] = rsp_UnknownOpcode;
- RSP_Opcode[30] = rsp_UnknownOpcode;
- RSP_Opcode[31] = rsp_UnknownOpcode;
- RSP_Opcode[32] = RSP_Opcode_LB;
- RSP_Opcode[33] = RSP_Opcode_LH;
- RSP_Opcode[34] = rsp_UnknownOpcode;
- RSP_Opcode[35] = RSP_Opcode_LW;
- RSP_Opcode[36] = RSP_Opcode_LBU;
- RSP_Opcode[37] = RSP_Opcode_LHU;
- RSP_Opcode[38] = rsp_UnknownOpcode;
- RSP_Opcode[39] = RSP_Opcode_LWU;
- RSP_Opcode[40] = RSP_Opcode_SB;
- RSP_Opcode[41] = RSP_Opcode_SH;
- RSP_Opcode[42] = rsp_UnknownOpcode;
- RSP_Opcode[43] = RSP_Opcode_SW;
- RSP_Opcode[44] = rsp_UnknownOpcode;
- RSP_Opcode[45] = rsp_UnknownOpcode;
- RSP_Opcode[46] = rsp_UnknownOpcode;
- RSP_Opcode[47] = rsp_UnknownOpcode;
- RSP_Opcode[48] = rsp_UnknownOpcode;
- RSP_Opcode[49] = rsp_UnknownOpcode;
- RSP_Opcode[50] = RSP_Opcode_LC2;
- RSP_Opcode[51] = rsp_UnknownOpcode;
- RSP_Opcode[52] = rsp_UnknownOpcode;
- RSP_Opcode[53] = rsp_UnknownOpcode;
- RSP_Opcode[54] = rsp_UnknownOpcode;
- RSP_Opcode[55] = rsp_UnknownOpcode;
- RSP_Opcode[56] = rsp_UnknownOpcode;
- RSP_Opcode[57] = rsp_UnknownOpcode;
- RSP_Opcode[58] = RSP_Opcode_SC2;
- RSP_Opcode[59] = rsp_UnknownOpcode;
- RSP_Opcode[60] = rsp_UnknownOpcode;
- RSP_Opcode[61] = rsp_UnknownOpcode;
- RSP_Opcode[62] = rsp_UnknownOpcode;
- RSP_Opcode[63] = rsp_UnknownOpcode;
-
- RSP_Special[0] = RSP_Special_SLL;
- RSP_Special[1] = rsp_UnknownOpcode;
- RSP_Special[2] = RSP_Special_SRL;
- RSP_Special[3] = RSP_Special_SRA;
- RSP_Special[4] = RSP_Special_SLLV;
- RSP_Special[5] = rsp_UnknownOpcode;
- RSP_Special[6] = RSP_Special_SRLV;
- RSP_Special[7] = RSP_Special_SRAV;
- RSP_Special[8] = RSP_Special_JR;
- RSP_Special[9] = RSP_Special_JALR;
- RSP_Special[10] = rsp_UnknownOpcode;
- RSP_Special[11] = rsp_UnknownOpcode;
- RSP_Special[12] = rsp_UnknownOpcode;
- RSP_Special[13] = RSP_Special_BREAK;
- RSP_Special[14] = rsp_UnknownOpcode;
- RSP_Special[15] = rsp_UnknownOpcode;
- RSP_Special[16] = rsp_UnknownOpcode;
- RSP_Special[17] = rsp_UnknownOpcode;
- RSP_Special[18] = rsp_UnknownOpcode;
- RSP_Special[19] = rsp_UnknownOpcode;
- RSP_Special[20] = rsp_UnknownOpcode;
- RSP_Special[21] = rsp_UnknownOpcode;
- RSP_Special[22] = rsp_UnknownOpcode;
- RSP_Special[23] = rsp_UnknownOpcode;
- RSP_Special[24] = rsp_UnknownOpcode;
- RSP_Special[25] = rsp_UnknownOpcode;
- RSP_Special[26] = rsp_UnknownOpcode;
- RSP_Special[27] = rsp_UnknownOpcode;
- RSP_Special[28] = rsp_UnknownOpcode;
- RSP_Special[29] = rsp_UnknownOpcode;
- RSP_Special[30] = rsp_UnknownOpcode;
- RSP_Special[31] = rsp_UnknownOpcode;
- RSP_Special[32] = RSP_Special_ADD;
- RSP_Special[33] = RSP_Special_ADDU;
- RSP_Special[34] = RSP_Special_SUB;
- RSP_Special[35] = RSP_Special_SUBU;
- RSP_Special[36] = RSP_Special_AND;
- RSP_Special[37] = RSP_Special_OR;
- RSP_Special[38] = RSP_Special_XOR;
- RSP_Special[39] = RSP_Special_NOR;
- RSP_Special[40] = rsp_UnknownOpcode;
- RSP_Special[41] = rsp_UnknownOpcode;
- RSP_Special[42] = RSP_Special_SLT;
- RSP_Special[43] = RSP_Special_SLTU;
- RSP_Special[44] = rsp_UnknownOpcode;
- RSP_Special[45] = rsp_UnknownOpcode;
- RSP_Special[46] = rsp_UnknownOpcode;
- RSP_Special[47] = rsp_UnknownOpcode;
- RSP_Special[48] = rsp_UnknownOpcode;
- RSP_Special[49] = rsp_UnknownOpcode;
- RSP_Special[50] = rsp_UnknownOpcode;
- RSP_Special[51] = rsp_UnknownOpcode;
- RSP_Special[52] = rsp_UnknownOpcode;
- RSP_Special[53] = rsp_UnknownOpcode;
- RSP_Special[54] = rsp_UnknownOpcode;
- RSP_Special[55] = rsp_UnknownOpcode;
- RSP_Special[56] = rsp_UnknownOpcode;
- RSP_Special[57] = rsp_UnknownOpcode;
- RSP_Special[58] = rsp_UnknownOpcode;
- RSP_Special[59] = rsp_UnknownOpcode;
- RSP_Special[60] = rsp_UnknownOpcode;
- RSP_Special[61] = rsp_UnknownOpcode;
- RSP_Special[62] = rsp_UnknownOpcode;
- RSP_Special[63] = rsp_UnknownOpcode;
-
- RSP_RegImm[0] = RSP_Opcode_BLTZ;
- RSP_RegImm[1] = RSP_Opcode_BGEZ;
- RSP_RegImm[2] = rsp_UnknownOpcode;
- RSP_RegImm[3] = rsp_UnknownOpcode;
- RSP_RegImm[4] = rsp_UnknownOpcode;
- RSP_RegImm[5] = rsp_UnknownOpcode;
- RSP_RegImm[6] = rsp_UnknownOpcode;
- RSP_RegImm[7] = rsp_UnknownOpcode;
- RSP_RegImm[8] = rsp_UnknownOpcode;
- RSP_RegImm[9] = rsp_UnknownOpcode;
- RSP_RegImm[10] = rsp_UnknownOpcode;
- RSP_RegImm[11] = rsp_UnknownOpcode;
- RSP_RegImm[12] = rsp_UnknownOpcode;
- RSP_RegImm[13] = rsp_UnknownOpcode;
- RSP_RegImm[14] = rsp_UnknownOpcode;
- RSP_RegImm[15] = rsp_UnknownOpcode;
- RSP_RegImm[16] = RSP_Opcode_BLTZAL;
- RSP_RegImm[17] = RSP_Opcode_BGEZAL;
- RSP_RegImm[18] = rsp_UnknownOpcode;
- RSP_RegImm[19] = rsp_UnknownOpcode;
- RSP_RegImm[20] = rsp_UnknownOpcode;
- RSP_RegImm[21] = rsp_UnknownOpcode;
- RSP_RegImm[22] = rsp_UnknownOpcode;
- RSP_RegImm[23] = rsp_UnknownOpcode;
- RSP_RegImm[24] = rsp_UnknownOpcode;
- RSP_RegImm[25] = rsp_UnknownOpcode;
- RSP_RegImm[26] = rsp_UnknownOpcode;
- RSP_RegImm[27] = rsp_UnknownOpcode;
- RSP_RegImm[28] = rsp_UnknownOpcode;
- RSP_RegImm[29] = rsp_UnknownOpcode;
- RSP_RegImm[30] = rsp_UnknownOpcode;
- RSP_RegImm[31] = rsp_UnknownOpcode;
-
- RSP_Cop0[0] = RSP_Cop0_MF;
- RSP_Cop0[1] = rsp_UnknownOpcode;
- RSP_Cop0[2] = rsp_UnknownOpcode;
- RSP_Cop0[3] = rsp_UnknownOpcode;
- RSP_Cop0[4] = RSP_Cop0_MT;
- RSP_Cop0[5] = rsp_UnknownOpcode;
- RSP_Cop0[6] = rsp_UnknownOpcode;
- RSP_Cop0[7] = rsp_UnknownOpcode;
- RSP_Cop0[8] = rsp_UnknownOpcode;
- RSP_Cop0[9] = rsp_UnknownOpcode;
- RSP_Cop0[10] = rsp_UnknownOpcode;
- RSP_Cop0[11] = rsp_UnknownOpcode;
- RSP_Cop0[12] = rsp_UnknownOpcode;
- RSP_Cop0[13] = rsp_UnknownOpcode;
- RSP_Cop0[14] = rsp_UnknownOpcode;
- RSP_Cop0[15] = rsp_UnknownOpcode;
- RSP_Cop0[16] = rsp_UnknownOpcode;
- RSP_Cop0[17] = rsp_UnknownOpcode;
- RSP_Cop0[18] = rsp_UnknownOpcode;
- RSP_Cop0[19] = rsp_UnknownOpcode;
- RSP_Cop0[20] = rsp_UnknownOpcode;
- RSP_Cop0[21] = rsp_UnknownOpcode;
- RSP_Cop0[22] = rsp_UnknownOpcode;
- RSP_Cop0[23] = rsp_UnknownOpcode;
- RSP_Cop0[24] = rsp_UnknownOpcode;
- RSP_Cop0[25] = rsp_UnknownOpcode;
- RSP_Cop0[26] = rsp_UnknownOpcode;
- RSP_Cop0[27] = rsp_UnknownOpcode;
- RSP_Cop0[28] = rsp_UnknownOpcode;
- RSP_Cop0[29] = rsp_UnknownOpcode;
- RSP_Cop0[30] = rsp_UnknownOpcode;
- RSP_Cop0[31] = rsp_UnknownOpcode;
-
- RSP_Cop2[0] = RSP_Cop2_MF;
- RSP_Cop2[1] = rsp_UnknownOpcode;
- RSP_Cop2[2] = RSP_Cop2_CF;
- RSP_Cop2[3] = rsp_UnknownOpcode;
- RSP_Cop2[4] = RSP_Cop2_MT;
- RSP_Cop2[5] = rsp_UnknownOpcode;
- RSP_Cop2[6] = RSP_Cop2_CT;
- RSP_Cop2[7] = rsp_UnknownOpcode;
- RSP_Cop2[8] = rsp_UnknownOpcode;
- RSP_Cop2[9] = rsp_UnknownOpcode;
- RSP_Cop2[10] = rsp_UnknownOpcode;
- RSP_Cop2[11] = rsp_UnknownOpcode;
- RSP_Cop2[12] = rsp_UnknownOpcode;
- RSP_Cop2[13] = rsp_UnknownOpcode;
- RSP_Cop2[14] = rsp_UnknownOpcode;
- RSP_Cop2[15] = rsp_UnknownOpcode;
- RSP_Cop2[16] = RSP_COP2_VECTOR;
- RSP_Cop2[17] = RSP_COP2_VECTOR;
- RSP_Cop2[18] = RSP_COP2_VECTOR;
- RSP_Cop2[19] = RSP_COP2_VECTOR;
- RSP_Cop2[20] = RSP_COP2_VECTOR;
- RSP_Cop2[21] = RSP_COP2_VECTOR;
- RSP_Cop2[22] = RSP_COP2_VECTOR;
- RSP_Cop2[23] = RSP_COP2_VECTOR;
- RSP_Cop2[24] = RSP_COP2_VECTOR;
- RSP_Cop2[25] = RSP_COP2_VECTOR;
- RSP_Cop2[26] = RSP_COP2_VECTOR;
- RSP_Cop2[27] = RSP_COP2_VECTOR;
- RSP_Cop2[28] = RSP_COP2_VECTOR;
- RSP_Cop2[29] = RSP_COP2_VECTOR;
- RSP_Cop2[30] = RSP_COP2_VECTOR;
- RSP_Cop2[31] = RSP_COP2_VECTOR;
-
- RSP_Vector[0] = RSP_Vector_VMULF;
- RSP_Vector[1] = RSP_Vector_VMULU;
- RSP_Vector[2] = RSP_Vector_VRNDP;
- RSP_Vector[3] = RSP_Vector_VMULQ;
- RSP_Vector[4] = RSP_Vector_VMUDL;
- RSP_Vector[5] = RSP_Vector_VMUDM;
- RSP_Vector[6] = RSP_Vector_VMUDN;
- RSP_Vector[7] = RSP_Vector_VMUDH;
- RSP_Vector[8] = RSP_Vector_VMACF;
- RSP_Vector[9] = RSP_Vector_VMACU;
- RSP_Vector[10] = RSP_Vector_VRNDN;
- RSP_Vector[11] = RSP_Vector_VMACQ;
- RSP_Vector[12] = RSP_Vector_VMADL;
- RSP_Vector[13] = RSP_Vector_VMADM;
- RSP_Vector[14] = RSP_Vector_VMADN;
- RSP_Vector[15] = RSP_Vector_VMADH;
- RSP_Vector[16] = RSP_Vector_VADD;
- RSP_Vector[17] = RSP_Vector_VSUB;
- RSP_Vector[18] = RSP_Vector_Reserved;
- RSP_Vector[19] = RSP_Vector_VABS;
- RSP_Vector[20] = RSP_Vector_VADDC;
- RSP_Vector[21] = RSP_Vector_VSUBC;
- RSP_Vector[22] = RSP_Vector_Reserved;
- RSP_Vector[23] = RSP_Vector_Reserved;
- RSP_Vector[24] = RSP_Vector_Reserved;
- RSP_Vector[25] = RSP_Vector_Reserved;
- RSP_Vector[26] = RSP_Vector_Reserved;
- RSP_Vector[27] = RSP_Vector_Reserved;
- RSP_Vector[28] = RSP_Vector_Reserved;
- RSP_Vector[29] = RSP_Vector_VSAW;
- RSP_Vector[30] = RSP_Vector_Reserved;
- RSP_Vector[31] = RSP_Vector_Reserved;
- RSP_Vector[32] = RSP_Vector_VLT;
- RSP_Vector[33] = RSP_Vector_VEQ;
- RSP_Vector[34] = RSP_Vector_VNE;
- RSP_Vector[35] = RSP_Vector_VGE;
- RSP_Vector[36] = RSP_Vector_VCL;
- RSP_Vector[37] = RSP_Vector_VCH;
- RSP_Vector[38] = RSP_Vector_VCR;
- RSP_Vector[39] = RSP_Vector_VMRG;
- RSP_Vector[40] = RSP_Vector_VAND;
- RSP_Vector[41] = RSP_Vector_VNAND;
- RSP_Vector[42] = RSP_Vector_VOR;
- RSP_Vector[43] = RSP_Vector_VNOR;
- RSP_Vector[44] = RSP_Vector_VXOR;
- RSP_Vector[45] = RSP_Vector_VNXOR;
- RSP_Vector[46] = RSP_Vector_Reserved;
- RSP_Vector[47] = RSP_Vector_Reserved;
- RSP_Vector[48] = RSP_Vector_VRCP;
- RSP_Vector[49] = RSP_Vector_VRCPL;
- RSP_Vector[50] = RSP_Vector_VRCPH;
- RSP_Vector[51] = RSP_Vector_VMOV;
- RSP_Vector[52] = RSP_Vector_VRSQ;
- RSP_Vector[53] = RSP_Vector_VRSQL;
- RSP_Vector[54] = RSP_Vector_VRSQH;
- RSP_Vector[55] = RSP_Vector_VNOOP;
- RSP_Vector[56] = RSP_Vector_Reserved;
- RSP_Vector[57] = RSP_Vector_Reserved;
- RSP_Vector[58] = RSP_Vector_Reserved;
- RSP_Vector[59] = RSP_Vector_Reserved;
- RSP_Vector[60] = RSP_Vector_Reserved;
- RSP_Vector[61] = RSP_Vector_Reserved;
- RSP_Vector[62] = RSP_Vector_Reserved;
- RSP_Vector[63] = RSP_Vector_VNOOP;
-
- RSP_Lc2[0] = RSP_Opcode_LBV;
- RSP_Lc2[1] = RSP_Opcode_LSV;
- RSP_Lc2[2] = RSP_Opcode_LLV;
- RSP_Lc2[3] = RSP_Opcode_LDV;
- RSP_Lc2[4] = RSP_Opcode_LQV;
- RSP_Lc2[5] = RSP_Opcode_LRV;
- RSP_Lc2[6] = RSP_Opcode_LPV;
- RSP_Lc2[7] = RSP_Opcode_LUV;
- RSP_Lc2[8] = RSP_Opcode_LHV;
- RSP_Lc2[9] = RSP_Opcode_LFV;
- RSP_Lc2[10] = RSP_Opcode_LWV;
- RSP_Lc2[11] = RSP_Opcode_LTV;
- RSP_Lc2[12] = rsp_UnknownOpcode;
- RSP_Lc2[13] = rsp_UnknownOpcode;
- RSP_Lc2[14] = rsp_UnknownOpcode;
- RSP_Lc2[15] = rsp_UnknownOpcode;
- RSP_Lc2[16] = rsp_UnknownOpcode;
- RSP_Lc2[17] = rsp_UnknownOpcode;
- RSP_Lc2[18] = rsp_UnknownOpcode;
- RSP_Lc2[19] = rsp_UnknownOpcode;
- RSP_Lc2[20] = rsp_UnknownOpcode;
- RSP_Lc2[21] = rsp_UnknownOpcode;
- RSP_Lc2[22] = rsp_UnknownOpcode;
- RSP_Lc2[23] = rsp_UnknownOpcode;
- RSP_Lc2[24] = rsp_UnknownOpcode;
- RSP_Lc2[25] = rsp_UnknownOpcode;
- RSP_Lc2[26] = rsp_UnknownOpcode;
- RSP_Lc2[27] = rsp_UnknownOpcode;
- RSP_Lc2[28] = rsp_UnknownOpcode;
- RSP_Lc2[29] = rsp_UnknownOpcode;
- RSP_Lc2[30] = rsp_UnknownOpcode;
- RSP_Lc2[31] = rsp_UnknownOpcode;
-
- RSP_Sc2[0] = RSP_Opcode_SBV;
- RSP_Sc2[1] = RSP_Opcode_SSV;
- RSP_Sc2[2] = RSP_Opcode_SLV;
- RSP_Sc2[3] = RSP_Opcode_SDV;
- RSP_Sc2[4] = RSP_Opcode_SQV;
- RSP_Sc2[5] = RSP_Opcode_SRV;
- RSP_Sc2[6] = RSP_Opcode_SPV;
- RSP_Sc2[7] = RSP_Opcode_SUV;
- RSP_Sc2[8] = RSP_Opcode_SHV;
- RSP_Sc2[9] = RSP_Opcode_SFV;
- RSP_Sc2[10] = RSP_Opcode_SWV;
- RSP_Sc2[11] = RSP_Opcode_STV;
- RSP_Sc2[12] = rsp_UnknownOpcode;
- RSP_Sc2[13] = rsp_UnknownOpcode;
- RSP_Sc2[14] = rsp_UnknownOpcode;
- RSP_Sc2[15] = rsp_UnknownOpcode;
- RSP_Sc2[16] = rsp_UnknownOpcode;
- RSP_Sc2[17] = rsp_UnknownOpcode;
- RSP_Sc2[18] = rsp_UnknownOpcode;
- RSP_Sc2[19] = rsp_UnknownOpcode;
- RSP_Sc2[20] = rsp_UnknownOpcode;
- RSP_Sc2[21] = rsp_UnknownOpcode;
- RSP_Sc2[22] = rsp_UnknownOpcode;
- RSP_Sc2[23] = rsp_UnknownOpcode;
- RSP_Sc2[24] = rsp_UnknownOpcode;
- RSP_Sc2[25] = rsp_UnknownOpcode;
- RSP_Sc2[26] = rsp_UnknownOpcode;
- RSP_Sc2[27] = rsp_UnknownOpcode;
- RSP_Sc2[28] = rsp_UnknownOpcode;
- RSP_Sc2[29] = rsp_UnknownOpcode;
- RSP_Sc2[30] = rsp_UnknownOpcode;
- RSP_Sc2[31] = rsp_UnknownOpcode;
-}
-
-uint32_t RunInterpreterCPU(uint32_t Cycles)
-{
- uint32_t CycleCount;
- RSP_Running = true;
- if (g_RSPDebugger != nullptr)
- {
- g_RSPDebugger->StartingCPU();
- }
- CycleCount = 0;
-
- while (RSP_Running)
- {
- if (g_RSPDebugger != nullptr)
- {
- g_RSPDebugger->BeforeExecuteOp();
- }
- RSPOpC.Value = *(uint32_t *)(RSPInfo.IMEM + (*PrgCount & 0xFFC));
- RSP_Opcode[RSPOpC.op]();
- RSP_GPR[0].W = 0x00000000; // MIPS $zero hard-wired to 0
-
- switch (RSP_NextInstruction)
- {
- case RSPPIPELINE_NORMAL:
- *PrgCount = (*PrgCount + 4) & 0xFFC;
- break;
- case RSPPIPELINE_DELAY_SLOT:
- RSP_NextInstruction = RSPPIPELINE_JUMP;
- *PrgCount = (*PrgCount + 4) & 0xFFC;
- break;
- case RSPPIPELINE_JUMP:
- RSP_NextInstruction = RSPPIPELINE_NORMAL;
- *PrgCount = RSP_JumpTo;
- break;
- case RSPPIPELINE_SINGLE_STEP:
- *PrgCount = (*PrgCount + 4) & 0xFFC;
- RSP_NextInstruction = RSPPIPELINE_SINGLE_STEP_DONE;
- break;
- case RSPPIPELINE_SINGLE_STEP_DONE:
- *PrgCount = (*PrgCount + 4) & 0xFFC;
- *RSPInfo.SP_STATUS_REG |= SP_STATUS_HALT;
- RSP_Running = false;
- break;
- }
- }
- return Cycles;
-}
-
unsigned int RSP_branch_if(int condition)
{
unsigned int new_PC;
diff --git a/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.h b/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.h
index f37894111..89a97847b 100644
--- a/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.h
+++ b/Source/Project64-rsp-core/cpu/RSPInterpreterCPU.h
@@ -23,5 +23,4 @@ extern uint32_t RSP_JumpTo;
unsigned int RSP_branch_if(int condition);
-void BuildInterpreterCPU(void);
uint32_t RunInterpreterCPU(uint32_t Cycles);
diff --git a/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp b/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp
index ecb256d29..ba1f59dd7 100644
--- a/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp
+++ b/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp
@@ -6,6 +6,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -56,112 +57,485 @@ uint32_t clz32(uint32_t val)
#endif
}
+RSPOp::RSPOp(CRSPSystem & System) :
+ m_System(System)
+{
+ BuildInterpreter();
+}
+
+RSPOp::~RSPOp()
+{
+}
+
+void RSPOp::BuildInterpreter(void)
+{
+ Jump_Opcode[0] = &RSPOp::SPECIAL;
+ Jump_Opcode[1] = &RSPOp::REGIMM;
+ Jump_Opcode[2] = &RSPOp::J;
+ Jump_Opcode[3] = &RSPOp::JAL;
+ Jump_Opcode[4] = &RSPOp::BEQ;
+ Jump_Opcode[5] = &RSPOp::BNE;
+ Jump_Opcode[6] = &RSPOp::BLEZ;
+ Jump_Opcode[7] = &RSPOp::BGTZ;
+ Jump_Opcode[8] = &RSPOp::ADDI;
+ Jump_Opcode[9] = &RSPOp::ADDIU;
+ Jump_Opcode[10] = &RSPOp::SLTI;
+ Jump_Opcode[11] = &RSPOp::SLTIU;
+ Jump_Opcode[12] = &RSPOp::ANDI;
+ Jump_Opcode[13] = &RSPOp::ORI;
+ Jump_Opcode[14] = &RSPOp::XORI;
+ Jump_Opcode[15] = &RSPOp::LUI;
+ Jump_Opcode[16] = &RSPOp::COP0;
+ Jump_Opcode[17] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[18] = &RSPOp::COP2;
+ Jump_Opcode[19] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[20] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[21] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[22] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[23] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[24] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[25] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[26] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[27] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[28] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[29] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[30] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[31] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[32] = &RSPOp::LB;
+ Jump_Opcode[33] = &RSPOp::LH;
+ Jump_Opcode[34] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[35] = &RSPOp::LW;
+ Jump_Opcode[36] = &RSPOp::LBU;
+ Jump_Opcode[37] = &RSPOp::LHU;
+ Jump_Opcode[38] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[39] = &RSPOp::LWU;
+ Jump_Opcode[40] = &RSPOp::SB;
+ Jump_Opcode[41] = &RSPOp::SH;
+ Jump_Opcode[42] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[43] = &RSPOp::SW;
+ Jump_Opcode[44] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[45] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[46] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[47] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[48] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[49] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[50] = &RSPOp::LC2;
+ Jump_Opcode[51] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[52] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[53] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[54] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[55] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[56] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[57] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[58] = &RSPOp::SC2;
+ Jump_Opcode[59] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[60] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[61] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[62] = &RSPOp::UnknownOpcode;
+ Jump_Opcode[63] = &RSPOp::UnknownOpcode;
+
+ Jump_Special[0] = &RSPOp::Special_SLL;
+ Jump_Special[1] = &RSPOp::UnknownOpcode;
+ Jump_Special[2] = &RSPOp::Special_SRL;
+ Jump_Special[3] = &RSPOp::Special_SRA;
+ Jump_Special[4] = &RSPOp::Special_SLLV;
+ Jump_Special[5] = &RSPOp::UnknownOpcode;
+ Jump_Special[6] = &RSPOp::Special_SRLV;
+ Jump_Special[7] = &RSPOp::Special_SRAV;
+ Jump_Special[8] = &RSPOp::Special_JR;
+ Jump_Special[9] = &RSPOp::Special_JALR;
+ Jump_Special[10] = &RSPOp::UnknownOpcode;
+ Jump_Special[11] = &RSPOp::UnknownOpcode;
+ Jump_Special[12] = &RSPOp::UnknownOpcode;
+ Jump_Special[13] = &RSPOp::Special_BREAK;
+ Jump_Special[14] = &RSPOp::UnknownOpcode;
+ Jump_Special[15] = &RSPOp::UnknownOpcode;
+ Jump_Special[16] = &RSPOp::UnknownOpcode;
+ Jump_Special[17] = &RSPOp::UnknownOpcode;
+ Jump_Special[18] = &RSPOp::UnknownOpcode;
+ Jump_Special[19] = &RSPOp::UnknownOpcode;
+ Jump_Special[20] = &RSPOp::UnknownOpcode;
+ Jump_Special[21] = &RSPOp::UnknownOpcode;
+ Jump_Special[22] = &RSPOp::UnknownOpcode;
+ Jump_Special[23] = &RSPOp::UnknownOpcode;
+ Jump_Special[24] = &RSPOp::UnknownOpcode;
+ Jump_Special[25] = &RSPOp::UnknownOpcode;
+ Jump_Special[26] = &RSPOp::UnknownOpcode;
+ Jump_Special[27] = &RSPOp::UnknownOpcode;
+ Jump_Special[28] = &RSPOp::UnknownOpcode;
+ Jump_Special[29] = &RSPOp::UnknownOpcode;
+ Jump_Special[30] = &RSPOp::UnknownOpcode;
+ Jump_Special[31] = &RSPOp::UnknownOpcode;
+ Jump_Special[32] = &RSPOp::Special_ADD;
+ Jump_Special[33] = &RSPOp::Special_ADDU;
+ Jump_Special[34] = &RSPOp::Special_SUB;
+ Jump_Special[35] = &RSPOp::Special_SUBU;
+ Jump_Special[36] = &RSPOp::Special_AND;
+ Jump_Special[37] = &RSPOp::Special_OR;
+ Jump_Special[38] = &RSPOp::Special_XOR;
+ Jump_Special[39] = &RSPOp::Special_NOR;
+ Jump_Special[40] = &RSPOp::UnknownOpcode;
+ Jump_Special[41] = &RSPOp::UnknownOpcode;
+ Jump_Special[42] = &RSPOp::Special_SLT;
+ Jump_Special[43] = &RSPOp::Special_SLTU;
+ Jump_Special[44] = &RSPOp::UnknownOpcode;
+ Jump_Special[45] = &RSPOp::UnknownOpcode;
+ Jump_Special[46] = &RSPOp::UnknownOpcode;
+ Jump_Special[47] = &RSPOp::UnknownOpcode;
+ Jump_Special[48] = &RSPOp::UnknownOpcode;
+ Jump_Special[49] = &RSPOp::UnknownOpcode;
+ Jump_Special[50] = &RSPOp::UnknownOpcode;
+ Jump_Special[51] = &RSPOp::UnknownOpcode;
+ Jump_Special[52] = &RSPOp::UnknownOpcode;
+ Jump_Special[53] = &RSPOp::UnknownOpcode;
+ Jump_Special[54] = &RSPOp::UnknownOpcode;
+ Jump_Special[55] = &RSPOp::UnknownOpcode;
+ Jump_Special[56] = &RSPOp::UnknownOpcode;
+ Jump_Special[57] = &RSPOp::UnknownOpcode;
+ Jump_Special[58] = &RSPOp::UnknownOpcode;
+ Jump_Special[59] = &RSPOp::UnknownOpcode;
+ Jump_Special[60] = &RSPOp::UnknownOpcode;
+ Jump_Special[61] = &RSPOp::UnknownOpcode;
+ Jump_Special[62] = &RSPOp::UnknownOpcode;
+ Jump_Special[63] = &RSPOp::UnknownOpcode;
+
+ Jump_RegImm[0] = &RSPOp::BLTZ;
+ Jump_RegImm[1] = &RSPOp::BGEZ;
+ Jump_RegImm[2] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[3] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[4] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[5] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[6] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[7] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[8] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[9] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[10] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[11] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[12] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[13] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[14] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[15] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[16] = &RSPOp::BLTZAL;
+ Jump_RegImm[17] = &RSPOp::BGEZAL;
+ Jump_RegImm[18] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[19] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[20] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[21] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[22] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[23] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[24] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[25] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[26] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[27] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[28] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[29] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[30] = &RSPOp::UnknownOpcode;
+ Jump_RegImm[31] = &RSPOp::UnknownOpcode;
+
+ Jump_Cop0[0] = &RSPOp::Cop0_MF;
+ Jump_Cop0[1] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[2] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[3] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[4] = &RSPOp::Cop0_MT;
+ Jump_Cop0[5] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[6] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[7] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[8] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[9] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[10] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[11] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[12] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[13] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[14] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[15] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[16] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[17] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[18] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[19] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[20] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[21] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[22] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[23] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[24] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[25] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[26] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[27] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[28] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[29] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[30] = &RSPOp::UnknownOpcode;
+ Jump_Cop0[31] = &RSPOp::UnknownOpcode;
+
+ Jump_Cop2[0] = &RSPOp::Cop2_MF;
+ Jump_Cop2[1] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[2] = &RSPOp::Cop2_CF;
+ Jump_Cop2[3] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[4] = &RSPOp::Cop2_MT;
+ Jump_Cop2[5] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[6] = &RSPOp::Cop2_CT;
+ Jump_Cop2[7] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[8] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[9] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[10] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[11] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[12] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[13] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[14] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[15] = &RSPOp::UnknownOpcode;
+ Jump_Cop2[16] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[17] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[18] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[19] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[20] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[21] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[22] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[23] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[24] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[25] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[26] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[27] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[28] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[29] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[30] = &RSPOp::Cop2_VECTOR;
+ Jump_Cop2[31] = &RSPOp::Cop2_VECTOR;
+
+ Jump_Vector[0] = &RSPOp::Vector_VMULF;
+ Jump_Vector[1] = &RSPOp::Vector_VMULU;
+ Jump_Vector[2] = &RSPOp::Vector_VRNDP;
+ Jump_Vector[3] = &RSPOp::Vector_VMULQ;
+ Jump_Vector[4] = &RSPOp::Vector_VMUDL;
+ Jump_Vector[5] = &RSPOp::Vector_VMUDM;
+ Jump_Vector[6] = &RSPOp::Vector_VMUDN;
+ Jump_Vector[7] = &RSPOp::Vector_VMUDH;
+ Jump_Vector[8] = &RSPOp::Vector_VMACF;
+ Jump_Vector[9] = &RSPOp::Vector_VMACU;
+ Jump_Vector[10] = &RSPOp::Vector_VRNDN;
+ Jump_Vector[11] = &RSPOp::Vector_VMACQ;
+ Jump_Vector[12] = &RSPOp::Vector_VMADL;
+ Jump_Vector[13] = &RSPOp::Vector_VMADM;
+ Jump_Vector[14] = &RSPOp::Vector_VMADN;
+ Jump_Vector[15] = &RSPOp::Vector_VMADH;
+ Jump_Vector[16] = &RSPOp::Vector_VADD;
+ Jump_Vector[17] = &RSPOp::Vector_VSUB;
+ Jump_Vector[18] = &RSPOp::Vector_Reserved;
+ Jump_Vector[19] = &RSPOp::Vector_VABS;
+ Jump_Vector[20] = &RSPOp::Vector_VADDC;
+ Jump_Vector[21] = &RSPOp::Vector_VSUBC;
+ Jump_Vector[22] = &RSPOp::Vector_Reserved;
+ Jump_Vector[23] = &RSPOp::Vector_Reserved;
+ Jump_Vector[24] = &RSPOp::Vector_Reserved;
+ Jump_Vector[25] = &RSPOp::Vector_Reserved;
+ Jump_Vector[26] = &RSPOp::Vector_Reserved;
+ Jump_Vector[27] = &RSPOp::Vector_Reserved;
+ Jump_Vector[28] = &RSPOp::Vector_Reserved;
+ Jump_Vector[29] = &RSPOp::Vector_VSAW;
+ Jump_Vector[30] = &RSPOp::Vector_Reserved;
+ Jump_Vector[31] = &RSPOp::Vector_Reserved;
+ Jump_Vector[32] = &RSPOp::Vector_VLT;
+ Jump_Vector[33] = &RSPOp::Vector_VEQ;
+ Jump_Vector[34] = &RSPOp::Vector_VNE;
+ Jump_Vector[35] = &RSPOp::Vector_VGE;
+ Jump_Vector[36] = &RSPOp::Vector_VCL;
+ Jump_Vector[37] = &RSPOp::Vector_VCH;
+ Jump_Vector[38] = &RSPOp::Vector_VCR;
+ Jump_Vector[39] = &RSPOp::Vector_VMRG;
+ Jump_Vector[40] = &RSPOp::Vector_VAND;
+ Jump_Vector[41] = &RSPOp::Vector_VNAND;
+ Jump_Vector[42] = &RSPOp::Vector_VOR;
+ Jump_Vector[43] = &RSPOp::Vector_VNOR;
+ Jump_Vector[44] = &RSPOp::Vector_VXOR;
+ Jump_Vector[45] = &RSPOp::Vector_VNXOR;
+ Jump_Vector[46] = &RSPOp::Vector_Reserved;
+ Jump_Vector[47] = &RSPOp::Vector_Reserved;
+ Jump_Vector[48] = &RSPOp::Vector_VRCP;
+ Jump_Vector[49] = &RSPOp::Vector_VRCPL;
+ Jump_Vector[50] = &RSPOp::Vector_VRCPH;
+ Jump_Vector[51] = &RSPOp::Vector_VMOV;
+ Jump_Vector[52] = &RSPOp::Vector_VRSQ;
+ Jump_Vector[53] = &RSPOp::Vector_VRSQL;
+ Jump_Vector[54] = &RSPOp::Vector_VRSQH;
+ Jump_Vector[55] = &RSPOp::Vector_VNOOP;
+ Jump_Vector[56] = &RSPOp::Vector_Reserved;
+ Jump_Vector[57] = &RSPOp::Vector_Reserved;
+ Jump_Vector[58] = &RSPOp::Vector_Reserved;
+ Jump_Vector[59] = &RSPOp::Vector_Reserved;
+ Jump_Vector[60] = &RSPOp::Vector_Reserved;
+ Jump_Vector[61] = &RSPOp::Vector_Reserved;
+ Jump_Vector[62] = &RSPOp::Vector_Reserved;
+ Jump_Vector[63] = &RSPOp::Vector_VNOOP;
+
+ Jump_Lc2[0] = &RSPOp::LBV;
+ Jump_Lc2[1] = &RSPOp::LSV;
+ Jump_Lc2[2] = &RSPOp::LLV;
+ Jump_Lc2[3] = &RSPOp::LDV;
+ Jump_Lc2[4] = &RSPOp::LQV;
+ Jump_Lc2[5] = &RSPOp::LRV;
+ Jump_Lc2[6] = &RSPOp::LPV;
+ Jump_Lc2[7] = &RSPOp::LUV;
+ Jump_Lc2[8] = &RSPOp::LHV;
+ Jump_Lc2[9] = &RSPOp::LFV;
+ Jump_Lc2[10] = &RSPOp::LWV;
+ Jump_Lc2[11] = &RSPOp::LTV;
+ Jump_Lc2[12] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[13] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[14] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[15] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[16] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[17] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[18] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[19] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[20] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[21] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[22] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[23] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[24] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[25] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[26] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[27] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[28] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[29] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[30] = &RSPOp::UnknownOpcode;
+ Jump_Lc2[31] = &RSPOp::UnknownOpcode;
+
+ Jump_Sc2[0] = &RSPOp::SBV;
+ Jump_Sc2[1] = &RSPOp::SSV;
+ Jump_Sc2[2] = &RSPOp::SLV;
+ Jump_Sc2[3] = &RSPOp::SDV;
+ Jump_Sc2[4] = &RSPOp::SQV;
+ Jump_Sc2[5] = &RSPOp::SRV;
+ Jump_Sc2[6] = &RSPOp::SPV;
+ Jump_Sc2[7] = &RSPOp::SUV;
+ Jump_Sc2[8] = &RSPOp::SHV;
+ Jump_Sc2[9] = &RSPOp::SFV;
+ Jump_Sc2[10] = &RSPOp::SWV;
+ Jump_Sc2[11] = &RSPOp::STV;
+ Jump_Sc2[12] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[13] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[14] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[15] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[16] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[17] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[18] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[19] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[20] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[21] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[22] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[23] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[24] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[25] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[26] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[27] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[28] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[29] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[30] = &RSPOp::UnknownOpcode;
+ Jump_Sc2[31] = &RSPOp::UnknownOpcode;
+}
+
// Opcode functions
-void RSP_Opcode_SPECIAL(void)
+void RSPOp::SPECIAL(void)
{
- RSP_Special[RSPOpC.funct]();
+ (this->*Jump_Special[RSPOpC.funct])();
}
-void RSP_Opcode_REGIMM(void)
+void RSPOp::REGIMM(void)
{
- RSP_RegImm[RSPOpC.rt]();
+ (this->*Jump_RegImm[RSPOpC.rt])();
}
-void RSP_Opcode_J(void)
+void RSPOp::J(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = (RSPOpC.target << 2) & 0xFFC;
}
-void RSP_Opcode_JAL(void)
+void RSPOp::JAL(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_GPR[31].UW = (*PrgCount + 8) & 0xFFC;
RSP_JumpTo = (RSPOpC.target << 2) & 0xFFC;
}
-void RSP_Opcode_BEQ(void)
+void RSPOp::BEQ(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W == RSP_GPR[RSPOpC.rt].W);
}
-void RSP_Opcode_BNE(void)
+void RSPOp::BNE(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W != RSP_GPR[RSPOpC.rt].W);
}
-void RSP_Opcode_BLEZ(void)
+void RSPOp::BLEZ(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W <= 0);
}
-void RSP_Opcode_BGTZ(void)
+void RSPOp::BGTZ(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W > 0);
}
-void RSP_Opcode_ADDI(void)
+void RSPOp::ADDI(void)
{
RSP_GPR[RSPOpC.rt].W = RSP_GPR[RSPOpC.rs].W + (int16_t)RSPOpC.immediate;
}
-void RSP_Opcode_ADDIU(void)
+void RSPOp::ADDIU(void)
{
RSP_GPR[RSPOpC.rt].UW = RSP_GPR[RSPOpC.rs].UW + (uint32_t)((int16_t)RSPOpC.immediate);
}
-void RSP_Opcode_SLTI(void)
+void RSPOp::SLTI(void)
{
RSP_GPR[RSPOpC.rt].W = (RSP_GPR[RSPOpC.rs].W < (int16_t)RSPOpC.immediate) ? 1 : 0;
}
-void RSP_Opcode_SLTIU(void)
+void RSPOp::SLTIU(void)
{
RSP_GPR[RSPOpC.rt].W = (RSP_GPR[RSPOpC.rs].UW < (uint32_t)(int16_t)RSPOpC.immediate) ? 1 : 0;
}
-void RSP_Opcode_ANDI(void)
+void RSPOp::ANDI(void)
{
RSP_GPR[RSPOpC.rt].W = RSP_GPR[RSPOpC.rs].W & RSPOpC.immediate;
}
-void RSP_Opcode_ORI(void)
+void RSPOp::ORI(void)
{
RSP_GPR[RSPOpC.rt].W = RSP_GPR[RSPOpC.rs].W | RSPOpC.immediate;
}
-void RSP_Opcode_XORI(void)
+void RSPOp::XORI(void)
{
RSP_GPR[RSPOpC.rt].W = RSP_GPR[RSPOpC.rs].W ^ RSPOpC.immediate;
}
-void RSP_Opcode_LUI(void)
+void RSPOp::LUI(void)
{
RSP_GPR[RSPOpC.rt].W = RSPOpC.immediate << 16;
}
-void RSP_Opcode_COP0(void)
+void RSPOp::COP0(void)
{
- RSP_Cop0[RSPOpC.rs]();
+ (this->*Jump_Cop0[RSPOpC.rs])();
}
-void RSP_Opcode_COP2(void)
+void RSPOp::COP2(void)
{
- RSP_Cop2[RSPOpC.rs]();
+ (this->*Jump_Cop2[RSPOpC.rs])();
}
-void RSP_Opcode_LB(void)
+void RSPOp::LB(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
RSP_GPR[RSPOpC.rt].W = *(int8_t *)(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
}
-void RSP_Opcode_LH(void)
+void RSPOp::LH(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
if ((Address & 0x1) != 0)
@@ -176,7 +550,7 @@ void RSP_Opcode_LH(void)
RSP_GPR[RSPOpC.rt].W = RSP_GPR[RSPOpC.rt].HW[0];
}
-void RSP_Opcode_LW(void)
+void RSPOp::LW(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
if ((Address & 0x3) != 0)
@@ -192,13 +566,13 @@ void RSP_Opcode_LW(void)
}
}
-void RSP_Opcode_LBU(void)
+void RSPOp::LBU(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
RSP_GPR[RSPOpC.rt].UW = *(uint8_t *)(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
}
-void RSP_Opcode_LHU(void)
+void RSPOp::LHU(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
if ((Address & 0x1) != 0)
@@ -213,7 +587,7 @@ void RSP_Opcode_LHU(void)
RSP_GPR[RSPOpC.rt].UW = RSP_GPR[RSPOpC.rt].UHW[0];
}
-void RSP_Opcode_LWU(void)
+void RSPOp::LWU(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
if ((Address & 0x3) != 0)
@@ -229,13 +603,13 @@ void RSP_Opcode_LWU(void)
}
}
-void RSP_Opcode_SB(void)
+void RSPOp::SB(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
*(uint8_t *)(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_GPR[RSPOpC.rt].UB[0];
}
-void RSP_Opcode_SH(void)
+void RSPOp::SH(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
if ((Address & 0x1) != 0)
@@ -249,7 +623,7 @@ void RSP_Opcode_SH(void)
}
}
-void RSP_Opcode_SW(void)
+void RSPOp::SW(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (short)RSPOpC.offset) & 0xFFF;
if ((Address & 0x3) != 0)
@@ -265,62 +639,62 @@ void RSP_Opcode_SW(void)
}
}
-void RSP_Opcode_LC2(void)
+void RSPOp::LC2(void)
{
- RSP_Lc2[RSPOpC.rd]();
+ (this->*Jump_Lc2[RSPOpC.rd])();
}
-void RSP_Opcode_SC2(void)
+void RSPOp::SC2(void)
{
- RSP_Sc2[RSPOpC.rd]();
+ (this->*Jump_Sc2[RSPOpC.rd])();
}
// R4300i Opcodes: Special
-void RSP_Special_SLL(void)
+void RSPOp::Special_SLL(void)
{
RSP_GPR[RSPOpC.rd].W = RSP_GPR[RSPOpC.rt].W << RSPOpC.sa;
}
-void RSP_Special_SRL(void)
+void RSPOp::Special_SRL(void)
{
RSP_GPR[RSPOpC.rd].UW = RSP_GPR[RSPOpC.rt].UW >> RSPOpC.sa;
}
-void RSP_Special_SRA(void)
+void RSPOp::Special_SRA(void)
{
RSP_GPR[RSPOpC.rd].W = RSP_GPR[RSPOpC.rt].W >> RSPOpC.sa;
}
-void RSP_Special_SLLV(void)
+void RSPOp::Special_SLLV(void)
{
RSP_GPR[RSPOpC.rd].W = RSP_GPR[RSPOpC.rt].W << (RSP_GPR[RSPOpC.rs].W & 0x1F);
}
-void RSP_Special_SRLV(void)
+void RSPOp::Special_SRLV(void)
{
RSP_GPR[RSPOpC.rd].UW = RSP_GPR[RSPOpC.rt].UW >> (RSP_GPR[RSPOpC.rs].W & 0x1F);
}
-void RSP_Special_SRAV(void)
+void RSPOp::Special_SRAV(void)
{
RSP_GPR[RSPOpC.rd].W = RSP_GPR[RSPOpC.rt].W >> (RSP_GPR[RSPOpC.rs].W & 0x1F);
}
-void RSP_Special_JR(void)
+void RSPOp::Special_JR(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = (RSP_GPR[RSPOpC.rs].W & 0xFFC);
}
-void RSP_Special_JALR(void)
+void RSPOp::Special_JALR(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = (RSP_GPR[RSPOpC.rs].W & 0xFFC);
RSP_GPR[RSPOpC.rd].W = (*PrgCount + 8) & 0xFFC;
}
-void RSP_Special_BREAK(void)
+void RSPOp::Special_BREAK(void)
{
RSP_Running = false;
*RSPInfo.SP_STATUS_REG |= (SP_STATUS_HALT | SP_STATUS_BROKE);
@@ -331,78 +705,78 @@ void RSP_Special_BREAK(void)
}
}
-void RSP_Special_ADD(void)
+void RSPOp::Special_ADD(void)
{
RSP_GPR[RSPOpC.rd].W = RSP_GPR[RSPOpC.rs].W + RSP_GPR[RSPOpC.rt].W;
}
-void RSP_Special_ADDU(void)
+void RSPOp::Special_ADDU(void)
{
RSP_GPR[RSPOpC.rd].UW = RSP_GPR[RSPOpC.rs].UW + RSP_GPR[RSPOpC.rt].UW;
}
-void RSP_Special_SUB(void)
+void RSPOp::Special_SUB(void)
{
RSP_GPR[RSPOpC.rd].W = RSP_GPR[RSPOpC.rs].W - RSP_GPR[RSPOpC.rt].W;
}
-void RSP_Special_SUBU(void)
+void RSPOp::Special_SUBU(void)
{
RSP_GPR[RSPOpC.rd].UW = RSP_GPR[RSPOpC.rs].UW - RSP_GPR[RSPOpC.rt].UW;
}
-void RSP_Special_AND(void)
+void RSPOp::Special_AND(void)
{
RSP_GPR[RSPOpC.rd].UW = RSP_GPR[RSPOpC.rs].UW & RSP_GPR[RSPOpC.rt].UW;
}
-void RSP_Special_OR(void)
+void RSPOp::Special_OR(void)
{
RSP_GPR[RSPOpC.rd].UW = RSP_GPR[RSPOpC.rs].UW | RSP_GPR[RSPOpC.rt].UW;
}
-void RSP_Special_XOR(void)
+void RSPOp::Special_XOR(void)
{
RSP_GPR[RSPOpC.rd].UW = RSP_GPR[RSPOpC.rs].UW ^ RSP_GPR[RSPOpC.rt].UW;
}
-void RSP_Special_NOR(void)
+void RSPOp::Special_NOR(void)
{
RSP_GPR[RSPOpC.rd].UW = ~(RSP_GPR[RSPOpC.rs].UW | RSP_GPR[RSPOpC.rt].UW);
}
-void RSP_Special_SLT(void)
+void RSPOp::Special_SLT(void)
{
RSP_GPR[RSPOpC.rd].UW = (RSP_GPR[RSPOpC.rs].W < RSP_GPR[RSPOpC.rt].W) ? 1 : 0;
}
-void RSP_Special_SLTU(void)
+void RSPOp::Special_SLTU(void)
{
RSP_GPR[RSPOpC.rd].UW = (RSP_GPR[RSPOpC.rs].UW < RSP_GPR[RSPOpC.rt].UW) ? 1 : 0;
}
// R4300i Opcodes: RegImm
-void RSP_Opcode_BLTZ(void)
+void RSPOp::BLTZ(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W < 0);
}
-void RSP_Opcode_BGEZ(void)
+void RSPOp::BGEZ(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W >= 0);
}
-void RSP_Opcode_BLTZAL(void)
+void RSPOp::BLTZAL(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W < 0);
RSP_GPR[31].UW = (*PrgCount + 8) & 0xFFC;
}
-void RSP_Opcode_BGEZAL(void)
+void RSPOp::BGEZAL(void)
{
RSP_NextInstruction = RSPPIPELINE_DELAY_SLOT;
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W >= 0);
@@ -411,7 +785,7 @@ void RSP_Opcode_BGEZAL(void)
// COP0 functions
-void RSP_Cop0_MF(void)
+void RSPOp::Cop0_MF(void)
{
if (g_RSPDebugger != nullptr)
{
@@ -447,7 +821,7 @@ void RSP_Cop0_MF(void)
}
}
-void RSP_Cop0_MT(void)
+void RSPOp::Cop0_MT(void)
{
if (LogRDP && g_CPUCore == InterpreterCPU)
{
@@ -521,7 +895,7 @@ void RSP_Cop0_MT(void)
// COP2 functions
-void RSP_Cop2_MF(void)
+void RSPOp::Cop2_MF(void)
{
uint8_t element = (uint8_t)(RSPOpC.sa >> 1);
RSP_GPR[RSPOpC.rt].B[1] = RSP_Vect[RSPOpC.vs].s8(15 - element);
@@ -529,7 +903,7 @@ void RSP_Cop2_MF(void)
RSP_GPR[RSPOpC.rt].W = RSP_GPR[RSPOpC.rt].HW[0];
}
-void RSP_Cop2_CF(void)
+void RSPOp::Cop2_CF(void)
{
switch ((RSPOpC.rd & 0x03))
{
@@ -540,7 +914,7 @@ void RSP_Cop2_CF(void)
}
}
-void RSP_Cop2_MT(void)
+void RSPOp::Cop2_MT(void)
{
uint8_t element = (uint8_t)(15 - (RSPOpC.sa >> 1));
RSP_Vect[RSPOpC.vs].s8(element) = RSP_GPR[RSPOpC.rt].B[1];
@@ -550,7 +924,7 @@ void RSP_Cop2_MT(void)
}
}
-void RSP_Cop2_CT(void)
+void RSPOp::Cop2_CT(void)
{
switch ((RSPOpC.rd & 0x03))
{
@@ -561,14 +935,14 @@ void RSP_Cop2_CT(void)
}
}
-void RSP_COP2_VECTOR(void)
+void RSPOp::Cop2_VECTOR(void)
{
- RSP_Vector[RSPOpC.funct]();
+ (this->*Jump_Vector[RSPOpC.funct])();
}
// Vector functions
-void RSP_Vector_VMULF(void)
+void RSPOp::Vector_VMULF(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -579,7 +953,7 @@ void RSP_Vector_VMULF(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMULU(void)
+void RSPOp::Vector_VMULU(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -601,7 +975,7 @@ void RSP_Vector_VMULU(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VRNDP(void)
+void RSPOp::Vector_VRNDP(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -622,7 +996,7 @@ void RSP_Vector_VRNDP(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMUDL(void)
+void RSPOp::Vector_VMUDL(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -633,7 +1007,7 @@ void RSP_Vector_VMUDL(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMUDM(void)
+void RSPOp::Vector_VMUDM(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -644,7 +1018,7 @@ void RSP_Vector_VMUDM(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMULQ(void)
+void RSPOp::Vector_VMULQ(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -663,7 +1037,7 @@ void RSP_Vector_VMULQ(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMUDN(void)
+void RSPOp::Vector_VMUDN(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -674,7 +1048,7 @@ void RSP_Vector_VMUDN(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMUDH(void)
+void RSPOp::Vector_VMUDH(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -686,7 +1060,7 @@ void RSP_Vector_VMUDH(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMACF(void)
+void RSPOp::Vector_VMACF(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -697,7 +1071,7 @@ void RSP_Vector_VMACF(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMACU(void)
+void RSPOp::Vector_VMACU(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -719,7 +1093,7 @@ void RSP_Vector_VMACU(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMACQ(void)
+void RSPOp::Vector_VMACQ(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -740,7 +1114,7 @@ void RSP_Vector_VMACQ(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VRNDN(void)
+void RSPOp::Vector_VRNDN(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -761,7 +1135,7 @@ void RSP_Vector_VRNDN(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMADL(void)
+void RSPOp::Vector_VMADL(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -772,7 +1146,7 @@ void RSP_Vector_VMADL(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMADM(void)
+void RSPOp::Vector_VMADM(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -783,7 +1157,7 @@ void RSP_Vector_VMADM(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMADN(void)
+void RSPOp::Vector_VMADN(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -794,7 +1168,7 @@ void RSP_Vector_VMADN(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VMADH(void)
+void RSPOp::Vector_VMADH(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -807,7 +1181,7 @@ void RSP_Vector_VMADH(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VADD(void)
+void RSPOp::Vector_VADD(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -821,7 +1195,7 @@ void RSP_Vector_VADD(void)
VCOH.Clear();
}
-void RSP_Vector_VSUB(void)
+void RSPOp::Vector_VSUB(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -835,7 +1209,7 @@ void RSP_Vector_VSUB(void)
VCOH.Clear();
}
-void RSP_Vector_VABS(void)
+void RSPOp::Vector_VABS(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -867,7 +1241,7 @@ void RSP_Vector_VABS(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VADDC(void)
+void RSPOp::Vector_VADDC(void)
{
RSPVector Result;
VCOH.Clear();
@@ -881,7 +1255,7 @@ void RSP_Vector_VADDC(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VSUBC(void)
+void RSPOp::Vector_VSUBC(void)
{
RSPVector Result;
VCOH.Clear();
@@ -896,7 +1270,7 @@ void RSP_Vector_VSUBC(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_Reserved(void)
+void RSPOp::Vector_Reserved(void)
{
for (uint8_t el = 0; el < 8; el++)
{
@@ -905,7 +1279,7 @@ void RSP_Vector_Reserved(void)
RSP_Vect[RSPOpC.vd] = RSPVector();
}
-void RSP_Vector_VSAW(void)
+void RSPOp::Vector_VSAW(void)
{
RSPVector Result;
@@ -948,7 +1322,7 @@ void RSP_Vector_VSAW(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VLT(void)
+void RSPOp::Vector_VLT(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -971,7 +1345,7 @@ void RSP_Vector_VLT(void)
VCOH.Clear();
}
-void RSP_Vector_VEQ(void)
+void RSPOp::Vector_VEQ(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -985,7 +1359,7 @@ void RSP_Vector_VEQ(void)
VCCH.Clear();
}
-void RSP_Vector_VNE(void)
+void RSPOp::Vector_VNE(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -999,7 +1373,7 @@ void RSP_Vector_VNE(void)
VCOH.Clear();
}
-void RSP_Vector_VGE(void)
+void RSPOp::Vector_VGE(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1022,7 +1396,7 @@ void RSP_Vector_VGE(void)
VCOH.Clear();
}
-void RSP_Vector_VCL(void)
+void RSPOp::Vector_VCL(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1059,7 +1433,7 @@ void RSP_Vector_VCL(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VCH(void)
+void RSPOp::Vector_VCH(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1087,7 +1461,7 @@ void RSP_Vector_VCH(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VCR(void)
+void RSPOp::Vector_VCR(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1110,7 +1484,7 @@ void RSP_Vector_VCR(void)
VCE.Clear();
}
-void RSP_Vector_VMRG(void)
+void RSPOp::Vector_VMRG(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1123,7 +1497,7 @@ void RSP_Vector_VMRG(void)
VCOH.Clear();
}
-void RSP_Vector_VAND(void)
+void RSPOp::Vector_VAND(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1134,7 +1508,7 @@ void RSP_Vector_VAND(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VNAND(void)
+void RSPOp::Vector_VNAND(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1145,7 +1519,7 @@ void RSP_Vector_VNAND(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VOR(void)
+void RSPOp::Vector_VOR(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1156,7 +1530,7 @@ void RSP_Vector_VOR(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VNOR(void)
+void RSPOp::Vector_VNOR(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1167,7 +1541,7 @@ void RSP_Vector_VNOR(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VXOR(void)
+void RSPOp::Vector_VXOR(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1178,7 +1552,7 @@ void RSP_Vector_VXOR(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VNXOR(void)
+void RSPOp::Vector_VNXOR(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
@@ -1189,7 +1563,7 @@ void RSP_Vector_VNXOR(void)
RSP_Vect[RSPOpC.vd] = Result;
}
-void RSP_Vector_VRCP(void)
+void RSPOp::Vector_VRCP(void)
{
int32_t Input = RSP_Vect[RSPOpC.vt].s16(7 - (RSPOpC.e & 0x7));
int32_t Mask = Input >> 31;
@@ -1222,7 +1596,7 @@ void RSP_Vector_VRCP(void)
RSP_Vect[RSPOpC.vd].s16(7 - (RSPOpC.rd & 0x7)) = (int16_t)Result;
}
-void RSP_Vector_VRCPL(void)
+void RSPOp::Vector_VRCPL(void)
{
int32_t Result = 0;
int32_t Input = RcpHigh ? (RcpIn << 16 | RSP_Vect[RSPOpC.vt].u16(7 - (RSPOpC.e & 0x7))) : RSP_Vect[RSPOpC.vt].s16(7 - (RSPOpC.e & 0x7));
@@ -1255,7 +1629,7 @@ void RSP_Vector_VRCPL(void)
RSP_Vect[RSPOpC.vd].s16(7 - (RSPOpC.rd & 0x7)) = (int16_t)Result;
}
-void RSP_Vector_VRCPH(void)
+void RSPOp::Vector_VRCPH(void)
{
RcpHigh = true;
RcpIn = RSP_Vect[RSPOpC.vt].u16(EleSpec[RSPOpC.e].B[(RSPOpC.de & 0x7)]);
@@ -1266,7 +1640,7 @@ void RSP_Vector_VRCPH(void)
RSP_Vect[RSPOpC.vd].u16(7 - (RSPOpC.de & 0x7)) = RcpResult;
}
-void RSP_Vector_VMOV(void)
+void RSPOp::Vector_VMOV(void)
{
for (uint8_t i = 0; i < 8; i++)
{
@@ -1276,7 +1650,7 @@ void RSP_Vector_VMOV(void)
RSP_Vect[RSPOpC.vd].u16(Index) = RSP_Vect[RSPOpC.vt].se(Index, RSPOpC.e);
}
-void RSP_Vector_VRSQ(void)
+void RSPOp::Vector_VRSQ(void)
{
int64_t Result = 0;
int32_t Input = RSP_Vect[RSPOpC.vt].s16(7 - (RSPOpC.e & 0x7));
@@ -1309,7 +1683,7 @@ void RSP_Vector_VRSQ(void)
RSP_Vect[RSPOpC.vd].s16(7 - (RSPOpC.rd & 0x7)) = (int16_t)Result;
}
-void RSP_Vector_VRSQL(void)
+void RSPOp::Vector_VRSQL(void)
{
int32_t Result = 0;
int32_t Input = RcpHigh ? RcpIn << 16 | RSP_Vect[RSPOpC.vt].u16(7 - (RSPOpC.e & 0x7)) : RSP_Vect[RSPOpC.vt].s16(7 - (RSPOpC.e & 0x7));
@@ -1342,7 +1716,7 @@ void RSP_Vector_VRSQL(void)
RSP_Vect[RSPOpC.vd].s16(7 - (RSPOpC.rd & 0x7)) = (int16_t)Result;
}
-void RSP_Vector_VRSQH(void)
+void RSPOp::Vector_VRSQH(void)
{
RcpHigh = 1;
RcpIn = RSP_Vect[RSPOpC.vt].u16(EleSpec[RSPOpC.e].B[(RSPOpC.rd & 0x7)]);
@@ -1353,19 +1727,19 @@ void RSP_Vector_VRSQH(void)
RSP_Vect[RSPOpC.vd].u16(7 - (RSPOpC.rd & 0x7)) = RcpResult;
}
-void RSP_Vector_VNOOP(void)
+void RSPOp::Vector_VNOOP(void)
{
}
// LC2 functions
-void RSP_Opcode_LBV(void)
+void RSPOp::LBV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 0)) & 0xFFF;
RSP_Vect[RSPOpC.vt].u8((uint8_t)(15 - RSPOpC.del)) = *(RSPInfo.DMEM + (Address ^ 3));
}
-void RSP_Opcode_LSV(void)
+void RSPOp::LSV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 1)) & 0xFFF;
uint8_t Length = std::min((uint8_t)2, (uint8_t)(16 - RSPOpC.del));
@@ -1375,7 +1749,7 @@ void RSP_Opcode_LSV(void)
}
}
-void RSP_Opcode_LLV(void)
+void RSPOp::LLV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 2)) & 0xFFF;
uint8_t Length = std::min((uint8_t)4, (uint8_t)(16 - RSPOpC.del));
@@ -1385,7 +1759,7 @@ void RSP_Opcode_LLV(void)
}
}
-void RSP_Opcode_LDV(void)
+void RSPOp::LDV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
uint8_t Length = std::min((uint8_t)8, (uint8_t)(16 - RSPOpC.del));
@@ -1395,7 +1769,7 @@ void RSP_Opcode_LDV(void)
}
}
-void RSP_Opcode_LQV(void)
+void RSPOp::LQV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
uint8_t Length = std::min((uint8_t)(((Address + 0x10) & ~0xF) - Address), (uint8_t)(16 - RSPOpC.del));
@@ -1405,7 +1779,7 @@ void RSP_Opcode_LQV(void)
}
}
-void RSP_Opcode_LRV(void)
+void RSPOp::LRV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
uint8_t Offset = (uint8_t)((0x10 - (Address & 0xF)) + RSPOpC.del);
@@ -1416,7 +1790,7 @@ void RSP_Opcode_LRV(void)
}
}
-void RSP_Opcode_LPV(void)
+void RSPOp::LPV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3));
uint32_t Offset = ((Address & 7) - RSPOpC.del);
@@ -1428,7 +1802,7 @@ void RSP_Opcode_LPV(void)
}
}
-void RSP_Opcode_LUV(void)
+void RSPOp::LUV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3));
uint32_t Offset = ((Address & 7) - RSPOpC.del);
@@ -1440,7 +1814,7 @@ void RSP_Opcode_LUV(void)
}
}
-void RSP_Opcode_LHV(void)
+void RSPOp::LHV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4));
uint32_t Offset = ((Address & 7) - RSPOpC.del);
@@ -1452,7 +1826,7 @@ void RSP_Opcode_LHV(void)
}
}
-void RSP_Opcode_LFV(void)
+void RSPOp::LFV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4));
uint8_t Length = std::min((uint8_t)(8 + RSPOpC.del), (uint8_t)16);
@@ -1472,11 +1846,11 @@ void RSP_Opcode_LFV(void)
}
}
-void RSP_Opcode_LWV(void)
+void RSPOp::LWV(void)
{
}
-void RSP_Opcode_LTV(void)
+void RSPOp::LTV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4));
uint32_t Start = Address & ~7;
@@ -1500,13 +1874,13 @@ void RSP_Opcode_LTV(void)
// SC2 functions
-void RSP_Opcode_SBV(void)
+void RSPOp::SBV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 0)) & 0xFFF;
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.vt].u8((uint8_t)(15 - RSPOpC.del));
}
-void RSP_Opcode_SSV(void)
+void RSPOp::SSV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 1)) & 0xFFF;
for (uint8_t i = RSPOpC.del, n = (uint8_t)(2 + RSPOpC.del); i < n; i++, Address++)
@@ -1515,7 +1889,7 @@ void RSP_Opcode_SSV(void)
}
}
-void RSP_Opcode_SLV(void)
+void RSPOp::SLV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 2)) & 0xFFF;
for (uint8_t i = RSPOpC.del, n = (uint8_t)(4 + RSPOpC.del); i < n; i++, Address++)
@@ -1524,7 +1898,7 @@ void RSP_Opcode_SLV(void)
}
}
-void RSP_Opcode_SDV(void)
+void RSPOp::SDV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
for (uint8_t i = RSPOpC.del; i < (8 + RSPOpC.del); i++, Address++)
@@ -1533,7 +1907,7 @@ void RSP_Opcode_SDV(void)
}
}
-void RSP_Opcode_SQV(void)
+void RSPOp::SQV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
uint8_t Length = (uint8_t)(((Address + 0x10) & ~0xF) - Address);
@@ -1543,7 +1917,7 @@ void RSP_Opcode_SQV(void)
}
}
-void RSP_Opcode_SRV(void)
+void RSPOp::SRV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
uint8_t Length = (Address & 0xF);
@@ -1555,7 +1929,7 @@ void RSP_Opcode_SRV(void)
}
}
-void RSP_Opcode_SPV(void)
+void RSPOp::SPV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
for (uint8_t i = RSPOpC.del, n = (uint8_t)(8 + RSPOpC.del); i < n; i++, Address++)
@@ -1571,7 +1945,7 @@ void RSP_Opcode_SPV(void)
}
}
-void RSP_Opcode_SUV(void)
+void RSPOp::SUV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
for (uint8_t Count = RSPOpC.del; Count < (8 + RSPOpC.del); Count++, Address++)
@@ -1587,7 +1961,7 @@ void RSP_Opcode_SUV(void)
}
}
-void RSP_Opcode_SHV(void)
+void RSPOp::SHV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4));
uint8_t Offset = Address & 7;
@@ -1599,7 +1973,7 @@ void RSP_Opcode_SHV(void)
}
}
-void RSP_Opcode_SFV(void)
+void RSPOp::SFV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
uint8_t Offset = Address & 7;
@@ -1659,7 +2033,7 @@ void RSP_Opcode_SFV(void)
}
}
-void RSP_Opcode_STV(void)
+void RSPOp::STV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4));
uint8_t Element = 16 - (RSPOpC.del & ~1);
@@ -1673,7 +2047,7 @@ void RSP_Opcode_STV(void)
}
}
-void RSP_Opcode_SWV(void)
+void RSPOp::SWV(void)
{
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF;
uint8_t Offset = Address & 7;
@@ -1686,7 +2060,7 @@ void RSP_Opcode_SWV(void)
// Other functions
-void rsp_UnknownOpcode(void)
+void RSPOp::UnknownOpcode(void)
{
if (g_RSPDebugger != nullptr)
{
diff --git a/Source/Project64-rsp-core/cpu/RSPInterpreterOps.h b/Source/Project64-rsp-core/cpu/RSPInterpreterOps.h
index e25cc5742..bca841116 100644
--- a/Source/Project64-rsp-core/cpu/RSPInterpreterOps.h
+++ b/Source/Project64-rsp-core/cpu/RSPInterpreterOps.h
@@ -1,155 +1,178 @@
-// Opcode functions
+#pragma once
-void RSP_Opcode_SPECIAL(void);
-void RSP_Opcode_REGIMM(void);
-void RSP_Opcode_J(void);
-void RSP_Opcode_JAL(void);
-void RSP_Opcode_BEQ(void);
-void RSP_Opcode_BNE(void);
-void RSP_Opcode_BLEZ(void);
-void RSP_Opcode_BGTZ(void);
-void RSP_Opcode_ADDI(void);
-void RSP_Opcode_ADDIU(void);
-void RSP_Opcode_SLTI(void);
-void RSP_Opcode_SLTIU(void);
-void RSP_Opcode_ANDI(void);
-void RSP_Opcode_ORI(void);
-void RSP_Opcode_XORI(void);
-void RSP_Opcode_LUI(void);
-void RSP_Opcode_COP0(void);
-void RSP_Opcode_COP2(void);
-void RSP_Opcode_LB(void);
-void RSP_Opcode_LH(void);
-void RSP_Opcode_LW(void);
-void RSP_Opcode_LBU(void);
-void RSP_Opcode_LHU(void);
-void RSP_Opcode_LWU(void);
-void RSP_Opcode_SB(void);
-void RSP_Opcode_SH(void);
-void RSP_Opcode_SW(void);
-void RSP_Opcode_LC2(void);
-void RSP_Opcode_SC2(void);
+class CRSPSystem;
-// R4300i Opcodes: Special
+class RSPOp
+{
+public:
+ RSPOp(CRSPSystem & System);
+ ~RSPOp();
-void RSP_Special_SLL(void);
-void RSP_Special_SRL(void);
-void RSP_Special_SRA(void);
-void RSP_Special_SLLV(void);
-void RSP_Special_SRLV(void);
-void RSP_Special_SRAV(void);
-void RSP_Special_JR(void);
-void RSP_Special_JALR(void);
-void RSP_Special_BREAK(void);
-void RSP_Special_ADD(void);
-void RSP_Special_ADDU(void);
-void RSP_Special_SUB(void);
-void RSP_Special_SUBU(void);
-void RSP_Special_AND(void);
-void RSP_Special_OR(void);
-void RSP_Special_XOR(void);
-void RSP_Special_NOR(void);
-void RSP_Special_SLT(void);
-void RSP_Special_SLTU(void);
+public:
+ RSPOp();
+ RSPOp(const RSPOp &);
+ RSPOp & operator=(const RSPOp &);
-// R4300i Opcodes: RegImm
+ void BuildInterpreter(void);
-void RSP_Opcode_BLTZ(void);
-void RSP_Opcode_BGEZ(void);
-void RSP_Opcode_BLTZAL(void);
-void RSP_Opcode_BGEZAL(void);
+ typedef void (RSPOp::*Func)();
-// COP0 functions
+ void SPECIAL(void);
+ void REGIMM(void);
+ void J(void);
+ void JAL(void);
+ void BEQ(void);
+ void BNE(void);
+ void BLEZ(void);
+ void BGTZ(void);
+ void ADDI(void);
+ void ADDIU(void);
+ void SLTI(void);
+ void SLTIU(void);
+ void ANDI(void);
+ void ORI(void);
+ void XORI(void);
+ void LUI(void);
+ void COP0(void);
+ void COP2(void);
+ void LB(void);
+ void LH(void);
+ void LW(void);
+ void LBU(void);
+ void LHU(void);
+ void LWU(void);
+ void SB(void);
+ void SH(void);
+ void SW(void);
+ void LC2(void);
+ void SC2(void);
-void RSP_Cop0_MF(void);
-void RSP_Cop0_MT(void);
+ // R4300i Opcodes: Special
+ void Special_SLL(void);
+ void Special_SRL(void);
+ void Special_SRA(void);
+ void Special_SLLV(void);
+ void Special_SRLV(void);
+ void Special_SRAV(void);
+ void Special_JR(void);
+ void Special_JALR(void);
+ void Special_BREAK(void);
+ void Special_ADD(void);
+ void Special_ADDU(void);
+ void Special_SUB(void);
+ void Special_SUBU(void);
+ void Special_AND(void);
+ void Special_OR(void);
+ void Special_XOR(void);
+ void Special_NOR(void);
+ void Special_SLT(void);
+ void Special_SLTU(void);
-// COP2 functions
+ // R4300i Opcodes: RegImm
+ void BLTZ(void);
+ void BGEZ(void);
+ void BLTZAL(void);
+ void BGEZAL(void);
-void RSP_Cop2_MF(void);
-void RSP_Cop2_CF(void);
-void RSP_Cop2_MT(void);
-void RSP_Cop2_CT(void);
-void RSP_COP2_VECTOR(void);
+ // COP0 functions
+ void Cop0_MF(void);
+ void Cop0_MT(void);
-// Vector functions
+ // COP2 functions
+ void Cop2_MF(void);
+ void Cop2_CF(void);
+ void Cop2_MT(void);
+ void Cop2_CT(void);
+ void Cop2_VECTOR(void);
-void RSP_Vector_VMULF(void);
-void RSP_Vector_VMULU(void);
-void RSP_Vector_VRNDP(void);
-void RSP_Vector_VMULQ(void);
-void RSP_Vector_VMUDL(void);
-void RSP_Vector_VMUDM(void);
-void RSP_Vector_VMUDN(void);
-void RSP_Vector_VMUDH(void);
-void RSP_Vector_VMACF(void);
-void RSP_Vector_VMACU(void);
-void RSP_Vector_VMACQ(void);
-void RSP_Vector_VRNDN(void);
-void RSP_Vector_VMADL(void);
-void RSP_Vector_VMADM(void);
-void RSP_Vector_VMADN(void);
-void RSP_Vector_VMADH(void);
-void RSP_Vector_VADD(void);
-void RSP_Vector_VSUB(void);
-void RSP_Vector_VABS(void);
-void RSP_Vector_VADDC(void);
-void RSP_Vector_VSUBC(void);
-void RSP_Vector_Reserved(void);
-void RSP_Vector_VSAW(void);
-void RSP_Vector_VLT(void);
-void RSP_Vector_VEQ(void);
-void RSP_Vector_VNE(void);
-void RSP_Vector_VGE(void);
-void RSP_Vector_VCL(void);
-void RSP_Vector_VCH(void);
-void RSP_Vector_VCR(void);
-void RSP_Vector_VMRG(void);
-void RSP_Vector_VAND(void);
-void RSP_Vector_VNAND(void);
-void RSP_Vector_VOR(void);
-void RSP_Vector_VNOR(void);
-void RSP_Vector_VXOR(void);
-void RSP_Vector_VNXOR(void);
-void RSP_Vector_VRCP(void);
-void RSP_Vector_VRCPL(void);
-void RSP_Vector_VRCPH(void);
-void RSP_Vector_VMOV(void);
-void RSP_Vector_VRSQ(void);
-void RSP_Vector_VRSQL(void);
-void RSP_Vector_VRSQH(void);
-void RSP_Vector_VNOOP(void);
+ // Vector functions
+ void Vector_VMULF(void);
+ void Vector_VMULU(void);
+ void Vector_VRNDP(void);
+ void Vector_VMULQ(void);
+ void Vector_VMUDL(void);
+ void Vector_VMUDM(void);
+ void Vector_VMUDN(void);
+ void Vector_VMUDH(void);
+ void Vector_VMACF(void);
+ void Vector_VMACU(void);
+ void Vector_VMACQ(void);
+ void Vector_VRNDN(void);
+ void Vector_VMADL(void);
+ void Vector_VMADM(void);
+ void Vector_VMADN(void);
+ void Vector_VMADH(void);
+ void Vector_VADD(void);
+ void Vector_VSUB(void);
+ void Vector_VABS(void);
+ void Vector_VADDC(void);
+ void Vector_VSUBC(void);
+ void Vector_Reserved(void);
+ void Vector_VSAW(void);
+ void Vector_VLT(void);
+ void Vector_VEQ(void);
+ void Vector_VNE(void);
+ void Vector_VGE(void);
+ void Vector_VCL(void);
+ void Vector_VCH(void);
+ void Vector_VCR(void);
+ void Vector_VMRG(void);
+ void Vector_VAND(void);
+ void Vector_VNAND(void);
+ void Vector_VOR(void);
+ void Vector_VNOR(void);
+ void Vector_VXOR(void);
+ void Vector_VNXOR(void);
+ void Vector_VRCP(void);
+ void Vector_VRCPL(void);
+ void Vector_VRCPH(void);
+ void Vector_VMOV(void);
+ void Vector_VRSQ(void);
+ void Vector_VRSQL(void);
+ void Vector_VRSQH(void);
+ void Vector_VNOOP(void);
-// LC2 functions
+ // LC2 functions
+ void LBV(void);
+ void LSV(void);
+ void LLV(void);
+ void LDV(void);
+ void LQV(void);
+ void LRV(void);
+ void LPV(void);
+ void LUV(void);
+ void LHV(void);
+ void LFV(void);
+ void LWV(void);
+ void LTV(void);
-void RSP_Opcode_LBV(void);
-void RSP_Opcode_LSV(void);
-void RSP_Opcode_LLV(void);
-void RSP_Opcode_LDV(void);
-void RSP_Opcode_LQV(void);
-void RSP_Opcode_LRV(void);
-void RSP_Opcode_LPV(void);
-void RSP_Opcode_LUV(void);
-void RSP_Opcode_LHV(void);
-void RSP_Opcode_LFV(void);
-void RSP_Opcode_LWV(void);
-void RSP_Opcode_LTV(void);
+ // LC2 functions
+ void SBV(void);
+ void SSV(void);
+ void SLV(void);
+ void SDV(void);
+ void SQV(void);
+ void SRV(void);
+ void SPV(void);
+ void SUV(void);
+ void SHV(void);
+ void SFV(void);
+ void STV(void);
+ void SWV(void);
-// LC2 functions
+ // Other functions
+ void UnknownOpcode(void);
-void RSP_Opcode_SBV(void);
-void RSP_Opcode_SSV(void);
-void RSP_Opcode_SLV(void);
-void RSP_Opcode_SDV(void);
-void RSP_Opcode_SQV(void);
-void RSP_Opcode_SRV(void);
-void RSP_Opcode_SPV(void);
-void RSP_Opcode_SUV(void);
-void RSP_Opcode_SHV(void);
-void RSP_Opcode_SFV(void);
-void RSP_Opcode_STV(void);
-void RSP_Opcode_SWV(void);
+ CRSPSystem & m_System;
-// Other functions
+ typedef void (RSPOp::*Func)();
-void rsp_UnknownOpcode(void);
+ Func Jump_Opcode[64];
+ Func Jump_RegImm[32];
+ Func Jump_Special[64];
+ Func Jump_Cop0[32];
+ Func Jump_Cop2[32];
+ Func Jump_Vector[64];
+ Func Jump_Lc2[32];
+ Func Jump_Sc2[32];
+};
\ No newline at end of file
diff --git a/Source/Project64-rsp-core/cpu/RspSystem.cpp b/Source/Project64-rsp-core/cpu/RspSystem.cpp
new file mode 100644
index 000000000..8603e5631
--- /dev/null
+++ b/Source/Project64-rsp-core/cpu/RspSystem.cpp
@@ -0,0 +1,60 @@
+#include
+#include
+#include
+#include
+#include
+#include
+
+CRSPSystem RSPSystem;
+
+CRSPSystem::CRSPSystem() :
+ m_OpCodes(*this)
+{
+}
+
+uint32_t CRSPSystem::RunInterpreterCPU(uint32_t Cycles)
+{
+ uint32_t CycleCount;
+ RSP_Running = true;
+ if (g_RSPDebugger != nullptr)
+ {
+ g_RSPDebugger->StartingCPU();
+ }
+ CycleCount = 0;
+
+ while (RSP_Running)
+ {
+ if (g_RSPDebugger != nullptr)
+ {
+ g_RSPDebugger->BeforeExecuteOp();
+ }
+ RSPOpC.Value = *(uint32_t *)(RSPInfo.IMEM + (*PrgCount & 0xFFC));
+ (m_OpCodes.*(m_OpCodes.Jump_Opcode[RSPOpC.op]))();
+ RSP_GPR[0].W = 0x00000000; // MIPS $zero hard-wired to 0
+
+ switch (RSP_NextInstruction)
+ {
+ case RSPPIPELINE_NORMAL:
+ *PrgCount = (*PrgCount + 4) & 0xFFC;
+ break;
+ case RSPPIPELINE_DELAY_SLOT:
+ RSP_NextInstruction = RSPPIPELINE_JUMP;
+ *PrgCount = (*PrgCount + 4) & 0xFFC;
+ break;
+ case RSPPIPELINE_JUMP:
+ RSP_NextInstruction = RSPPIPELINE_NORMAL;
+ *PrgCount = RSP_JumpTo;
+ break;
+ case RSPPIPELINE_SINGLE_STEP:
+ *PrgCount = (*PrgCount + 4) & 0xFFC;
+ RSP_NextInstruction = RSPPIPELINE_SINGLE_STEP_DONE;
+ break;
+ case RSPPIPELINE_SINGLE_STEP_DONE:
+ *PrgCount = (*PrgCount + 4) & 0xFFC;
+ *RSPInfo.SP_STATUS_REG |= SP_STATUS_HALT;
+ RSP_Running = false;
+ break;
+ }
+ }
+ return Cycles;
+}
diff --git a/Source/Project64-rsp-core/cpu/RspSystem.h b/Source/Project64-rsp-core/cpu/RspSystem.h
new file mode 100644
index 000000000..0d55639f2
--- /dev/null
+++ b/Source/Project64-rsp-core/cpu/RspSystem.h
@@ -0,0 +1,17 @@
+#pragma once
+#include
+#include
+#include
+
+class CRSPSystem
+{
+public:
+ CRSPSystem();
+
+ uint32_t RunInterpreterCPU(uint32_t Cycles);
+
+private:
+ RSPOp m_OpCodes;
+};
+
+extern CRSPSystem RSPSystem;
\ No newline at end of file