Skip to content

Commit

Permalink
RSP: Create a RSP instruction for decoding the RSP op
Browse files Browse the repository at this point in the history
  • Loading branch information
project64 committed Jun 15, 2023
1 parent df215c1 commit 080a3b6
Show file tree
Hide file tree
Showing 17 changed files with 1,107 additions and 849 deletions.
4 changes: 2 additions & 2 deletions Source/Project64-rsp/Cpu.cpp
@@ -1,5 +1,5 @@
#include "Cpu.h"
#include "OpCode.h"
#include "cpu/RSPOpcode.h"
#include "Profiling.h"
#include "RSP Command.h"
#include "RSP registers.h"
Expand All @@ -15,7 +15,7 @@
#include <windows.h>

UDWORD EleSpec[32], Indx[32];
OPCODE RSPOpC;
RSPOpcode RSPOpC;
uint32_t *PrgCount, NextInstruction, RSP_Running, RSP_MfStatusCount;

p_func RSP_Opcode[64];
Expand Down
5 changes: 3 additions & 2 deletions Source/Project64-rsp/Cpu.h
@@ -1,4 +1,5 @@
#include "OpCode.h"
#include "cpu\RSPOpcode.h"
#include "Types.h"
#include <Windows.h>

extern UDWORD EleSpec[32], Indx[32];
Expand All @@ -12,7 +13,7 @@ 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 OPCODE RSPOpC;
extern RSPOpcode RSPOpC;

void SetCPU(DWORD core);
void Build_RSP(void);
Expand Down
4 changes: 2 additions & 2 deletions Source/Project64-rsp/Interpreter CPU.cpp
Expand Up @@ -7,7 +7,7 @@
#include "breakpoint.h"
#include "log.h"
#include "memory.h"
#include "opcode.h"
#include "cpu/RSPOpcode.h"
#include <float.h>
#include <stdio.h>
#include <windows.h>
Expand Down Expand Up @@ -429,7 +429,7 @@ DWORD RunInterpreterCPU(DWORD Cycles)

RDP_LogLoc(*PrgCount);

RSP_LW_IMEM(*PrgCount, &RSPOpC.Hex);
RSP_LW_IMEM(*PrgCount, &RSPOpC.Value);
RSP_Opcode[RSPOpC.op]();
RSP_GPR[0].W = 0x00000000; // MIPS $zero hard-wired to 0

Expand Down
5 changes: 3 additions & 2 deletions Source/Project64-rsp/Interpreter Ops.cpp
Expand Up @@ -8,6 +8,7 @@
#include "log.h"
#include "memory.h"
#include "x86.h"
#include "cpu/RSPInstruction.h"
#include <math.h>
#include <stdio.h>
#include <windows.h>
Expand Down Expand Up @@ -2250,12 +2251,12 @@ void rsp_UnknownOpcode(void)
if (InRSPCommandsWindow)
{
SetRSPCommandViewto(*PrgCount);
DisplayError("Unhandled Opcode\n%s\n\nStopping emulation", RSPOpcodeName(RSPOpC.Hex, *PrgCount));
DisplayError("Unhandled Opcode\n%s\n\nStopping emulation", RSPInstruction(*PrgCount, RSPOpC.Value).NameAndParam().c_str());
}
else
{
sprintf(Message, "Unhandled Opcode\n%s\n\nStopping emulation.\n\nWOuld you like to open the debugger?",
RSPOpcodeName(RSPOpC.Hex, *PrgCount));
RSPInstruction(*PrgCount, RSPOpC.Value).NameAndParam().c_str());
response = MessageBoxA(NULL, Message, "Error", MB_YESNO | MB_ICONERROR);
if (response == IDYES)
{
Expand Down
189 changes: 0 additions & 189 deletions Source/Project64-rsp/OpCode.h

This file was deleted.

4 changes: 3 additions & 1 deletion Source/Project64-rsp/Project64-rsp.vcxproj
Expand Up @@ -48,6 +48,7 @@
<ItemGroup>
<ClCompile Include="breakpoint.cpp" />
<ClCompile Include="Cpu.cpp" />
<ClCompile Include="cpu\RSPiInstruction.cpp" />
<ClCompile Include="dma.cpp" />
<ClCompile Include="Interpreter CPU.cpp" />
<ClCompile Include="Interpreter Ops.cpp" />
Expand All @@ -68,12 +69,13 @@
<ItemGroup>
<ClInclude Include="breakpoint.h" />
<ClInclude Include="Cpu.h" />
<ClInclude Include="cpu\RSPInstruction.h" />
<ClInclude Include="cpu\RSPOpcode.h" />
<ClInclude Include="dma.h" />
<ClInclude Include="Interpreter CPU.h" />
<ClInclude Include="Interpreter Ops.h" />
<ClInclude Include="log.h" />
<ClInclude Include="memory.h" />
<ClInclude Include="OpCode.h" />
<ClInclude Include="Profiling.h" />
<ClInclude Include="Recompiler CPU.h" />
<ClInclude Include="Recompiler Ops.h" />
Expand Down
22 changes: 17 additions & 5 deletions Source/Project64-rsp/Project64-rsp.vcxproj.filters
Expand Up @@ -16,6 +16,12 @@
<UniqueIdentifier>{53b9495d-f564-4b1d-968c-42c816ca2d41}</UniqueIdentifier>
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
</Filter>
<Filter Include="Source Files\cpu">
<UniqueIdentifier>{150686bc-00e7-44b5-bfee-3228ba09841f}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\cpu">
<UniqueIdentifier>{3054cc35-3f98-4464-9642-ad02eaed525f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="breakpoint.h">
Expand All @@ -39,9 +45,6 @@
<ClInclude Include="memory.h">
<Filter>Header Files\RSP Header Files</Filter>
</ClInclude>
<ClInclude Include="OpCode.h">
<Filter>Header Files\RSP Header Files</Filter>
</ClInclude>
<ClInclude Include="Profiling.h">
<Filter>Header Files\RSP Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -72,10 +75,16 @@
<ClInclude Include="Version.h">
<Filter>Header Files\RSP Header Files</Filter>
</ClInclude>
<ClInclude Include="cpu\RSPInstruction.h">
<Filter>Header Files\cpu</Filter>
</ClInclude>
<ClInclude Include="cpu\RSPOpcode.h">
<Filter>Header Files\cpu</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="RSP.rc">
<Filter>Resource Files</Filter>
<ResourceCompile Include="Project64-rsp.rc">
<Filter>Source Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -133,5 +142,8 @@
<ClCompile Include="X86.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="cpu\RSPiInstruction.cpp">
<Filter>Source Files\cpu</Filter>
</ClCompile>
</ItemGroup>
</Project>

0 comments on commit 080a3b6

Please sign in to comment.