Skip to content

Commit

Permalink
RSP: Update the display of RSP opcodes in debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
project64 committed Sep 7, 2023
1 parent 4f74dc4 commit ab67374
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 4 deletions.
19 changes: 19 additions & 0 deletions Source/Project64-rsp-core/cpu/RSPOpcode.h
Expand Up @@ -171,7 +171,16 @@ enum RSPVectorOpCodes
RSP_VECTOR_VABS = 19,
RSP_VECTOR_VADDC = 20,
RSP_VECTOR_VSUBC = 21,
RSP_VECTOR_VADDB = 22,
RSP_VECTOR_VSUBB = 23,
RSP_VECTOR_VACCB = 24,
RSP_VECTOR_VSUCB = 25,
RSP_VECTOR_VSAD = 26,
RSP_VECTOR_VSAC = 27,
RSP_VECTOR_VSUM = 28,
RSP_VECTOR_VSAW = 29,
RSP_VECTOR_VACC = 30,
RSP_VECTOR_VSUC = 31,
RSP_VECTOR_VLT = 32,
RSP_VECTOR_VEQ = 33,
RSP_VECTOR_VNE = 34,
Expand All @@ -186,6 +195,8 @@ enum RSPVectorOpCodes
RSP_VECTOR_VNOR = 43,
RSP_VECTOR_VXOR = 44,
RSP_VECTOR_VNXOR = 45,
RSP_VECTOR_V056 = 46,
RSP_VECTOR_V057 = 47,
RSP_VECTOR_VRCP = 48,
RSP_VECTOR_VRCPL = 49,
RSP_VECTOR_VRCPH = 50,
Expand All @@ -194,6 +205,14 @@ enum RSPVectorOpCodes
RSP_VECTOR_VRSQL = 53,
RSP_VECTOR_VRSQH = 54,
RSP_VECTOR_VNOP = 55,
RSP_VECTOR_VEXTT = 56,
RSP_VECTOR_VEXTQ = 57,
RSP_VECTOR_VEXTN = 58,
RSP_VECTOR_V073 = 59,
RSP_VECTOR_VINST = 60,
RSP_VECTOR_VINSQ = 61,
RSP_VECTOR_VINSN = 62,
RSP_VECTOR_VNULL = 63,
};

enum RSPLSC2OpCodes
Expand Down
92 changes: 88 additions & 4 deletions Source/Project64-rsp-core/cpu/RSPiInstruction.cpp
Expand Up @@ -363,6 +363,14 @@ void RSPInstruction::DecodeCop2Name(void)
break;
case RSP_VECTOR_VMULU:
strcpy(m_Name, "VMULU");
sprintf(m_Param, "$v%d, %d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VRNDP:
strcpy(m_Name, "VRNDP");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, (m_Instruction.vs & 1), m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VMULQ:
strcpy(m_Name, "VMULQ");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VMUDL:
Expand All @@ -389,6 +397,10 @@ void RSPInstruction::DecodeCop2Name(void)
strcpy(m_Name, "VMACU");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VRNDN:
strcpy(m_Name, "VRNDN");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, (m_Instruction.vs & 1), m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VMACQ:
strcpy(m_Name, "VMACQ");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
Expand Down Expand Up @@ -417,14 +429,14 @@ void RSPInstruction::DecodeCop2Name(void)
strcpy(m_Name, "VSUB");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VSUT:
strcpy(m_Name, "Reserved (VSUT)");
strcpy(m_Param, "");
break;
case RSP_VECTOR_VABS:
strcpy(m_Name, "VABS");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VSUT:
strcpy(m_Name, "VSUT");
strcpy(m_Param, "");
break;
case RSP_VECTOR_VADDC:
strcpy(m_Name, "VADDC");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
Expand All @@ -433,10 +445,46 @@ void RSPInstruction::DecodeCop2Name(void)
strcpy(m_Name, "VSUBC");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VADDB:
strcpy(m_Name, "Reserved (VADDB)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VSUBB:
strcpy(m_Name, "Reserved (VSUBB)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VACCB:
strcpy(m_Name, "Reserved (VACCB)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VSUCB:
strcpy(m_Name, "Reserved (VSUCB)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VSAD:
strcpy(m_Name, "Reserved (VSAD)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VSAC:
strcpy(m_Name, "Reserved (VSAC)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VSUM:
strcpy(m_Name, "Reserved (VSUM)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VSAW:
strcpy(m_Name, "VSAW");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VACC:
strcpy(m_Name, "Reserved (VACC)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VSUC:
strcpy(m_Name, "Reserved (VSUC)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VLT:
strcpy(m_Name, "VLT");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
Expand Down Expand Up @@ -493,6 +541,14 @@ void RSPInstruction::DecodeCop2Name(void)
strcpy(m_Name, "VNXOR");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_V056:
strcpy(m_Name, "Reserved (V056)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_V057:
strcpy(m_Name, "Reserved (V057)");
sprintf(m_Param, "$v%d, $v%d, $v%d%s", m_Instruction.vd, m_Instruction.vs, m_Instruction.vt, ElementSpecifier(m_Instruction.e));
break;
case RSP_VECTOR_VRCP:
strcpy(m_Name, "VRCP");
sprintf(m_Param, "$v%d[%d], $v%d%s", m_Instruction.sa, m_Instruction.rd & 0x7, m_Instruction.rt, ElementSpecifier(m_Instruction.e));
Expand Down Expand Up @@ -524,6 +580,34 @@ void RSPInstruction::DecodeCop2Name(void)
strcpy(m_Name, "VNOP");
strcpy(m_Param, "");
break;
case RSP_VECTOR_VEXTT:
strcpy(m_Name, "Reserved (VEXTT)");
strcpy(m_Param, "");
break;
case RSP_VECTOR_VEXTQ:
strcpy(m_Name, "Reserved (VEXTQ)");
strcpy(m_Param, "");
break;
case RSP_VECTOR_VEXTN:
strcpy(m_Name, "Reserved (VEXTN)");
strcpy(m_Param, "");
break;
case RSP_VECTOR_V073:
strcpy(m_Name, "Reserved (V073)");
strcpy(m_Param, "");
break;
case RSP_VECTOR_VINST:
strcpy(m_Name, "Reserved (VINST)");
strcpy(m_Param, "");
break;
case RSP_VECTOR_VINSQ:
strcpy(m_Name, "Reserved (VINSQ)");
strcpy(m_Param, "");
break;
case RSP_VECTOR_VINSN:
strcpy(m_Name, "Reserved (VINSN)");
strcpy(m_Param, "");
break;
default:
strcpy(m_Name, "UNKNOWN");
sprintf(m_Param, "0x%08X", m_Instruction.Value);
Expand Down

0 comments on commit ab67374

Please sign in to comment.