RSP: Get the code to conform to clang-format
This commit is contained in:
parent
90fefed579
commit
98b96a60cb
|
@ -1,18 +1,18 @@
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <float.h>
|
||||
#include "Rsp.h"
|
||||
#include "Cpu.h"
|
||||
#include "RSP registers.h"
|
||||
#include "RSP Command.h"
|
||||
#include "Recompiler CPU.h"
|
||||
#include "memory.h"
|
||||
#include "OpCode.h"
|
||||
#include "log.h"
|
||||
#include "Profiling.h"
|
||||
#include "breakpoint.h"
|
||||
#include "x86.h"
|
||||
#include "RSP Command.h"
|
||||
#include "RSP registers.h"
|
||||
#include "Recompiler CPU.h"
|
||||
#include "Rsp.h"
|
||||
#include "Types.h"
|
||||
#include "breakpoint.h"
|
||||
#include "log.h"
|
||||
#include "memory.h"
|
||||
#include "x86.h"
|
||||
#include <float.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
UDWORD EleSpec[32], Indx[32];
|
||||
OPCODE RSPOpC;
|
||||
|
@ -35,120 +35,120 @@ DWORD Mfc0Count, SemaphoreExit = 0;
|
|||
|
||||
void SetCPU(DWORD core)
|
||||
{
|
||||
WaitForSingleObjectEx(hMutex, 1000 * 100, FALSE);
|
||||
CPUCore = core;
|
||||
switch (core)
|
||||
{
|
||||
case RecompilerCPU:
|
||||
BuildRecompilerCPU();
|
||||
break;
|
||||
case InterpreterCPU:
|
||||
BuildInterpreterCPU();
|
||||
break;
|
||||
}
|
||||
ReleaseMutex(hMutex);
|
||||
WaitForSingleObjectEx(hMutex, 1000 * 100, FALSE);
|
||||
CPUCore = core;
|
||||
switch (core)
|
||||
{
|
||||
case RecompilerCPU:
|
||||
BuildRecompilerCPU();
|
||||
break;
|
||||
case InterpreterCPU:
|
||||
BuildInterpreterCPU();
|
||||
break;
|
||||
}
|
||||
ReleaseMutex(hMutex);
|
||||
}
|
||||
|
||||
void Build_RSP ( void )
|
||||
void Build_RSP(void)
|
||||
{
|
||||
int i;
|
||||
extern UWORD32 Recp, RecpResult, SQroot, SQrootResult;
|
||||
int i;
|
||||
extern UWORD32 Recp, RecpResult, SQroot, SQrootResult;
|
||||
|
||||
Recp.UW = 0;
|
||||
RecpResult.UW = 0;
|
||||
SQroot.UW = 0;
|
||||
SQrootResult.UW = 0;
|
||||
Recp.UW = 0;
|
||||
RecpResult.UW = 0;
|
||||
SQroot.UW = 0;
|
||||
SQrootResult.UW = 0;
|
||||
|
||||
SetCPU(CPUCore);
|
||||
ResetTimerList();
|
||||
SetCPU(CPUCore);
|
||||
ResetTimerList();
|
||||
|
||||
EleSpec[ 0].DW = 0;
|
||||
EleSpec[ 1].DW = 0;
|
||||
EleSpec[ 2].DW = 0;
|
||||
EleSpec[ 3].DW = 0;
|
||||
EleSpec[ 4].DW = 0;
|
||||
EleSpec[ 5].DW = 0;
|
||||
EleSpec[ 6].DW = 0;
|
||||
EleSpec[ 7].DW = 0;
|
||||
EleSpec[ 8].DW = 0;
|
||||
EleSpec[ 9].DW = 0;
|
||||
EleSpec[10].DW = 0;
|
||||
EleSpec[11].DW = 0;
|
||||
EleSpec[12].DW = 0;
|
||||
EleSpec[13].DW = 0;
|
||||
EleSpec[14].DW = 0;
|
||||
EleSpec[15].DW = 0;
|
||||
EleSpec[16].DW = 0x0001020304050607; // None
|
||||
EleSpec[17].DW = 0x0001020304050607; // None
|
||||
EleSpec[18].DW = 0x0000020204040606; // 0q
|
||||
EleSpec[19].DW = 0x0101030305050707; // 1q
|
||||
EleSpec[20].DW = 0x0000000004040404; // 0h
|
||||
EleSpec[21].DW = 0x0101010105050505; // 1h
|
||||
EleSpec[22].DW = 0x0202020206060606; // 2h
|
||||
EleSpec[23].DW = 0x0303030307070707; // 3h
|
||||
EleSpec[24].DW = 0x0000000000000000; // 0
|
||||
EleSpec[25].DW = 0x0101010101010101; // 1
|
||||
EleSpec[26].DW = 0x0202020202020202; // 2
|
||||
EleSpec[27].DW = 0x0303030303030303; // 3
|
||||
EleSpec[28].DW = 0x0404040404040404; // 4
|
||||
EleSpec[29].DW = 0x0505050505050505; // 5
|
||||
EleSpec[30].DW = 0x0606060606060606; // 6
|
||||
EleSpec[31].DW = 0x0707070707070707; // 7
|
||||
EleSpec[0].DW = 0;
|
||||
EleSpec[1].DW = 0;
|
||||
EleSpec[2].DW = 0;
|
||||
EleSpec[3].DW = 0;
|
||||
EleSpec[4].DW = 0;
|
||||
EleSpec[5].DW = 0;
|
||||
EleSpec[6].DW = 0;
|
||||
EleSpec[7].DW = 0;
|
||||
EleSpec[8].DW = 0;
|
||||
EleSpec[9].DW = 0;
|
||||
EleSpec[10].DW = 0;
|
||||
EleSpec[11].DW = 0;
|
||||
EleSpec[12].DW = 0;
|
||||
EleSpec[13].DW = 0;
|
||||
EleSpec[14].DW = 0;
|
||||
EleSpec[15].DW = 0;
|
||||
EleSpec[16].DW = 0x0001020304050607; // None
|
||||
EleSpec[17].DW = 0x0001020304050607; // None
|
||||
EleSpec[18].DW = 0x0000020204040606; // 0q
|
||||
EleSpec[19].DW = 0x0101030305050707; // 1q
|
||||
EleSpec[20].DW = 0x0000000004040404; // 0h
|
||||
EleSpec[21].DW = 0x0101010105050505; // 1h
|
||||
EleSpec[22].DW = 0x0202020206060606; // 2h
|
||||
EleSpec[23].DW = 0x0303030307070707; // 3h
|
||||
EleSpec[24].DW = 0x0000000000000000; // 0
|
||||
EleSpec[25].DW = 0x0101010101010101; // 1
|
||||
EleSpec[26].DW = 0x0202020202020202; // 2
|
||||
EleSpec[27].DW = 0x0303030303030303; // 3
|
||||
EleSpec[28].DW = 0x0404040404040404; // 4
|
||||
EleSpec[29].DW = 0x0505050505050505; // 5
|
||||
EleSpec[30].DW = 0x0606060606060606; // 6
|
||||
EleSpec[31].DW = 0x0707070707070707; // 7
|
||||
|
||||
Indx[ 0].DW = 0;
|
||||
Indx[ 1].DW = 0;
|
||||
Indx[ 2].DW = 0;
|
||||
Indx[ 3].DW = 0;
|
||||
Indx[ 4].DW = 0;
|
||||
Indx[ 5].DW = 0;
|
||||
Indx[ 6].DW = 0;
|
||||
Indx[ 7].DW = 0;
|
||||
Indx[ 8].DW = 0;
|
||||
Indx[ 9].DW = 0;
|
||||
Indx[10].DW = 0;
|
||||
Indx[11].DW = 0;
|
||||
Indx[12].DW = 0;
|
||||
Indx[13].DW = 0;
|
||||
Indx[14].DW = 0;
|
||||
Indx[15].DW = 0;
|
||||
Indx[0].DW = 0;
|
||||
Indx[1].DW = 0;
|
||||
Indx[2].DW = 0;
|
||||
Indx[3].DW = 0;
|
||||
Indx[4].DW = 0;
|
||||
Indx[5].DW = 0;
|
||||
Indx[6].DW = 0;
|
||||
Indx[7].DW = 0;
|
||||
Indx[8].DW = 0;
|
||||
Indx[9].DW = 0;
|
||||
Indx[10].DW = 0;
|
||||
Indx[11].DW = 0;
|
||||
Indx[12].DW = 0;
|
||||
Indx[13].DW = 0;
|
||||
Indx[14].DW = 0;
|
||||
Indx[15].DW = 0;
|
||||
|
||||
Indx[16].DW = 0x0001020304050607; // None
|
||||
Indx[17].DW = 0x0001020304050607; // None
|
||||
Indx[18].DW = 0x0103050700020406; // 0q
|
||||
Indx[19].DW = 0x0002040601030507; // 1q
|
||||
Indx[20].DW = 0x0102030506070004; // 0h
|
||||
Indx[21].DW = 0x0002030406070105; // 1h
|
||||
Indx[22].DW = 0x0001030405070206; // 2h
|
||||
Indx[23].DW = 0x0001020405060307; // 3h
|
||||
Indx[24].DW = 0x0102030405060700; // 0
|
||||
Indx[25].DW = 0x0002030405060701; // 1
|
||||
Indx[26].DW = 0x0001030405060702; // 2
|
||||
Indx[27].DW = 0x0001020405060703; // 3
|
||||
Indx[28].DW = 0x0001020305060704; // 4
|
||||
Indx[29].DW = 0x0001020304060705; // 5
|
||||
Indx[30].DW = 0x0001020304050706; // 6
|
||||
Indx[31].DW = 0x0001020304050607; // 7
|
||||
Indx[16].DW = 0x0001020304050607; // None
|
||||
Indx[17].DW = 0x0001020304050607; // None
|
||||
Indx[18].DW = 0x0103050700020406; // 0q
|
||||
Indx[19].DW = 0x0002040601030507; // 1q
|
||||
Indx[20].DW = 0x0102030506070004; // 0h
|
||||
Indx[21].DW = 0x0002030406070105; // 1h
|
||||
Indx[22].DW = 0x0001030405070206; // 2h
|
||||
Indx[23].DW = 0x0001020405060307; // 3h
|
||||
Indx[24].DW = 0x0102030405060700; // 0
|
||||
Indx[25].DW = 0x0002030405060701; // 1
|
||||
Indx[26].DW = 0x0001030405060702; // 2
|
||||
Indx[27].DW = 0x0001020405060703; // 3
|
||||
Indx[28].DW = 0x0001020305060704; // 4
|
||||
Indx[29].DW = 0x0001020304060705; // 5
|
||||
Indx[30].DW = 0x0001020304050706; // 6
|
||||
Indx[31].DW = 0x0001020304050607; // 7
|
||||
|
||||
for (i = 16; i < 32; i ++)
|
||||
{
|
||||
int count;
|
||||
for (i = 16; i < 32; i++)
|
||||
{
|
||||
int count;
|
||||
|
||||
for (count = 0; count < 8; count ++)
|
||||
{
|
||||
Indx[i].B[count] = 7 - Indx[i].B[count];
|
||||
EleSpec[i].B[count] = 7 - EleSpec[i].B[count];
|
||||
}
|
||||
for (count = 0; count < 4; count ++)
|
||||
{
|
||||
BYTE Temp;
|
||||
for (count = 0; count < 8; count++)
|
||||
{
|
||||
Indx[i].B[count] = 7 - Indx[i].B[count];
|
||||
EleSpec[i].B[count] = 7 - EleSpec[i].B[count];
|
||||
}
|
||||
for (count = 0; count < 4; count++)
|
||||
{
|
||||
BYTE Temp;
|
||||
|
||||
Temp = Indx[i].B[count];
|
||||
Indx[i].B[count] = Indx[i].B[7 - count];
|
||||
Indx[i].B[7 - count] = Temp;
|
||||
}
|
||||
}
|
||||
Temp = Indx[i].B[count];
|
||||
Indx[i].B[count] = Indx[i].B[7 - count];
|
||||
Indx[i].B[7 - count] = Temp;
|
||||
}
|
||||
}
|
||||
|
||||
PrgCount = RSPInfo.SP_PC_REG;
|
||||
PrgCount = RSPInfo.SP_PC_REG;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -163,16 +163,16 @@ be greater than the number of cycles that the RSP should have performed.
|
|||
*/
|
||||
|
||||
DWORD RunInterpreterCPU(DWORD Cycles);
|
||||
DWORD RunRecompilerCPU (DWORD Cycles);
|
||||
DWORD RunRecompilerCPU(DWORD Cycles);
|
||||
|
||||
#define MI_INTR_SP 0x01 /* Bit 0: SP intr */
|
||||
#define MI_INTR_SP 0x01 /* Bit 0: SP intr */
|
||||
|
||||
uint32_t DoRspCycles (uint32_t Cycles )
|
||||
uint32_t DoRspCycles(uint32_t Cycles)
|
||||
{
|
||||
extern Boolean AudioHle, GraphicsHle;
|
||||
DWORD TaskType = *(DWORD*)(RSPInfo.DMEM + 0xFC0);
|
||||
|
||||
/* if (*RSPInfo.SP_STATUS_REG & SP_STATUS_SIG0)
|
||||
DWORD TaskType = *(DWORD *)(RSPInfo.DMEM + 0xFC0);
|
||||
|
||||
/* if (*RSPInfo.SP_STATUS_REG & SP_STATUS_SIG0)
|
||||
{
|
||||
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_SIG0;
|
||||
*RSPInfo.MI_INTR_REG |= MI_INTR_SP;
|
||||
|
@ -180,44 +180,44 @@ uint32_t DoRspCycles (uint32_t Cycles )
|
|||
return Cycles;
|
||||
}
|
||||
*/
|
||||
if (TaskType == 1 && GraphicsHle && *(DWORD*)(RSPInfo.DMEM + 0x0ff0) != 0)
|
||||
{
|
||||
if (RSPInfo.ProcessDList != NULL)
|
||||
{
|
||||
RSPInfo.ProcessDList();
|
||||
}
|
||||
*RSPInfo.SP_STATUS_REG |= (0x0203 );
|
||||
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 )
|
||||
{
|
||||
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
|
||||
RSPInfo.CheckInterrupts();
|
||||
}
|
||||
if (TaskType == 1 && GraphicsHle && *(DWORD *)(RSPInfo.DMEM + 0x0ff0) != 0)
|
||||
{
|
||||
if (RSPInfo.ProcessDList != NULL)
|
||||
{
|
||||
RSPInfo.ProcessDList();
|
||||
}
|
||||
*RSPInfo.SP_STATUS_REG |= (0x0203);
|
||||
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0)
|
||||
{
|
||||
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
|
||||
RSPInfo.CheckInterrupts();
|
||||
}
|
||||
|
||||
*RSPInfo.DPC_STATUS_REG &= ~0x0002;
|
||||
return Cycles;
|
||||
}
|
||||
else if (TaskType == 2 && AudioHle)
|
||||
{
|
||||
if (RSPInfo.ProcessAList != NULL)
|
||||
{
|
||||
RSPInfo.ProcessAList();
|
||||
}
|
||||
*RSPInfo.SP_STATUS_REG |= (0x0203 );
|
||||
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 )
|
||||
{
|
||||
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
|
||||
RSPInfo.CheckInterrupts();
|
||||
}
|
||||
return Cycles;
|
||||
}
|
||||
else if (TaskType == 7)
|
||||
{
|
||||
RSPInfo.ShowCFB();
|
||||
}
|
||||
*RSPInfo.DPC_STATUS_REG &= ~0x0002;
|
||||
return Cycles;
|
||||
}
|
||||
else if (TaskType == 2 && AudioHle)
|
||||
{
|
||||
if (RSPInfo.ProcessAList != NULL)
|
||||
{
|
||||
RSPInfo.ProcessAList();
|
||||
}
|
||||
*RSPInfo.SP_STATUS_REG |= (0x0203);
|
||||
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0)
|
||||
{
|
||||
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
|
||||
RSPInfo.CheckInterrupts();
|
||||
}
|
||||
return Cycles;
|
||||
}
|
||||
else if (TaskType == 7)
|
||||
{
|
||||
RSPInfo.ShowCFB();
|
||||
}
|
||||
|
||||
Compiler.bAudioUcode = (TaskType == 2) ? TRUE : FALSE;
|
||||
Compiler.bAudioUcode = (TaskType == 2) ? TRUE : FALSE;
|
||||
|
||||
/*
|
||||
/*
|
||||
*RSPInfo.SP_STATUS_REG |= (0x0203 );
|
||||
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 )
|
||||
{
|
||||
|
@ -225,36 +225,36 @@ uint32_t DoRspCycles (uint32_t Cycles )
|
|||
RSPInfo.CheckInterrupts();
|
||||
}
|
||||
//return Cycles;
|
||||
*/
|
||||
*/
|
||||
|
||||
if (Profiling && !IndvidualBlock)
|
||||
{
|
||||
StartTimer((DWORD)Timer_RSP_Running);
|
||||
}
|
||||
if (Profiling && !IndvidualBlock)
|
||||
{
|
||||
StartTimer((DWORD)Timer_RSP_Running);
|
||||
}
|
||||
|
||||
WaitForSingleObjectEx(hMutex, 1000 * 100, FALSE);
|
||||
WaitForSingleObjectEx(hMutex, 1000 * 100, FALSE);
|
||||
|
||||
if (BreakOnStart)
|
||||
{
|
||||
Enter_RSP_Commands_Window();
|
||||
}
|
||||
RSP_MfStatusCount = 0;
|
||||
if (BreakOnStart)
|
||||
{
|
||||
Enter_RSP_Commands_Window();
|
||||
}
|
||||
RSP_MfStatusCount = 0;
|
||||
|
||||
switch (CPUCore)
|
||||
{
|
||||
case RecompilerCPU:
|
||||
RunRecompilerCPU(Cycles);
|
||||
break;
|
||||
case InterpreterCPU:
|
||||
RunInterpreterCPU(Cycles);
|
||||
break;
|
||||
}
|
||||
ReleaseMutex(hMutex);
|
||||
switch (CPUCore)
|
||||
{
|
||||
case RecompilerCPU:
|
||||
RunRecompilerCPU(Cycles);
|
||||
break;
|
||||
case InterpreterCPU:
|
||||
RunInterpreterCPU(Cycles);
|
||||
break;
|
||||
}
|
||||
ReleaseMutex(hMutex);
|
||||
|
||||
if (Profiling && !IndvidualBlock)
|
||||
{
|
||||
StartTimer((DWORD)Timer_R4300_Running);
|
||||
}
|
||||
if (Profiling && !IndvidualBlock)
|
||||
{
|
||||
StartTimer((DWORD)Timer_R4300_Running);
|
||||
}
|
||||
|
||||
return Cycles;
|
||||
return Cycles;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "OpCode.h"
|
||||
#include <Windows.h>
|
||||
|
||||
extern UDWORD EleSpec[32], Indx[32];
|
||||
|
||||
|
@ -10,10 +11,10 @@ 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 uint32_t *PrgCount, RSP_Running;
|
||||
extern OPCODE RSPOpC;
|
||||
|
||||
void SetCPU(DWORD core);
|
||||
void Build_RSP (void);
|
||||
void Build_RSP(void);
|
||||
|
||||
extern DWORD Mfc0Count, SemaphoreExit;
|
||||
|
|
|
@ -1,455 +1,470 @@
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <float.h>
|
||||
#include "breakpoint.h"
|
||||
#include "Rsp.h"
|
||||
#include "Interpreter CPU.h"
|
||||
#include "Cpu.h"
|
||||
#include "Interpreter Ops.h"
|
||||
#include "Interpreter CPU.h"
|
||||
#include "RSP registers.h"
|
||||
#include "RSP Command.h"
|
||||
#include "RSP registers.h"
|
||||
#include "Rsp.h"
|
||||
#include "breakpoint.h"
|
||||
#include "log.h"
|
||||
#include "memory.h"
|
||||
#include "opcode.h"
|
||||
#include "log.h"
|
||||
#include <float.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
DWORD RSP_NextInstruction, 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_UnknownOpcode;
|
||||
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;
|
||||
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_UnknownOpcode;
|
||||
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_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_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_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_Vector[ 0] = RSP_Vector_VMULF;
|
||||
RSP_Vector[ 1] = RSP_Vector_VMULU;
|
||||
RSP_Vector[ 2] = rsp_UnknownOpcode;
|
||||
RSP_Vector[ 3] = rsp_UnknownOpcode;
|
||||
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_UnknownOpcode;
|
||||
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_UnknownOpcode;
|
||||
RSP_Vector[19] = RSP_Vector_VABS;
|
||||
RSP_Vector[20] = RSP_Vector_VADDC;
|
||||
RSP_Vector[21] = RSP_Vector_VSUBC;
|
||||
RSP_Vector[22] = rsp_UnknownOpcode;
|
||||
RSP_Vector[23] = rsp_UnknownOpcode;
|
||||
RSP_Vector[24] = rsp_UnknownOpcode;
|
||||
RSP_Vector[25] = rsp_UnknownOpcode;
|
||||
RSP_Vector[26] = rsp_UnknownOpcode;
|
||||
RSP_Vector[27] = rsp_UnknownOpcode;
|
||||
RSP_Vector[28] = rsp_UnknownOpcode;
|
||||
RSP_Vector[29] = RSP_Vector_VSAW;
|
||||
RSP_Vector[30] = rsp_UnknownOpcode;
|
||||
RSP_Vector[31] = rsp_UnknownOpcode;
|
||||
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_UnknownOpcode;
|
||||
RSP_Vector[47] = rsp_UnknownOpcode;
|
||||
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_UnknownOpcode;
|
||||
RSP_Vector[57] = rsp_UnknownOpcode;
|
||||
RSP_Vector[58] = rsp_UnknownOpcode;
|
||||
RSP_Vector[59] = rsp_UnknownOpcode;
|
||||
RSP_Vector[60] = rsp_UnknownOpcode;
|
||||
RSP_Vector[61] = rsp_UnknownOpcode;
|
||||
RSP_Vector[62] = rsp_UnknownOpcode;
|
||||
RSP_Vector[63] = 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_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_UnknownOpcode;
|
||||
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_Vector[0] = RSP_Vector_VMULF;
|
||||
RSP_Vector[1] = RSP_Vector_VMULU;
|
||||
RSP_Vector[2] = rsp_UnknownOpcode;
|
||||
RSP_Vector[3] = rsp_UnknownOpcode;
|
||||
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_UnknownOpcode;
|
||||
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_UnknownOpcode;
|
||||
RSP_Vector[19] = RSP_Vector_VABS;
|
||||
RSP_Vector[20] = RSP_Vector_VADDC;
|
||||
RSP_Vector[21] = RSP_Vector_VSUBC;
|
||||
RSP_Vector[22] = rsp_UnknownOpcode;
|
||||
RSP_Vector[23] = rsp_UnknownOpcode;
|
||||
RSP_Vector[24] = rsp_UnknownOpcode;
|
||||
RSP_Vector[25] = rsp_UnknownOpcode;
|
||||
RSP_Vector[26] = rsp_UnknownOpcode;
|
||||
RSP_Vector[27] = rsp_UnknownOpcode;
|
||||
RSP_Vector[28] = rsp_UnknownOpcode;
|
||||
RSP_Vector[29] = RSP_Vector_VSAW;
|
||||
RSP_Vector[30] = rsp_UnknownOpcode;
|
||||
RSP_Vector[31] = rsp_UnknownOpcode;
|
||||
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_UnknownOpcode;
|
||||
RSP_Vector[47] = rsp_UnknownOpcode;
|
||||
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_UnknownOpcode;
|
||||
RSP_Vector[57] = rsp_UnknownOpcode;
|
||||
RSP_Vector[58] = rsp_UnknownOpcode;
|
||||
RSP_Vector[59] = rsp_UnknownOpcode;
|
||||
RSP_Vector[60] = rsp_UnknownOpcode;
|
||||
RSP_Vector[61] = rsp_UnknownOpcode;
|
||||
RSP_Vector[62] = rsp_UnknownOpcode;
|
||||
RSP_Vector[63] = 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;
|
||||
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_UnknownOpcode;
|
||||
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;
|
||||
}
|
||||
|
||||
DWORD RunInterpreterCPU(DWORD Cycles) {
|
||||
DWORD CycleCount;
|
||||
RSP_Running = TRUE;
|
||||
Enable_RSP_Commands_Window();
|
||||
CycleCount = 0;
|
||||
DWORD RunInterpreterCPU(DWORD Cycles)
|
||||
{
|
||||
DWORD CycleCount;
|
||||
RSP_Running = TRUE;
|
||||
Enable_RSP_Commands_Window();
|
||||
CycleCount = 0;
|
||||
|
||||
while (RSP_Running) {
|
||||
if (NoOfBpoints != 0) {
|
||||
if (CheckForRSPBPoint(*PrgCount)) {
|
||||
if (InRSPCommandsWindow) {
|
||||
Enter_RSP_Commands_Window();
|
||||
if (Stepping_Commands) {
|
||||
DisplayError ( "Encountered an R4300i breakpoint" );
|
||||
} else {
|
||||
DisplayError ( "Encountered an R4300i breakpoint\n\nNow stepping" );
|
||||
SetRSPCommandViewto( *PrgCount );
|
||||
SetRSPCommandToStepping();
|
||||
}
|
||||
} else {
|
||||
DisplayError ( "Encountered an RSP breakpoint\n\nEntering command window" );
|
||||
Enter_RSP_Commands_Window();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Stepping_Commands) {
|
||||
WaitingForStep = TRUE;
|
||||
SetRSPCommandViewto( *PrgCount );
|
||||
UpdateRSPRegistersScreen();
|
||||
while ( WaitingForStep == TRUE ){
|
||||
Sleep(20);
|
||||
if (!Stepping_Commands) {
|
||||
WaitingForStep = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (RSP_Running)
|
||||
{
|
||||
if (NoOfBpoints != 0)
|
||||
{
|
||||
if (CheckForRSPBPoint(*PrgCount))
|
||||
{
|
||||
if (InRSPCommandsWindow)
|
||||
{
|
||||
Enter_RSP_Commands_Window();
|
||||
if (Stepping_Commands)
|
||||
{
|
||||
DisplayError("Encountered an R4300i breakpoint");
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError("Encountered an R4300i breakpoint\n\nNow stepping");
|
||||
SetRSPCommandViewto(*PrgCount);
|
||||
SetRSPCommandToStepping();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError("Encountered an RSP breakpoint\n\nEntering command window");
|
||||
Enter_RSP_Commands_Window();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RDP_LogLoc(*PrgCount);
|
||||
if (Stepping_Commands)
|
||||
{
|
||||
WaitingForStep = TRUE;
|
||||
SetRSPCommandViewto(*PrgCount);
|
||||
UpdateRSPRegistersScreen();
|
||||
while (WaitingForStep == TRUE)
|
||||
{
|
||||
Sleep(20);
|
||||
if (!Stepping_Commands)
|
||||
{
|
||||
WaitingForStep = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RSP_LW_IMEM(*PrgCount, &RSPOpC.Hex);
|
||||
RSP_Opcode[ RSPOpC.op ]();
|
||||
RSP_GPR[0].W = 0x00000000; // MIPS $zero hard-wired to 0
|
||||
RDP_LogLoc(*PrgCount);
|
||||
|
||||
switch (RSP_NextInstruction) {
|
||||
case NORMAL:
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
break;
|
||||
case DELAY_SLOT:
|
||||
RSP_NextInstruction = JUMP;
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
break;
|
||||
case JUMP:
|
||||
RSP_NextInstruction = NORMAL;
|
||||
*PrgCount = RSP_JumpTo;
|
||||
break;
|
||||
case SINGLE_STEP:
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
RSP_NextInstruction = SINGLE_STEP_DONE;
|
||||
break;
|
||||
case SINGLE_STEP_DONE:
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
*RSPInfo.SP_STATUS_REG |= SP_STATUS_HALT;
|
||||
RSP_Running = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Cycles;
|
||||
RSP_LW_IMEM(*PrgCount, &RSPOpC.Hex);
|
||||
RSP_Opcode[RSPOpC.op]();
|
||||
RSP_GPR[0].W = 0x00000000; // MIPS $zero hard-wired to 0
|
||||
|
||||
switch (RSP_NextInstruction)
|
||||
{
|
||||
case NORMAL:
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
break;
|
||||
case DELAY_SLOT:
|
||||
RSP_NextInstruction = JUMP;
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
break;
|
||||
case JUMP:
|
||||
RSP_NextInstruction = NORMAL;
|
||||
*PrgCount = RSP_JumpTo;
|
||||
break;
|
||||
case SINGLE_STEP:
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
RSP_NextInstruction = SINGLE_STEP_DONE;
|
||||
break;
|
||||
case 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;
|
||||
|
||||
/* RSP_NextInstruction = DELAY_SLOT; */
|
||||
/* RSP_NextInstruction = DELAY_SLOT; */
|
||||
if (condition)
|
||||
{
|
||||
new_PC = *PrgCount + 4 + ((short)RSPOpC.offset << 2);
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
#define NORMAL 0
|
||||
#define DO_DELAY_SLOT 1
|
||||
#define DELAY_SLOT 2
|
||||
#define DELAY_SLOT_DONE 3
|
||||
#define DELAY_SLOT_EXIT 4
|
||||
#define DELAY_SLOT_EXIT_DONE 5
|
||||
#define JUMP 6
|
||||
#define SINGLE_STEP 7
|
||||
#define SINGLE_STEP_DONE 8
|
||||
#define FINISH_BLOCK 9
|
||||
#define FINISH_SUB_BLOCK 10
|
||||
#include <Windows.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define NORMAL 0
|
||||
#define DO_DELAY_SLOT 1
|
||||
#define DELAY_SLOT 2
|
||||
#define DELAY_SLOT_DONE 3
|
||||
#define DELAY_SLOT_EXIT 4
|
||||
#define DELAY_SLOT_EXIT_DONE 5
|
||||
#define JUMP 6
|
||||
#define SINGLE_STEP 7
|
||||
#define SINGLE_STEP_DONE 8
|
||||
#define FINISH_BLOCK 9
|
||||
#define FINISH_SUB_BLOCK 10
|
||||
|
||||
extern DWORD RSP_NextInstruction, RSP_JumpTo;
|
||||
extern uint32_t RSP_MfStatusCount;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,149 +1,149 @@
|
|||
// Opcode functions
|
||||
|
||||
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_SB ( void );
|
||||
void RSP_Opcode_SH ( void );
|
||||
void RSP_Opcode_SW ( void );
|
||||
void RSP_Opcode_LC2 ( void );
|
||||
void RSP_Opcode_SC2 ( void );
|
||||
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_SB(void);
|
||||
void RSP_Opcode_SH(void);
|
||||
void RSP_Opcode_SW(void);
|
||||
void RSP_Opcode_LC2(void);
|
||||
void RSP_Opcode_SC2(void);
|
||||
|
||||
// R4300i Opcodes: Special
|
||||
|
||||
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 );
|
||||
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);
|
||||
|
||||
// R4300i Opcodes: RegImm
|
||||
|
||||
void RSP_Opcode_BLTZ ( void );
|
||||
void RSP_Opcode_BGEZ ( void );
|
||||
void RSP_Opcode_BLTZAL ( void );
|
||||
void RSP_Opcode_BGEZAL ( void );
|
||||
void RSP_Opcode_BLTZ(void);
|
||||
void RSP_Opcode_BGEZ(void);
|
||||
void RSP_Opcode_BLTZAL(void);
|
||||
void RSP_Opcode_BGEZAL(void);
|
||||
|
||||
// COP0 functions
|
||||
|
||||
void RSP_Cop0_MF ( void );
|
||||
void RSP_Cop0_MT ( void );
|
||||
void RSP_Cop0_MF(void);
|
||||
void RSP_Cop0_MT(void);
|
||||
|
||||
// COP2 functions
|
||||
|
||||
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 );
|
||||
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);
|
||||
|
||||
// Vector functions
|
||||
|
||||
void RSP_Vector_VMULF ( void );
|
||||
void RSP_Vector_VMULU ( 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_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_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 );
|
||||
void RSP_Vector_VMULF(void);
|
||||
void RSP_Vector_VMULU(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_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_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);
|
||||
|
||||
// LC2 functions
|
||||
|
||||
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_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_LTV(void);
|
||||
|
||||
// LC2 functions
|
||||
|
||||
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 );
|
||||
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);
|
||||
|
||||
// Other functions
|
||||
|
||||
void rsp_UnknownOpcode ( void );
|
||||
void rsp_UnknownOpcode(void);
|
||||
|
|
1024
Source/RSP/Main.cpp
1024
Source/RSP/Main.cpp
File diff suppressed because it is too large
Load Diff
1299
Source/RSP/Mmx.cpp
1299
Source/RSP/Mmx.cpp
File diff suppressed because it is too large
Load Diff
|
@ -4,180 +4,186 @@
|
|||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201) // Non-standard extension used: nameless struct/union
|
||||
|
||||
typedef union tagOPCODE {
|
||||
uint32_t Hex;
|
||||
unsigned char Ascii[4];
|
||||
typedef union tagOPCODE
|
||||
{
|
||||
uint32_t Hex;
|
||||
unsigned char Ascii[4];
|
||||
|
||||
struct {
|
||||
unsigned immediate : 16;
|
||||
unsigned rt : 5;
|
||||
unsigned rs : 5;
|
||||
unsigned op : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
unsigned immediate : 16;
|
||||
unsigned rt : 5;
|
||||
unsigned rs : 5;
|
||||
unsigned op : 6;
|
||||
};
|
||||
|
||||
struct {
|
||||
unsigned offset : 16;
|
||||
unsigned : 5;
|
||||
unsigned base : 5;
|
||||
unsigned : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
unsigned offset : 16;
|
||||
unsigned : 5;
|
||||
unsigned base : 5;
|
||||
unsigned : 6;
|
||||
};
|
||||
|
||||
struct {
|
||||
unsigned target : 26;
|
||||
unsigned : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
unsigned target : 26;
|
||||
unsigned : 6;
|
||||
};
|
||||
|
||||
struct {
|
||||
unsigned funct : 6;
|
||||
unsigned sa : 5;
|
||||
unsigned rd : 5;
|
||||
unsigned : 5;
|
||||
unsigned : 5;
|
||||
unsigned : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
unsigned funct : 6;
|
||||
unsigned sa : 5;
|
||||
unsigned rd : 5;
|
||||
unsigned : 5;
|
||||
unsigned : 5;
|
||||
unsigned : 6;
|
||||
};
|
||||
|
||||
struct {
|
||||
signed voffset : 7;
|
||||
unsigned del : 4;
|
||||
unsigned : 5;
|
||||
unsigned dest : 5;
|
||||
unsigned : 5;
|
||||
unsigned : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
signed voffset : 7;
|
||||
unsigned del : 4;
|
||||
unsigned : 5;
|
||||
unsigned dest : 5;
|
||||
unsigned : 5;
|
||||
unsigned : 6;
|
||||
};
|
||||
} OPCODE;
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
// RSP opcodes
|
||||
|
||||
#define RSP_SPECIAL 0
|
||||
#define RSP_REGIMM 1
|
||||
#define RSP_J 2
|
||||
#define RSP_JAL 3
|
||||
#define RSP_BEQ 4
|
||||
#define RSP_BNE 5
|
||||
#define RSP_BLEZ 6
|
||||
#define RSP_BGTZ 7
|
||||
#define RSP_ADDI 8
|
||||
#define RSP_ADDIU 9
|
||||
#define RSP_SLTI 10
|
||||
#define RSP_SLTIU 11
|
||||
#define RSP_ANDI 12
|
||||
#define RSP_ORI 13
|
||||
#define RSP_XORI 14
|
||||
#define RSP_LUI 15
|
||||
#define RSP_CP0 16
|
||||
#define RSP_CP2 18
|
||||
#define RSP_LB 32
|
||||
#define RSP_LH 33
|
||||
#define RSP_LW 35
|
||||
#define RSP_LBU 36
|
||||
#define RSP_LHU 37
|
||||
#define RSP_SB 40
|
||||
#define RSP_SH 41
|
||||
#define RSP_SW 43
|
||||
#define RSP_LC2 50
|
||||
#define RSP_SC2 58
|
||||
#define RSP_SPECIAL 0
|
||||
#define RSP_REGIMM 1
|
||||
#define RSP_J 2
|
||||
#define RSP_JAL 3
|
||||
#define RSP_BEQ 4
|
||||
#define RSP_BNE 5
|
||||
#define RSP_BLEZ 6
|
||||
#define RSP_BGTZ 7
|
||||
#define RSP_ADDI 8
|
||||
#define RSP_ADDIU 9
|
||||
#define RSP_SLTI 10
|
||||
#define RSP_SLTIU 11
|
||||
#define RSP_ANDI 12
|
||||
#define RSP_ORI 13
|
||||
#define RSP_XORI 14
|
||||
#define RSP_LUI 15
|
||||
#define RSP_CP0 16
|
||||
#define RSP_CP2 18
|
||||
#define RSP_LB 32
|
||||
#define RSP_LH 33
|
||||
#define RSP_LW 35
|
||||
#define RSP_LBU 36
|
||||
#define RSP_LHU 37
|
||||
#define RSP_SB 40
|
||||
#define RSP_SH 41
|
||||
#define RSP_SW 43
|
||||
#define RSP_LC2 50
|
||||
#define RSP_SC2 58
|
||||
|
||||
// RSP special opcodes
|
||||
|
||||
#define RSP_SPECIAL_SLL 0
|
||||
#define RSP_SPECIAL_SRL 2
|
||||
#define RSP_SPECIAL_SRA 3
|
||||
#define RSP_SPECIAL_SLLV 4
|
||||
#define RSP_SPECIAL_SRLV 6
|
||||
#define RSP_SPECIAL_SRAV 7
|
||||
#define RSP_SPECIAL_JR 8
|
||||
#define RSP_SPECIAL_JALR 9
|
||||
#define RSP_SPECIAL_BREAK 13
|
||||
#define RSP_SPECIAL_ADD 32
|
||||
#define RSP_SPECIAL_ADDU 33
|
||||
#define RSP_SPECIAL_SUB 34
|
||||
#define RSP_SPECIAL_SUBU 35
|
||||
#define RSP_SPECIAL_AND 36
|
||||
#define RSP_SPECIAL_OR 37
|
||||
#define RSP_SPECIAL_XOR 38
|
||||
#define RSP_SPECIAL_NOR 39
|
||||
#define RSP_SPECIAL_SLT 42
|
||||
#define RSP_SPECIAL_SLTU 43
|
||||
#define RSP_SPECIAL_SLL 0
|
||||
#define RSP_SPECIAL_SRL 2
|
||||
#define RSP_SPECIAL_SRA 3
|
||||
#define RSP_SPECIAL_SLLV 4
|
||||
#define RSP_SPECIAL_SRLV 6
|
||||
#define RSP_SPECIAL_SRAV 7
|
||||
#define RSP_SPECIAL_JR 8
|
||||
#define RSP_SPECIAL_JALR 9
|
||||
#define RSP_SPECIAL_BREAK 13
|
||||
#define RSP_SPECIAL_ADD 32
|
||||
#define RSP_SPECIAL_ADDU 33
|
||||
#define RSP_SPECIAL_SUB 34
|
||||
#define RSP_SPECIAL_SUBU 35
|
||||
#define RSP_SPECIAL_AND 36
|
||||
#define RSP_SPECIAL_OR 37
|
||||
#define RSP_SPECIAL_XOR 38
|
||||
#define RSP_SPECIAL_NOR 39
|
||||
#define RSP_SPECIAL_SLT 42
|
||||
#define RSP_SPECIAL_SLTU 43
|
||||
|
||||
// RSP RegImm opcodes
|
||||
|
||||
#define RSP_REGIMM_BLTZ 0
|
||||
#define RSP_REGIMM_BGEZ 1
|
||||
#define RSP_REGIMM_BLTZAL 16
|
||||
#define RSP_REGIMM_BGEZAL 17
|
||||
#define RSP_REGIMM_BLTZ 0
|
||||
#define RSP_REGIMM_BGEZ 1
|
||||
#define RSP_REGIMM_BLTZAL 16
|
||||
#define RSP_REGIMM_BGEZAL 17
|
||||
|
||||
// RSP COP0 opcodes
|
||||
|
||||
#define RSP_COP0_MF 0
|
||||
#define RSP_COP0_MT 4
|
||||
#define RSP_COP0_MF 0
|
||||
#define RSP_COP0_MT 4
|
||||
|
||||
// RSP COP2 opcodes
|
||||
|
||||
#define RSP_COP2_MF 0
|
||||
#define RSP_COP2_CF 2
|
||||
#define RSP_COP2_MT 4
|
||||
#define RSP_COP2_CT 6
|
||||
#define RSP_COP2_MF 0
|
||||
#define RSP_COP2_CF 2
|
||||
#define RSP_COP2_MT 4
|
||||
#define RSP_COP2_CT 6
|
||||
|
||||
// RSP vector opcodes
|
||||
|
||||
#define RSP_VECTOR_VMULF 0
|
||||
#define RSP_VECTOR_VMULU 1
|
||||
#define RSP_VECTOR_VRNDP 2
|
||||
#define RSP_VECTOR_VMULQ 3
|
||||
#define RSP_VECTOR_VMUDL 4
|
||||
#define RSP_VECTOR_VMUDM 5
|
||||
#define RSP_VECTOR_VMUDN 6
|
||||
#define RSP_VECTOR_VMUDH 7
|
||||
#define RSP_VECTOR_VMACF 8
|
||||
#define RSP_VECTOR_VMACU 9
|
||||
#define RSP_VECTOR_VRNDN 10
|
||||
#define RSP_VECTOR_VMACQ 11
|
||||
#define RSP_VECTOR_VMADL 12
|
||||
#define RSP_VECTOR_VMADM 13
|
||||
#define RSP_VECTOR_VMADN 14
|
||||
#define RSP_VECTOR_VMADH 15
|
||||
#define RSP_VECTOR_VADD 16
|
||||
#define RSP_VECTOR_VSUB 17
|
||||
#define RSP_VECTOR_VABS 19
|
||||
#define RSP_VECTOR_VADDC 20
|
||||
#define RSP_VECTOR_VSUBC 21
|
||||
#define RSP_VECTOR_VSAW 29
|
||||
#define RSP_VECTOR_VLT 32
|
||||
#define RSP_VECTOR_VEQ 33
|
||||
#define RSP_VECTOR_VNE 34
|
||||
#define RSP_VECTOR_VGE 35
|
||||
#define RSP_VECTOR_VCL 36
|
||||
#define RSP_VECTOR_VCH 37
|
||||
#define RSP_VECTOR_VCR 38
|
||||
#define RSP_VECTOR_VMRG 39
|
||||
#define RSP_VECTOR_VAND 40
|
||||
#define RSP_VECTOR_VNAND 41
|
||||
#define RSP_VECTOR_VOR 42
|
||||
#define RSP_VECTOR_VNOR 43
|
||||
#define RSP_VECTOR_VXOR 44
|
||||
#define RSP_VECTOR_VNXOR 45
|
||||
#define RSP_VECTOR_VRCP 48
|
||||
#define RSP_VECTOR_VRCPL 49
|
||||
#define RSP_VECTOR_VRCPH 50
|
||||
#define RSP_VECTOR_VMOV 51
|
||||
#define RSP_VECTOR_VRSQ 52
|
||||
#define RSP_VECTOR_VRSQL 53
|
||||
#define RSP_VECTOR_VRSQH 54
|
||||
#define RSP_VECTOR_VNOOP 55
|
||||
#define RSP_VECTOR_VMULF 0
|
||||
#define RSP_VECTOR_VMULU 1
|
||||
#define RSP_VECTOR_VRNDP 2
|
||||
#define RSP_VECTOR_VMULQ 3
|
||||
#define RSP_VECTOR_VMUDL 4
|
||||
#define RSP_VECTOR_VMUDM 5
|
||||
#define RSP_VECTOR_VMUDN 6
|
||||
#define RSP_VECTOR_VMUDH 7
|
||||
#define RSP_VECTOR_VMACF 8
|
||||
#define RSP_VECTOR_VMACU 9
|
||||
#define RSP_VECTOR_VRNDN 10
|
||||
#define RSP_VECTOR_VMACQ 11
|
||||
#define RSP_VECTOR_VMADL 12
|
||||
#define RSP_VECTOR_VMADM 13
|
||||
#define RSP_VECTOR_VMADN 14
|
||||
#define RSP_VECTOR_VMADH 15
|
||||
#define RSP_VECTOR_VADD 16
|
||||
#define RSP_VECTOR_VSUB 17
|
||||
#define RSP_VECTOR_VABS 19
|
||||
#define RSP_VECTOR_VADDC 20
|
||||
#define RSP_VECTOR_VSUBC 21
|
||||
#define RSP_VECTOR_VSAW 29
|
||||
#define RSP_VECTOR_VLT 32
|
||||
#define RSP_VECTOR_VEQ 33
|
||||
#define RSP_VECTOR_VNE 34
|
||||
#define RSP_VECTOR_VGE 35
|
||||
#define RSP_VECTOR_VCL 36
|
||||
#define RSP_VECTOR_VCH 37
|
||||
#define RSP_VECTOR_VCR 38
|
||||
#define RSP_VECTOR_VMRG 39
|
||||
#define RSP_VECTOR_VAND 40
|
||||
#define RSP_VECTOR_VNAND 41
|
||||
#define RSP_VECTOR_VOR 42
|
||||
#define RSP_VECTOR_VNOR 43
|
||||
#define RSP_VECTOR_VXOR 44
|
||||
#define RSP_VECTOR_VNXOR 45
|
||||
#define RSP_VECTOR_VRCP 48
|
||||
#define RSP_VECTOR_VRCPL 49
|
||||
#define RSP_VECTOR_VRCPH 50
|
||||
#define RSP_VECTOR_VMOV 51
|
||||
#define RSP_VECTOR_VRSQ 52
|
||||
#define RSP_VECTOR_VRSQL 53
|
||||
#define RSP_VECTOR_VRSQH 54
|
||||
#define RSP_VECTOR_VNOOP 55
|
||||
|
||||
// RSP LSC2 opcodes
|
||||
|
||||
#define RSP_LSC2_BV 0
|
||||
#define RSP_LSC2_SV 1
|
||||
#define RSP_LSC2_LV 2
|
||||
#define RSP_LSC2_DV 3
|
||||
#define RSP_LSC2_QV 4
|
||||
#define RSP_LSC2_RV 5
|
||||
#define RSP_LSC2_PV 6
|
||||
#define RSP_LSC2_UV 7
|
||||
#define RSP_LSC2_HV 8
|
||||
#define RSP_LSC2_FV 9
|
||||
#define RSP_LSC2_WV 10
|
||||
#define RSP_LSC2_TV 11
|
||||
#define RSP_LSC2_BV 0
|
||||
#define RSP_LSC2_SV 1
|
||||
#define RSP_LSC2_LV 2
|
||||
#define RSP_LSC2_DV 3
|
||||
#define RSP_LSC2_QV 4
|
||||
#define RSP_LSC2_RV 5
|
||||
#define RSP_LSC2_PV 6
|
||||
#define RSP_LSC2_UV 7
|
||||
#define RSP_LSC2_HV 8
|
||||
#define RSP_LSC2_FV 9
|
||||
#define RSP_LSC2_WV 10
|
||||
#define RSP_LSC2_TV 11
|
||||
|
|
|
@ -1,320 +1,337 @@
|
|||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "profiling.h"
|
||||
#pragma warning(disable:4786)
|
||||
#include <Common/StdString.h>
|
||||
#pragma warning(disable : 4786)
|
||||
#include <Common/File.h>
|
||||
#include <Common/Log.h>
|
||||
#include <Common/StdString.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
class CProfiling
|
||||
{
|
||||
typedef std::map<DWORD, __int64 > PROFILE_ENRTIES;
|
||||
typedef PROFILE_ENRTIES::iterator PROFILE_ENRTY;
|
||||
typedef PROFILE_ENRTIES::value_type PROFILE_VALUE;
|
||||
typedef struct { SPECIAL_TIMERS Timer; char * Name; } TIMER_NAME;
|
||||
typedef std::map<DWORD, __int64> PROFILE_ENRTIES;
|
||||
typedef PROFILE_ENRTIES::iterator PROFILE_ENRTY;
|
||||
typedef PROFILE_ENRTIES::value_type PROFILE_VALUE;
|
||||
typedef struct
|
||||
{
|
||||
SPECIAL_TIMERS Timer;
|
||||
char * Name;
|
||||
} TIMER_NAME;
|
||||
|
||||
DWORD m_CurrentTimerAddr, CurrentDisplayCount;
|
||||
DWORD m_StartTimeHi, m_StartTimeLo; // The current timer start time
|
||||
PROFILE_ENRTIES m_Entries;
|
||||
DWORD m_CurrentTimerAddr, CurrentDisplayCount;
|
||||
DWORD m_StartTimeHi, m_StartTimeLo; // The current timer start time
|
||||
PROFILE_ENRTIES m_Entries;
|
||||
|
||||
public:
|
||||
CProfiling ()
|
||||
{
|
||||
m_CurrentTimerAddr = Timer_None;
|
||||
}
|
||||
|
||||
// Recording timing against current timer, returns the address of the timer stopped
|
||||
DWORD StartTimer ( DWORD Address )
|
||||
{
|
||||
DWORD OldTimerAddr = StopTimer();
|
||||
m_CurrentTimerAddr = Address;
|
||||
public:
|
||||
CProfiling()
|
||||
{
|
||||
m_CurrentTimerAddr = Timer_None;
|
||||
}
|
||||
|
||||
// Recording timing against current timer, returns the address of the timer stopped
|
||||
DWORD StartTimer(DWORD Address)
|
||||
{
|
||||
DWORD OldTimerAddr = StopTimer();
|
||||
m_CurrentTimerAddr = Address;
|
||||
|
||||
#if defined(_M_IX86) && defined(_MSC_VER)
|
||||
DWORD HiValue, LoValue;
|
||||
_asm {
|
||||
DWORD HiValue, LoValue;
|
||||
_asm {
|
||||
pushad
|
||||
rdtsc
|
||||
mov HiValue, edx
|
||||
mov LoValue, eax
|
||||
popad
|
||||
}
|
||||
m_StartTimeHi = HiValue;
|
||||
m_StartTimeLo = LoValue;
|
||||
}
|
||||
m_StartTimeHi = HiValue;
|
||||
m_StartTimeLo = LoValue;
|
||||
#else
|
||||
DebugBreak();
|
||||
DebugBreak();
|
||||
#endif
|
||||
return OldTimerAddr;
|
||||
}
|
||||
DWORD StopTimer ( void )
|
||||
{
|
||||
if (m_CurrentTimerAddr == Timer_None) { return m_CurrentTimerAddr; }
|
||||
return OldTimerAddr;
|
||||
}
|
||||
DWORD StopTimer(void)
|
||||
{
|
||||
if (m_CurrentTimerAddr == Timer_None)
|
||||
{
|
||||
return m_CurrentTimerAddr;
|
||||
}
|
||||
|
||||
#if defined(_M_IX86) && defined(_MSC_VER)
|
||||
DWORD HiValue, LoValue;
|
||||
_asm {
|
||||
DWORD HiValue, LoValue;
|
||||
_asm {
|
||||
pushad
|
||||
rdtsc
|
||||
mov HiValue, edx
|
||||
mov LoValue, eax
|
||||
popad
|
||||
}
|
||||
}
|
||||
|
||||
__int64 StopTime = ((unsigned __int64)HiValue << 32) + (unsigned __int64)LoValue;
|
||||
__int64 StartTime = ((unsigned __int64)m_StartTimeHi << 32) + (unsigned __int64)m_StartTimeLo;
|
||||
__int64 TimeTaken = StopTime - StartTime;
|
||||
__int64 StopTime = ((unsigned __int64)HiValue << 32) + (unsigned __int64)LoValue;
|
||||
__int64 StartTime = ((unsigned __int64)m_StartTimeHi << 32) + (unsigned __int64)m_StartTimeLo;
|
||||
__int64 TimeTaken = StopTime - StartTime;
|
||||
|
||||
PROFILE_ENRTY Entry = m_Entries.find(m_CurrentTimerAddr);
|
||||
if (Entry != m_Entries.end())
|
||||
{
|
||||
Entry->second += TimeTaken;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Entries.insert(PROFILE_ENRTIES::value_type(m_CurrentTimerAddr, TimeTaken));
|
||||
}
|
||||
PROFILE_ENRTY Entry = m_Entries.find(m_CurrentTimerAddr);
|
||||
if (Entry != m_Entries.end())
|
||||
{
|
||||
Entry->second += TimeTaken;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Entries.insert(PROFILE_ENRTIES::value_type(m_CurrentTimerAddr, TimeTaken));
|
||||
}
|
||||
#else
|
||||
DebugBreak();
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
||||
DWORD OldTimerAddr = m_CurrentTimerAddr;
|
||||
m_CurrentTimerAddr = Timer_None;
|
||||
return OldTimerAddr;
|
||||
}
|
||||
DWORD OldTimerAddr = m_CurrentTimerAddr;
|
||||
m_CurrentTimerAddr = Timer_None;
|
||||
return OldTimerAddr;
|
||||
}
|
||||
|
||||
// Reset all the counters back to 0
|
||||
void ResetCounters ( void )
|
||||
{
|
||||
m_Entries.clear();
|
||||
}
|
||||
// Reset all the counters back to 0
|
||||
void ResetCounters(void)
|
||||
{
|
||||
m_Entries.clear();
|
||||
}
|
||||
|
||||
// Generate a log file with the current results, this will also reset the counters
|
||||
void GenerateLog ( void )
|
||||
{
|
||||
stdstr LogFileName;
|
||||
{
|
||||
CLog Log;
|
||||
Log.Open("RSP Profiling.txt");
|
||||
LogFileName = Log.FileName();
|
||||
// Generate a log file with the current results, this will also reset the counters
|
||||
void GenerateLog(void)
|
||||
{
|
||||
stdstr LogFileName;
|
||||
{
|
||||
CLog Log;
|
||||
Log.Open("RSP Profiling.txt");
|
||||
LogFileName = Log.FileName();
|
||||
|
||||
// Get the total time
|
||||
__int64 TotalTime = 0;
|
||||
for (PROFILE_ENRTY itemTime = m_Entries.begin(); itemTime != m_Entries.end(); itemTime++ )
|
||||
{
|
||||
TotalTime += itemTime->second;
|
||||
}
|
||||
// Get the total time
|
||||
__int64 TotalTime = 0;
|
||||
for (PROFILE_ENRTY itemTime = m_Entries.begin(); itemTime != m_Entries.end(); itemTime++)
|
||||
{
|
||||
TotalTime += itemTime->second;
|
||||
}
|
||||
|
||||
// Create a sortable list of items
|
||||
std::vector<PROFILE_VALUE *> ItemList;
|
||||
for (PROFILE_ENRTY Entry = m_Entries.begin(); Entry != m_Entries.end(); Entry++ )
|
||||
{
|
||||
ItemList.push_back(&(*Entry));
|
||||
}
|
||||
// Create a sortable list of items
|
||||
std::vector<PROFILE_VALUE *> ItemList;
|
||||
for (PROFILE_ENRTY Entry = m_Entries.begin(); Entry != m_Entries.end(); Entry++)
|
||||
{
|
||||
ItemList.push_back(&(*Entry));
|
||||
}
|
||||
|
||||
// Sort the list with a basic bubble sort
|
||||
if (ItemList.size() > 0)
|
||||
{
|
||||
for (size_t OuterPass = 0; OuterPass < (ItemList.size() - 1); OuterPass++ )
|
||||
{
|
||||
for (size_t InnerPass = 0; InnerPass < (ItemList.size() - 1); InnerPass++ )
|
||||
{
|
||||
if (ItemList[InnerPass]->second < ItemList[InnerPass + 1]->second)
|
||||
{
|
||||
PROFILE_VALUE * TempPtr = ItemList[InnerPass];
|
||||
ItemList[InnerPass] = ItemList[InnerPass + 1];
|
||||
ItemList[InnerPass + 1] = TempPtr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sort the list with a basic bubble sort
|
||||
if (ItemList.size() > 0)
|
||||
{
|
||||
for (size_t OuterPass = 0; OuterPass < (ItemList.size() - 1); OuterPass++)
|
||||
{
|
||||
for (size_t InnerPass = 0; InnerPass < (ItemList.size() - 1); InnerPass++)
|
||||
{
|
||||
if (ItemList[InnerPass]->second < ItemList[InnerPass + 1]->second)
|
||||
{
|
||||
PROFILE_VALUE * TempPtr = ItemList[InnerPass];
|
||||
ItemList[InnerPass] = ItemList[InnerPass + 1];
|
||||
ItemList[InnerPass + 1] = TempPtr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TIMER_NAME TimerNames[] = {
|
||||
{Timer_Compiling, "RSP: Compiling"},
|
||||
{Timer_RSP_Running, "RSP: Running"},
|
||||
{Timer_R4300_Running, "R4300i: Running"},
|
||||
{Timer_RDP_Running, "RDP: Running"},
|
||||
};
|
||||
TIMER_NAME TimerNames[] = {
|
||||
{Timer_Compiling, "RSP: Compiling"},
|
||||
{Timer_RSP_Running, "RSP: Running"},
|
||||
{Timer_R4300_Running, "R4300i: Running"},
|
||||
{Timer_RDP_Running, "RDP: Running"},
|
||||
};
|
||||
|
||||
for (size_t count = 0; count < ItemList.size(); count++ )
|
||||
{
|
||||
char Buffer[255];
|
||||
float CpuUsage = (float)(((double)ItemList[count]->second / (double)TotalTime) * 100);
|
||||
for (size_t count = 0; count < ItemList.size(); count++)
|
||||
{
|
||||
char Buffer[255];
|
||||
float CpuUsage = (float)(((double)ItemList[count]->second / (double)TotalTime) * 100);
|
||||
|
||||
if (CpuUsage <= 0.2) { continue; }
|
||||
sprintf(Buffer, "Function 0x%08X", ItemList[count]->first);
|
||||
for (int NameID = 0; NameID < (sizeof(TimerNames) / sizeof(TIMER_NAME)); NameID++)
|
||||
{
|
||||
if (ItemList[count]->first == (DWORD)TimerNames[NameID].Timer)
|
||||
{
|
||||
strcpy(Buffer,TimerNames[NameID].Name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Log.LogF("%s\t%2.2f",Buffer, CpuUsage);
|
||||
}
|
||||
}
|
||||
if (CpuUsage <= 0.2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
sprintf(Buffer, "Function 0x%08X", ItemList[count]->first);
|
||||
for (int NameID = 0; NameID < (sizeof(TimerNames) / sizeof(TIMER_NAME)); NameID++)
|
||||
{
|
||||
if (ItemList[count]->first == (DWORD)TimerNames[NameID].Timer)
|
||||
{
|
||||
strcpy(Buffer, TimerNames[NameID].Name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Log.LogF("%s\t%2.2f", Buffer, CpuUsage);
|
||||
}
|
||||
}
|
||||
|
||||
ShellExecuteA(NULL,"open",LogFileName.c_str(),NULL,NULL,SW_SHOW);
|
||||
ResetCounters();
|
||||
}
|
||||
ShellExecuteA(NULL, "open", LogFileName.c_str(), NULL, NULL, SW_SHOW);
|
||||
ResetCounters();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
CProfiling& GetProfiler ( void )
|
||||
CProfiling & GetProfiler(void)
|
||||
{
|
||||
static CProfiling Profile;
|
||||
return Profile;
|
||||
static CProfiling Profile;
|
||||
return Profile;
|
||||
}
|
||||
|
||||
void ResetTimerList (void)
|
||||
void ResetTimerList(void)
|
||||
{
|
||||
GetProfiler().ResetCounters();
|
||||
GetProfiler().ResetCounters();
|
||||
}
|
||||
|
||||
DWORD StartTimer (DWORD Address)
|
||||
DWORD StartTimer(DWORD Address)
|
||||
{
|
||||
return GetProfiler().StartTimer(Address);
|
||||
return GetProfiler().StartTimer(Address);
|
||||
}
|
||||
|
||||
void StopTimer (void)
|
||||
void StopTimer(void)
|
||||
{
|
||||
GetProfiler().StopTimer();
|
||||
GetProfiler().StopTimer();
|
||||
}
|
||||
|
||||
void GenerateTimerResults (void)
|
||||
void GenerateTimerResults(void)
|
||||
{
|
||||
GetProfiler().GenerateLog();
|
||||
GetProfiler().GenerateLog();
|
||||
}
|
||||
|
||||
#ifdef todelete
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
typedef struct {
|
||||
char Label[100];
|
||||
__int64 TimeTotal;
|
||||
typedef struct
|
||||
{
|
||||
char Label[100];
|
||||
__int64 TimeTotal;
|
||||
} TIME_STAMP_ENTRY;
|
||||
|
||||
DWORD StartTimeHi, StartTimeLo, StopTimeHi, StopTimeLo, TSE_Count, TSE_Max;
|
||||
TIME_STAMP_ENTRY * TS_Entries = NULL;
|
||||
char LastLabel[100];
|
||||
|
||||
void ResetTimerList (void)
|
||||
void ResetTimerList(void)
|
||||
{
|
||||
if (TS_Entries) { free(TS_Entries); }
|
||||
TS_Entries = NULL;
|
||||
TSE_Count = 0;
|
||||
TSE_Max = 0;
|
||||
if (TS_Entries)
|
||||
{
|
||||
free(TS_Entries);
|
||||
}
|
||||
TS_Entries = NULL;
|
||||
TSE_Count = 0;
|
||||
TSE_Max = 0;
|
||||
}
|
||||
|
||||
void StartTimer (char * Label)
|
||||
void StartTimer(char * Label)
|
||||
{
|
||||
strcpy(LastLabel,Label);
|
||||
_asm {
|
||||
strcpy(LastLabel, Label);
|
||||
_asm {
|
||||
pushad
|
||||
rdtsc
|
||||
mov StartTimeHi, edx
|
||||
mov StartTimeLo, eax
|
||||
popad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StopTimer (void)
|
||||
void StopTimer(void)
|
||||
{
|
||||
_asm {
|
||||
_asm {
|
||||
pushad
|
||||
rdtsc
|
||||
mov StopTimeHi, edx
|
||||
mov StopTimeLo, eax
|
||||
popad
|
||||
}
|
||||
if (strlen(LastLabel) == 0) { return; }
|
||||
{
|
||||
DWORD count;
|
||||
}
|
||||
if (strlen(LastLabel) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
{
|
||||
DWORD count;
|
||||
|
||||
for (count = 0; count < TSE_Count; count ++)
|
||||
{
|
||||
if (strcmp(LastLabel,TS_Entries[count].Label) == 0)
|
||||
{
|
||||
__int64 Time = ((unsigned __int64)StopTimeHi << 32) + (unsigned __int64)StopTimeLo;
|
||||
Time -= ((unsigned __int64)StartTimeHi << 32) + (unsigned __int64)StartTimeLo;
|
||||
TS_Entries[count].TimeTotal += Time;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TSE_Count == 0)
|
||||
{
|
||||
TS_Entries = (TIME_STAMP_ENTRY *)malloc(sizeof(TIME_STAMP_ENTRY) * 100);
|
||||
if (TS_Entries == NULL)
|
||||
{
|
||||
MessageBox(NULL,"TIME_STAMP_ENTRY == NULL ??","ERROR",MB_OK|MB_ICONERROR|MB_SETFOREGROUND);
|
||||
}
|
||||
TSE_Max = 100;
|
||||
}
|
||||
else if (TSE_Count == TSE_Max)
|
||||
{
|
||||
TSE_Max += 100;
|
||||
TS_Entries = (TIME_STAMP_ENTRY *)realloc(TS_Entries,sizeof(TIME_STAMP_ENTRY) * TSE_Max);
|
||||
if (TS_Entries == NULL)
|
||||
{
|
||||
MessageBox(NULL,"TIME_STAMP_ENTRY == NULL ??","ERROR",MB_OK|MB_ICONERROR|MB_SETFOREGROUND);
|
||||
}
|
||||
}
|
||||
strcpy(TS_Entries[TSE_Count].Label,LastLabel);
|
||||
TS_Entries[TSE_Count].TimeTotal = ((unsigned __int64)StopTimeHi << 32) + (unsigned __int64)StopTimeLo;
|
||||
TS_Entries[TSE_Count].TimeTotal -= ((unsigned __int64)StartTimeHi << 32) + (unsigned __int64)StartTimeLo;
|
||||
TSE_Count +=1;
|
||||
for (count = 0; count < TSE_Count; count++)
|
||||
{
|
||||
if (strcmp(LastLabel, TS_Entries[count].Label) == 0)
|
||||
{
|
||||
__int64 Time = ((unsigned __int64)StopTimeHi << 32) + (unsigned __int64)StopTimeLo;
|
||||
Time -= ((unsigned __int64)StartTimeHi << 32) + (unsigned __int64)StartTimeLo;
|
||||
TS_Entries[count].TimeTotal += Time;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TSE_Count == 0)
|
||||
{
|
||||
TS_Entries = (TIME_STAMP_ENTRY *)malloc(sizeof(TIME_STAMP_ENTRY) * 100);
|
||||
if (TS_Entries == NULL)
|
||||
{
|
||||
MessageBox(NULL, "TIME_STAMP_ENTRY == NULL ??", "ERROR", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
}
|
||||
TSE_Max = 100;
|
||||
}
|
||||
else if (TSE_Count == TSE_Max)
|
||||
{
|
||||
TSE_Max += 100;
|
||||
TS_Entries = (TIME_STAMP_ENTRY *)realloc(TS_Entries, sizeof(TIME_STAMP_ENTRY) * TSE_Max);
|
||||
if (TS_Entries == NULL)
|
||||
{
|
||||
MessageBox(NULL, "TIME_STAMP_ENTRY == NULL ??", "ERROR", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
}
|
||||
}
|
||||
strcpy(TS_Entries[TSE_Count].Label, LastLabel);
|
||||
TS_Entries[TSE_Count].TimeTotal = ((unsigned __int64)StopTimeHi << 32) + (unsigned __int64)StopTimeLo;
|
||||
TS_Entries[TSE_Count].TimeTotal -= ((unsigned __int64)StartTimeHi << 32) + (unsigned __int64)StartTimeLo;
|
||||
TSE_Count += 1;
|
||||
}
|
||||
|
||||
void GenerateTimerResults (void)
|
||||
void GenerateTimerResults(void)
|
||||
{
|
||||
char buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
|
||||
char fname[_MAX_FNAME],ext[_MAX_EXT], LogFileName[_MAX_PATH];
|
||||
DWORD dwWritten, count, count2;
|
||||
HANDLE hLogFile = NULL;
|
||||
__int64 TotalTime;
|
||||
char buffer[_MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR];
|
||||
char fname[_MAX_FNAME], ext[_MAX_EXT], LogFileName[_MAX_PATH];
|
||||
DWORD dwWritten, count, count2;
|
||||
HANDLE hLogFile = NULL;
|
||||
__int64 TotalTime;
|
||||
|
||||
StopTimer();
|
||||
StopTimer();
|
||||
|
||||
GetModuleFileName(NULL,buffer,sizeof(buffer));
|
||||
_splitpath( buffer, drive, dir, fname, ext );
|
||||
_makepath( LogFileName, drive, dir, "RSP Profiling", "log" );
|
||||
GetModuleFileName(NULL, buffer, sizeof(buffer));
|
||||
_splitpath(buffer, drive, dir, fname, ext);
|
||||
_makepath(LogFileName, drive, dir, "RSP Profiling", "log");
|
||||
|
||||
hLogFile = CreateFile(LogFileName,GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
|
||||
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
|
||||
hLogFile = CreateFile(LogFileName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
|
||||
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
SetFilePointer(hLogFile, 0, NULL, FILE_BEGIN);
|
||||
|
||||
for (count = 0; count < TSE_Count; count ++)
|
||||
{
|
||||
for (count2 = 0; count2 < (TSE_Count - 1); count2 ++)
|
||||
{
|
||||
if (TS_Entries[count2].TimeTotal < TS_Entries[count2 + 1].TimeTotal)
|
||||
{
|
||||
TIME_STAMP_ENTRY Temp;
|
||||
memcpy(&Temp,&TS_Entries[count2],sizeof(TIME_STAMP_ENTRY));
|
||||
memcpy(&TS_Entries[count2],&TS_Entries[count2 + 1],sizeof(TIME_STAMP_ENTRY));
|
||||
memcpy(&TS_Entries[count2 + 1],&Temp,sizeof(TIME_STAMP_ENTRY));
|
||||
}
|
||||
}
|
||||
}
|
||||
TotalTime = 0;
|
||||
for (count = 0; count < TSE_Count; count ++)
|
||||
{
|
||||
TotalTime += TS_Entries[count].TimeTotal;
|
||||
}
|
||||
for (count = 0; count < (TSE_Count < 50?TSE_Count:50); count ++)
|
||||
{
|
||||
sprintf(buffer,"%s - %0.2f%c\r\n",
|
||||
TS_Entries[count].Label,
|
||||
(((double)TS_Entries[count].TimeTotal / (double)TotalTime) * 100),'%'
|
||||
);
|
||||
WriteFile( hLogFile,buffer,strlen(buffer),&dwWritten,NULL );
|
||||
}
|
||||
CloseHandle(hLogFile);
|
||||
ResetTimerList();
|
||||
for (count = 0; count < TSE_Count; count++)
|
||||
{
|
||||
for (count2 = 0; count2 < (TSE_Count - 1); count2++)
|
||||
{
|
||||
if (TS_Entries[count2].TimeTotal < TS_Entries[count2 + 1].TimeTotal)
|
||||
{
|
||||
TIME_STAMP_ENTRY Temp;
|
||||
memcpy(&Temp, &TS_Entries[count2], sizeof(TIME_STAMP_ENTRY));
|
||||
memcpy(&TS_Entries[count2], &TS_Entries[count2 + 1], sizeof(TIME_STAMP_ENTRY));
|
||||
memcpy(&TS_Entries[count2 + 1], &Temp, sizeof(TIME_STAMP_ENTRY));
|
||||
}
|
||||
}
|
||||
}
|
||||
TotalTime = 0;
|
||||
for (count = 0; count < TSE_Count; count++)
|
||||
{
|
||||
TotalTime += TS_Entries[count].TimeTotal;
|
||||
}
|
||||
for (count = 0; count < (TSE_Count < 50 ? TSE_Count : 50); count++)
|
||||
{
|
||||
sprintf(buffer, "%s - %0.2f%c\r\n",
|
||||
TS_Entries[count].Label,
|
||||
(((double)TS_Entries[count].TimeTotal / (double)TotalTime) * 100), '%');
|
||||
WriteFile(hLogFile, buffer, strlen(buffer), &dwWritten, NULL);
|
||||
}
|
||||
CloseHandle(hLogFile);
|
||||
ResetTimerList();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
enum SPECIAL_TIMERS {
|
||||
Timer_None = 0, Timer_Compiling = -1, Timer_RSP_Running = -2,
|
||||
Timer_R4300_Running = -3, Timer_RDP_Running = -5, Timer_RefreshScreen = -6,
|
||||
Timer_UpdateScreen = -7, Timer_UpdateFPS = -9, Timer_Idel = -10,
|
||||
Timer_FuncLookup = -11,Timer_Done = -13,
|
||||
enum SPECIAL_TIMERS
|
||||
{
|
||||
Timer_None = 0,
|
||||
Timer_Compiling = -1,
|
||||
Timer_RSP_Running = -2,
|
||||
Timer_R4300_Running = -3,
|
||||
Timer_RDP_Running = -5,
|
||||
Timer_RefreshScreen = -6,
|
||||
Timer_UpdateScreen = -7,
|
||||
Timer_UpdateFPS = -9,
|
||||
Timer_Idel = -10,
|
||||
Timer_FuncLookup = -11,
|
||||
Timer_Done = -13,
|
||||
};
|
||||
|
||||
void ResetTimerList ( void );
|
||||
DWORD StartTimer ( DWORD Address );
|
||||
void StopTimer ( void );
|
||||
void GenerateTimerResults ( void );
|
||||
void ResetTimerList(void);
|
||||
DWORD StartTimer(DWORD Address);
|
||||
void StopTimer(void);
|
||||
void GenerateTimerResults(void);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,13 @@
|
|||
char * RSPOpcodeName ( DWORD OpCode, DWORD PC );
|
||||
char * RSPOpcodeName(DWORD OpCode, DWORD PC);
|
||||
|
||||
void DumpRSPCode (void);
|
||||
void DumpRSPData (void);
|
||||
void Disable_RSP_Commands_Window ( void );
|
||||
void Enable_RSP_Commands_Window ( void );
|
||||
void Enter_RSP_Commands_Window ( void );
|
||||
void RefreshRSPCommands ( void );
|
||||
void SetRSPCommandToRunning ( void );
|
||||
void SetRSPCommandToStepping ( void );
|
||||
void DumpRSPCode(void);
|
||||
void DumpRSPData(void);
|
||||
void Disable_RSP_Commands_Window(void);
|
||||
void Enable_RSP_Commands_Window(void);
|
||||
void Enter_RSP_Commands_Window(void);
|
||||
void RefreshRSPCommands(void);
|
||||
void SetRSPCommandToRunning(void);
|
||||
void SetRSPCommandToStepping(void);
|
||||
void SetRSPCommandViewto(unsigned int NewLocation);
|
||||
|
||||
extern DWORD Stepping_Commands, WaitingForStep;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,71 +1,71 @@
|
|||
#include "Types.h"
|
||||
|
||||
#define SP_STATUS_HALT 0x001 // Bit 0: Halt
|
||||
#define SP_STATUS_BROKE 0x002 // Bit 1: Broke
|
||||
#define SP_STATUS_DMA_BUSY 0x004 // Bit 2: DMA busy
|
||||
#define SP_STATUS_DMA_FULL 0x008 // Bit 3: DMA full
|
||||
#define SP_STATUS_IO_FULL 0x010 // Bit 4: IO full
|
||||
#define SP_STATUS_SSTEP 0x020 // Bit 5: Single step
|
||||
#define SP_STATUS_INTR_BREAK 0x040 // Bit 6: Interrupt on break
|
||||
#define SP_STATUS_SIG0 0x080 // Bit 7: Signal 0 set
|
||||
#define SP_STATUS_SIG1 0x100 // Bit 8: Signal 1 set
|
||||
#define SP_STATUS_SIG2 0x200 // Bit 9: Signal 2 set
|
||||
#define SP_STATUS_SIG3 0x400 // Bit 10: Signal 3 set
|
||||
#define SP_STATUS_SIG4 0x800 // Bit 11: Signal 4 set
|
||||
#define SP_STATUS_SIG5 0x1000 // Bit 12: Signal 5 set
|
||||
#define SP_STATUS_SIG6 0x2000 // Bit 13: Signal 6 set
|
||||
#define SP_STATUS_SIG7 0x4000 // Bit 14: Signal 7 set
|
||||
#define SP_STATUS_HALT 0x001 // Bit 0: Halt
|
||||
#define SP_STATUS_BROKE 0x002 // Bit 1: Broke
|
||||
#define SP_STATUS_DMA_BUSY 0x004 // Bit 2: DMA busy
|
||||
#define SP_STATUS_DMA_FULL 0x008 // Bit 3: DMA full
|
||||
#define SP_STATUS_IO_FULL 0x010 // Bit 4: IO full
|
||||
#define SP_STATUS_SSTEP 0x020 // Bit 5: Single step
|
||||
#define SP_STATUS_INTR_BREAK 0x040 // Bit 6: Interrupt on break
|
||||
#define SP_STATUS_SIG0 0x080 // Bit 7: Signal 0 set
|
||||
#define SP_STATUS_SIG1 0x100 // Bit 8: Signal 1 set
|
||||
#define SP_STATUS_SIG2 0x200 // Bit 9: Signal 2 set
|
||||
#define SP_STATUS_SIG3 0x400 // Bit 10: Signal 3 set
|
||||
#define SP_STATUS_SIG4 0x800 // Bit 11: Signal 4 set
|
||||
#define SP_STATUS_SIG5 0x1000 // Bit 12: Signal 5 set
|
||||
#define SP_STATUS_SIG6 0x2000 // Bit 13: Signal 6 set
|
||||
#define SP_STATUS_SIG7 0x4000 // Bit 14: Signal 7 set
|
||||
|
||||
#define SP_CLR_HALT 0x00001 // Bit 0: Clear halt
|
||||
#define SP_SET_HALT 0x00002 // Bit 1: Set halt
|
||||
#define SP_CLR_BROKE 0x00004 // Bit 2: Clear broke
|
||||
#define SP_CLR_INTR 0x00008 // Bit 3: Clear INTR
|
||||
#define SP_SET_INTR 0x00010 // Bit 4: Set INTR
|
||||
#define SP_CLR_SSTEP 0x00020 // Bit 5: Clear SSTEP
|
||||
#define SP_SET_SSTEP 0x00040 // Bit 6: Set SSTEP
|
||||
#define SP_CLR_INTR_BREAK 0x00080 // Bit 7: Clear INTR on break
|
||||
#define SP_SET_INTR_BREAK 0x00100 // Bit 8: Set INTR on break
|
||||
#define SP_CLR_SIG0 0x00200 // Bit 9: Clear signal 0
|
||||
#define SP_SET_SIG0 0x00400 // Bit 10: Set signal 0
|
||||
#define SP_CLR_SIG1 0x00800 // Bit 11: Clear signal 1
|
||||
#define SP_SET_SIG1 0x01000 // Bit 12: Set signal 1
|
||||
#define SP_CLR_SIG2 0x02000 // Bit 13: Clear signal 2
|
||||
#define SP_SET_SIG2 0x04000 // Bit 14: Set signal 2
|
||||
#define SP_CLR_SIG3 0x08000 // Bit 15: Clear signal 3
|
||||
#define SP_SET_SIG3 0x10000 // Bit 16: Set signal 3
|
||||
#define SP_CLR_SIG4 0x20000 // Bit 17: Clear signal 4
|
||||
#define SP_SET_SIG4 0x40000 // Bit 18: Set signal 4
|
||||
#define SP_CLR_SIG5 0x80000 // Bit 19: Clear signal 5
|
||||
#define SP_SET_SIG5 0x100000 // Bit 20: Set signal 5
|
||||
#define SP_CLR_SIG6 0x200000 // Bit 21: Clear signal 6
|
||||
#define SP_SET_SIG6 0x400000 // Bit 22: Set signal 6
|
||||
#define SP_CLR_SIG7 0x800000 // Bit 23: Clear signal 7
|
||||
#define SP_SET_SIG7 0x1000000 // Bit 24: Set signal 7
|
||||
#define SP_CLR_HALT 0x00001 // Bit 0: Clear halt
|
||||
#define SP_SET_HALT 0x00002 // Bit 1: Set halt
|
||||
#define SP_CLR_BROKE 0x00004 // Bit 2: Clear broke
|
||||
#define SP_CLR_INTR 0x00008 // Bit 3: Clear INTR
|
||||
#define SP_SET_INTR 0x00010 // Bit 4: Set INTR
|
||||
#define SP_CLR_SSTEP 0x00020 // Bit 5: Clear SSTEP
|
||||
#define SP_SET_SSTEP 0x00040 // Bit 6: Set SSTEP
|
||||
#define SP_CLR_INTR_BREAK 0x00080 // Bit 7: Clear INTR on break
|
||||
#define SP_SET_INTR_BREAK 0x00100 // Bit 8: Set INTR on break
|
||||
#define SP_CLR_SIG0 0x00200 // Bit 9: Clear signal 0
|
||||
#define SP_SET_SIG0 0x00400 // Bit 10: Set signal 0
|
||||
#define SP_CLR_SIG1 0x00800 // Bit 11: Clear signal 1
|
||||
#define SP_SET_SIG1 0x01000 // Bit 12: Set signal 1
|
||||
#define SP_CLR_SIG2 0x02000 // Bit 13: Clear signal 2
|
||||
#define SP_SET_SIG2 0x04000 // Bit 14: Set signal 2
|
||||
#define SP_CLR_SIG3 0x08000 // Bit 15: Clear signal 3
|
||||
#define SP_SET_SIG3 0x10000 // Bit 16: Set signal 3
|
||||
#define SP_CLR_SIG4 0x20000 // Bit 17: Clear signal 4
|
||||
#define SP_SET_SIG4 0x40000 // Bit 18: Set signal 4
|
||||
#define SP_CLR_SIG5 0x80000 // Bit 19: Clear signal 5
|
||||
#define SP_SET_SIG5 0x100000 // Bit 20: Set signal 5
|
||||
#define SP_CLR_SIG6 0x200000 // Bit 21: Clear signal 6
|
||||
#define SP_SET_SIG6 0x400000 // Bit 22: Set signal 6
|
||||
#define SP_CLR_SIG7 0x800000 // Bit 23: Clear signal 7
|
||||
#define SP_SET_SIG7 0x1000000 // Bit 24: Set signal 7
|
||||
|
||||
#define DPC_CLR_XBUS_DMEM_DMA 0x0001 // Bit 0: Clear xbus_dmem_dma
|
||||
#define DPC_SET_XBUS_DMEM_DMA 0x0002 // Bit 1: Set xbus_dmem_dma
|
||||
#define DPC_CLR_FREEZE 0x0004 // Bit 2: Clear freeze
|
||||
#define DPC_SET_FREEZE 0x0008 // Bit 3: Set freeze
|
||||
#define DPC_CLR_FLUSH 0x0010 // Bit 4: Clear flush
|
||||
#define DPC_SET_FLUSH 0x0020 // Bit 5: Set flush
|
||||
#define DPC_CLR_TMEM_CTR 0x0040 // Bit 6: Clear TMEM CTR
|
||||
#define DPC_CLR_PIPE_CTR 0x0080 // Bit 7: Clear pipe CTR
|
||||
#define DPC_CLR_CMD_CTR 0x0100 // Bit 8: Clear CMD CTR
|
||||
#define DPC_CLR_CLOCK_CTR 0x0200 // Bit 9: Clear clock CTR
|
||||
#define DPC_CLR_XBUS_DMEM_DMA 0x0001 // Bit 0: Clear xbus_dmem_dma
|
||||
#define DPC_SET_XBUS_DMEM_DMA 0x0002 // Bit 1: Set xbus_dmem_dma
|
||||
#define DPC_CLR_FREEZE 0x0004 // Bit 2: Clear freeze
|
||||
#define DPC_SET_FREEZE 0x0008 // Bit 3: Set freeze
|
||||
#define DPC_CLR_FLUSH 0x0010 // Bit 4: Clear flush
|
||||
#define DPC_SET_FLUSH 0x0020 // Bit 5: Set flush
|
||||
#define DPC_CLR_TMEM_CTR 0x0040 // Bit 6: Clear TMEM CTR
|
||||
#define DPC_CLR_PIPE_CTR 0x0080 // Bit 7: Clear pipe CTR
|
||||
#define DPC_CLR_CMD_CTR 0x0100 // Bit 8: Clear CMD CTR
|
||||
#define DPC_CLR_CLOCK_CTR 0x0200 // Bit 9: Clear clock CTR
|
||||
|
||||
#define DPC_STATUS_XBUS_DMEM_DMA 0x001 // Bit 0: xbus_dmem_dma
|
||||
#define DPC_STATUS_FREEZE 0x002 // Bit 1: Freeze
|
||||
#define DPC_STATUS_FLUSH 0x004 // Bit 2: Flush
|
||||
#define DPC_STATUS_START_GCLK 0x008 // Bit 3: Start GCLK
|
||||
#define DPC_STATUS_TMEM_BUSY 0x010 // Bit 4: TMEM busy
|
||||
#define DPC_STATUS_PIPE_BUSY 0x020 // Bit 5: Pipe busy
|
||||
#define DPC_STATUS_CMD_BUSY 0x040 // Bit 6: CMD busy
|
||||
#define DPC_STATUS_CBUF_READY 0x080 // Bit 7: CBUF ready
|
||||
#define DPC_STATUS_DMA_BUSY 0x100 // Bit 8: DMA busy
|
||||
#define DPC_STATUS_END_VALID 0x200 // Bit 9: End valid
|
||||
#define DPC_STATUS_START_VALID 0x400 // Bit 10: Start valid
|
||||
#define DPC_STATUS_XBUS_DMEM_DMA 0x001 // Bit 0: xbus_dmem_dma
|
||||
#define DPC_STATUS_FREEZE 0x002 // Bit 1: Freeze
|
||||
#define DPC_STATUS_FLUSH 0x004 // Bit 2: Flush
|
||||
#define DPC_STATUS_START_GCLK 0x008 // Bit 3: Start GCLK
|
||||
#define DPC_STATUS_TMEM_BUSY 0x010 // Bit 4: TMEM busy
|
||||
#define DPC_STATUS_PIPE_BUSY 0x020 // Bit 5: Pipe busy
|
||||
#define DPC_STATUS_CMD_BUSY 0x040 // Bit 6: CMD busy
|
||||
#define DPC_STATUS_CBUF_READY 0x080 // Bit 7: CBUF ready
|
||||
#define DPC_STATUS_DMA_BUSY 0x100 // Bit 8: DMA busy
|
||||
#define DPC_STATUS_END_VALID 0x200 // Bit 9: End valid
|
||||
#define DPC_STATUS_START_VALID 0x400 // Bit 10: Start valid
|
||||
|
||||
#define R4300i_SP_Intr 0x1
|
||||
#define R4300i_SP_Intr 0x1
|
||||
|
||||
extern char * x86_Strings[8];
|
||||
extern char * GPR_Strings[32];
|
||||
|
@ -86,38 +86,47 @@ extern char * GPR_Strings[32];
|
|||
(Reg) == 31 ? "RA" : "Unknown Register"
|
||||
*/
|
||||
|
||||
#define COP0_Name(Reg)\
|
||||
(Reg) == 0 ? "SP memory address" :\
|
||||
(Reg) == 1 ? "SP DRAM DMA address" :\
|
||||
(Reg) == 2 ? "SP read DMA length" :\
|
||||
(Reg) == 3 ? "SP write DMA length" :\
|
||||
(Reg) == 4 ? "SP status" :\
|
||||
(Reg) == 5 ? "SP DMA full" :\
|
||||
(Reg) == 6 ? "SP DMA busy" :\
|
||||
(Reg) == 7 ? "SP semaphore" :\
|
||||
(Reg) == 8 ? "DP CMD DMA start" :\
|
||||
(Reg) == 9 ? "DP CMD DMA end" :\
|
||||
(Reg) == 10 ? "DP CMD DMA current" :\
|
||||
(Reg) == 11 ? "DP CMD status" :\
|
||||
(Reg) == 12 ? "DP clock counter" :\
|
||||
(Reg) == 13 ? "DP buffer busy counter" :\
|
||||
(Reg) == 14 ? "DP pipe busy counter" :\
|
||||
(Reg) == 15 ? "DP TMEM load counter" :\
|
||||
"Unknown Register"
|
||||
#define COP0_Name(Reg) \
|
||||
(Reg) == 0 ? "SP memory address" : (Reg) == 1 ? "SP DRAM DMA address" \
|
||||
: (Reg) == 2 ? "SP read DMA length" \
|
||||
: (Reg) == 3 ? "SP write DMA length" \
|
||||
: (Reg) == 4 ? "SP status" \
|
||||
: (Reg) == 5 ? "SP DMA full" \
|
||||
: (Reg) == 6 ? "SP DMA busy" \
|
||||
: (Reg) == 7 ? "SP semaphore" \
|
||||
: (Reg) == 8 ? "DP CMD DMA start" \
|
||||
: (Reg) == 9 ? "DP CMD DMA end" \
|
||||
: (Reg) == 10 ? "DP CMD DMA current" \
|
||||
: (Reg) == 11 ? "DP CMD status" \
|
||||
: (Reg) == 12 ? "DP clock counter" \
|
||||
: (Reg) == 13 ? "DP buffer busy counter" \
|
||||
: (Reg) == 14 ? "DP pipe busy counter" \
|
||||
: (Reg) == 15 ? "DP TMEM load counter" \
|
||||
: "Unknown Register"
|
||||
|
||||
#define ElementSpecifier(Elem)\
|
||||
(Elem) == 0 ? "" : (Elem) == 1 ? "" : (Elem) == 2 ? " [0q]" :\
|
||||
(Elem) == 3 ? " [1q]" : (Elem) == 4 ? " [0h]" : (Elem) == 5 ? " [1h]" :\
|
||||
(Elem) == 6 ? " [2h]" : (Elem) == 7 ? " [3h]" : (Elem) == 8 ? " [0]" :\
|
||||
(Elem) == 9 ? " [1]" : (Elem) == 10 ? " [2]" : (Elem) == 11 ? " [3]" :\
|
||||
(Elem) == 12 ? " [4]" : (Elem) == 13 ? " [5]" : (Elem) == 14 ? " [6]" :\
|
||||
(Elem) == 15 ? " [7]" : "Unknown Element"
|
||||
#define ElementSpecifier(Elem) \
|
||||
(Elem) == 0 ? "" : (Elem) == 1 ? "" \
|
||||
: (Elem) == 2 ? " [0q]" \
|
||||
: (Elem) == 3 ? " [1q]" \
|
||||
: (Elem) == 4 ? " [0h]" \
|
||||
: (Elem) == 5 ? " [1h]" \
|
||||
: (Elem) == 6 ? " [2h]" \
|
||||
: (Elem) == 7 ? " [3h]" \
|
||||
: (Elem) == 8 ? " [0]" \
|
||||
: (Elem) == 9 ? " [1]" \
|
||||
: (Elem) == 10 ? " [2]" \
|
||||
: (Elem) == 11 ? " [3]" \
|
||||
: (Elem) == 12 ? " [4]" \
|
||||
: (Elem) == 13 ? " [5]" \
|
||||
: (Elem) == 14 ? " [6]" \
|
||||
: (Elem) == 15 ? " [7]" \
|
||||
: "Unknown Element"
|
||||
|
||||
void Enter_RSP_Register_Window ( void );
|
||||
void InitilizeRSPRegisters (void);
|
||||
void UpdateRSPRegistersScreen ( void );
|
||||
void Enter_RSP_Register_Window(void);
|
||||
void InitilizeRSPRegisters(void);
|
||||
void UpdateRSPRegistersScreen(void);
|
||||
|
||||
// RSP registers
|
||||
extern UWORD32 RSP_GPR[32], RSP_Flags[4];
|
||||
extern UDWORD RSP_ACCUM[8];
|
||||
extern VECTOR RSP_Vect[32];
|
||||
extern UWORD32 RSP_GPR[32], RSP_Flags[4];
|
||||
extern UDWORD RSP_ACCUM[8];
|
||||
extern VECTOR RSP_Vect[32];
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -4,12 +4,13 @@
|
|||
extern uint32_t CompilePC, NextInstruction, JumpTableSize;
|
||||
extern Boolean ChangedPC;
|
||||
|
||||
#define CompilerWarning if (ShowErrors) DisplayError
|
||||
#define CompilerWarning \
|
||||
if (ShowErrors) DisplayError
|
||||
|
||||
#define High16BitAccum 1
|
||||
#define Middle16BitAccum 2
|
||||
#define Low16BitAccum 4
|
||||
#define EntireAccum (Low16BitAccum|Middle16BitAccum|High16BitAccum)
|
||||
#define High16BitAccum 1
|
||||
#define Middle16BitAccum 2
|
||||
#define Low16BitAccum 4
|
||||
#define EntireAccum (Low16BitAccum | Middle16BitAccum | High16BitAccum)
|
||||
|
||||
Boolean WriteToAccum(int Location, int PC);
|
||||
Boolean WriteToVectorDest(DWORD DestReg, int PC);
|
||||
|
@ -26,57 +27,61 @@ Boolean IsRegisterConstant(DWORD Reg, DWORD * Constant);
|
|||
void RSP_Element2Mmx(int MmxReg);
|
||||
void RSP_MultiElement2Mmx(int MmxReg1, int MmxReg2);
|
||||
|
||||
#define MainBuffer 0
|
||||
#define SecondaryBuffer 1
|
||||
#define MainBuffer 0
|
||||
#define SecondaryBuffer 1
|
||||
|
||||
DWORD RunRecompilerCPU ( DWORD Cycles );
|
||||
void BuildRecompilerCPU ( void );
|
||||
DWORD RunRecompilerCPU(DWORD Cycles);
|
||||
void BuildRecompilerCPU(void);
|
||||
|
||||
void CompilerRSPBlock ( void );
|
||||
void CompilerToggleBuffer (void);
|
||||
void CompilerRSPBlock(void);
|
||||
void CompilerToggleBuffer(void);
|
||||
Boolean RSP_DoSections(void);
|
||||
|
||||
typedef struct {
|
||||
DWORD StartPC, CurrPC; // Block start
|
||||
|
||||
struct {
|
||||
DWORD TargetPC; // Target for this unknown branch
|
||||
DWORD * X86JumpLoc; // Our x86 DWORD to fill
|
||||
} BranchesToResolve[200]; // Branches inside or outside block
|
||||
|
||||
DWORD ResolveCount; // Branches with NULL jump table
|
||||
typedef struct
|
||||
{
|
||||
DWORD StartPC, CurrPC; // Block start
|
||||
|
||||
struct
|
||||
{
|
||||
DWORD TargetPC; // Target for this unknown branch
|
||||
DWORD * X86JumpLoc; // Our x86 DWORD to fill
|
||||
} BranchesToResolve[200]; // Branches inside or outside block
|
||||
|
||||
DWORD ResolveCount; // Branches with NULL jump table
|
||||
} RSP_BLOCK;
|
||||
|
||||
extern RSP_BLOCK CurrentBlock;
|
||||
|
||||
typedef struct {
|
||||
Boolean bIsRegConst[32]; // Boolean toggle for constant
|
||||
DWORD MipsRegConst[32]; // Value of register 32-bit
|
||||
DWORD BranchLabels[250];
|
||||
DWORD LabelCount;
|
||||
DWORD BranchLocations[250];
|
||||
DWORD BranchCount;
|
||||
typedef struct
|
||||
{
|
||||
Boolean bIsRegConst[32]; // Boolean toggle for constant
|
||||
DWORD MipsRegConst[32]; // Value of register 32-bit
|
||||
DWORD BranchLabels[250];
|
||||
DWORD LabelCount;
|
||||
DWORD BranchLocations[250];
|
||||
DWORD BranchCount;
|
||||
} RSP_CODE;
|
||||
|
||||
extern RSP_CODE RspCode;
|
||||
|
||||
#define IsRegConst(i) (RspCode.bIsRegConst[i])
|
||||
#define IsRegConst(i) (RspCode.bIsRegConst[i])
|
||||
#define MipsRegConst(i) (RspCode.MipsRegConst[i])
|
||||
|
||||
typedef struct {
|
||||
Boolean mmx, mmx2, sse; // CPU specs and compiling
|
||||
Boolean bFlags; // RSP flag analysis
|
||||
Boolean bReOrdering; // Instruction reordering
|
||||
Boolean bSections; // Microcode sections
|
||||
Boolean bDest; // Vector destination toggle
|
||||
Boolean bAccum; // Accumulator toggle
|
||||
Boolean bGPRConstants; // Analyze GPR constants
|
||||
Boolean bAlignVector; // Align known vector loads
|
||||
Boolean bAudioUcode; // Audio microcode analysis
|
||||
typedef struct
|
||||
{
|
||||
Boolean mmx, mmx2, sse; // CPU specs and compiling
|
||||
Boolean bFlags; // RSP flag analysis
|
||||
Boolean bReOrdering; // Instruction reordering
|
||||
Boolean bSections; // Microcode sections
|
||||
Boolean bDest; // Vector destination toggle
|
||||
Boolean bAccum; // Accumulator toggle
|
||||
Boolean bGPRConstants; // Analyze GPR constants
|
||||
Boolean bAlignVector; // Align known vector loads
|
||||
Boolean bAudioUcode; // Audio microcode analysis
|
||||
} RSP_COMPILER;
|
||||
|
||||
extern RSP_COMPILER Compiler;
|
||||
|
||||
#define IsMmxEnabled (Compiler.mmx)
|
||||
#define IsMmx2Enabled (Compiler.mmx2)
|
||||
#define IsSseEnabled (Compiler.sse)
|
||||
#define IsMmxEnabled (Compiler.mmx)
|
||||
#define IsMmx2Enabled (Compiler.mmx2)
|
||||
#define IsSseEnabled (Compiler.sse)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,149 +1,149 @@
|
|||
// Opcode functions
|
||||
|
||||
void Compile_SPECIAL ( void );
|
||||
void Compile_REGIMM ( void );
|
||||
void Compile_J ( void );
|
||||
void Compile_JAL ( void );
|
||||
void Compile_BEQ ( void );
|
||||
void Compile_BNE ( void );
|
||||
void Compile_BLEZ ( void );
|
||||
void Compile_BGTZ ( void );
|
||||
void Compile_ADDI ( void );
|
||||
void Compile_ADDIU ( void );
|
||||
void Compile_SLTI ( void );
|
||||
void Compile_SLTIU ( void );
|
||||
void Compile_ANDI ( void );
|
||||
void Compile_ORI ( void );
|
||||
void Compile_XORI ( void );
|
||||
void Compile_LUI ( void );
|
||||
void Compile_COP0 ( void );
|
||||
void Compile_COP2 ( void );
|
||||
void Compile_LB ( void );
|
||||
void Compile_LH ( void );
|
||||
void Compile_LW ( void );
|
||||
void Compile_LBU ( void );
|
||||
void Compile_LHU ( void );
|
||||
void Compile_SB ( void );
|
||||
void Compile_SH ( void );
|
||||
void Compile_SW ( void );
|
||||
void Compile_LC2 ( void );
|
||||
void Compile_SC2 ( void );
|
||||
void Compile_SPECIAL(void);
|
||||
void Compile_REGIMM(void);
|
||||
void Compile_J(void);
|
||||
void Compile_JAL(void);
|
||||
void Compile_BEQ(void);
|
||||
void Compile_BNE(void);
|
||||
void Compile_BLEZ(void);
|
||||
void Compile_BGTZ(void);
|
||||
void Compile_ADDI(void);
|
||||
void Compile_ADDIU(void);
|
||||
void Compile_SLTI(void);
|
||||
void Compile_SLTIU(void);
|
||||
void Compile_ANDI(void);
|
||||
void Compile_ORI(void);
|
||||
void Compile_XORI(void);
|
||||
void Compile_LUI(void);
|
||||
void Compile_COP0(void);
|
||||
void Compile_COP2(void);
|
||||
void Compile_LB(void);
|
||||
void Compile_LH(void);
|
||||
void Compile_LW(void);
|
||||
void Compile_LBU(void);
|
||||
void Compile_LHU(void);
|
||||
void Compile_SB(void);
|
||||
void Compile_SH(void);
|
||||
void Compile_SW(void);
|
||||
void Compile_LC2(void);
|
||||
void Compile_SC2(void);
|
||||
|
||||
// R4300i Opcodes: Special
|
||||
|
||||
void Compile_Special_SLL ( void );
|
||||
void Compile_Special_SRL ( void );
|
||||
void Compile_Special_SRA ( void );
|
||||
void Compile_Special_SLLV ( void );
|
||||
void Compile_Special_SRLV ( void );
|
||||
void Compile_Special_SRAV ( void );
|
||||
void Compile_Special_JR ( void );
|
||||
void Compile_Special_JALR ( void );
|
||||
void Compile_Special_BREAK ( void );
|
||||
void Compile_Special_ADD ( void );
|
||||
void Compile_Special_ADDU ( void );
|
||||
void Compile_Special_SUB ( void );
|
||||
void Compile_Special_SUBU ( void );
|
||||
void Compile_Special_AND ( void );
|
||||
void Compile_Special_OR ( void );
|
||||
void Compile_Special_XOR ( void );
|
||||
void Compile_Special_NOR ( void );
|
||||
void Compile_Special_SLT ( void );
|
||||
void Compile_Special_SLTU ( void );
|
||||
void Compile_Special_SLL(void);
|
||||
void Compile_Special_SRL(void);
|
||||
void Compile_Special_SRA(void);
|
||||
void Compile_Special_SLLV(void);
|
||||
void Compile_Special_SRLV(void);
|
||||
void Compile_Special_SRAV(void);
|
||||
void Compile_Special_JR(void);
|
||||
void Compile_Special_JALR(void);
|
||||
void Compile_Special_BREAK(void);
|
||||
void Compile_Special_ADD(void);
|
||||
void Compile_Special_ADDU(void);
|
||||
void Compile_Special_SUB(void);
|
||||
void Compile_Special_SUBU(void);
|
||||
void Compile_Special_AND(void);
|
||||
void Compile_Special_OR(void);
|
||||
void Compile_Special_XOR(void);
|
||||
void Compile_Special_NOR(void);
|
||||
void Compile_Special_SLT(void);
|
||||
void Compile_Special_SLTU(void);
|
||||
|
||||
// R4300i Opcodes: RegImm
|
||||
|
||||
void Compile_RegImm_BLTZ ( void );
|
||||
void Compile_RegImm_BGEZ ( void );
|
||||
void Compile_RegImm_BLTZAL ( void );
|
||||
void Compile_RegImm_BGEZAL ( void );
|
||||
void Compile_RegImm_BLTZ(void);
|
||||
void Compile_RegImm_BGEZ(void);
|
||||
void Compile_RegImm_BLTZAL(void);
|
||||
void Compile_RegImm_BGEZAL(void);
|
||||
|
||||
// COP0 functions
|
||||
|
||||
void Compile_Cop0_MF ( void );
|
||||
void Compile_Cop0_MT ( void );
|
||||
void Compile_Cop0_MF(void);
|
||||
void Compile_Cop0_MT(void);
|
||||
|
||||
// COP2 functions
|
||||
|
||||
void Compile_Cop2_MF ( void );
|
||||
void Compile_Cop2_CF ( void );
|
||||
void Compile_Cop2_MT ( void );
|
||||
void Compile_Cop2_CT ( void );
|
||||
void Compile_COP2_VECTOR ( void );
|
||||
void Compile_Cop2_MF(void);
|
||||
void Compile_Cop2_CF(void);
|
||||
void Compile_Cop2_MT(void);
|
||||
void Compile_Cop2_CT(void);
|
||||
void Compile_COP2_VECTOR(void);
|
||||
|
||||
// Vector functions
|
||||
|
||||
void Compile_Vector_VMULF ( void );
|
||||
void Compile_Vector_VMULU ( void );
|
||||
void Compile_Vector_VMUDL ( void );
|
||||
void Compile_Vector_VMUDM ( void );
|
||||
void Compile_Vector_VMUDN ( void );
|
||||
void Compile_Vector_VMUDH ( void );
|
||||
void Compile_Vector_VMACF ( void );
|
||||
void Compile_Vector_VMACU ( void );
|
||||
void Compile_Vector_VMACQ ( void );
|
||||
void Compile_Vector_VMADL ( void );
|
||||
void Compile_Vector_VMADM ( void );
|
||||
void Compile_Vector_VMADN ( void );
|
||||
void Compile_Vector_VMADH ( void );
|
||||
void Compile_Vector_VADD ( void );
|
||||
void Compile_Vector_VSUB ( void );
|
||||
void Compile_Vector_VABS ( void );
|
||||
void Compile_Vector_VADDC ( void );
|
||||
void Compile_Vector_VSUBC ( void );
|
||||
void Compile_Vector_VSAW ( void );
|
||||
void Compile_Vector_VLT ( void );
|
||||
void Compile_Vector_VEQ ( void );
|
||||
void Compile_Vector_VNE ( void );
|
||||
void Compile_Vector_VGE ( void );
|
||||
void Compile_Vector_VCL ( void );
|
||||
void Compile_Vector_VCH ( void );
|
||||
void Compile_Vector_VCR ( void );
|
||||
void Compile_Vector_VMRG ( void );
|
||||
void Compile_Vector_VAND ( void );
|
||||
void Compile_Vector_VNAND ( void );
|
||||
void Compile_Vector_VOR ( void );
|
||||
void Compile_Vector_VNOR ( void );
|
||||
void Compile_Vector_VXOR ( void );
|
||||
void Compile_Vector_VNXOR ( void );
|
||||
void Compile_Vector_VRCP ( void );
|
||||
void Compile_Vector_VRCPL ( void );
|
||||
void Compile_Vector_VRCPH ( void );
|
||||
void Compile_Vector_VMOV ( void );
|
||||
void Compile_Vector_VRSQ ( void );
|
||||
void Compile_Vector_VRSQL ( void );
|
||||
void Compile_Vector_VRSQH ( void );
|
||||
void Compile_Vector_VNOOP ( void );
|
||||
void Compile_Vector_VMULF(void);
|
||||
void Compile_Vector_VMULU(void);
|
||||
void Compile_Vector_VMUDL(void);
|
||||
void Compile_Vector_VMUDM(void);
|
||||
void Compile_Vector_VMUDN(void);
|
||||
void Compile_Vector_VMUDH(void);
|
||||
void Compile_Vector_VMACF(void);
|
||||
void Compile_Vector_VMACU(void);
|
||||
void Compile_Vector_VMACQ(void);
|
||||
void Compile_Vector_VMADL(void);
|
||||
void Compile_Vector_VMADM(void);
|
||||
void Compile_Vector_VMADN(void);
|
||||
void Compile_Vector_VMADH(void);
|
||||
void Compile_Vector_VADD(void);
|
||||
void Compile_Vector_VSUB(void);
|
||||
void Compile_Vector_VABS(void);
|
||||
void Compile_Vector_VADDC(void);
|
||||
void Compile_Vector_VSUBC(void);
|
||||
void Compile_Vector_VSAW(void);
|
||||
void Compile_Vector_VLT(void);
|
||||
void Compile_Vector_VEQ(void);
|
||||
void Compile_Vector_VNE(void);
|
||||
void Compile_Vector_VGE(void);
|
||||
void Compile_Vector_VCL(void);
|
||||
void Compile_Vector_VCH(void);
|
||||
void Compile_Vector_VCR(void);
|
||||
void Compile_Vector_VMRG(void);
|
||||
void Compile_Vector_VAND(void);
|
||||
void Compile_Vector_VNAND(void);
|
||||
void Compile_Vector_VOR(void);
|
||||
void Compile_Vector_VNOR(void);
|
||||
void Compile_Vector_VXOR(void);
|
||||
void Compile_Vector_VNXOR(void);
|
||||
void Compile_Vector_VRCP(void);
|
||||
void Compile_Vector_VRCPL(void);
|
||||
void Compile_Vector_VRCPH(void);
|
||||
void Compile_Vector_VMOV(void);
|
||||
void Compile_Vector_VRSQ(void);
|
||||
void Compile_Vector_VRSQL(void);
|
||||
void Compile_Vector_VRSQH(void);
|
||||
void Compile_Vector_VNOOP(void);
|
||||
|
||||
// LC2 functions
|
||||
|
||||
void Compile_Opcode_LBV ( void );
|
||||
void Compile_Opcode_LSV ( void );
|
||||
void Compile_Opcode_LLV ( void );
|
||||
void Compile_Opcode_LDV ( void );
|
||||
void Compile_Opcode_LQV ( void );
|
||||
void Compile_Opcode_LRV ( void );
|
||||
void Compile_Opcode_LPV ( void );
|
||||
void Compile_Opcode_LUV ( void );
|
||||
void Compile_Opcode_LHV ( void );
|
||||
void Compile_Opcode_LFV ( void );
|
||||
void Compile_Opcode_LTV ( void );
|
||||
void Compile_Opcode_LBV(void);
|
||||
void Compile_Opcode_LSV(void);
|
||||
void Compile_Opcode_LLV(void);
|
||||
void Compile_Opcode_LDV(void);
|
||||
void Compile_Opcode_LQV(void);
|
||||
void Compile_Opcode_LRV(void);
|
||||
void Compile_Opcode_LPV(void);
|
||||
void Compile_Opcode_LUV(void);
|
||||
void Compile_Opcode_LHV(void);
|
||||
void Compile_Opcode_LFV(void);
|
||||
void Compile_Opcode_LTV(void);
|
||||
|
||||
// SC2 functions
|
||||
|
||||
void Compile_Opcode_SBV ( void );
|
||||
void Compile_Opcode_SSV ( void );
|
||||
void Compile_Opcode_SLV ( void );
|
||||
void Compile_Opcode_SDV ( void );
|
||||
void Compile_Opcode_SQV ( void );
|
||||
void Compile_Opcode_SRV ( void );
|
||||
void Compile_Opcode_SPV ( void );
|
||||
void Compile_Opcode_SUV ( void );
|
||||
void Compile_Opcode_SHV ( void );
|
||||
void Compile_Opcode_SFV ( void );
|
||||
void Compile_Opcode_SWV ( void );
|
||||
void Compile_Opcode_STV ( void );
|
||||
void Compile_Opcode_SBV(void);
|
||||
void Compile_Opcode_SSV(void);
|
||||
void Compile_Opcode_SLV(void);
|
||||
void Compile_Opcode_SDV(void);
|
||||
void Compile_Opcode_SQV(void);
|
||||
void Compile_Opcode_SRV(void);
|
||||
void Compile_Opcode_SPV(void);
|
||||
void Compile_Opcode_SUV(void);
|
||||
void Compile_Opcode_SHV(void);
|
||||
void Compile_Opcode_SFV(void);
|
||||
void Compile_Opcode_SWV(void);
|
||||
void Compile_Opcode_STV(void);
|
||||
|
||||
// Other functions
|
||||
|
||||
void Compile_UnknownOpcode (void);
|
||||
void Compile_UnknownOpcode(void);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,20 +1,20 @@
|
|||
#pragma once
|
||||
#include <Project64-plugin-spec/Rsp.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include "Types.h"
|
||||
#include <stdint.h>
|
||||
|
||||
// Profiling
|
||||
#define Default_ProfilingOn FALSE
|
||||
#define Default_IndvidualBlock FALSE
|
||||
#define Default_ShowErrors FALSE
|
||||
#define Default_AudioHle FALSE
|
||||
#define Default_ProfilingOn FALSE
|
||||
#define Default_IndvidualBlock FALSE
|
||||
#define Default_ShowErrors FALSE
|
||||
#define Default_AudioHle FALSE
|
||||
|
||||
uint32_t AsciiToHex(char * HexValue);
|
||||
void DisplayError(char * Message, ...);
|
||||
|
||||
#define InterpreterCPU 0
|
||||
#define RecompilerCPU 1
|
||||
#define InterpreterCPU 0
|
||||
#define RecompilerCPU 1
|
||||
|
||||
extern int DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, BreakOnStart, LogRDP, LogX86Code;
|
||||
extern uint32_t CPUCore;
|
||||
|
|
|
@ -1,317 +1,352 @@
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "Rsp.h"
|
||||
#include "x86.h"
|
||||
#include "memory.h"
|
||||
#include "RSP registers.h"
|
||||
#include "Rsp.h"
|
||||
#include "log.h"
|
||||
#include "memory.h"
|
||||
#include "x86.h"
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define PUTDST8(dest,value) (*((BYTE *)(dest))=(BYTE)(value)); dest += 1;
|
||||
#define PUTDST16(dest,value) (*((WORD *)(dest))=(WORD)(value)); dest += 2;
|
||||
#define PUTDST32(dest,value) (*((DWORD *)(dest))=(DWORD)(value)); dest += 4;
|
||||
#define PUTDSTPTR(dest, value) \
|
||||
*(void **)(dest) = (void *)(value); dest += sizeof(void *);
|
||||
#define PUTDST8(dest, value) \
|
||||
(*((BYTE *)(dest)) = (BYTE)(value)); \
|
||||
dest += 1;
|
||||
#define PUTDST16(dest, value) \
|
||||
(*((WORD *)(dest)) = (WORD)(value)); \
|
||||
dest += 2;
|
||||
#define PUTDST32(dest, value) \
|
||||
(*((DWORD *)(dest)) = (DWORD)(value)); \
|
||||
dest += 4;
|
||||
#define PUTDSTPTR(dest, value) \
|
||||
*(void **)(dest) = (void *)(value); \
|
||||
dest += sizeof(void *);
|
||||
|
||||
char * sse_Strings[8] = {
|
||||
"xmm0", "xmm1", "xmm2", "xmm3",
|
||||
"xmm4", "xmm5", "xmm6", "xmm7"
|
||||
};
|
||||
"xmm0", "xmm1", "xmm2", "xmm3",
|
||||
"xmm4", "xmm5", "xmm6", "xmm7"};
|
||||
|
||||
#define sse_Name(Reg) (sse_Strings[(Reg)])
|
||||
|
||||
void SseMoveAlignedVariableToReg(void *Variable, char *VariableName, int sseReg) {
|
||||
BYTE x86Command = 0;
|
||||
void SseMoveAlignedVariableToReg(void * Variable, char * VariableName, int sseReg)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" movaps %s, xmmword ptr [%s]",sse_Name(sseReg), VariableName);
|
||||
CPU_Message(" movaps %s, xmmword ptr [%s]", sse_Name(sseReg), VariableName);
|
||||
|
||||
switch (sseReg) {
|
||||
case x86_XMM0: x86Command = 0x05; break;
|
||||
case x86_XMM1: x86Command = 0x0D; break;
|
||||
case x86_XMM2: x86Command = 0x15; break;
|
||||
case x86_XMM3: x86Command = 0x1D; break;
|
||||
case x86_XMM4: x86Command = 0x25; break;
|
||||
case x86_XMM5: x86Command = 0x2D; break;
|
||||
case x86_XMM6: x86Command = 0x35; break;
|
||||
case x86_XMM7: x86Command = 0x3D; break;
|
||||
}
|
||||
switch (sseReg)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x05; break;
|
||||
case x86_XMM1: x86Command = 0x0D; break;
|
||||
case x86_XMM2: x86Command = 0x15; break;
|
||||
case x86_XMM3: x86Command = 0x1D; break;
|
||||
case x86_XMM4: x86Command = 0x25; break;
|
||||
case x86_XMM5: x86Command = 0x2D; break;
|
||||
case x86_XMM6: x86Command = 0x35; break;
|
||||
case x86_XMM7: x86Command = 0x3D; break;
|
||||
}
|
||||
|
||||
PUTDST16(RecompPos,0x280f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, Variable);
|
||||
PUTDST16(RecompPos, 0x280f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, Variable);
|
||||
}
|
||||
|
||||
void SseMoveAlignedN64MemToReg(int sseReg, int AddrReg) {
|
||||
BYTE x86Command = 0;
|
||||
void SseMoveAlignedN64MemToReg(int sseReg, int AddrReg)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" movaps %s, xmmword ptr [Dmem+%s]",sse_Name(sseReg), x86_Name(AddrReg));
|
||||
CPU_Message(" movaps %s, xmmword ptr [Dmem+%s]", sse_Name(sseReg), x86_Name(AddrReg));
|
||||
|
||||
switch (sseReg) {
|
||||
case x86_XMM0: x86Command = 0x80; break;
|
||||
case x86_XMM1: x86Command = 0x88; break;
|
||||
case x86_XMM2: x86Command = 0x90; break;
|
||||
case x86_XMM3: x86Command = 0x98; break;
|
||||
case x86_XMM4: x86Command = 0xA0; break;
|
||||
case x86_XMM5: x86Command = 0xA8; break;
|
||||
case x86_XMM6: x86Command = 0xB0; break;
|
||||
case x86_XMM7: x86Command = 0xB8; break;
|
||||
}
|
||||
switch (AddrReg) {
|
||||
case x86_EAX: x86Command += 0x00; break;
|
||||
case x86_EBX: x86Command += 0x03; break;
|
||||
case x86_ECX: x86Command += 0x01; break;
|
||||
case x86_EDX: x86Command += 0x02; break;
|
||||
case x86_ESI: x86Command += 0x06; break;
|
||||
case x86_EDI: x86Command += 0x07; break;
|
||||
case x86_ESP: x86Command += 0x04; break;
|
||||
case x86_EBP: x86Command += 0x05; break;
|
||||
}
|
||||
switch (sseReg)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x80; break;
|
||||
case x86_XMM1: x86Command = 0x88; break;
|
||||
case x86_XMM2: x86Command = 0x90; break;
|
||||
case x86_XMM3: x86Command = 0x98; break;
|
||||
case x86_XMM4: x86Command = 0xA0; break;
|
||||
case x86_XMM5: x86Command = 0xA8; break;
|
||||
case x86_XMM6: x86Command = 0xB0; break;
|
||||
case x86_XMM7: x86Command = 0xB8; break;
|
||||
}
|
||||
switch (AddrReg)
|
||||
{
|
||||
case x86_EAX: x86Command += 0x00; break;
|
||||
case x86_EBX: x86Command += 0x03; break;
|
||||
case x86_ECX: x86Command += 0x01; break;
|
||||
case x86_EDX: x86Command += 0x02; break;
|
||||
case x86_ESI: x86Command += 0x06; break;
|
||||
case x86_EDI: x86Command += 0x07; break;
|
||||
case x86_ESP: x86Command += 0x04; break;
|
||||
case x86_EBP: x86Command += 0x05; break;
|
||||
}
|
||||
|
||||
PUTDST16(RecompPos,0x280f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, RSPInfo.DMEM);
|
||||
PUTDST16(RecompPos, 0x280f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, RSPInfo.DMEM);
|
||||
}
|
||||
|
||||
void SseMoveAlignedRegToVariable(int sseReg, void *Variable, char *VariableName) {
|
||||
BYTE x86Command = 0;
|
||||
void SseMoveAlignedRegToVariable(int sseReg, void * Variable, char * VariableName)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" movaps xmmword ptr [%s], %s",VariableName, sse_Name(sseReg));
|
||||
CPU_Message(" movaps xmmword ptr [%s], %s", VariableName, sse_Name(sseReg));
|
||||
|
||||
switch (sseReg) {
|
||||
case x86_XMM0: x86Command = 0x05; break;
|
||||
case x86_XMM1: x86Command = 0x0D; break;
|
||||
case x86_XMM2: x86Command = 0x15; break;
|
||||
case x86_XMM3: x86Command = 0x1D; break;
|
||||
case x86_XMM4: x86Command = 0x25; break;
|
||||
case x86_XMM5: x86Command = 0x2D; break;
|
||||
case x86_XMM6: x86Command = 0x35; break;
|
||||
case x86_XMM7: x86Command = 0x3D; break;
|
||||
}
|
||||
switch (sseReg)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x05; break;
|
||||
case x86_XMM1: x86Command = 0x0D; break;
|
||||
case x86_XMM2: x86Command = 0x15; break;
|
||||
case x86_XMM3: x86Command = 0x1D; break;
|
||||
case x86_XMM4: x86Command = 0x25; break;
|
||||
case x86_XMM5: x86Command = 0x2D; break;
|
||||
case x86_XMM6: x86Command = 0x35; break;
|
||||
case x86_XMM7: x86Command = 0x3D; break;
|
||||
}
|
||||
|
||||
PUTDST16(RecompPos,0x290f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, Variable);
|
||||
PUTDST16(RecompPos, 0x290f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, Variable);
|
||||
}
|
||||
|
||||
void SseMoveAlignedRegToN64Mem(int sseReg, int AddrReg) {
|
||||
BYTE x86Command = 0;
|
||||
void SseMoveAlignedRegToN64Mem(int sseReg, int AddrReg)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" movaps xmmword ptr [Dmem+%s], %s",x86_Name(AddrReg),sse_Name(sseReg));
|
||||
CPU_Message(" movaps xmmword ptr [Dmem+%s], %s", x86_Name(AddrReg), sse_Name(sseReg));
|
||||
|
||||
switch (sseReg) {
|
||||
case x86_XMM0: x86Command = 0x80; break;
|
||||
case x86_XMM1: x86Command = 0x88; break;
|
||||
case x86_XMM2: x86Command = 0x90; break;
|
||||
case x86_XMM3: x86Command = 0x98; break;
|
||||
case x86_XMM4: x86Command = 0xA0; break;
|
||||
case x86_XMM5: x86Command = 0xA8; break;
|
||||
case x86_XMM6: x86Command = 0xB0; break;
|
||||
case x86_XMM7: x86Command = 0xB8; break;
|
||||
}
|
||||
switch (AddrReg) {
|
||||
case x86_EAX: x86Command += 0x00; break;
|
||||
case x86_EBX: x86Command += 0x03; break;
|
||||
case x86_ECX: x86Command += 0x01; break;
|
||||
case x86_EDX: x86Command += 0x02; break;
|
||||
case x86_ESI: x86Command += 0x06; break;
|
||||
case x86_EDI: x86Command += 0x07; break;
|
||||
case x86_ESP: x86Command += 0x04; break;
|
||||
case x86_EBP: x86Command += 0x05; break;
|
||||
}
|
||||
switch (sseReg)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x80; break;
|
||||
case x86_XMM1: x86Command = 0x88; break;
|
||||
case x86_XMM2: x86Command = 0x90; break;
|
||||
case x86_XMM3: x86Command = 0x98; break;
|
||||
case x86_XMM4: x86Command = 0xA0; break;
|
||||
case x86_XMM5: x86Command = 0xA8; break;
|
||||
case x86_XMM6: x86Command = 0xB0; break;
|
||||
case x86_XMM7: x86Command = 0xB8; break;
|
||||
}
|
||||
switch (AddrReg)
|
||||
{
|
||||
case x86_EAX: x86Command += 0x00; break;
|
||||
case x86_EBX: x86Command += 0x03; break;
|
||||
case x86_ECX: x86Command += 0x01; break;
|
||||
case x86_EDX: x86Command += 0x02; break;
|
||||
case x86_ESI: x86Command += 0x06; break;
|
||||
case x86_EDI: x86Command += 0x07; break;
|
||||
case x86_ESP: x86Command += 0x04; break;
|
||||
case x86_EBP: x86Command += 0x05; break;
|
||||
}
|
||||
|
||||
PUTDST16(RecompPos,0x290f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, RSPInfo.DMEM);
|
||||
PUTDST16(RecompPos, 0x290f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, RSPInfo.DMEM);
|
||||
}
|
||||
|
||||
void SseMoveUnalignedVariableToReg(void *Variable, char *VariableName, int sseReg) {
|
||||
BYTE x86Command = 0;
|
||||
void SseMoveUnalignedVariableToReg(void * Variable, char * VariableName, int sseReg)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" movups %s, xmmword ptr [%s]",sse_Name(sseReg), VariableName);
|
||||
CPU_Message(" movups %s, xmmword ptr [%s]", sse_Name(sseReg), VariableName);
|
||||
|
||||
switch (sseReg) {
|
||||
case x86_XMM0: x86Command = 0x05; break;
|
||||
case x86_XMM1: x86Command = 0x0D; break;
|
||||
case x86_XMM2: x86Command = 0x15; break;
|
||||
case x86_XMM3: x86Command = 0x1D; break;
|
||||
case x86_XMM4: x86Command = 0x25; break;
|
||||
case x86_XMM5: x86Command = 0x2D; break;
|
||||
case x86_XMM6: x86Command = 0x35; break;
|
||||
case x86_XMM7: x86Command = 0x3D; break;
|
||||
}
|
||||
switch (sseReg)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x05; break;
|
||||
case x86_XMM1: x86Command = 0x0D; break;
|
||||
case x86_XMM2: x86Command = 0x15; break;
|
||||
case x86_XMM3: x86Command = 0x1D; break;
|
||||
case x86_XMM4: x86Command = 0x25; break;
|
||||
case x86_XMM5: x86Command = 0x2D; break;
|
||||
case x86_XMM6: x86Command = 0x35; break;
|
||||
case x86_XMM7: x86Command = 0x3D; break;
|
||||
}
|
||||
|
||||
PUTDST16(RecompPos,0x100f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, Variable);
|
||||
PUTDST16(RecompPos, 0x100f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, Variable);
|
||||
}
|
||||
|
||||
void SseMoveUnalignedN64MemToReg(int sseReg, int AddrReg) {
|
||||
BYTE x86Command = 0;
|
||||
void SseMoveUnalignedN64MemToReg(int sseReg, int AddrReg)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" movups %s, xmmword ptr [Dmem+%s]",sse_Name(sseReg), x86_Name(AddrReg));
|
||||
CPU_Message(" movups %s, xmmword ptr [Dmem+%s]", sse_Name(sseReg), x86_Name(AddrReg));
|
||||
|
||||
switch (sseReg) {
|
||||
case x86_XMM0: x86Command = 0x80; break;
|
||||
case x86_XMM1: x86Command = 0x88; break;
|
||||
case x86_XMM2: x86Command = 0x90; break;
|
||||
case x86_XMM3: x86Command = 0x98; break;
|
||||
case x86_XMM4: x86Command = 0xA0; break;
|
||||
case x86_XMM5: x86Command = 0xA8; break;
|
||||
case x86_XMM6: x86Command = 0xB0; break;
|
||||
case x86_XMM7: x86Command = 0xB8; break;
|
||||
}
|
||||
switch (AddrReg) {
|
||||
case x86_EAX: x86Command += 0x00; break;
|
||||
case x86_EBX: x86Command += 0x03; break;
|
||||
case x86_ECX: x86Command += 0x01; break;
|
||||
case x86_EDX: x86Command += 0x02; break;
|
||||
case x86_ESI: x86Command += 0x06; break;
|
||||
case x86_EDI: x86Command += 0x07; break;
|
||||
case x86_ESP: x86Command += 0x04; break;
|
||||
case x86_EBP: x86Command += 0x05; break;
|
||||
}
|
||||
switch (sseReg)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x80; break;
|
||||
case x86_XMM1: x86Command = 0x88; break;
|
||||
case x86_XMM2: x86Command = 0x90; break;
|
||||
case x86_XMM3: x86Command = 0x98; break;
|
||||
case x86_XMM4: x86Command = 0xA0; break;
|
||||
case x86_XMM5: x86Command = 0xA8; break;
|
||||
case x86_XMM6: x86Command = 0xB0; break;
|
||||
case x86_XMM7: x86Command = 0xB8; break;
|
||||
}
|
||||
switch (AddrReg)
|
||||
{
|
||||
case x86_EAX: x86Command += 0x00; break;
|
||||
case x86_EBX: x86Command += 0x03; break;
|
||||
case x86_ECX: x86Command += 0x01; break;
|
||||
case x86_EDX: x86Command += 0x02; break;
|
||||
case x86_ESI: x86Command += 0x06; break;
|
||||
case x86_EDI: x86Command += 0x07; break;
|
||||
case x86_ESP: x86Command += 0x04; break;
|
||||
case x86_EBP: x86Command += 0x05; break;
|
||||
}
|
||||
|
||||
PUTDST16(RecompPos,0x100f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, RSPInfo.DMEM);
|
||||
PUTDST16(RecompPos, 0x100f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, RSPInfo.DMEM);
|
||||
}
|
||||
|
||||
void SseMoveUnalignedRegToVariable(int sseReg, void *Variable, char *VariableName) {
|
||||
BYTE x86Command = 0;
|
||||
void SseMoveUnalignedRegToVariable(int sseReg, void * Variable, char * VariableName)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" movups xmmword ptr [%s], %s",VariableName, sse_Name(sseReg));
|
||||
CPU_Message(" movups xmmword ptr [%s], %s", VariableName, sse_Name(sseReg));
|
||||
|
||||
switch (sseReg) {
|
||||
case x86_XMM0: x86Command = 0x05; break;
|
||||
case x86_XMM1: x86Command = 0x0D; break;
|
||||
case x86_XMM2: x86Command = 0x15; break;
|
||||
case x86_XMM3: x86Command = 0x1D; break;
|
||||
case x86_XMM4: x86Command = 0x25; break;
|
||||
case x86_XMM5: x86Command = 0x2D; break;
|
||||
case x86_XMM6: x86Command = 0x35; break;
|
||||
case x86_XMM7: x86Command = 0x3D; break;
|
||||
}
|
||||
switch (sseReg)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x05; break;
|
||||
case x86_XMM1: x86Command = 0x0D; break;
|
||||
case x86_XMM2: x86Command = 0x15; break;
|
||||
case x86_XMM3: x86Command = 0x1D; break;
|
||||
case x86_XMM4: x86Command = 0x25; break;
|
||||
case x86_XMM5: x86Command = 0x2D; break;
|
||||
case x86_XMM6: x86Command = 0x35; break;
|
||||
case x86_XMM7: x86Command = 0x3D; break;
|
||||
}
|
||||
|
||||
PUTDST16(RecompPos,0x110f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, Variable);
|
||||
PUTDST16(RecompPos, 0x110f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, Variable);
|
||||
}
|
||||
|
||||
void SseMoveUnalignedRegToN64Mem(int sseReg, int AddrReg) {
|
||||
BYTE x86Command = 0;
|
||||
void SseMoveUnalignedRegToN64Mem(int sseReg, int AddrReg)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" movups xmmword ptr [Dmem+%s], %s",x86_Name(AddrReg),sse_Name(sseReg));
|
||||
CPU_Message(" movups xmmword ptr [Dmem+%s], %s", x86_Name(AddrReg), sse_Name(sseReg));
|
||||
|
||||
switch (sseReg) {
|
||||
case x86_XMM0: x86Command = 0x80; break;
|
||||
case x86_XMM1: x86Command = 0x88; break;
|
||||
case x86_XMM2: x86Command = 0x90; break;
|
||||
case x86_XMM3: x86Command = 0x98; break;
|
||||
case x86_XMM4: x86Command = 0xA0; break;
|
||||
case x86_XMM5: x86Command = 0xA8; break;
|
||||
case x86_XMM6: x86Command = 0xB0; break;
|
||||
case x86_XMM7: x86Command = 0xB8; break;
|
||||
}
|
||||
switch (AddrReg) {
|
||||
case x86_EAX: x86Command += 0x00; break;
|
||||
case x86_EBX: x86Command += 0x03; break;
|
||||
case x86_ECX: x86Command += 0x01; break;
|
||||
case x86_EDX: x86Command += 0x02; break;
|
||||
case x86_ESI: x86Command += 0x06; break;
|
||||
case x86_EDI: x86Command += 0x07; break;
|
||||
case x86_ESP: x86Command += 0x04; break;
|
||||
case x86_EBP: x86Command += 0x05; break;
|
||||
}
|
||||
switch (sseReg)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x80; break;
|
||||
case x86_XMM1: x86Command = 0x88; break;
|
||||
case x86_XMM2: x86Command = 0x90; break;
|
||||
case x86_XMM3: x86Command = 0x98; break;
|
||||
case x86_XMM4: x86Command = 0xA0; break;
|
||||
case x86_XMM5: x86Command = 0xA8; break;
|
||||
case x86_XMM6: x86Command = 0xB0; break;
|
||||
case x86_XMM7: x86Command = 0xB8; break;
|
||||
}
|
||||
switch (AddrReg)
|
||||
{
|
||||
case x86_EAX: x86Command += 0x00; break;
|
||||
case x86_EBX: x86Command += 0x03; break;
|
||||
case x86_ECX: x86Command += 0x01; break;
|
||||
case x86_EDX: x86Command += 0x02; break;
|
||||
case x86_ESI: x86Command += 0x06; break;
|
||||
case x86_EDI: x86Command += 0x07; break;
|
||||
case x86_ESP: x86Command += 0x04; break;
|
||||
case x86_EBP: x86Command += 0x05; break;
|
||||
}
|
||||
|
||||
PUTDST16(RecompPos,0x110f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, RSPInfo.DMEM);
|
||||
PUTDST16(RecompPos, 0x110f);
|
||||
PUTDST8(RecompPos, x86Command);
|
||||
PUTDSTPTR(RecompPos, RSPInfo.DMEM);
|
||||
}
|
||||
|
||||
void SseMoveRegToReg(int Dest, int Source) {
|
||||
BYTE x86Command = 0;
|
||||
void SseMoveRegToReg(int Dest, int Source)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" movaps %s, %s", sse_Name(Dest), sse_Name(Source));
|
||||
CPU_Message(" movaps %s, %s", sse_Name(Dest), sse_Name(Source));
|
||||
|
||||
switch (Dest) {
|
||||
case x86_XMM0: x86Command = 0x00; break;
|
||||
case x86_XMM1: x86Command = 0x08; break;
|
||||
case x86_XMM2: x86Command = 0x10; break;
|
||||
case x86_XMM3: x86Command = 0x18; break;
|
||||
case x86_XMM4: x86Command = 0x20; break;
|
||||
case x86_XMM5: x86Command = 0x28; break;
|
||||
case x86_XMM6: x86Command = 0x30; break;
|
||||
case x86_XMM7: x86Command = 0x38; break;
|
||||
}
|
||||
switch (Source) {
|
||||
case x86_XMM0: x86Command += 0x00; break;
|
||||
case x86_XMM1: x86Command += 0x01; break;
|
||||
case x86_XMM2: x86Command += 0x02; break;
|
||||
case x86_XMM3: x86Command += 0x03; break;
|
||||
case x86_XMM4: x86Command += 0x04; break;
|
||||
case x86_XMM5: x86Command += 0x05; break;
|
||||
case x86_XMM6: x86Command += 0x06; break;
|
||||
case x86_XMM7: x86Command += 0x07; break;
|
||||
}
|
||||
switch (Dest)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x00; break;
|
||||
case x86_XMM1: x86Command = 0x08; break;
|
||||
case x86_XMM2: x86Command = 0x10; break;
|
||||
case x86_XMM3: x86Command = 0x18; break;
|
||||
case x86_XMM4: x86Command = 0x20; break;
|
||||
case x86_XMM5: x86Command = 0x28; break;
|
||||
case x86_XMM6: x86Command = 0x30; break;
|
||||
case x86_XMM7: x86Command = 0x38; break;
|
||||
}
|
||||
switch (Source)
|
||||
{
|
||||
case x86_XMM0: x86Command += 0x00; break;
|
||||
case x86_XMM1: x86Command += 0x01; break;
|
||||
case x86_XMM2: x86Command += 0x02; break;
|
||||
case x86_XMM3: x86Command += 0x03; break;
|
||||
case x86_XMM4: x86Command += 0x04; break;
|
||||
case x86_XMM5: x86Command += 0x05; break;
|
||||
case x86_XMM6: x86Command += 0x06; break;
|
||||
case x86_XMM7: x86Command += 0x07; break;
|
||||
}
|
||||
|
||||
PUTDST16(RecompPos,0x280f);
|
||||
PUTDST8(RecompPos, 0xC0 | x86Command);
|
||||
PUTDST16(RecompPos, 0x280f);
|
||||
PUTDST8(RecompPos, 0xC0 | x86Command);
|
||||
}
|
||||
|
||||
void SseXorRegToReg(int Dest, int Source) {
|
||||
BYTE x86Command = 0;
|
||||
void SseXorRegToReg(int Dest, int Source)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" xorps %s, %s", sse_Name(Dest), sse_Name(Source));
|
||||
CPU_Message(" xorps %s, %s", sse_Name(Dest), sse_Name(Source));
|
||||
|
||||
switch (Dest) {
|
||||
case x86_XMM0: x86Command = 0x00; break;
|
||||
case x86_XMM1: x86Command = 0x08; break;
|
||||
case x86_XMM2: x86Command = 0x10; break;
|
||||
case x86_XMM3: x86Command = 0x18; break;
|
||||
case x86_XMM4: x86Command = 0x20; break;
|
||||
case x86_XMM5: x86Command = 0x28; break;
|
||||
case x86_XMM6: x86Command = 0x30; break;
|
||||
case x86_XMM7: x86Command = 0x38; break;
|
||||
}
|
||||
switch (Source) {
|
||||
case x86_XMM0: x86Command += 0x00; break;
|
||||
case x86_XMM1: x86Command += 0x01; break;
|
||||
case x86_XMM2: x86Command += 0x02; break;
|
||||
case x86_XMM3: x86Command += 0x03; break;
|
||||
case x86_XMM4: x86Command += 0x04; break;
|
||||
case x86_XMM5: x86Command += 0x05; break;
|
||||
case x86_XMM6: x86Command += 0x06; break;
|
||||
case x86_XMM7: x86Command += 0x07; break;
|
||||
}
|
||||
PUTDST16(RecompPos,0x570f);
|
||||
PUTDST8(RecompPos, 0xC0 | x86Command);
|
||||
switch (Dest)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x00; break;
|
||||
case x86_XMM1: x86Command = 0x08; break;
|
||||
case x86_XMM2: x86Command = 0x10; break;
|
||||
case x86_XMM3: x86Command = 0x18; break;
|
||||
case x86_XMM4: x86Command = 0x20; break;
|
||||
case x86_XMM5: x86Command = 0x28; break;
|
||||
case x86_XMM6: x86Command = 0x30; break;
|
||||
case x86_XMM7: x86Command = 0x38; break;
|
||||
}
|
||||
switch (Source)
|
||||
{
|
||||
case x86_XMM0: x86Command += 0x00; break;
|
||||
case x86_XMM1: x86Command += 0x01; break;
|
||||
case x86_XMM2: x86Command += 0x02; break;
|
||||
case x86_XMM3: x86Command += 0x03; break;
|
||||
case x86_XMM4: x86Command += 0x04; break;
|
||||
case x86_XMM5: x86Command += 0x05; break;
|
||||
case x86_XMM6: x86Command += 0x06; break;
|
||||
case x86_XMM7: x86Command += 0x07; break;
|
||||
}
|
||||
PUTDST16(RecompPos, 0x570f);
|
||||
PUTDST8(RecompPos, 0xC0 | x86Command);
|
||||
}
|
||||
|
||||
void SseShuffleReg(int Dest, int Source, BYTE Immed) {
|
||||
BYTE x86Command = 0;
|
||||
void SseShuffleReg(int Dest, int Source, BYTE Immed)
|
||||
{
|
||||
BYTE x86Command = 0;
|
||||
|
||||
CPU_Message(" shufps %s, %s, %02X", sse_Name(Dest), sse_Name(Source), Immed);
|
||||
CPU_Message(" shufps %s, %s, %02X", sse_Name(Dest), sse_Name(Source), Immed);
|
||||
|
||||
switch (Dest) {
|
||||
case x86_XMM0: x86Command = 0x00; break;
|
||||
case x86_XMM1: x86Command = 0x08; break;
|
||||
case x86_XMM2: x86Command = 0x10; break;
|
||||
case x86_XMM3: x86Command = 0x18; break;
|
||||
case x86_XMM4: x86Command = 0x20; break;
|
||||
case x86_XMM5: x86Command = 0x28; break;
|
||||
case x86_XMM6: x86Command = 0x30; break;
|
||||
case x86_XMM7: x86Command = 0x38; break;
|
||||
}
|
||||
switch (Source) {
|
||||
case x86_XMM0: x86Command += 0x00; break;
|
||||
case x86_XMM1: x86Command += 0x01; break;
|
||||
case x86_XMM2: x86Command += 0x02; break;
|
||||
case x86_XMM3: x86Command += 0x03; break;
|
||||
case x86_XMM4: x86Command += 0x04; break;
|
||||
case x86_XMM5: x86Command += 0x05; break;
|
||||
case x86_XMM6: x86Command += 0x06; break;
|
||||
case x86_XMM7: x86Command += 0x07; break;
|
||||
}
|
||||
PUTDST16(RecompPos,0xC60f);
|
||||
PUTDST8(RecompPos, 0xC0 | x86Command);
|
||||
PUTDST8(RecompPos, Immed);
|
||||
switch (Dest)
|
||||
{
|
||||
case x86_XMM0: x86Command = 0x00; break;
|
||||
case x86_XMM1: x86Command = 0x08; break;
|
||||
case x86_XMM2: x86Command = 0x10; break;
|
||||
case x86_XMM3: x86Command = 0x18; break;
|
||||
case x86_XMM4: x86Command = 0x20; break;
|
||||
case x86_XMM5: x86Command = 0x28; break;
|
||||
case x86_XMM6: x86Command = 0x30; break;
|
||||
case x86_XMM7: x86Command = 0x38; break;
|
||||
}
|
||||
switch (Source)
|
||||
{
|
||||
case x86_XMM0: x86Command += 0x00; break;
|
||||
case x86_XMM1: x86Command += 0x01; break;
|
||||
case x86_XMM2: x86Command += 0x02; break;
|
||||
case x86_XMM3: x86Command += 0x03; break;
|
||||
case x86_XMM4: x86Command += 0x04; break;
|
||||
case x86_XMM5: x86Command += 0x05; break;
|
||||
case x86_XMM6: x86Command += 0x06; break;
|
||||
case x86_XMM7: x86Command += 0x07; break;
|
||||
}
|
||||
PUTDST16(RecompPos, 0xC60f);
|
||||
PUTDST8(RecompPos, 0xC0 | x86Command);
|
||||
PUTDST8(RecompPos, Immed);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// Pointer to RSP operation code functions or "func"
|
||||
// This is the type of all RSP interpreter and recompiler functions
|
||||
|
||||
typedef void(*p_func)(void);
|
||||
typedef void (*p_func)(void);
|
||||
|
||||
// TODO: Rewrite/remove/address?
|
||||
/*
|
||||
|
@ -21,47 +21,50 @@ Until then, a simple type definition will help emphasize true/false logic.
|
|||
|
||||
typedef int Boolean;
|
||||
#if !defined(FALSE) && !defined(TRUE)
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
typedef union tagUWORD {
|
||||
int32_t W;
|
||||
uint32_t UW;
|
||||
int16_t HW[2];
|
||||
uint16_t UHW[2];
|
||||
int8_t B[4];
|
||||
uint8_t UB[4];
|
||||
typedef union tagUWORD
|
||||
{
|
||||
int32_t W;
|
||||
uint32_t UW;
|
||||
int16_t HW[2];
|
||||
uint16_t UHW[2];
|
||||
int8_t B[4];
|
||||
uint8_t UB[4];
|
||||
|
||||
float F;
|
||||
float F;
|
||||
} UWORD32;
|
||||
|
||||
typedef union tagUDWORD {
|
||||
int64_t DW;
|
||||
uint64_t UDW;
|
||||
int32_t W[2];
|
||||
uint32_t UW[2];
|
||||
int16_t HW[4];
|
||||
uint16_t UHW[4];
|
||||
int8_t B[8];
|
||||
uint8_t UB[8];
|
||||
typedef union tagUDWORD
|
||||
{
|
||||
int64_t DW;
|
||||
uint64_t UDW;
|
||||
int32_t W[2];
|
||||
uint32_t UW[2];
|
||||
int16_t HW[4];
|
||||
uint16_t UHW[4];
|
||||
int8_t B[8];
|
||||
uint8_t UB[8];
|
||||
|
||||
double D;
|
||||
float F[2];
|
||||
double D;
|
||||
float F[2];
|
||||
} UDWORD;
|
||||
|
||||
typedef union tagVect {
|
||||
int64_t DW[2];
|
||||
uint64_t UDW[2];
|
||||
int32_t W[4];
|
||||
uint32_t UW[4];
|
||||
int16_t HW[8];
|
||||
uint16_t UHW[8];
|
||||
int8_t B[16];
|
||||
uint8_t UB[16];
|
||||
typedef union tagVect
|
||||
{
|
||||
int64_t DW[2];
|
||||
uint64_t UDW[2];
|
||||
int32_t W[4];
|
||||
uint32_t UW[4];
|
||||
int16_t HW[8];
|
||||
uint16_t UHW[8];
|
||||
int8_t B[16];
|
||||
uint8_t UB[16];
|
||||
|
||||
double FD[2];
|
||||
float FS[4];
|
||||
double FD[2];
|
||||
float FS[4];
|
||||
} VECTOR;
|
||||
|
||||
#endif
|
||||
|
|
5459
Source/RSP/X86.cpp
5459
Source/RSP/X86.cpp
File diff suppressed because it is too large
Load Diff
471
Source/RSP/X86.h
471
Source/RSP/X86.h
|
@ -1,244 +1,267 @@
|
|||
enum x86RegValues {
|
||||
x86_EAX = 0, x86_EBX = 1, x86_ECX = 2, x86_EDX = 3,
|
||||
x86_ESI = 4, x86_EDI = 5, x86_EBP = 6, x86_ESP = 7
|
||||
enum x86RegValues
|
||||
{
|
||||
x86_EAX = 0,
|
||||
x86_EBX = 1,
|
||||
x86_ECX = 2,
|
||||
x86_EDX = 3,
|
||||
x86_ESI = 4,
|
||||
x86_EDI = 5,
|
||||
x86_EBP = 6,
|
||||
x86_ESP = 7
|
||||
};
|
||||
|
||||
enum mmxRegValues {
|
||||
x86_MM0 = 0, x86_MM1 = 1, x86_MM2 = 2, x86_MM3 = 3,
|
||||
x86_MM4 = 4, x86_MM5 = 5, x86_MM6 = 6, x86_MM7 = 7
|
||||
enum mmxRegValues
|
||||
{
|
||||
x86_MM0 = 0,
|
||||
x86_MM1 = 1,
|
||||
x86_MM2 = 2,
|
||||
x86_MM3 = 3,
|
||||
x86_MM4 = 4,
|
||||
x86_MM5 = 5,
|
||||
x86_MM6 = 6,
|
||||
x86_MM7 = 7
|
||||
};
|
||||
|
||||
enum sseRegValues {
|
||||
x86_XMM0 = 0, x86_XMM1 = 1, x86_XMM2 = 2, x86_XMM3 = 3,
|
||||
x86_XMM4 = 4, x86_XMM5 = 5, x86_XMM6 = 6, x86_XMM7 = 7
|
||||
enum sseRegValues
|
||||
{
|
||||
x86_XMM0 = 0,
|
||||
x86_XMM1 = 1,
|
||||
x86_XMM2 = 2,
|
||||
x86_XMM3 = 3,
|
||||
x86_XMM4 = 4,
|
||||
x86_XMM5 = 5,
|
||||
x86_XMM6 = 6,
|
||||
x86_XMM7 = 7
|
||||
};
|
||||
|
||||
void AdcX86RegToX86Reg ( int Destination, int Source );
|
||||
void AdcX86regToVariable ( int x86reg, void * Variable, char * VariableName );
|
||||
void AdcX86regHalfToVariable ( int x86reg, void * Variable, char * VariableName );
|
||||
void AdcConstToX86reg ( BYTE Constant, int x86reg );
|
||||
void AdcConstToVariable ( void *Variable, char *VariableName, BYTE Constant );
|
||||
void AdcConstHalfToVariable ( void *Variable, char *VariableName, BYTE Constant );
|
||||
void AddConstToVariable ( DWORD Const, void *Variable, char *VariableName );
|
||||
void AddConstToX86Reg ( int x86Reg, size_t Const );
|
||||
void AddVariableToX86reg ( int x86reg, void * Variable, char * VariableName );
|
||||
void AddX86regToVariable ( int x86reg, void * Variable, char * VariableName );
|
||||
void AddX86regHalfToVariable ( int x86reg, void * Variable, char * VariableName );
|
||||
void AddX86RegToX86Reg ( int Destination, int Source );
|
||||
void AndConstToVariable ( DWORD Const, void *Variable, char *VariableName );
|
||||
void AndConstToX86Reg ( int x86Reg, DWORD Const );
|
||||
void AndVariableToX86Reg ( void * Variable, char * VariableName, int x86Reg );
|
||||
void AndVariableToX86regHalf ( void * Variable, char * VariableName, int x86Reg );
|
||||
void AndX86RegToVariable ( void * Variable, char * VariableName, int x86Reg );
|
||||
void AndX86RegToX86Reg ( int Destination, int Source );
|
||||
void AndX86RegHalfToX86RegHalf ( int Destination, int Source );
|
||||
void X86BreakPoint ( LPCSTR FileName, int LineNumber );
|
||||
void BsrX86RegToX86Reg ( int Destination, int Source );
|
||||
void Call_Direct ( void * FunctAddress, char * FunctName );
|
||||
void Call_Indirect ( void * FunctAddress, char * FunctName );
|
||||
void CondMoveEqual ( int Destination, int Source );
|
||||
void CondMoveNotEqual ( int Destination, int Source );
|
||||
void CondMoveGreater ( int Destination, int Source );
|
||||
void CondMoveGreaterEqual ( int Destination, int Source );
|
||||
void CondMoveLess ( int Destination, int Source );
|
||||
void CondMoveLessEqual ( int Destination, int Source );
|
||||
void CompConstToVariable ( DWORD Const, void * Variable, char * VariableName );
|
||||
void CompConstHalfToVariable ( WORD Const, void * Variable, char * VariableName );
|
||||
void CompConstToX86reg ( int x86Reg, DWORD Const );
|
||||
void CompX86regToVariable ( int x86Reg, void * Variable, char * VariableName );
|
||||
void CompVariableToX86reg ( int x86Reg, void * Variable, char * VariableName );
|
||||
void CompX86RegToX86Reg ( int Destination, int Source );
|
||||
void Cwd ( void );
|
||||
void Cwde ( void );
|
||||
void DecX86reg ( int x86Reg );
|
||||
void DivX86reg ( int x86reg );
|
||||
void idivX86reg ( int x86reg );
|
||||
void imulX86reg ( int x86reg );
|
||||
void ImulX86RegToX86Reg ( int Destination, int Source );
|
||||
void IncX86reg ( int x86Reg );
|
||||
void JaeLabel32 ( char * Label, DWORD Value );
|
||||
void JaLabel8 ( char * Label, BYTE Value );
|
||||
void JaLabel32 ( char * Label, DWORD Value );
|
||||
void JbLabel8 ( char * Label, BYTE Value );
|
||||
void JbLabel32 ( char * Label, DWORD Value );
|
||||
void JeLabel8 ( char * Label, BYTE Value );
|
||||
void JeLabel32 ( char * Label, DWORD Value );
|
||||
void JgeLabel8 ( char * Label, BYTE Value );
|
||||
void JgeLabel32 ( char * Label, DWORD Value );
|
||||
void JgLabel8 ( char * Label, BYTE Value );
|
||||
void JgLabel32 ( char * Label, DWORD Value );
|
||||
void JleLabel8 ( char * Label, BYTE Value );
|
||||
void JleLabel32 ( char * Label, DWORD Value );
|
||||
void JlLabel8 ( char * Label, BYTE Value );
|
||||
void JlLabel32 ( char * Label, DWORD Value );
|
||||
void JumpX86Reg ( int x86reg );
|
||||
void JmpLabel8 ( char * Label, BYTE Value );
|
||||
void JmpLabel32 ( char * Label, DWORD Value );
|
||||
void JneLabel8 ( char * Label, BYTE Value );
|
||||
void JneLabel32 ( char * Label, DWORD Value );
|
||||
void JnsLabel8 ( char * Label, BYTE Value );
|
||||
void JnsLabel32 ( char * Label, DWORD Value );
|
||||
void JsLabel32 ( char * Label, DWORD Value );
|
||||
void LeaSourceAndOffset ( int x86DestReg, int x86SourceReg, size_t offset );
|
||||
void MoveConstByteToN64Mem ( BYTE Const, int AddrReg );
|
||||
void MoveConstHalfToN64Mem ( WORD Const, int AddrReg );
|
||||
void MoveConstByteToVariable ( BYTE Const,void *Variable, char *VariableName );
|
||||
void MoveConstHalfToVariable ( WORD Const, void *Variable, char *VariableName );
|
||||
void MoveConstToN64Mem ( DWORD Const, int AddrReg );
|
||||
void MoveConstToN64MemDisp ( DWORD Const, int AddrReg, BYTE Disp );
|
||||
void MoveConstToVariable ( DWORD Const, void *Variable, char *VariableName );
|
||||
void MoveConstToX86reg ( DWORD Const, int x86reg );
|
||||
void MoveOffsetToX86reg ( size_t Const, char * VariableName, int x86reg );
|
||||
void MoveX86regByteToX86regPointer ( int Source, int AddrReg );
|
||||
void MoveX86regHalfToX86regPointer ( int Source, int AddrReg );
|
||||
void MoveX86regHalfToX86regPointerDisp ( int Source, int AddrReg, BYTE Disp);
|
||||
void MoveX86regToX86regPointer ( int Source, int AddrReg );
|
||||
void MoveX86RegToX86regPointerDisp ( int Source, int AddrReg, BYTE Disp );
|
||||
void MoveX86regPointerToX86regByte ( int Destination, int AddrReg );
|
||||
void MoveX86regPointerToX86regHalf ( int Destination, int AddrReg );
|
||||
void MoveX86regPointerToX86reg ( int Destination, int AddrReg );
|
||||
void MoveN64MemDispToX86reg ( int x86reg, int AddrReg, BYTE Disp );
|
||||
void MoveN64MemToX86reg ( int x86reg, int AddrReg );
|
||||
void MoveN64MemToX86regByte ( int x86reg, int AddrReg );
|
||||
void MoveN64MemToX86regHalf ( int x86reg, int AddrReg );
|
||||
void MoveX86regByteToN64Mem ( int x86reg, int AddrReg );
|
||||
void MoveX86regByteToVariable ( int x86reg, void * Variable, char * VariableName );
|
||||
void MoveX86regHalfToN64Mem ( int x86reg, int AddrReg );
|
||||
void MoveX86regHalfToVariable ( int x86reg, void * Variable, char * VariableName );
|
||||
void MoveX86regToN64Mem ( int x86reg, int AddrReg );
|
||||
void MoveX86regToN64MemDisp ( int x86reg, int AddrReg, BYTE Disp );
|
||||
void MoveX86regToVariable ( int x86reg, void * Variable, char * VariableName );
|
||||
void MoveX86RegToX86Reg ( int Source, int Destination );
|
||||
void MoveVariableToX86reg ( void *Variable, char *VariableName, int x86reg );
|
||||
void MoveVariableToX86regByte ( void *Variable, char *VariableName, int x86reg );
|
||||
void MoveVariableToX86regHalf ( void *Variable, char *VariableName, int x86reg );
|
||||
void MoveSxX86RegHalfToX86Reg ( int Source, int Destination );
|
||||
void MoveSxX86RegPtrDispToX86RegHalf( int AddrReg, BYTE Disp, int Destination );
|
||||
void MoveSxN64MemToX86regByte ( int x86reg, int AddrReg );
|
||||
void MoveSxN64MemToX86regHalf ( int x86reg, int AddrReg );
|
||||
void MoveSxVariableToX86regByte ( void *Variable, char *VariableName, int x86reg );
|
||||
void MoveSxVariableToX86regHalf ( void *Variable, char *VariableName, int x86reg );
|
||||
void MoveZxX86RegHalfToX86Reg ( int Source, int Destination );
|
||||
void MoveZxX86RegPtrDispToX86RegHalf( int AddrReg, BYTE Disp, int Destination );
|
||||
void MoveZxN64MemToX86regByte ( int x86reg, int AddrReg );
|
||||
void MoveZxN64MemToX86regHalf ( int x86reg, int AddrReg );
|
||||
void MoveZxVariableToX86regByte ( void *Variable, char *VariableName, int x86reg );
|
||||
void MoveZxVariableToX86regHalf ( void *Variable, char *VariableName, int x86reg );
|
||||
void MulX86reg ( int x86reg );
|
||||
void NegateX86reg ( int x86reg );
|
||||
void NotX86reg ( int x86reg );
|
||||
void OrConstToVariable ( DWORD Const, void * Variable, char * VariableName );
|
||||
void OrConstToX86Reg ( DWORD Const, int x86Reg );
|
||||
void OrVariableToX86Reg ( void * Variable, char * VariableName, int x86Reg );
|
||||
void OrVariableToX86regHalf ( void * Variable, char * VariableName, int x86Reg );
|
||||
void OrX86RegToVariable ( void * Variable, char * VariableName, int x86Reg );
|
||||
void OrX86RegToX86Reg ( int Destination, int Source );
|
||||
void Popad ( void );
|
||||
void Pushad ( void );
|
||||
void Push ( int x86reg );
|
||||
void Pop ( int x86reg );
|
||||
void PushImm32 ( char * String, DWORD Value );
|
||||
void Ret ( void );
|
||||
void Seta ( int x86reg );
|
||||
void Setae ( int x86reg );
|
||||
void Setl ( int x86reg );
|
||||
void Setb ( int x86reg );
|
||||
void Setg ( int x86reg );
|
||||
void Setz ( int x86reg );
|
||||
void Setnz ( int x86reg );
|
||||
void SetlVariable ( void * Variable, char * VariableName );
|
||||
void SetleVariable ( void * Variable, char * VariableName );
|
||||
void SetgVariable ( void * Variable, char * VariableName );
|
||||
void SetgeVariable ( void * Variable, char * VariableName );
|
||||
void SetbVariable ( void * Variable, char * VariableName );
|
||||
void SetaVariable ( void * Variable, char * VariableName );
|
||||
void SetzVariable ( void * Variable, char * VariableName );
|
||||
void SetnzVariable ( void * Variable, char * VariableName );
|
||||
void ShiftLeftSign ( int x86reg );
|
||||
void ShiftLeftSignImmed ( int x86reg, BYTE Immediate );
|
||||
void ShiftLeftSignVariableImmed ( void *Variable, char *VariableName, BYTE Immediate );
|
||||
void ShiftRightSignImmed ( int x86reg, BYTE Immediate );
|
||||
void ShiftRightSignVariableImmed ( void *Variable, char *VariableName, BYTE Immediate );
|
||||
void ShiftRightUnsign ( int x86reg );
|
||||
void ShiftRightUnsignImmed ( int x86reg, BYTE Immediate );
|
||||
void ShiftRightUnsignVariableImmed ( void *Variable, char *VariableName, BYTE Immediate );
|
||||
void ShiftLeftDoubleImmed ( int Destination, int Source, BYTE Immediate );
|
||||
void ShiftRightDoubleImmed ( int Destination, int Source, BYTE Immediate );
|
||||
void SubConstFromVariable ( DWORD Const, void *Variable, char *VariableName );
|
||||
void SubConstFromX86Reg ( int x86Reg, DWORD Const );
|
||||
void SubVariableFromX86reg ( int x86reg, void * Variable, char * VariableName );
|
||||
void SubX86RegToX86Reg ( int Destination, int Source );
|
||||
void SubX86regFromVariable ( int x86reg, void * Variable, char * VariableName );
|
||||
void SbbX86RegToX86Reg ( int Destination, int Source );
|
||||
void TestConstToVariable ( DWORD Const, void * Variable, char * VariableName );
|
||||
void TestConstToX86Reg ( DWORD Const, int x86reg );
|
||||
void TestX86RegToX86Reg ( int Destination, int Source );
|
||||
void XorConstToX86Reg ( int x86Reg, DWORD Const );
|
||||
void XorX86RegToX86Reg ( int Source, int Destination );
|
||||
void XorVariableToX86reg ( void *Variable, char *VariableName, int x86reg );
|
||||
void XorX86RegToVariable ( void *Variable, char *VariableName, int x86reg );
|
||||
void XorConstToVariable ( void *Variable, char *VariableName, DWORD Const );
|
||||
void AdcX86RegToX86Reg(int Destination, int Source);
|
||||
void AdcX86regToVariable(int x86reg, void * Variable, char * VariableName);
|
||||
void AdcX86regHalfToVariable(int x86reg, void * Variable, char * VariableName);
|
||||
void AdcConstToX86reg(BYTE Constant, int x86reg);
|
||||
void AdcConstToVariable(void * Variable, char * VariableName, BYTE Constant);
|
||||
void AdcConstHalfToVariable(void * Variable, char * VariableName, BYTE Constant);
|
||||
void AddConstToVariable(DWORD Const, void * Variable, char * VariableName);
|
||||
void AddConstToX86Reg(int x86Reg, size_t Const);
|
||||
void AddVariableToX86reg(int x86reg, void * Variable, char * VariableName);
|
||||
void AddX86regToVariable(int x86reg, void * Variable, char * VariableName);
|
||||
void AddX86regHalfToVariable(int x86reg, void * Variable, char * VariableName);
|
||||
void AddX86RegToX86Reg(int Destination, int Source);
|
||||
void AndConstToVariable(DWORD Const, void * Variable, char * VariableName);
|
||||
void AndConstToX86Reg(int x86Reg, DWORD Const);
|
||||
void AndVariableToX86Reg(void * Variable, char * VariableName, int x86Reg);
|
||||
void AndVariableToX86regHalf(void * Variable, char * VariableName, int x86Reg);
|
||||
void AndX86RegToVariable(void * Variable, char * VariableName, int x86Reg);
|
||||
void AndX86RegToX86Reg(int Destination, int Source);
|
||||
void AndX86RegHalfToX86RegHalf(int Destination, int Source);
|
||||
void X86BreakPoint(LPCSTR FileName, int LineNumber);
|
||||
void BsrX86RegToX86Reg(int Destination, int Source);
|
||||
void Call_Direct(void * FunctAddress, char * FunctName);
|
||||
void Call_Indirect(void * FunctAddress, char * FunctName);
|
||||
void CondMoveEqual(int Destination, int Source);
|
||||
void CondMoveNotEqual(int Destination, int Source);
|
||||
void CondMoveGreater(int Destination, int Source);
|
||||
void CondMoveGreaterEqual(int Destination, int Source);
|
||||
void CondMoveLess(int Destination, int Source);
|
||||
void CondMoveLessEqual(int Destination, int Source);
|
||||
void CompConstToVariable(DWORD Const, void * Variable, char * VariableName);
|
||||
void CompConstHalfToVariable(WORD Const, void * Variable, char * VariableName);
|
||||
void CompConstToX86reg(int x86Reg, DWORD Const);
|
||||
void CompX86regToVariable(int x86Reg, void * Variable, char * VariableName);
|
||||
void CompVariableToX86reg(int x86Reg, void * Variable, char * VariableName);
|
||||
void CompX86RegToX86Reg(int Destination, int Source);
|
||||
void Cwd(void);
|
||||
void Cwde(void);
|
||||
void DecX86reg(int x86Reg);
|
||||
void DivX86reg(int x86reg);
|
||||
void idivX86reg(int x86reg);
|
||||
void imulX86reg(int x86reg);
|
||||
void ImulX86RegToX86Reg(int Destination, int Source);
|
||||
void IncX86reg(int x86Reg);
|
||||
void JaeLabel32(char * Label, DWORD Value);
|
||||
void JaLabel8(char * Label, BYTE Value);
|
||||
void JaLabel32(char * Label, DWORD Value);
|
||||
void JbLabel8(char * Label, BYTE Value);
|
||||
void JbLabel32(char * Label, DWORD Value);
|
||||
void JeLabel8(char * Label, BYTE Value);
|
||||
void JeLabel32(char * Label, DWORD Value);
|
||||
void JgeLabel8(char * Label, BYTE Value);
|
||||
void JgeLabel32(char * Label, DWORD Value);
|
||||
void JgLabel8(char * Label, BYTE Value);
|
||||
void JgLabel32(char * Label, DWORD Value);
|
||||
void JleLabel8(char * Label, BYTE Value);
|
||||
void JleLabel32(char * Label, DWORD Value);
|
||||
void JlLabel8(char * Label, BYTE Value);
|
||||
void JlLabel32(char * Label, DWORD Value);
|
||||
void JumpX86Reg(int x86reg);
|
||||
void JmpLabel8(char * Label, BYTE Value);
|
||||
void JmpLabel32(char * Label, DWORD Value);
|
||||
void JneLabel8(char * Label, BYTE Value);
|
||||
void JneLabel32(char * Label, DWORD Value);
|
||||
void JnsLabel8(char * Label, BYTE Value);
|
||||
void JnsLabel32(char * Label, DWORD Value);
|
||||
void JsLabel32(char * Label, DWORD Value);
|
||||
void LeaSourceAndOffset(int x86DestReg, int x86SourceReg, size_t offset);
|
||||
void MoveConstByteToN64Mem(BYTE Const, int AddrReg);
|
||||
void MoveConstHalfToN64Mem(WORD Const, int AddrReg);
|
||||
void MoveConstByteToVariable(BYTE Const, void * Variable, char * VariableName);
|
||||
void MoveConstHalfToVariable(WORD Const, void * Variable, char * VariableName);
|
||||
void MoveConstToN64Mem(DWORD Const, int AddrReg);
|
||||
void MoveConstToN64MemDisp(DWORD Const, int AddrReg, BYTE Disp);
|
||||
void MoveConstToVariable(DWORD Const, void * Variable, char * VariableName);
|
||||
void MoveConstToX86reg(DWORD Const, int x86reg);
|
||||
void MoveOffsetToX86reg(size_t Const, char * VariableName, int x86reg);
|
||||
void MoveX86regByteToX86regPointer(int Source, int AddrReg);
|
||||
void MoveX86regHalfToX86regPointer(int Source, int AddrReg);
|
||||
void MoveX86regHalfToX86regPointerDisp(int Source, int AddrReg, BYTE Disp);
|
||||
void MoveX86regToX86regPointer(int Source, int AddrReg);
|
||||
void MoveX86RegToX86regPointerDisp(int Source, int AddrReg, BYTE Disp);
|
||||
void MoveX86regPointerToX86regByte(int Destination, int AddrReg);
|
||||
void MoveX86regPointerToX86regHalf(int Destination, int AddrReg);
|
||||
void MoveX86regPointerToX86reg(int Destination, int AddrReg);
|
||||
void MoveN64MemDispToX86reg(int x86reg, int AddrReg, BYTE Disp);
|
||||
void MoveN64MemToX86reg(int x86reg, int AddrReg);
|
||||
void MoveN64MemToX86regByte(int x86reg, int AddrReg);
|
||||
void MoveN64MemToX86regHalf(int x86reg, int AddrReg);
|
||||
void MoveX86regByteToN64Mem(int x86reg, int AddrReg);
|
||||
void MoveX86regByteToVariable(int x86reg, void * Variable, char * VariableName);
|
||||
void MoveX86regHalfToN64Mem(int x86reg, int AddrReg);
|
||||
void MoveX86regHalfToVariable(int x86reg, void * Variable, char * VariableName);
|
||||
void MoveX86regToN64Mem(int x86reg, int AddrReg);
|
||||
void MoveX86regToN64MemDisp(int x86reg, int AddrReg, BYTE Disp);
|
||||
void MoveX86regToVariable(int x86reg, void * Variable, char * VariableName);
|
||||
void MoveX86RegToX86Reg(int Source, int Destination);
|
||||
void MoveVariableToX86reg(void * Variable, char * VariableName, int x86reg);
|
||||
void MoveVariableToX86regByte(void * Variable, char * VariableName, int x86reg);
|
||||
void MoveVariableToX86regHalf(void * Variable, char * VariableName, int x86reg);
|
||||
void MoveSxX86RegHalfToX86Reg(int Source, int Destination);
|
||||
void MoveSxX86RegPtrDispToX86RegHalf(int AddrReg, BYTE Disp, int Destination);
|
||||
void MoveSxN64MemToX86regByte(int x86reg, int AddrReg);
|
||||
void MoveSxN64MemToX86regHalf(int x86reg, int AddrReg);
|
||||
void MoveSxVariableToX86regByte(void * Variable, char * VariableName, int x86reg);
|
||||
void MoveSxVariableToX86regHalf(void * Variable, char * VariableName, int x86reg);
|
||||
void MoveZxX86RegHalfToX86Reg(int Source, int Destination);
|
||||
void MoveZxX86RegPtrDispToX86RegHalf(int AddrReg, BYTE Disp, int Destination);
|
||||
void MoveZxN64MemToX86regByte(int x86reg, int AddrReg);
|
||||
void MoveZxN64MemToX86regHalf(int x86reg, int AddrReg);
|
||||
void MoveZxVariableToX86regByte(void * Variable, char * VariableName, int x86reg);
|
||||
void MoveZxVariableToX86regHalf(void * Variable, char * VariableName, int x86reg);
|
||||
void MulX86reg(int x86reg);
|
||||
void NegateX86reg(int x86reg);
|
||||
void NotX86reg(int x86reg);
|
||||
void OrConstToVariable(DWORD Const, void * Variable, char * VariableName);
|
||||
void OrConstToX86Reg(DWORD Const, int x86Reg);
|
||||
void OrVariableToX86Reg(void * Variable, char * VariableName, int x86Reg);
|
||||
void OrVariableToX86regHalf(void * Variable, char * VariableName, int x86Reg);
|
||||
void OrX86RegToVariable(void * Variable, char * VariableName, int x86Reg);
|
||||
void OrX86RegToX86Reg(int Destination, int Source);
|
||||
void Popad(void);
|
||||
void Pushad(void);
|
||||
void Push(int x86reg);
|
||||
void Pop(int x86reg);
|
||||
void PushImm32(char * String, DWORD Value);
|
||||
void Ret(void);
|
||||
void Seta(int x86reg);
|
||||
void Setae(int x86reg);
|
||||
void Setl(int x86reg);
|
||||
void Setb(int x86reg);
|
||||
void Setg(int x86reg);
|
||||
void Setz(int x86reg);
|
||||
void Setnz(int x86reg);
|
||||
void SetlVariable(void * Variable, char * VariableName);
|
||||
void SetleVariable(void * Variable, char * VariableName);
|
||||
void SetgVariable(void * Variable, char * VariableName);
|
||||
void SetgeVariable(void * Variable, char * VariableName);
|
||||
void SetbVariable(void * Variable, char * VariableName);
|
||||
void SetaVariable(void * Variable, char * VariableName);
|
||||
void SetzVariable(void * Variable, char * VariableName);
|
||||
void SetnzVariable(void * Variable, char * VariableName);
|
||||
void ShiftLeftSign(int x86reg);
|
||||
void ShiftLeftSignImmed(int x86reg, BYTE Immediate);
|
||||
void ShiftLeftSignVariableImmed(void * Variable, char * VariableName, BYTE Immediate);
|
||||
void ShiftRightSignImmed(int x86reg, BYTE Immediate);
|
||||
void ShiftRightSignVariableImmed(void * Variable, char * VariableName, BYTE Immediate);
|
||||
void ShiftRightUnsign(int x86reg);
|
||||
void ShiftRightUnsignImmed(int x86reg, BYTE Immediate);
|
||||
void ShiftRightUnsignVariableImmed(void * Variable, char * VariableName, BYTE Immediate);
|
||||
void ShiftLeftDoubleImmed(int Destination, int Source, BYTE Immediate);
|
||||
void ShiftRightDoubleImmed(int Destination, int Source, BYTE Immediate);
|
||||
void SubConstFromVariable(DWORD Const, void * Variable, char * VariableName);
|
||||
void SubConstFromX86Reg(int x86Reg, DWORD Const);
|
||||
void SubVariableFromX86reg(int x86reg, void * Variable, char * VariableName);
|
||||
void SubX86RegToX86Reg(int Destination, int Source);
|
||||
void SubX86regFromVariable(int x86reg, void * Variable, char * VariableName);
|
||||
void SbbX86RegToX86Reg(int Destination, int Source);
|
||||
void TestConstToVariable(DWORD Const, void * Variable, char * VariableName);
|
||||
void TestConstToX86Reg(DWORD Const, int x86reg);
|
||||
void TestX86RegToX86Reg(int Destination, int Source);
|
||||
void XorConstToX86Reg(int x86Reg, DWORD Const);
|
||||
void XorX86RegToX86Reg(int Source, int Destination);
|
||||
void XorVariableToX86reg(void * Variable, char * VariableName, int x86reg);
|
||||
void XorX86RegToVariable(void * Variable, char * VariableName, int x86reg);
|
||||
void XorConstToVariable(void * Variable, char * VariableName, DWORD Const);
|
||||
|
||||
#define _MMX_SHUFFLE(a, b, c, d) \
|
||||
((BYTE)(((a) << 6) | ((b) << 4) | ((c) << 2) | (d)))
|
||||
#define _MMX_SHUFFLE(a, b, c, d) \
|
||||
((BYTE)(((a) << 6) | ((b) << 4) | ((c) << 2) | (d)))
|
||||
|
||||
void MmxMoveRegToReg ( int Dest, int Source );
|
||||
void MmxMoveQwordRegToVariable ( int Dest, void *Variable, char *VariableName );
|
||||
void MmxMoveQwordVariableToReg ( int Dest, void *Variable, char *VariableName );
|
||||
void MmxPandRegToReg ( int Dest, int Source );
|
||||
void MmxPandnRegToReg ( int Dest, int Source );
|
||||
void MmxPandVariableToReg ( void * Variable, char * VariableName, int Dest );
|
||||
void MmxPorRegToReg ( int Dest, int Source );
|
||||
void MmxPorVariableToReg ( void * Variable, char * VariableName, int Dest );
|
||||
void MmxXorRegToReg ( int Dest, int Source );
|
||||
void MmxShuffleMemoryToReg ( int Dest, void * Variable, char * VariableName, BYTE Immed );
|
||||
void MmxPcmpeqwRegToReg ( int Dest, int Source );
|
||||
void MmxPmullwRegToReg ( int Dest, int Source );
|
||||
void MmxPmullwVariableToReg ( int Dest, void * Variable, char * VariableName );
|
||||
void MmxPmulhuwRegToReg ( int Dest, int Source );
|
||||
void MmxPmulhwRegToReg ( int Dest, int Source );
|
||||
void MmxPmulhwRegToVariable ( int Dest, void * Variable, char * VariableName );
|
||||
void MmxPsrlwImmed ( int Dest, BYTE Immed );
|
||||
void MmxPsrawImmed ( int Dest, BYTE Immed );
|
||||
void MmxPsllwImmed ( int Dest, BYTE Immed );
|
||||
void MmxPaddswRegToReg ( int Dest, int Source );
|
||||
void MmxPaddswVariableToReg ( int Dest, void * Variable, char * VariableName );
|
||||
void MmxPaddwRegToReg ( int Dest, int Source );
|
||||
void MmxPsubswVariableToReg ( int Dest, void * Variable, char * VariableName );
|
||||
void MmxPsubswRegToReg ( int Dest, int Source );
|
||||
void MmxPackSignedDwords ( int Dest, int Source );
|
||||
void MmxUnpackLowWord ( int Dest, int Source );
|
||||
void MmxUnpackHighWord ( int Dest, int Source );
|
||||
void MmxCompareGreaterWordRegToReg ( int Dest, int Source );
|
||||
void MmxEmptyMultimediaState ( void );
|
||||
void MmxMoveRegToReg(int Dest, int Source);
|
||||
void MmxMoveQwordRegToVariable(int Dest, void * Variable, char * VariableName);
|
||||
void MmxMoveQwordVariableToReg(int Dest, void * Variable, char * VariableName);
|
||||
void MmxPandRegToReg(int Dest, int Source);
|
||||
void MmxPandnRegToReg(int Dest, int Source);
|
||||
void MmxPandVariableToReg(void * Variable, char * VariableName, int Dest);
|
||||
void MmxPorRegToReg(int Dest, int Source);
|
||||
void MmxPorVariableToReg(void * Variable, char * VariableName, int Dest);
|
||||
void MmxXorRegToReg(int Dest, int Source);
|
||||
void MmxShuffleMemoryToReg(int Dest, void * Variable, char * VariableName, BYTE Immed);
|
||||
void MmxPcmpeqwRegToReg(int Dest, int Source);
|
||||
void MmxPmullwRegToReg(int Dest, int Source);
|
||||
void MmxPmullwVariableToReg(int Dest, void * Variable, char * VariableName);
|
||||
void MmxPmulhuwRegToReg(int Dest, int Source);
|
||||
void MmxPmulhwRegToReg(int Dest, int Source);
|
||||
void MmxPmulhwRegToVariable(int Dest, void * Variable, char * VariableName);
|
||||
void MmxPsrlwImmed(int Dest, BYTE Immed);
|
||||
void MmxPsrawImmed(int Dest, BYTE Immed);
|
||||
void MmxPsllwImmed(int Dest, BYTE Immed);
|
||||
void MmxPaddswRegToReg(int Dest, int Source);
|
||||
void MmxPaddswVariableToReg(int Dest, void * Variable, char * VariableName);
|
||||
void MmxPaddwRegToReg(int Dest, int Source);
|
||||
void MmxPsubswVariableToReg(int Dest, void * Variable, char * VariableName);
|
||||
void MmxPsubswRegToReg(int Dest, int Source);
|
||||
void MmxPackSignedDwords(int Dest, int Source);
|
||||
void MmxUnpackLowWord(int Dest, int Source);
|
||||
void MmxUnpackHighWord(int Dest, int Source);
|
||||
void MmxCompareGreaterWordRegToReg(int Dest, int Source);
|
||||
void MmxEmptyMultimediaState(void);
|
||||
|
||||
void SseMoveAlignedVariableToReg ( void *Variable, char *VariableName, int sseReg );
|
||||
void SseMoveAlignedRegToVariable ( int sseReg, void *Variable, char *VariableName );
|
||||
void SseMoveAlignedN64MemToReg ( int sseReg, int AddrReg );
|
||||
void SseMoveAlignedRegToN64Mem ( int sseReg, int AddrReg );
|
||||
void SseMoveUnalignedVariableToReg ( void *Variable, char *VariableName, int sseReg );
|
||||
void SseMoveUnalignedRegToVariable ( int sseReg, void *Variable, char *VariableName );
|
||||
void SseMoveUnalignedN64MemToReg ( int sseReg, int AddrReg );
|
||||
void SseMoveUnalignedRegToN64Mem ( int sseReg, int AddrReg );
|
||||
void SseMoveRegToReg ( int Dest, int Source );
|
||||
void SseXorRegToReg ( int Dest, int Source );
|
||||
void SseMoveAlignedVariableToReg(void * Variable, char * VariableName, int sseReg);
|
||||
void SseMoveAlignedRegToVariable(int sseReg, void * Variable, char * VariableName);
|
||||
void SseMoveAlignedN64MemToReg(int sseReg, int AddrReg);
|
||||
void SseMoveAlignedRegToN64Mem(int sseReg, int AddrReg);
|
||||
void SseMoveUnalignedVariableToReg(void * Variable, char * VariableName, int sseReg);
|
||||
void SseMoveUnalignedRegToVariable(int sseReg, void * Variable, char * VariableName);
|
||||
void SseMoveUnalignedN64MemToReg(int sseReg, int AddrReg);
|
||||
void SseMoveUnalignedRegToN64Mem(int sseReg, int AddrReg);
|
||||
void SseMoveRegToReg(int Dest, int Source);
|
||||
void SseXorRegToReg(int Dest, int Source);
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201) // Non-standard extension used: nameless struct/union
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
unsigned Reg0 : 2;
|
||||
unsigned Reg1 : 2;
|
||||
unsigned Reg2 : 2;
|
||||
unsigned Reg3 : 2;
|
||||
};
|
||||
unsigned UB:8;
|
||||
typedef union
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned Reg0 : 2;
|
||||
unsigned Reg1 : 2;
|
||||
unsigned Reg2 : 2;
|
||||
unsigned Reg3 : 2;
|
||||
};
|
||||
unsigned UB : 8;
|
||||
} SHUFFLE;
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
void SseShuffleReg ( int Dest, int Source, BYTE Immed );
|
||||
void SseShuffleReg(int Dest, int Source, BYTE Immed);
|
||||
|
||||
void x86_SetBranch32b(void * JumpByte, void * Destination);
|
||||
void x86_SetBranch8b(void * JumpByte, void * Destination);
|
||||
|
|
|
@ -1,180 +1,183 @@
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "Rsp.h"
|
||||
#include "CPU.h"
|
||||
#include "breakpoint.h"
|
||||
#include "CPU.h"
|
||||
#include "Rsp.h"
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define IDC_LOCATION_EDIT 105
|
||||
#define IDC_LOCATION_EDIT 105
|
||||
HWND BPoint_Win_hDlg, hRSPLocation = NULL;
|
||||
|
||||
BPOINT BPoint[MaxBPoints];
|
||||
int NoOfBpoints;
|
||||
int NoOfBpoints;
|
||||
|
||||
void Add_BPoint ( void )
|
||||
void Add_BPoint(void)
|
||||
{
|
||||
char Title[10];
|
||||
char Title[10];
|
||||
|
||||
GetWindowTextA(hRSPLocation,Title,sizeof(Title));
|
||||
if (!AddRSP_BPoint(AsciiToHex(Title),TRUE )) {
|
||||
SendMessage(hRSPLocation,EM_SETSEL,(WPARAM)0,(LPARAM)-1);
|
||||
SetFocus(hRSPLocation);
|
||||
}
|
||||
GetWindowTextA(hRSPLocation, Title, sizeof(Title));
|
||||
if (!AddRSP_BPoint(AsciiToHex(Title), TRUE))
|
||||
{
|
||||
SendMessage(hRSPLocation, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
|
||||
SetFocus(hRSPLocation);
|
||||
}
|
||||
}
|
||||
|
||||
int AddRSP_BPoint( DWORD Location, int Confirm )
|
||||
int AddRSP_BPoint(DWORD Location, int Confirm)
|
||||
{
|
||||
int count;
|
||||
int count;
|
||||
|
||||
if (NoOfBpoints == MaxBPoints)
|
||||
{
|
||||
DisplayError("Max amount of breakpoints set");
|
||||
return FALSE;
|
||||
}
|
||||
if (NoOfBpoints == MaxBPoints)
|
||||
{
|
||||
DisplayError("Max amount of breakpoints set");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (count = 0; count < NoOfBpoints; count ++)
|
||||
{
|
||||
if (BPoint[count].Location == Location)
|
||||
{
|
||||
DisplayError("You already have this breakpoint");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
for (count = 0; count < NoOfBpoints; count++)
|
||||
{
|
||||
if (BPoint[count].Location == Location)
|
||||
{
|
||||
DisplayError("You already have this breakpoint");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Confirm)
|
||||
{
|
||||
char Message[150];
|
||||
int Response;
|
||||
if (Confirm)
|
||||
{
|
||||
char Message[150];
|
||||
int Response;
|
||||
|
||||
sprintf(Message,"Break when:\n\nRSP's program counter = 0x%03X\n\nIs this correct?",
|
||||
Location);
|
||||
Response = MessageBoxA(BPoint_Win_hDlg, Message, "Breakpoint", MB_YESNO | MB_ICONINFORMATION);
|
||||
if (Response == IDNO)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
BPoint[NoOfBpoints].Location = Location;
|
||||
NoOfBpoints += 1;
|
||||
if (DebugInfo.UpdateBreakPoints)
|
||||
{
|
||||
DebugInfo.UpdateBreakPoints();
|
||||
}
|
||||
return TRUE;
|
||||
sprintf(Message, "Break when:\n\nRSP's program counter = 0x%03X\n\nIs this correct?",
|
||||
Location);
|
||||
Response = MessageBoxA(BPoint_Win_hDlg, Message, "Breakpoint", MB_YESNO | MB_ICONINFORMATION);
|
||||
if (Response == IDNO)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
BPoint[NoOfBpoints].Location = Location;
|
||||
NoOfBpoints += 1;
|
||||
if (DebugInfo.UpdateBreakPoints)
|
||||
{
|
||||
DebugInfo.UpdateBreakPoints();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CheckForRSPBPoint ( DWORD Location )
|
||||
int CheckForRSPBPoint(DWORD Location)
|
||||
{
|
||||
int count;
|
||||
|
||||
for (count = 0; count < NoOfBpoints; count ++)
|
||||
{
|
||||
if (BPoint[count].Location == Location)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
int count;
|
||||
|
||||
for (count = 0; count < NoOfBpoints; count++)
|
||||
{
|
||||
if (BPoint[count].Location == Location)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CreateBPPanel ( void * hDlg, rectangle rcBox )
|
||||
void CreateBPPanel(void * hDlg, rectangle rcBox)
|
||||
{
|
||||
if (hRSPLocation != NULL) { return; }
|
||||
if (hRSPLocation != NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
rcBox = rcBox; // Remove warning of unused
|
||||
rcBox = rcBox; // Remove warning of unused
|
||||
|
||||
BPoint_Win_hDlg = (HWND)hDlg;
|
||||
|
||||
hRSPLocation = CreateWindowExA(0,"EDIT","", WS_CHILD | WS_BORDER | ES_UPPERCASE | WS_TABSTOP,
|
||||
83,90,100,17, (HWND)hDlg,(HMENU)IDC_LOCATION_EDIT,(HINSTANCE)RSPInfo.hInst,NULL);
|
||||
if (hRSPLocation)
|
||||
{
|
||||
char Title[20];
|
||||
SendMessage(hRSPLocation,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||
SendMessage(hRSPLocation,EM_SETLIMITTEXT,(WPARAM)3,(LPARAM)0);
|
||||
sprintf(Title,"%03X",*PrgCount);
|
||||
SetWindowTextA(hRSPLocation,Title);
|
||||
}
|
||||
BPoint_Win_hDlg = (HWND)hDlg;
|
||||
|
||||
hRSPLocation = CreateWindowExA(0, "EDIT", "", WS_CHILD | WS_BORDER | ES_UPPERCASE | WS_TABSTOP,
|
||||
83, 90, 100, 17, (HWND)hDlg, (HMENU)IDC_LOCATION_EDIT, (HINSTANCE)RSPInfo.hInst, NULL);
|
||||
if (hRSPLocation)
|
||||
{
|
||||
char Title[20];
|
||||
SendMessage(hRSPLocation, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
|
||||
SendMessage(hRSPLocation, EM_SETLIMITTEXT, (WPARAM)3, (LPARAM)0);
|
||||
sprintf(Title, "%03X", *PrgCount);
|
||||
SetWindowTextA(hRSPLocation, Title);
|
||||
}
|
||||
}
|
||||
|
||||
void HideBPPanel ( void )
|
||||
void HideBPPanel(void)
|
||||
{
|
||||
ShowWindow(hRSPLocation,FALSE);
|
||||
ShowWindow(hRSPLocation, FALSE);
|
||||
}
|
||||
|
||||
void PaintBPPanel ( window_paint ps )
|
||||
void PaintBPPanel(window_paint ps)
|
||||
{
|
||||
TextOutA((HDC)ps.hdc, 29,60,"Break when the program counter equals",37);
|
||||
TextOutA((HDC)ps.hdc, 59,85,"0x",2);
|
||||
TextOutA((HDC)ps.hdc, 29, 60, "Break when the program counter equals", 37);
|
||||
TextOutA((HDC)ps.hdc, 59, 85, "0x", 2);
|
||||
}
|
||||
|
||||
void ShowBPPanel ( void )
|
||||
void ShowBPPanel(void)
|
||||
{
|
||||
ShowWindow(hRSPLocation,TRUE);
|
||||
ShowWindow(hRSPLocation, TRUE);
|
||||
}
|
||||
|
||||
void RefreshBpoints ( void * hList )
|
||||
void RefreshBpoints(void * hList)
|
||||
{
|
||||
char Message[100];
|
||||
LRESULT location;
|
||||
int count;
|
||||
char Message[100];
|
||||
LRESULT location;
|
||||
int count;
|
||||
|
||||
for (count = 0; count < NoOfBpoints; count ++ ) {
|
||||
sprintf(Message," at 0x%03X (RSP)", BPoint[count].Location);
|
||||
location = SendMessageA((HWND)hList, LB_ADDSTRING, 0, (LPARAM)Message);
|
||||
SendMessageA(
|
||||
for (count = 0; count < NoOfBpoints; count++)
|
||||
{
|
||||
sprintf(Message, " at 0x%03X (RSP)", BPoint[count].Location);
|
||||
location = SendMessageA((HWND)hList, LB_ADDSTRING, 0, (LPARAM)Message);
|
||||
SendMessageA(
|
||||
(HWND)hList,
|
||||
LB_SETITEMDATA,
|
||||
(WPARAM)location,
|
||||
(LPARAM)BPoint[count].Location
|
||||
);
|
||||
}
|
||||
LB_SETITEMDATA,
|
||||
(WPARAM)location,
|
||||
(LPARAM)BPoint[count].Location);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveAllBpoint ( void )
|
||||
void RemoveAllBpoint(void)
|
||||
{
|
||||
NoOfBpoints = 0;
|
||||
NoOfBpoints = 0;
|
||||
}
|
||||
|
||||
void RemoveBpoint (void * hList, int index )
|
||||
void RemoveBpoint(void * hList, int index)
|
||||
{
|
||||
LRESULT response;
|
||||
uint32_t location;
|
||||
LRESULT response;
|
||||
uint32_t location;
|
||||
|
||||
response = SendMessage((HWND)hList, LB_GETITEMDATA, (WPARAM)index, 0);
|
||||
if (response < 0 || response > 0x7FFFFFFFL)
|
||||
{
|
||||
DisplayError(
|
||||
"LB_GETITEMDATA response for %i out of DWORD range.",
|
||||
index
|
||||
);
|
||||
}
|
||||
location = (uint32_t)response;
|
||||
RemoveRSPBreakPoint(location);
|
||||
response = SendMessage((HWND)hList, LB_GETITEMDATA, (WPARAM)index, 0);
|
||||
if (response < 0 || response > 0x7FFFFFFFL)
|
||||
{
|
||||
DisplayError(
|
||||
"LB_GETITEMDATA response for %i out of DWORD range.",
|
||||
index);
|
||||
}
|
||||
location = (uint32_t)response;
|
||||
RemoveRSPBreakPoint(location);
|
||||
}
|
||||
|
||||
void RemoveRSPBreakPoint (DWORD Location)
|
||||
void RemoveRSPBreakPoint(DWORD Location)
|
||||
{
|
||||
int count, location = -1;
|
||||
|
||||
for (count = 0; count < NoOfBpoints; count ++)
|
||||
{
|
||||
if (BPoint[count].Location == Location)
|
||||
{
|
||||
location = count;
|
||||
count = NoOfBpoints;
|
||||
}
|
||||
}
|
||||
|
||||
if (location >= 0)
|
||||
{
|
||||
for (count = location; count < NoOfBpoints - 1; count ++ )
|
||||
{
|
||||
BPoint[count].Location = BPoint[count + 1].Location;
|
||||
}
|
||||
NoOfBpoints -= 1;
|
||||
if (DebugInfo.UpdateBreakPoints)
|
||||
{
|
||||
DebugInfo.UpdateBreakPoints();
|
||||
}
|
||||
}
|
||||
int count, location = -1;
|
||||
|
||||
for (count = 0; count < NoOfBpoints; count++)
|
||||
{
|
||||
if (BPoint[count].Location == Location)
|
||||
{
|
||||
location = count;
|
||||
count = NoOfBpoints;
|
||||
}
|
||||
}
|
||||
|
||||
if (location >= 0)
|
||||
{
|
||||
for (count = location; count < NoOfBpoints - 1; count++)
|
||||
{
|
||||
BPoint[count].Location = BPoint[count + 1].Location;
|
||||
}
|
||||
NoOfBpoints -= 1;
|
||||
if (DebugInfo.UpdateBreakPoints)
|
||||
{
|
||||
DebugInfo.UpdateBreakPoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
#include "Rsp.h"
|
||||
#include <Windows.h>
|
||||
|
||||
#define MaxBPoints 0x30
|
||||
#define MaxBPoints 0x30
|
||||
|
||||
typedef struct {
|
||||
unsigned int Location;
|
||||
typedef struct
|
||||
{
|
||||
unsigned int Location;
|
||||
} BPOINT;
|
||||
|
||||
extern BPOINT BPoint[MaxBPoints];
|
||||
extern int NoOfBpoints;
|
||||
extern int NoOfBpoints;
|
||||
|
||||
void Add_BPoint ( void );
|
||||
void CreateBPPanel ( void * hDlg, rectangle rcBox );
|
||||
void HideBPPanel ( void );
|
||||
void PaintBPPanel ( window_paint ps );
|
||||
void ShowBPPanel ( void );
|
||||
void RefreshBpoints ( void * hList );
|
||||
void RemoveBpoint ( void * hList, int index );
|
||||
void RemoveAllBpoint ( void );
|
||||
void Add_BPoint(void);
|
||||
void CreateBPPanel(void * hDlg, rectangle rcBox);
|
||||
void HideBPPanel(void);
|
||||
void PaintBPPanel(window_paint ps);
|
||||
void ShowBPPanel(void);
|
||||
void RefreshBpoints(void * hList);
|
||||
void RemoveBpoint(void * hList, int index);
|
||||
void RemoveAllBpoint(void);
|
||||
|
||||
int AddRSP_BPoint ( DWORD Location, int Confirm );
|
||||
int CheckForRSPBPoint ( DWORD Location );
|
||||
void RemoveRSPBreakPoint (DWORD Location);
|
||||
int AddRSP_BPoint(DWORD Location, int Confirm);
|
||||
int CheckForRSPBPoint(DWORD Location);
|
||||
void RemoveRSPBreakPoint(DWORD Location);
|
||||
|
|
|
@ -1,137 +1,137 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "Rsp.h"
|
||||
#include "RSP Registers.h"
|
||||
#include "Rsp.h"
|
||||
#include "memory.h"
|
||||
|
||||
// #define RSP_SAFE_DMA // Unoptimized DMA transfers
|
||||
|
||||
void SP_DMA_READ (void)
|
||||
void SP_DMA_READ(void)
|
||||
{
|
||||
uint32_t i, j, Length, Skip, Count, End, addr;
|
||||
uint8_t *Dest, *Source;
|
||||
|
||||
addr = (*RSPInfo.SP_DRAM_ADDR_REG) & 0x00FFFFFF;
|
||||
|
||||
if (addr > 0x7FFFFF)
|
||||
{
|
||||
if (addr > 0x7FFFFF)
|
||||
{
|
||||
DisplayError("SP DMA READ\nSP_DRAM_ADDR_REG not in RDRAM space");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||
{
|
||||
DisplayError("SP DMA READ\nCould not fit copy in memory segment");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Length = ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) | 7) + 1;
|
||||
Skip = (*RSPInfo.SP_RD_LEN_REG >> 20) + Length;
|
||||
Count = ((*RSPInfo.SP_RD_LEN_REG >> 12) & 0xFF) + 1;
|
||||
End = ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7) + (((Count - 1) * Skip) + Length);
|
||||
Dest = ((*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0 ? RSPInfo.IMEM : RSPInfo.DMEM) + ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7);
|
||||
Source = RSPInfo.RDRAM + (addr & ~7);
|
||||
if ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||
{
|
||||
DisplayError("SP DMA READ\nCould not fit copy in memory segment");
|
||||
return;
|
||||
}
|
||||
|
||||
Length = ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) | 7) + 1;
|
||||
Skip = (*RSPInfo.SP_RD_LEN_REG >> 20) + Length;
|
||||
Count = ((*RSPInfo.SP_RD_LEN_REG >> 12) & 0xFF) + 1;
|
||||
End = ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7) + (((Count - 1) * Skip) + Length);
|
||||
Dest = ((*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0 ? RSPInfo.IMEM : RSPInfo.DMEM) + ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7);
|
||||
Source = RSPInfo.RDRAM + (addr & ~7);
|
||||
|
||||
#if defined(RSP_SAFE_DMA)
|
||||
for (j = 0 ; j < Count; j++)
|
||||
{
|
||||
for (i = 0 ; i < Length; i++)
|
||||
{
|
||||
*(uint8_t *)(((size_t)Dest + j * Length + i) ^ 3) = *(uint8_t *)(((size_t)Source + j * Skip + i) ^ 3);
|
||||
}
|
||||
}
|
||||
for (j = 0; j < Count; j++)
|
||||
{
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
*(uint8_t *)(((size_t)Dest + j * Length + i) ^ 3) = *(uint8_t *)(((size_t)Source + j * Skip + i) ^ 3);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if ((Skip & 0x3) == 0)
|
||||
{
|
||||
for (j = 0; j < Count; j++)
|
||||
{
|
||||
memcpy(Dest, Source, Length);
|
||||
Source += Skip;
|
||||
Dest += Length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0 ; j < Count; j++)
|
||||
{
|
||||
for (i = 0 ; i < Length; i++)
|
||||
{
|
||||
*(uint8_t *)(((size_t)Dest + i) ^ 3) = *(uint8_t *)(((size_t)Source + i) ^ 3);
|
||||
}
|
||||
Source += Skip;
|
||||
Dest += Length;
|
||||
}
|
||||
}
|
||||
if ((Skip & 0x3) == 0)
|
||||
{
|
||||
for (j = 0; j < Count; j++)
|
||||
{
|
||||
memcpy(Dest, Source, Length);
|
||||
Source += Skip;
|
||||
Dest += Length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < Count; j++)
|
||||
{
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
*(uint8_t *)(((size_t)Dest + i) ^ 3) = *(uint8_t *)(((size_t)Source + i) ^ 3);
|
||||
}
|
||||
Source += Skip;
|
||||
Dest += Length;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// TODO: Could this be a problem DMEM to IMEM?
|
||||
if (CPUCore == RecompilerCPU && (*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0)
|
||||
{
|
||||
SetJumpTable(End);
|
||||
}
|
||||
// TODO: Could this be a problem DMEM to IMEM?
|
||||
if (CPUCore == RecompilerCPU && (*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0)
|
||||
{
|
||||
SetJumpTable(End);
|
||||
}
|
||||
|
||||
*RSPInfo.SP_DMA_BUSY_REG = 0;
|
||||
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
*RSPInfo.SP_DMA_BUSY_REG = 0;
|
||||
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
}
|
||||
|
||||
void SP_DMA_WRITE (void)
|
||||
void SP_DMA_WRITE(void)
|
||||
{
|
||||
uint32_t i, j, Length, Skip, Count, addr;
|
||||
uint8_t *Dest, *Source;
|
||||
|
||||
addr = (*RSPInfo.SP_DRAM_ADDR_REG) & 0x00FFFFFF;
|
||||
|
||||
if (addr > 0x7FFFFF)
|
||||
{
|
||||
if (addr > 0x7FFFFF)
|
||||
{
|
||||
DisplayError("SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRAM space");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||
{
|
||||
if ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||
{
|
||||
DisplayError("SP DMA WRITE\nCould not fit copy in memory segment");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Length = ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) | 7) + 1;
|
||||
Skip = (*RSPInfo.SP_WR_LEN_REG >> 20) + Length;
|
||||
Count = ((*RSPInfo.SP_WR_LEN_REG >> 12) & 0xFF) + 1;
|
||||
Dest = RSPInfo.RDRAM + (addr & ~7);
|
||||
Source = ((*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0 ? RSPInfo.IMEM : RSPInfo.DMEM) + ((*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) & ~7);
|
||||
Length = ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) | 7) + 1;
|
||||
Skip = (*RSPInfo.SP_WR_LEN_REG >> 20) + Length;
|
||||
Count = ((*RSPInfo.SP_WR_LEN_REG >> 12) & 0xFF) + 1;
|
||||
Dest = RSPInfo.RDRAM + (addr & ~7);
|
||||
Source = ((*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0 ? RSPInfo.IMEM : RSPInfo.DMEM) + ((*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) & ~7);
|
||||
|
||||
#if defined(RSP_SAFE_DMA)
|
||||
for (j = 0 ; j < Count; j++)
|
||||
{
|
||||
for (i = 0 ; i < Length; i++)
|
||||
{
|
||||
*(uint8_t *)(((size_t)Dest + j * Skip + i) ^ 3) = *(uint8_t *)(((size_t)Source + j * Length + i) ^ 3);
|
||||
}
|
||||
}
|
||||
for (j = 0; j < Count; j++)
|
||||
{
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
*(uint8_t *)(((size_t)Dest + j * Skip + i) ^ 3) = *(uint8_t *)(((size_t)Source + j * Length + i) ^ 3);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if ((Skip & 0x3) == 0)
|
||||
{
|
||||
for (j = 0; j < Count; j++)
|
||||
{
|
||||
memcpy(Dest, Source, Length);
|
||||
Source += Length;
|
||||
Dest += Skip;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0 ; j < Count; j++)
|
||||
{
|
||||
for (i = 0 ; i < Length; i++)
|
||||
{
|
||||
*(uint8_t *)(((size_t)Dest + i) ^ 3) = *(uint8_t *)(((size_t)Source + i) ^ 3);
|
||||
}
|
||||
Source += Length;
|
||||
Dest += Skip;
|
||||
}
|
||||
}
|
||||
if ((Skip & 0x3) == 0)
|
||||
{
|
||||
for (j = 0; j < Count; j++)
|
||||
{
|
||||
memcpy(Dest, Source, Length);
|
||||
Source += Length;
|
||||
Dest += Skip;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < Count; j++)
|
||||
{
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
*(uint8_t *)(((size_t)Dest + i) ^ 3) = *(uint8_t *)(((size_t)Source + i) ^ 3);
|
||||
}
|
||||
Source += Length;
|
||||
Dest += Skip;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*RSPInfo.SP_DMA_BUSY_REG = 0;
|
||||
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
*RSPInfo.SP_DMA_BUSY_REG = 0;
|
||||
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
void SP_DMA_READ ( void );
|
||||
void SP_DMA_WRITE ( void );
|
||||
void SP_DMA_READ(void);
|
||||
void SP_DMA_WRITE(void);
|
||||
|
|
|
@ -1,264 +1,274 @@
|
|||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <Common/StdString.h>
|
||||
#include <Common/File.h>
|
||||
#include <Common/Log.h>
|
||||
#include <Common/StdString.h>
|
||||
#include <Common/path.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "Log.h"
|
||||
#include "Rsp.h"
|
||||
#include "Rsp Registers.h"
|
||||
|
||||
#include "Rsp.h"
|
||||
|
||||
CLog * RDPLog = NULL;
|
||||
CLog * CPULog = NULL;
|
||||
|
||||
void StartCPULog ( void )
|
||||
void StartCPULog(void)
|
||||
{
|
||||
if (CPULog == NULL)
|
||||
{
|
||||
CPath LogFile(CPath::MODULE_DIRECTORY,"RSP_x86Log.txt");
|
||||
LogFile.AppendDirectory("Logs");
|
||||
if (CPULog == NULL)
|
||||
{
|
||||
CPath LogFile(CPath::MODULE_DIRECTORY, "RSP_x86Log.txt");
|
||||
LogFile.AppendDirectory("Logs");
|
||||
|
||||
CPULog = new CLog;
|
||||
CPULog->Open(LogFile);
|
||||
}
|
||||
CPULog = new CLog;
|
||||
CPULog->Open(LogFile);
|
||||
}
|
||||
}
|
||||
|
||||
void StopCPULog ( void )
|
||||
void StopCPULog(void)
|
||||
{
|
||||
if (CPULog != NULL)
|
||||
{
|
||||
delete CPULog;
|
||||
CPULog = NULL;
|
||||
}
|
||||
if (CPULog != NULL)
|
||||
{
|
||||
delete CPULog;
|
||||
CPULog = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CPU_Message ( const char * Message, ...)
|
||||
void CPU_Message(const char * Message, ...)
|
||||
{
|
||||
if (CPULog == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (CPULog == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
stdstr Msg;
|
||||
stdstr Msg;
|
||||
|
||||
va_list args;
|
||||
va_start(args, Message);
|
||||
Msg.ArgFormat(Message,args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, Message);
|
||||
Msg.ArgFormat(Message, args);
|
||||
va_end(args);
|
||||
|
||||
Msg += "\r\n";
|
||||
|
||||
CPULog->Log(Msg.c_str());
|
||||
Msg += "\r\n";
|
||||
|
||||
CPULog->Log(Msg.c_str());
|
||||
}
|
||||
|
||||
void StartRDPLog ( void )
|
||||
void StartRDPLog(void)
|
||||
{
|
||||
if (RDPLog == NULL)
|
||||
{
|
||||
CPath LogFile(CPath::MODULE_DIRECTORY,"RDP_Log.txt");
|
||||
LogFile.AppendDirectory("Logs");
|
||||
if (RDPLog == NULL)
|
||||
{
|
||||
CPath LogFile(CPath::MODULE_DIRECTORY, "RDP_Log.txt");
|
||||
LogFile.AppendDirectory("Logs");
|
||||
|
||||
RDPLog = new CLog;
|
||||
RDPLog->Open(LogFile);
|
||||
RDPLog->SetMaxFileSize(400 * 1024 * 1024);
|
||||
// RDPLog->SetFlush(true);
|
||||
}
|
||||
RDPLog = new CLog;
|
||||
RDPLog->Open(LogFile);
|
||||
RDPLog->SetMaxFileSize(400 * 1024 * 1024);
|
||||
// RDPLog->SetFlush(true);
|
||||
}
|
||||
}
|
||||
|
||||
void StopRDPLog ( void )
|
||||
void StopRDPLog(void)
|
||||
{
|
||||
if (RDPLog != NULL)
|
||||
{
|
||||
delete RDPLog;
|
||||
RDPLog = NULL;
|
||||
}
|
||||
if (RDPLog != NULL)
|
||||
{
|
||||
delete RDPLog;
|
||||
RDPLog = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void RDP_Message ( const char * Message, ...)
|
||||
void RDP_Message(const char * Message, ...)
|
||||
{
|
||||
if (RDPLog == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (RDPLog == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
stdstr Msg;
|
||||
stdstr Msg;
|
||||
|
||||
va_list args;
|
||||
va_start(args, Message);
|
||||
Msg.ArgFormat(Message,args);
|
||||
va_end(args);
|
||||
va_list args;
|
||||
va_start(args, Message);
|
||||
Msg.ArgFormat(Message, args);
|
||||
va_end(args);
|
||||
|
||||
Msg += "\r\n";
|
||||
Msg += "\r\n";
|
||||
|
||||
RDPLog->Log(Msg.c_str());
|
||||
RDPLog->Log(Msg.c_str());
|
||||
}
|
||||
|
||||
void RDP_LogMT0 ( DWORD PC, int Reg, DWORD Value )
|
||||
void RDP_LogMT0(DWORD PC, int Reg, DWORD Value)
|
||||
{
|
||||
if (RDPLog == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (Reg) {
|
||||
case 0: RDP_Message("%03X: Stored 0x%08X into SP_MEM_ADDR_REG",PC,Value); break;
|
||||
case 1: RDP_Message("%03X: Stored 0x%08X into SP_DRAM_ADDR_REG",PC,Value); break;
|
||||
case 2: RDP_Message("%03X: Stored 0x%08X into SP_RD_LEN_REG",PC,Value); break;
|
||||
case 3: RDP_Message("%03X: Stored 0x%08X into SP_WR_LEN_REG",PC,Value); break;
|
||||
case 4: RDP_Message("%03X: Stored 0x%08X into SP_STATUS_REG",PC,Value); break;
|
||||
case 5: RDP_Message("%03X: Stored 0x%08X into Reg 5 ???",PC,Value); break;
|
||||
case 6: RDP_Message("%03X: Stored 0x%08X into Reg 6 ???",PC,Value); break;
|
||||
case 7: RDP_Message("%03X: Stored 0x%08X into SP_SEMAPHORE_REG",PC,Value); break;
|
||||
case 8: RDP_Message("%03X: Stored 0x%08X into DPC_START_REG",PC,Value); break;
|
||||
case 9: RDP_Message("%03X: Stored 0x%08X into DPC_END_REG",PC,Value); break;
|
||||
case 10: RDP_Message("%03X: Stored 0x%08X into DPC_CURRENT_REG",PC,Value); break;
|
||||
case 11: RDP_Message("%03X: Stored 0x%08X into DPC_STATUS_REG",PC,Value); break;
|
||||
case 12: RDP_Message("%03X: Stored 0x%08X into DPC_CLOCK_REG",PC,Value); break;
|
||||
}
|
||||
if (RDPLog == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (Reg)
|
||||
{
|
||||
case 0: RDP_Message("%03X: Stored 0x%08X into SP_MEM_ADDR_REG", PC, Value); break;
|
||||
case 1: RDP_Message("%03X: Stored 0x%08X into SP_DRAM_ADDR_REG", PC, Value); break;
|
||||
case 2: RDP_Message("%03X: Stored 0x%08X into SP_RD_LEN_REG", PC, Value); break;
|
||||
case 3: RDP_Message("%03X: Stored 0x%08X into SP_WR_LEN_REG", PC, Value); break;
|
||||
case 4: RDP_Message("%03X: Stored 0x%08X into SP_STATUS_REG", PC, Value); break;
|
||||
case 5: RDP_Message("%03X: Stored 0x%08X into Reg 5 ???", PC, Value); break;
|
||||
case 6: RDP_Message("%03X: Stored 0x%08X into Reg 6 ???", PC, Value); break;
|
||||
case 7: RDP_Message("%03X: Stored 0x%08X into SP_SEMAPHORE_REG", PC, Value); break;
|
||||
case 8: RDP_Message("%03X: Stored 0x%08X into DPC_START_REG", PC, Value); break;
|
||||
case 9: RDP_Message("%03X: Stored 0x%08X into DPC_END_REG", PC, Value); break;
|
||||
case 10: RDP_Message("%03X: Stored 0x%08X into DPC_CURRENT_REG", PC, Value); break;
|
||||
case 11: RDP_Message("%03X: Stored 0x%08X into DPC_STATUS_REG", PC, Value); break;
|
||||
case 12: RDP_Message("%03X: Stored 0x%08X into DPC_CLOCK_REG", PC, Value); break;
|
||||
}
|
||||
}
|
||||
|
||||
void RDP_LogMF0 ( DWORD PC, int Reg )
|
||||
void RDP_LogMF0(DWORD PC, int Reg)
|
||||
{
|
||||
switch (Reg) {
|
||||
case 8: RDP_Message("%03X: Read 0x%08X from DPC_START_REG",PC,*RSPInfo.DPC_START_REG); break;
|
||||
case 9: RDP_Message("%03X: Read 0x%08X from DPC_END_REG",PC,*RSPInfo.DPC_END_REG); break;
|
||||
case 10: RDP_Message("%03X: Read 0x%08X from DPC_CURRENT_REG",PC,*RSPInfo.DPC_CURRENT_REG); break;
|
||||
case 11: RDP_Message("%03X: Read 0x%08X from DPC_STATUS_REG",PC,*RSPInfo.DPC_STATUS_REG); break;
|
||||
case 12: RDP_Message("%03X: Read 0x%08X from DPC_CLOCK_REG",PC,*RSPInfo.DPC_CLOCK_REG); break;
|
||||
}
|
||||
switch (Reg)
|
||||
{
|
||||
case 8: RDP_Message("%03X: Read 0x%08X from DPC_START_REG", PC, *RSPInfo.DPC_START_REG); break;
|
||||
case 9: RDP_Message("%03X: Read 0x%08X from DPC_END_REG", PC, *RSPInfo.DPC_END_REG); break;
|
||||
case 10: RDP_Message("%03X: Read 0x%08X from DPC_CURRENT_REG", PC, *RSPInfo.DPC_CURRENT_REG); break;
|
||||
case 11: RDP_Message("%03X: Read 0x%08X from DPC_STATUS_REG", PC, *RSPInfo.DPC_STATUS_REG); break;
|
||||
case 12: RDP_Message("%03X: Read 0x%08X from DPC_CLOCK_REG", PC, *RSPInfo.DPC_CLOCK_REG); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RDP_LogDlist ( void )
|
||||
void RDP_LogDlist(void)
|
||||
{
|
||||
if (RDPLog == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DWORD Length = *RSPInfo.DPC_END_REG - *RSPInfo.DPC_CURRENT_REG;
|
||||
RDP_Message(" Dlist length = %d bytes",Length);
|
||||
|
||||
DWORD Pos = *RSPInfo.DPC_CURRENT_REG;
|
||||
while (Pos < *RSPInfo.DPC_END_REG)
|
||||
{
|
||||
char Hex[100], Ascii[30];
|
||||
DWORD count;
|
||||
if (RDPLog == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DWORD Length = *RSPInfo.DPC_END_REG - *RSPInfo.DPC_CURRENT_REG;
|
||||
RDP_Message(" Dlist length = %d bytes", Length);
|
||||
|
||||
memset(&Hex,0,sizeof(Hex));
|
||||
memset(&Ascii,0,sizeof(Ascii));
|
||||
DWORD Pos = *RSPInfo.DPC_CURRENT_REG;
|
||||
while (Pos < *RSPInfo.DPC_END_REG)
|
||||
{
|
||||
char Hex[100], Ascii[30];
|
||||
DWORD count;
|
||||
|
||||
BYTE * Mem = RSPInfo.DMEM;
|
||||
if ((*RSPInfo.DPC_STATUS_REG & DPC_STATUS_XBUS_DMEM_DMA) == 0)
|
||||
{
|
||||
Mem = RSPInfo.RDRAM;
|
||||
}
|
||||
memset(&Hex, 0, sizeof(Hex));
|
||||
memset(&Ascii, 0, sizeof(Ascii));
|
||||
|
||||
for (count = 0; count < 0x10; count ++, Pos++ ) {
|
||||
char tmp[3];
|
||||
if ((count % 4) != 0 || count == 0) {
|
||||
sprintf(tmp,"%02X",Mem[Pos]);
|
||||
strcat(Hex," ");
|
||||
strcat(Hex,tmp);
|
||||
} else {
|
||||
sprintf(tmp,"%02X",Mem[Pos]);
|
||||
strcat(Hex," - ");
|
||||
strcat(Hex,tmp);
|
||||
}
|
||||
BYTE * Mem = RSPInfo.DMEM;
|
||||
if ((*RSPInfo.DPC_STATUS_REG & DPC_STATUS_XBUS_DMEM_DMA) == 0)
|
||||
{
|
||||
Mem = RSPInfo.RDRAM;
|
||||
}
|
||||
|
||||
|
||||
if (Mem[Pos] < 30 || Mem[Pos] > 127) {
|
||||
strcat(Ascii,".");
|
||||
} else {
|
||||
sprintf(tmp,"%c",Mem[Pos]);
|
||||
strcat(Ascii,tmp);
|
||||
}
|
||||
}
|
||||
RDP_Message(" %s %s",Hex, Ascii);
|
||||
}
|
||||
for (count = 0; count < 0x10; count++, Pos++)
|
||||
{
|
||||
char tmp[3];
|
||||
if ((count % 4) != 0 || count == 0)
|
||||
{
|
||||
sprintf(tmp, "%02X", Mem[Pos]);
|
||||
strcat(Hex, " ");
|
||||
strcat(Hex, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(tmp, "%02X", Mem[Pos]);
|
||||
strcat(Hex, " - ");
|
||||
strcat(Hex, tmp);
|
||||
}
|
||||
|
||||
if (Mem[Pos] < 30 || Mem[Pos] > 127)
|
||||
{
|
||||
strcat(Ascii, ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(tmp, "%c", Mem[Pos]);
|
||||
strcat(Ascii, tmp);
|
||||
}
|
||||
}
|
||||
RDP_Message(" %s %s", Hex, Ascii);
|
||||
}
|
||||
}
|
||||
|
||||
void RDP_LogLoc ( DWORD /*PC*/ )
|
||||
void RDP_LogLoc(DWORD /*PC*/)
|
||||
{
|
||||
// RDP_Message("%03X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X",PC, RSP_GPR[26].UW, *(DWORD *)&RSPInfo.IMEM[0xDBC],
|
||||
// RSP_Flags[0].UW, RSP_Vect[0].UW[0],RSP_Vect[0].UW[1],RSP_Vect[0].UW[2],RSP_Vect[0].UW[3],
|
||||
// RSP_Vect[28].UW[0],RSP_Vect[28].UW[1],RSP_Vect[28].UW[2],RSP_Vect[28].UW[3],RSP_Vect[31].UW[0]);
|
||||
// RDP_Message("%03X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X",PC, RSP_GPR[26].UW, *(DWORD *)&RSPInfo.IMEM[0xDBC],
|
||||
// RSP_Flags[0].UW, RSP_Vect[0].UW[0],RSP_Vect[0].UW[1],RSP_Vect[0].UW[2],RSP_Vect[0].UW[3],
|
||||
// RSP_Vect[28].UW[0],RSP_Vect[28].UW[1],RSP_Vect[28].UW[2],RSP_Vect[28].UW[3],RSP_Vect[31].UW[0]);
|
||||
}
|
||||
|
||||
|
||||
#ifdef old
|
||||
|
||||
#include <windows.h>
|
||||
#include "RSP Registers.h"
|
||||
#include "log.h"
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef Log_x86Code
|
||||
static HANDLE hCPULogFile = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GenerateLog
|
||||
static HANDLE hLogFile = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef Log_x86Code
|
||||
void CPU_Message (char * Message, ...) {
|
||||
DWORD dwWritten;
|
||||
char Msg[400];
|
||||
va_list ap;
|
||||
void CPU_Message(char * Message, ...)
|
||||
{
|
||||
DWORD dwWritten;
|
||||
char Msg[400];
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, Message );
|
||||
vsprintf( Msg, Message, ap );
|
||||
va_end( ap );
|
||||
|
||||
strcat(Msg,"\r\n");
|
||||
WriteFile( hCPULogFile,Msg,strlen(Msg),&dwWritten,NULL );
|
||||
va_start(ap, Message);
|
||||
vsprintf(Msg, Message, ap);
|
||||
va_end(ap);
|
||||
|
||||
strcat(Msg, "\r\n");
|
||||
WriteFile(hCPULogFile, Msg, strlen(Msg), &dwWritten, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GenerateLog
|
||||
void Log_Message (char * Message, ...) {
|
||||
DWORD dwWritten;
|
||||
char Msg[400];
|
||||
va_list ap;
|
||||
void Log_Message(char * Message, ...)
|
||||
{
|
||||
DWORD dwWritten;
|
||||
char Msg[400];
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, Message );
|
||||
vsprintf( Msg, Message, ap );
|
||||
va_end( ap );
|
||||
|
||||
strcat(Msg,"\r\n");
|
||||
va_start(ap, Message);
|
||||
vsprintf(Msg, Message, ap);
|
||||
va_end(ap);
|
||||
|
||||
WriteFile( hLogFile,Msg,strlen(Msg),&dwWritten,NULL );
|
||||
strcat(Msg, "\r\n");
|
||||
|
||||
WriteFile(hLogFile, Msg, strlen(Msg), &dwWritten, NULL);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef Log_x86Code
|
||||
void Start_x86_Log (void) {
|
||||
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
|
||||
char File[_MAX_PATH];
|
||||
void Start_x86_Log(void)
|
||||
{
|
||||
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR];
|
||||
char File[_MAX_PATH];
|
||||
|
||||
GetModuleFileName(NULL,path_buffer,_MAX_PATH);
|
||||
_splitpath(path_buffer, drive, dir, NULL, NULL);
|
||||
|
||||
sprintf(File, "%s%s\\RSPx86Log.log", drive, dir);
|
||||
GetModuleFileName(NULL, path_buffer, _MAX_PATH);
|
||||
_splitpath(path_buffer, drive, dir, NULL, NULL);
|
||||
|
||||
hCPULogFile = CreateFile(File,GENERIC_WRITE, FILE_SHARE_READ,NULL,CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
SetFilePointer(hCPULogFile,0,NULL,FILE_BEGIN);
|
||||
sprintf(File, "%s%s\\RSPx86Log.log", drive, dir);
|
||||
|
||||
hCPULogFile = CreateFile(File, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
SetFilePointer(hCPULogFile, 0, NULL, FILE_BEGIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GenerateLog
|
||||
void Log_MT_CP0 ( unsigned int PC, int CP0Reg, int Value ) {
|
||||
switch (CP0Reg) {
|
||||
//case 0: Log_Message("%03X: Stored 0x%08X in SP_MEM_ADDR_REG",PC,Value); break;
|
||||
//case 1: Log_Message("%03X: Stored 0x%08X in SP_DRAM_ADDR_REG",PC,Value); break;
|
||||
//case 2: Log_Message("%03X: Stored 0x%08X in SP_RD_LEN_REG",PC,Value); break;
|
||||
case 3:
|
||||
//Log_Message("%03X: Stored 0x%08X in SP_WR_LEN_REG",PC,Value);
|
||||
Log_Message("Instruction: %08X%08X",RSP_GPR[25].UW,RSP_GPR[24].UW);
|
||||
//Log_Message("");
|
||||
break;
|
||||
/*case 4: Log_Message("%03X: Stored 0x%08X in SP_STATUS_REG",PC,Value); break;
|
||||
void Log_MT_CP0(unsigned int PC, int CP0Reg, int Value)
|
||||
{
|
||||
switch (CP0Reg)
|
||||
{
|
||||
//case 0: Log_Message("%03X: Stored 0x%08X in SP_MEM_ADDR_REG",PC,Value); break;
|
||||
//case 1: Log_Message("%03X: Stored 0x%08X in SP_DRAM_ADDR_REG",PC,Value); break;
|
||||
//case 2: Log_Message("%03X: Stored 0x%08X in SP_RD_LEN_REG",PC,Value); break;
|
||||
case 3:
|
||||
//Log_Message("%03X: Stored 0x%08X in SP_WR_LEN_REG",PC,Value);
|
||||
Log_Message("Instruction: %08X%08X", RSP_GPR[25].UW, RSP_GPR[24].UW);
|
||||
//Log_Message("");
|
||||
break;
|
||||
/*case 4: Log_Message("%03X: Stored 0x%08X in SP_STATUS_REG",PC,Value); break;
|
||||
case 5: Log_Message("%03X: Stored 0x%08X in SP_DMA_FULL_REG",PC,Value); break;
|
||||
case 6: Log_Message("%03X: Stored 0x%08X in SP_DMA_BUSY_REG",PC,Value); break;
|
||||
case 7: Log_Message("%03X: Stored 0x%08X in SP_SEMAPHORE_REG",PC,Value); break;
|
||||
|
@ -273,37 +283,42 @@ void Log_MT_CP0 ( unsigned int PC, int CP0Reg, int Value ) {
|
|||
default:
|
||||
Log_Message("%03X: Unknown RSP CP0 register %d",PC,CP0Reg);
|
||||
break;*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Start_Log (void) {
|
||||
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
|
||||
char File[_MAX_PATH];
|
||||
void Start_Log(void)
|
||||
{
|
||||
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR];
|
||||
char File[_MAX_PATH];
|
||||
|
||||
GetModuleFileName(NULL,path_buffer,_MAX_PATH);
|
||||
_splitpath(path_buffer, drive, dir, NULL, NULL);
|
||||
|
||||
sprintf(File, "%s%s\\RSP.log", drive, dir);
|
||||
|
||||
hLogFile = CreateFile(File,GENERIC_WRITE, FILE_SHARE_READ,NULL,CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
|
||||
GetModuleFileName(NULL, path_buffer, _MAX_PATH);
|
||||
_splitpath(path_buffer, drive, dir, NULL, NULL);
|
||||
|
||||
sprintf(File, "%s%s\\RSP.log", drive, dir);
|
||||
|
||||
hLogFile = CreateFile(File, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
SetFilePointer(hLogFile, 0, NULL, FILE_BEGIN);
|
||||
}
|
||||
|
||||
void Stop_Log (void) {
|
||||
if (hLogFile) {
|
||||
CloseHandle(hLogFile);
|
||||
hLogFile = NULL;
|
||||
}
|
||||
void Stop_Log(void)
|
||||
{
|
||||
if (hLogFile)
|
||||
{
|
||||
CloseHandle(hLogFile);
|
||||
hLogFile = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Log_x86Code
|
||||
void Stop_x86_Log (void) {
|
||||
if (hCPULogFile) {
|
||||
CloseHandle(hCPULogFile);
|
||||
hCPULogFile = NULL;
|
||||
}
|
||||
void Stop_x86_Log(void)
|
||||
{
|
||||
if (hCPULogFile)
|
||||
{
|
||||
CloseHandle(hCPULogFile);
|
||||
hCPULogFile = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
void StartCPULog ( void );
|
||||
void StopCPULog ( void );
|
||||
void CPU_Message ( const char * Message, ...);
|
||||
#include <windows.h>
|
||||
|
||||
void StartRDPLog ( void );
|
||||
void StopRDPLog ( void );
|
||||
void RDP_Message ( const char * Message, ...);
|
||||
void RDP_LogDlist ( void );
|
||||
void RDP_LogMT0 ( DWORD PC, int Reg, DWORD Value );
|
||||
void RDP_LogMF0 ( DWORD PC, int Reg );
|
||||
void RDP_LogLoc ( DWORD PC );
|
||||
void StartCPULog(void);
|
||||
void StopCPULog(void);
|
||||
void CPU_Message(const char * Message, ...);
|
||||
|
||||
void StartRDPLog(void);
|
||||
void StopRDPLog(void);
|
||||
void RDP_Message(const char * Message, ...);
|
||||
void RDP_LogDlist(void);
|
||||
void RDP_LogMT0(DWORD PC, int Reg, DWORD Value);
|
||||
void RDP_LogMF0(DWORD PC, int Reg);
|
||||
void RDP_LogLoc(DWORD PC);
|
File diff suppressed because it is too large
Load Diff
|
@ -1,40 +1,40 @@
|
|||
#include "Types.h"
|
||||
|
||||
int AllocateMemory ( void );
|
||||
void FreeMemory ( void );
|
||||
void SetJumpTable (uint32_t End);
|
||||
int AllocateMemory(void);
|
||||
void FreeMemory(void);
|
||||
void SetJumpTable(uint32_t End);
|
||||
|
||||
extern uint8_t * RecompCode, * RecompCodeSecondary, * RecompPos;
|
||||
extern uint8_t *RecompCode, *RecompCodeSecondary, *RecompPos;
|
||||
extern void ** JumpTable;
|
||||
extern uint32_t Table;
|
||||
|
||||
void RSP_LB_DMEM ( uint32_t Addr, uint8_t * Value );
|
||||
void RSP_LBV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LDV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LFV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LH_DMEM ( uint32_t Addr, uint16_t * Value );
|
||||
void RSP_LHV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LLV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LPV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LRV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LQV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LSV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LTV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LUV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LW_DMEM ( uint32_t Addr, uint32_t * Value );
|
||||
void RSP_LW_IMEM ( uint32_t Addr, uint32_t * Value );
|
||||
void RSP_SB_DMEM ( uint32_t Addr, uint8_t Value );
|
||||
void RSP_SBV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_SDV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_SFV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_SH_DMEM ( uint32_t Addr, uint16_t Value );
|
||||
void RSP_SHV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_SLV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_SPV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_SQV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_SRV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_SSV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_STV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_SUV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_SW_DMEM ( uint32_t Addr, uint32_t Value );
|
||||
void RSP_SWV_DMEM ( uint32_t Addr, int vect, int element );
|
||||
void RSP_LB_DMEM(uint32_t Addr, uint8_t * Value);
|
||||
void RSP_LBV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LDV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LFV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LH_DMEM(uint32_t Addr, uint16_t * Value);
|
||||
void RSP_LHV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LLV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LPV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LRV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LQV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LSV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LTV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LUV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_LW_DMEM(uint32_t Addr, uint32_t * Value);
|
||||
void RSP_LW_IMEM(uint32_t Addr, uint32_t * Value);
|
||||
void RSP_SB_DMEM(uint32_t Addr, uint8_t Value);
|
||||
void RSP_SBV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_SDV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_SFV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_SH_DMEM(uint32_t Addr, uint16_t Value);
|
||||
void RSP_SHV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_SLV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_SPV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_SQV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_SRV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_SSV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_STV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_SUV_DMEM(uint32_t Addr, int vect, int element);
|
||||
void RSP_SW_DMEM(uint32_t Addr, uint32_t Value);
|
||||
void RSP_SWV_DMEM(uint32_t Addr, int vect, int element);
|
||||
|
|
|
@ -9,12 +9,15 @@ cd /d %origdir%
|
|||
set ScanDir[0]="%base_dir%\Source\Common"
|
||||
set ScanDir[1]="%base_dir%\Source\Project64"
|
||||
set ScanDir[2]="%base_dir%\Source\Project64-core"
|
||||
set ScanDir[3]="%base_dir%\Source\RSP"
|
||||
|
||||
set ScanFiles[0]="*.cpp"
|
||||
set ScanFiles[1]="*.h"
|
||||
|
||||
set Exclude[0]="%base_dir%\Source\Project64-core\Version.h"
|
||||
set Exclude[1]="%base_dir%\Source\Project64\UserInterface\resource.h"
|
||||
set Exclude[2]="%base_dir%\Source\RSP\Version.h"
|
||||
set Exclude[3]="%base_dir%\Source\RSP\resource.h"
|
||||
|
||||
set ValidParam=0
|
||||
if "%1" == "check" set ValidParam=1
|
||||
|
|
Loading…
Reference in New Issue