Merge branch 'master' into lool
Conflicts: Source/RSP/Interpreter Ops.c
This commit is contained in:
commit
ee13bf0c82
|
@ -167,7 +167,7 @@ void Build_RSP ( void )
|
|||
BYTE Temp;
|
||||
|
||||
Temp = Indx[i].B[count];
|
||||
Indx[i].B[count] = Indx[i].B[7 - count];
|
||||
Indx[i].B[count] = Indx[i].B[7 - count];
|
||||
Indx[i].B[7 - count] = Temp;
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ __declspec(dllexport) DWORD DoRspCycles ( DWORD Cycles )
|
|||
/* if (*RSPInfo.SP_STATUS_REG & SP_STATUS_SIG0)
|
||||
{
|
||||
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_SIG0;
|
||||
*RSPInfo.MI_INTR_REG |= MI_INTR_SP;
|
||||
*RSPInfo.MI_INTR_REG |= MI_INTR_SP;
|
||||
RSPInfo.CheckInterrupts();
|
||||
return Cycles;
|
||||
}
|
||||
|
|
|
@ -432,7 +432,7 @@ DWORD RunInterpreterCPU(DWORD Cycles) {
|
|||
SetRSPCommandViewto( *PrgCount );
|
||||
UpdateRSPRegistersScreen();
|
||||
while ( WaitingForStep == TRUE ){
|
||||
Sleep(20);
|
||||
Sleep(20);
|
||||
if (!Stepping_Commands) {
|
||||
WaitingForStep = FALSE;
|
||||
}
|
||||
|
@ -448,22 +448,22 @@ DWORD RunInterpreterCPU(DWORD Cycles) {
|
|||
|
||||
switch (RSP_NextInstruction) {
|
||||
case NORMAL:
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
break;
|
||||
case DELAY_SLOT:
|
||||
RSP_NextInstruction = JUMP;
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
break;
|
||||
case JUMP:
|
||||
RSP_NextInstruction = NORMAL;
|
||||
*PrgCount = RSP_JumpTo;
|
||||
break;
|
||||
case SINGLE_STEP:
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
RSP_NextInstruction = SINGLE_STEP_DONE;
|
||||
break;
|
||||
case SINGLE_STEP_DONE:
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
*PrgCount = (*PrgCount + 4) & 0xFFC;
|
||||
*RSPInfo.SP_STATUS_REG |= SP_STATUS_HALT;
|
||||
RSP_Running = FALSE;
|
||||
break;
|
||||
|
@ -472,3 +472,18 @@ DWORD RunInterpreterCPU(DWORD Cycles) {
|
|||
return Cycles;
|
||||
}
|
||||
|
||||
unsigned int RSP_branch_if(int condition)
|
||||
{
|
||||
unsigned int new_PC;
|
||||
|
||||
/* RSP_NextInstruction = DELAY_SLOT; */
|
||||
if (condition)
|
||||
{
|
||||
new_PC = *PrgCount + 4 + ((short)RSPOpC.offset << 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_PC = *PrgCount + 4 + 4;
|
||||
}
|
||||
return (new_PC & 0xFFC);
|
||||
}
|
||||
|
|
|
@ -38,5 +38,11 @@
|
|||
|
||||
extern DWORD RSP_NextInstruction, RSP_JumpTo, RSP_MfStatusCount;
|
||||
|
||||
/*
|
||||
* standard MIPS PC-relative branch
|
||||
* returns the new PC, based on whether the condition passes
|
||||
*/
|
||||
unsigned int RSP_branch_if(int condition);
|
||||
|
||||
void BuildInterpreterCPU(void);
|
||||
DWORD RunInterpreterCPU(DWORD Cycles);
|
||||
|
|
|
@ -63,38 +63,22 @@ void RSP_Opcode_JAL ( void ) {
|
|||
|
||||
void RSP_Opcode_BEQ ( void ) {
|
||||
RSP_NextInstruction = DELAY_SLOT;
|
||||
if (RSP_GPR[RSPOpC.rs].W == RSP_GPR[RSPOpC.rt].W) {
|
||||
RSP_JumpTo = ( *PrgCount + ((short)RSPOpC.offset << 2) + 4 ) & 0xFFC;
|
||||
} else {
|
||||
RSP_JumpTo = ( *PrgCount + 8 ) & 0xFFC;
|
||||
}
|
||||
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W == RSP_GPR[RSPOpC.rt].W);
|
||||
}
|
||||
|
||||
void RSP_Opcode_BNE ( void ) {
|
||||
RSP_NextInstruction = DELAY_SLOT;
|
||||
if (RSP_GPR[RSPOpC.rs].W != RSP_GPR[RSPOpC.rt].W) {
|
||||
RSP_JumpTo = ( *PrgCount + ((short)RSPOpC.offset << 2) + 4 ) & 0xFFC;
|
||||
} else {
|
||||
RSP_JumpTo = ( *PrgCount + 8 ) & 0xFFC;
|
||||
}
|
||||
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W != RSP_GPR[RSPOpC.rt].W);
|
||||
}
|
||||
|
||||
void RSP_Opcode_BLEZ ( void ) {
|
||||
RSP_NextInstruction = DELAY_SLOT;
|
||||
if (RSP_GPR[RSPOpC.rs].W <= 0) {
|
||||
RSP_JumpTo = ( *PrgCount + ((short)RSPOpC.offset << 2) + 4 ) & 0xFFC;
|
||||
} else {
|
||||
RSP_JumpTo = ( *PrgCount + 8 ) & 0xFFC;
|
||||
}
|
||||
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W <= 0);
|
||||
}
|
||||
|
||||
void RSP_Opcode_BGTZ ( void ) {
|
||||
RSP_NextInstruction = DELAY_SLOT;
|
||||
if (RSP_GPR[RSPOpC.rs].W > 0) {
|
||||
RSP_JumpTo = ( *PrgCount + ((short)RSPOpC.offset << 2) + 4 ) & 0xFFC;
|
||||
} else {
|
||||
RSP_JumpTo = ( *PrgCount + 8 ) & 0xFFC;
|
||||
}
|
||||
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W > 0);
|
||||
}
|
||||
|
||||
void RSP_Opcode_ADDI ( void ) {
|
||||
|
@ -106,19 +90,11 @@ void RSP_Opcode_ADDIU ( void ) {
|
|||
}
|
||||
|
||||
void RSP_Opcode_SLTI (void) {
|
||||
if (RSP_GPR[RSPOpC.rs].W < (int16_t)RSPOpC.immediate) {
|
||||
RSP_GPR[RSPOpC.rt].W = 1;
|
||||
} else {
|
||||
RSP_GPR[RSPOpC.rt].W = 0;
|
||||
}
|
||||
RSP_GPR[RSPOpC.rt].W = (RSP_GPR[RSPOpC.rs].W < (int16_t)RSPOpC.immediate) ? 1 : 0;
|
||||
}
|
||||
|
||||
void RSP_Opcode_SLTIU (void) {
|
||||
if (RSP_GPR[RSPOpC.rs].UW < (uint32_t)(int16_t)RSPOpC.immediate) {
|
||||
RSP_GPR[RSPOpC.rt].W = 1;
|
||||
} else {
|
||||
RSP_GPR[RSPOpC.rt].W = 0;
|
||||
}
|
||||
RSP_GPR[RSPOpC.rt].W = (RSP_GPR[RSPOpC.rs].UW < (uint32_t)(int16_t)RSPOpC.immediate) ? 1 : 0;
|
||||
}
|
||||
|
||||
void RSP_Opcode_ANDI ( void ) {
|
||||
|
@ -275,58 +251,34 @@ void RSP_Special_NOR (void) {
|
|||
}
|
||||
|
||||
void RSP_Special_SLT (void) {
|
||||
if (RSP_GPR[RSPOpC.rs].W < RSP_GPR[RSPOpC.rt].W) {
|
||||
RSP_GPR[RSPOpC.rd].UW = 1;
|
||||
} else {
|
||||
RSP_GPR[RSPOpC.rd].UW = 0;
|
||||
}
|
||||
RSP_GPR[RSPOpC.rd].UW = (RSP_GPR[RSPOpC.rs].W < RSP_GPR[RSPOpC.rt].W) ? 1 : 0;
|
||||
}
|
||||
|
||||
void RSP_Special_SLTU (void) {
|
||||
if (RSP_GPR[RSPOpC.rs].UW < RSP_GPR[RSPOpC.rt].UW) {
|
||||
RSP_GPR[RSPOpC.rd].UW = 1;
|
||||
} else {
|
||||
RSP_GPR[RSPOpC.rd].UW = 0;
|
||||
}
|
||||
RSP_GPR[RSPOpC.rd].UW = (RSP_GPR[RSPOpC.rs].UW < RSP_GPR[RSPOpC.rt].UW) ? 1 : 0;
|
||||
}
|
||||
|
||||
/********************** R4300i OpCodes: RegImm **********************/
|
||||
void RSP_Opcode_BLTZ ( void ) {
|
||||
RSP_NextInstruction = DELAY_SLOT;
|
||||
if (RSP_GPR[RSPOpC.rs].W < 0) {
|
||||
RSP_JumpTo = ( *PrgCount + ((short)RSPOpC.offset << 2) + 4 ) & 0xFFC;
|
||||
} else {
|
||||
RSP_JumpTo = ( *PrgCount + 8 ) & 0xFFC;
|
||||
}
|
||||
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W < 0);
|
||||
}
|
||||
|
||||
void RSP_Opcode_BGEZ ( void ) {
|
||||
RSP_NextInstruction = DELAY_SLOT;
|
||||
if (RSP_GPR[RSPOpC.rs].W >= 0) {
|
||||
RSP_JumpTo = ( *PrgCount + ((short)RSPOpC.offset << 2) + 4 ) & 0xFFC;
|
||||
} else {
|
||||
RSP_JumpTo = ( *PrgCount + 8 ) & 0xFFC;
|
||||
}
|
||||
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W >= 0);
|
||||
}
|
||||
|
||||
void RSP_Opcode_BLTZAL ( void ) {
|
||||
RSP_NextInstruction = DELAY_SLOT;
|
||||
RSP_GPR[31].UW = ( *PrgCount + 8 ) & 0xFFC;
|
||||
if (RSP_GPR[RSPOpC.rs].W < 0) {
|
||||
RSP_JumpTo = ( *PrgCount + ((short)RSPOpC.offset << 2) + 4 ) & 0xFFC;
|
||||
} else {
|
||||
RSP_JumpTo = ( *PrgCount + 8 ) & 0xFFC;
|
||||
}
|
||||
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W < 0);
|
||||
}
|
||||
|
||||
void RSP_Opcode_BGEZAL ( void ) {
|
||||
RSP_NextInstruction = DELAY_SLOT;
|
||||
RSP_GPR[31].UW = ( *PrgCount + 8 ) & 0xFFC;
|
||||
if (RSP_GPR[RSPOpC.rs].W >= 0) {
|
||||
RSP_JumpTo = ( *PrgCount + ((short)RSPOpC.offset << 2) + 4 ) & 0xFFC;
|
||||
} else {
|
||||
RSP_JumpTo = ( *PrgCount + 8 ) & 0xFFC;
|
||||
}
|
||||
RSP_JumpTo = RSP_branch_if(RSP_GPR[RSPOpC.rs].W >= 0);
|
||||
}
|
||||
|
||||
/************************** Cop0 functions *************************/
|
||||
|
@ -340,7 +292,7 @@ void RSP_Cop0_MF (void) {
|
|||
case 1: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_DRAM_ADDR_REG; break;
|
||||
case 4:
|
||||
RSP_MfStatusCount += 1;
|
||||
RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_STATUS_REG;
|
||||
RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_STATUS_REG;
|
||||
if (RSP_MfStatusCount > 10)
|
||||
{
|
||||
RSP_Running = FALSE;
|
||||
|
@ -377,12 +329,12 @@ void RSP_Cop0_MT (void) {
|
|||
case 0: *RSPInfo.SP_MEM_ADDR_REG = RSP_GPR[RSPOpC.rt].UW; break;
|
||||
case 1: *RSPInfo.SP_DRAM_ADDR_REG = RSP_GPR[RSPOpC.rt].UW; break;
|
||||
case 2:
|
||||
*RSPInfo.SP_RD_LEN_REG = RSP_GPR[RSPOpC.rt].UW;
|
||||
SP_DMA_READ();
|
||||
*RSPInfo.SP_RD_LEN_REG = RSP_GPR[RSPOpC.rt].UW;
|
||||
SP_DMA_READ();
|
||||
break;
|
||||
case 3:
|
||||
*RSPInfo.SP_WR_LEN_REG = RSP_GPR[RSPOpC.rt].UW;
|
||||
SP_DMA_WRITE();
|
||||
*RSPInfo.SP_WR_LEN_REG = RSP_GPR[RSPOpC.rt].UW;
|
||||
SP_DMA_WRITE();
|
||||
break;
|
||||
case 4:
|
||||
if ( ( RSP_GPR[RSPOpC.rt].W & SP_CLR_HALT ) != 0) { *RSPInfo.SP_STATUS_REG &= ~SP_STATUS_HALT; }
|
||||
|
@ -397,7 +349,7 @@ void RSP_Cop0_MT (void) {
|
|||
}
|
||||
if ( ( RSP_GPR[RSPOpC.rt].W & SP_CLR_SSTEP ) != 0)
|
||||
{
|
||||
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_SSTEP;
|
||||
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_SSTEP;
|
||||
}
|
||||
if ( ( RSP_GPR[RSPOpC.rt].W & SP_SET_SSTEP ) != 0)
|
||||
{
|
||||
|
@ -425,11 +377,11 @@ void RSP_Cop0_MT (void) {
|
|||
break;
|
||||
case 7: *RSPInfo.SP_SEMAPHORE_REG = 0; break;
|
||||
case 8:
|
||||
*RSPInfo.DPC_START_REG = RSP_GPR[RSPOpC.rt].UW;
|
||||
*RSPInfo.DPC_CURRENT_REG = RSP_GPR[RSPOpC.rt].UW;
|
||||
*RSPInfo.DPC_START_REG = RSP_GPR[RSPOpC.rt].UW;
|
||||
*RSPInfo.DPC_CURRENT_REG = RSP_GPR[RSPOpC.rt].UW;
|
||||
break;
|
||||
case 9:
|
||||
*RSPInfo.DPC_END_REG = RSP_GPR[RSPOpC.rt].UW;
|
||||
*RSPInfo.DPC_END_REG = RSP_GPR[RSPOpC.rt].UW;
|
||||
RDP_LogDlist();
|
||||
if (RSPInfo.ProcessRdpList != NULL) { RSPInfo.ProcessRdpList(); }
|
||||
break;
|
||||
|
@ -498,19 +450,15 @@ void RSP_Vector_VMULF (void) {
|
|||
for (el = 0; el < 8; el ++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
||||
if (RSP_Vect[RSPOpC.rd].UHW[el] != 0x8000 || RSP_Vect[RSPOpC.rt].UHW[del] != 0x8000) {
|
||||
temp.W = ((int32_t)RSP_Vect[RSPOpC.rd].HW[el] * (int32_t)RSP_Vect[RSPOpC.rt].HW[del]) << 1;
|
||||
if (RSP_Vect[RSPOpC.rd].UHW[el] != 0x8000 || RSP_Vect[RSPOpC.rt].UHW[del] != 0x8000) {
|
||||
temp.W = ((int32_t)RSP_Vect[RSPOpC.rd].HW[el] * (int32_t)RSP_Vect[RSPOpC.rt].HW[del]) << 1;
|
||||
temp.UW += 0x8000;
|
||||
RSP_ACCUM[el].HW[2] = temp.HW[1];
|
||||
RSP_ACCUM[el].HW[1] = temp.HW[0];
|
||||
if ( RSP_ACCUM[el].HW[2] < 0 ) {
|
||||
RSP_ACCUM[el].HW[3] = -1;
|
||||
} else {
|
||||
RSP_ACCUM[el].HW[3] = 0;
|
||||
}
|
||||
RSP_ACCUM[el].HW[3] = (RSP_ACCUM[el].HW[2] < 0) ? -1 : 0;
|
||||
result.HW[el] = RSP_ACCUM[el].HW[2];
|
||||
} else {
|
||||
temp.W = 0x80000000;
|
||||
temp.W = 0x80000000;
|
||||
RSP_ACCUM[el].UHW[3] = 0;
|
||||
RSP_ACCUM[el].UHW[2] = 0x8000;
|
||||
RSP_ACCUM[el].UHW[1] = 0x8000;
|
||||
|
@ -550,7 +498,7 @@ void RSP_Vector_VMUDL (void) {
|
|||
temp.UW = (uint32_t)RSP_Vect[RSPOpC.rd].UHW[el] * (uint32_t)RSP_Vect[RSPOpC.rt].UHW[del];
|
||||
RSP_ACCUM[el].W[1] = 0;
|
||||
RSP_ACCUM[el].HW[1] = temp.HW[1];
|
||||
result.HW[el] = RSP_ACCUM[el].HW[1];
|
||||
result.HW[el] = RSP_ACCUM[el].HW[1];
|
||||
}
|
||||
RSP_Vect[RSPOpC.sa] = result;
|
||||
}
|
||||
|
@ -603,15 +551,15 @@ void RSP_Vector_VMUDH (void) {
|
|||
|
||||
for (el = 0; el < 8; el ++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
||||
RSP_ACCUM[el].W[1] = (int32_t)RSP_Vect[RSPOpC.rd].HW[el] * (int32_t)RSP_Vect[RSPOpC.rt].HW[del];
|
||||
|
||||
RSP_ACCUM[el].W[1] = (int32_t)RSP_Vect[RSPOpC.rd].HW[el] * (int32_t)RSP_Vect[RSPOpC.rt].HW[del];
|
||||
RSP_ACCUM[el].HW[1] = 0;
|
||||
if (RSP_ACCUM[el].HW[3] < 0) {
|
||||
if (RSP_ACCUM[el].UHW[3] != 0xFFFF) {
|
||||
result.HW[el] = (WORD)0x8000;
|
||||
result.HW[el] = 0x8000;
|
||||
} else {
|
||||
if (RSP_ACCUM[el].HW[2] >= 0) {
|
||||
result.HW[el] = (WORD)0x8000;
|
||||
result.HW[el] = 0x8000;
|
||||
} else {
|
||||
result.HW[el] = RSP_ACCUM[el].HW[2];
|
||||
}
|
||||
|
@ -651,10 +599,10 @@ void RSP_Vector_VMACF (void) {
|
|||
RSP_ACCUM[el].DW += ((int64_t)temp.W) << 17;
|
||||
if (RSP_ACCUM[el].HW[3] < 0) {
|
||||
if (RSP_ACCUM[el].UHW[3] != 0xFFFF) {
|
||||
result.HW[el] = (WORD)0x8000;
|
||||
result.HW[el] = 0x8000;
|
||||
} else {
|
||||
if (RSP_ACCUM[el].HW[2] >= 0) {
|
||||
result.HW[el] = (WORD)0x8000;
|
||||
result.HW[el] = 0x8000;
|
||||
} else {
|
||||
result.HW[el] = RSP_ACCUM[el].HW[2];
|
||||
}
|
||||
|
@ -694,10 +642,10 @@ void RSP_Vector_VMACU (void) {
|
|||
result.HW[el] = 0;
|
||||
} else {
|
||||
if (RSP_ACCUM[el].UHW[3] != 0) {
|
||||
result.UHW[el] = 0xFFFF;
|
||||
result.UHW[el] = 0xFFFF;
|
||||
} else {
|
||||
if (RSP_ACCUM[el].HW[2] < 0) {
|
||||
result.UHW[el] = 0xFFFF;
|
||||
result.UHW[el] = 0xFFFF;
|
||||
} else {
|
||||
result.HW[el] = RSP_ACCUM[el].HW[2];
|
||||
}
|
||||
|
@ -776,10 +724,10 @@ void RSP_Vector_VMADL (void) {
|
|||
}
|
||||
} else {
|
||||
if (RSP_ACCUM[el].UHW[3] != 0) {
|
||||
result.UHW[el] = 0xFFFF;
|
||||
result.UHW[el] = 0xFFFF;
|
||||
} else {
|
||||
if (RSP_ACCUM[el].HW[2] < 0) {
|
||||
result.UHW[el] = 0xFFFF;
|
||||
result.UHW[el] = 0xFFFF;
|
||||
} else {
|
||||
result.HW[el] = RSP_ACCUM[el].HW[1];
|
||||
}
|
||||
|
@ -804,14 +752,14 @@ void RSP_Vector_VMADM (void) {
|
|||
RSP_ACCUM[el].HW[2] = temp2.HW[0];
|
||||
RSP_ACCUM[el].HW[3] += temp2.HW[1];
|
||||
if (temp.W < 0) {
|
||||
RSP_ACCUM[el].HW[3] -= 1;
|
||||
RSP_ACCUM[el].HW[3] -= 1;
|
||||
}
|
||||
if (RSP_ACCUM[el].HW[3] < 0) {
|
||||
if (RSP_ACCUM[el].UHW[3] != 0xFFFF) {
|
||||
result.HW[el] = (WORD)0x8000;
|
||||
result.HW[el] = 0x8000;
|
||||
} else {
|
||||
if (RSP_ACCUM[el].HW[2] >= 0) {
|
||||
result.HW[el] = (WORD)0x8000;
|
||||
result.HW[el] = 0x8000;
|
||||
} else {
|
||||
result.HW[el] = RSP_ACCUM[el].HW[2];
|
||||
}
|
||||
|
@ -847,7 +795,7 @@ void RSP_Vector_VMADN (void) {
|
|||
RSP_ACCUM[el].HW[2] = temp2.HW[0];
|
||||
RSP_ACCUM[el].HW[3] += temp2.HW[1];
|
||||
if (temp.W < 0) {
|
||||
RSP_ACCUM[el].HW[3] -= 1;
|
||||
RSP_ACCUM[el].HW[3] -= 1;
|
||||
}
|
||||
if (RSP_ACCUM[el].HW[3] < 0) {
|
||||
if (RSP_ACCUM[el].UHW[3] != 0xFFFF) {
|
||||
|
@ -880,14 +828,14 @@ void RSP_Vector_VMADH (void) {
|
|||
|
||||
for (el = 0; el < 8; el ++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
||||
RSP_ACCUM[el].W[1] += (int32_t)RSP_Vect[RSPOpC.rd].HW[el] * (int32_t)RSP_Vect[RSPOpC.rt].HW[del];
|
||||
|
||||
RSP_ACCUM[el].W[1] += (int32_t)RSP_Vect[RSPOpC.rd].HW[el] * (int32_t)RSP_Vect[RSPOpC.rt].HW[del];
|
||||
if (RSP_ACCUM[el].HW[3] < 0) {
|
||||
if (RSP_ACCUM[el].UHW[3] != 0xFFFF) {
|
||||
result.HW[el] = (WORD)0x8000;
|
||||
result.HW[el] = 0x8000;
|
||||
} else {
|
||||
if (RSP_ACCUM[el].HW[2] >= 0) {
|
||||
result.HW[el] = (WORD)0x8000;
|
||||
result.HW[el] = 0x8000;
|
||||
} else {
|
||||
result.HW[el] = RSP_ACCUM[el].HW[2];
|
||||
}
|
||||
|
@ -911,7 +859,7 @@ void RSP_Vector_VADD (void) {
|
|||
int el, del;
|
||||
UWORD32 temp;
|
||||
VECTOR result = {0};
|
||||
|
||||
|
||||
for ( el = 0; el < 8; el++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
||||
|
@ -920,7 +868,7 @@ void RSP_Vector_VADD (void) {
|
|||
RSP_ACCUM[el].HW[1] = temp.HW[0];
|
||||
if ((temp.HW[0] & 0x8000) == 0) {
|
||||
if (temp.HW[1] != 0) {
|
||||
result.HW[el] = (WORD)0x8000;
|
||||
result.HW[el] = 0x8000;
|
||||
} else {
|
||||
result.HW[el] = temp.HW[0];
|
||||
}
|
||||
|
@ -940,7 +888,7 @@ void RSP_Vector_VSUB (void) {
|
|||
int el, del;
|
||||
UWORD32 temp;
|
||||
VECTOR result = {0};
|
||||
|
||||
|
||||
for ( el = 0; el < 8; el++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
||||
|
@ -949,7 +897,7 @@ void RSP_Vector_VSUB (void) {
|
|||
RSP_ACCUM[el].HW[1] = temp.HW[0];
|
||||
if ((temp.HW[0] & 0x8000) == 0) {
|
||||
if (temp.HW[1] != 0) {
|
||||
result.HW[el] = (WORD)0x8000;
|
||||
result.HW[el] = 0x8000;
|
||||
} else {
|
||||
result.HW[el] = temp.HW[0];
|
||||
}
|
||||
|
@ -992,7 +940,7 @@ void RSP_Vector_VADDC (void) {
|
|||
int el, del;
|
||||
UWORD32 temp;
|
||||
VECTOR result = {0};
|
||||
|
||||
|
||||
RSP_Flags[0].UW = 0;
|
||||
for ( el = 0; el < 8; el++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
@ -1011,7 +959,7 @@ void RSP_Vector_VSUBC (void) {
|
|||
int el, del;
|
||||
UWORD32 temp;
|
||||
VECTOR result = {0};
|
||||
|
||||
|
||||
RSP_Flags[0].UW = 0x0;
|
||||
for ( el = 0; el < 8; el++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
@ -1073,7 +1021,7 @@ void RSP_Vector_VSAW (void) {
|
|||
void RSP_Vector_VLT (void) {
|
||||
int el, del;
|
||||
VECTOR result = {0};
|
||||
|
||||
|
||||
RSP_Flags[1].UW = 0;
|
||||
for ( el = 0; el < 8; el++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
@ -1092,7 +1040,7 @@ void RSP_Vector_VLT (void) {
|
|||
RSP_Flags[1].UW &= ~( 1 << (7 - el) );
|
||||
}
|
||||
}
|
||||
RSP_ACCUM[el].HW[1] = result.HW[el];
|
||||
RSP_ACCUM[el].HW[1] = result.HW[el];
|
||||
}
|
||||
RSP_Flags[0].UW = 0;
|
||||
RSP_Vect[RSPOpC.sa] = result;
|
||||
|
@ -1101,7 +1049,7 @@ void RSP_Vector_VLT (void) {
|
|||
void RSP_Vector_VEQ (void) {
|
||||
int el, del;
|
||||
VECTOR result = {0};
|
||||
|
||||
|
||||
RSP_Flags[1].UW = 0;
|
||||
for ( el = 0; el < 8; el++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
@ -1112,7 +1060,7 @@ void RSP_Vector_VEQ (void) {
|
|||
}
|
||||
}
|
||||
result.HW[el] = RSP_Vect[RSPOpC.rt].UHW[del];
|
||||
RSP_ACCUM[el].HW[1] = RSP_Vect[RSPOpC.rt].UHW[del];
|
||||
RSP_ACCUM[el].HW[1] = RSP_Vect[RSPOpC.rt].UHW[del];
|
||||
}
|
||||
RSP_Flags[0].UW = 0;
|
||||
RSP_Vect[RSPOpC.sa] = result;
|
||||
|
@ -1121,7 +1069,7 @@ void RSP_Vector_VEQ (void) {
|
|||
void RSP_Vector_VNE (void) {
|
||||
int el, del;
|
||||
VECTOR result = {0};
|
||||
|
||||
|
||||
RSP_Flags[1].UW = 0;
|
||||
for ( el = 0; el < 8; el++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
@ -1134,7 +1082,7 @@ void RSP_Vector_VNE (void) {
|
|||
}
|
||||
}
|
||||
result.HW[el] = RSP_Vect[RSPOpC.rd].UHW[el];
|
||||
RSP_ACCUM[el].HW[1] = RSP_Vect[RSPOpC.rd].UHW[el];
|
||||
RSP_ACCUM[el].HW[1] = RSP_Vect[RSPOpC.rd].UHW[el];
|
||||
}
|
||||
RSP_Flags[0].UW = 0;
|
||||
RSP_Vect[RSPOpC.sa] = result;
|
||||
|
@ -1143,7 +1091,7 @@ void RSP_Vector_VNE (void) {
|
|||
void RSP_Vector_VGE (void) {
|
||||
int el, del;
|
||||
VECTOR result = {0};
|
||||
|
||||
|
||||
RSP_Flags[1].UW = 0;
|
||||
for ( el = 0; el < 8; el++ ) {
|
||||
del = EleSpec[RSPOpC.rs].B[el];
|
||||
|
@ -1162,7 +1110,7 @@ void RSP_Vector_VGE (void) {
|
|||
result.HW[el] = RSP_Vect[RSPOpC.rt].UHW[del];
|
||||
RSP_Flags[1].UW &= ~( 1 << (7 - el) );
|
||||
}
|
||||
RSP_ACCUM[el].HW[1] = result.HW[el];
|
||||
RSP_ACCUM[el].HW[1] = result.HW[el];
|
||||
}
|
||||
RSP_Flags[0].UW = 0;
|
||||
RSP_Vect[RSPOpC.sa] = result;
|
||||
|
@ -1228,7 +1176,7 @@ void RSP_Vector_VCL (void) {
|
|||
void RSP_Vector_VCH (void) {
|
||||
int el, del;
|
||||
VECTOR result = {0};
|
||||
|
||||
|
||||
RSP_Flags[0].UW = 0;
|
||||
RSP_Flags[1].UW = 0;
|
||||
RSP_Flags[2].UW = 0;
|
||||
|
@ -1445,7 +1393,7 @@ void RSP_Vector_VRCP (void) {
|
|||
|
||||
void RSP_Vector_VRCPL (void) {
|
||||
int count, neg;
|
||||
|
||||
|
||||
RecpResult.UW = RSP_Vect[RSPOpC.rt].UHW[EleSpec[RSPOpC.rs].B[(RSPOpC.rd & 0x7)]] | Recp.W;
|
||||
if (RecpResult.UW == 0) {
|
||||
RecpResult.UW = 0x7FFFFFFF;
|
||||
|
@ -1500,10 +1448,10 @@ void RSP_Vector_VRCPH (void) {
|
|||
|
||||
void RSP_Vector_VMOV (void) {
|
||||
int count;
|
||||
|
||||
for ( count = 0; count < 8; count++ ) {
|
||||
RSP_ACCUM[count].HW[1] = RSP_Vect[RSPOpC.rt].UHW[EleSpec[RSPOpC.rs].B[count]];
|
||||
}
|
||||
|
||||
RSP_Vect[RSPOpC.sa].UHW[7 - (RSPOpC.rd & 0x7)] =
|
||||
RSP_Vect[RSPOpC.rt].UHW[EleSpec[RSPOpC.rs].B[(RSPOpC.rd & 0x7)]];
|
||||
}
|
||||
|
@ -1553,7 +1501,7 @@ void RSP_Vector_VRSQ (void) {
|
|||
|
||||
void RSP_Vector_VRSQL (void) {
|
||||
int count, neg;
|
||||
|
||||
|
||||
SQrootResult.UW = RSP_Vect[RSPOpC.rt].UHW[EleSpec[RSPOpC.rs].B[(RSPOpC.rd & 0x7)]] | SQroot.W;
|
||||
if (SQrootResult.UW == 0) {
|
||||
SQrootResult.UW = 0x7FFFFFFF;
|
||||
|
@ -1738,7 +1686,7 @@ void rsp_UnknownOpcode (void) {
|
|||
} else {
|
||||
sprintf(Message,"Unhandled Opcode\n%s\n\nStoping Emulation!\n\nDo you wish to enter the debugger ?",
|
||||
RSPOpcodeName(RSPOpC.Hex,*PrgCount));
|
||||
response = MessageBox(NULL,Message,"Error", MB_YESNO | MB_ICONERROR );
|
||||
response = MessageBox(NULL,Message,"Error", MB_YESNO | MB_ICONERROR);
|
||||
if (response == IDYES) {
|
||||
Enter_RSP_Commands_Window ();
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ void Create_RSP_Commands_Window ( int Child )
|
|||
{
|
||||
Stepping_Commands = TRUE;
|
||||
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Create_RSP_Commands_Window,
|
||||
(LPVOID)TRUE,0, &ThreadID);
|
||||
(LPVOID)TRUE,0, &ThreadID);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ int DisplayRSPCommand (DWORD location, int InsertPos)
|
|||
{
|
||||
uint32_t OpCode;
|
||||
DWORD LinesUsed = 1, status;
|
||||
BOOL Redraw = FALSE;
|
||||
BOOL Redraw = FALSE;
|
||||
|
||||
RSP_LW_IMEM(location, &OpCode);
|
||||
|
||||
|
@ -148,12 +148,12 @@ int DisplayRSPCommand (DWORD location, int InsertPos)
|
|||
RSPOpcodeName ( OpCode, location ));
|
||||
if ( SendMessage(hList,LB_GETCOUNT,0,0) <= InsertPos)
|
||||
{
|
||||
SendMessage(hList,LB_INSERTSTRING,(WPARAM)InsertPos, (LPARAM)location);
|
||||
SendMessage(hList,LB_INSERTSTRING,(WPARAM)InsertPos, (LPARAM)location);
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT ItemRC;
|
||||
SendMessage(hList,LB_GETITEMRECT,(WPARAM)InsertPos, (LPARAM)&ItemRC);
|
||||
SendMessage(hList,LB_GETITEMRECT,(WPARAM)InsertPos, (LPARAM)&ItemRC);
|
||||
RedrawWindow(hList,&ItemRC,NULL, RDW_INVALIDATE );
|
||||
}
|
||||
}
|
||||
|
@ -305,21 +305,21 @@ void DrawRSPCommand ( LPARAM lParam )
|
|||
}
|
||||
}
|
||||
|
||||
FillRect( ditem->hDC, &ditem->rcItem,hBrush);
|
||||
FillRect( ditem->hDC, &ditem->rcItem,hBrush);
|
||||
SetBkMode( ditem->hDC, TRANSPARENT );
|
||||
|
||||
if (strlen (Command) == 0 )
|
||||
{
|
||||
SetRect(&TextRect,ditem->rcItem.left,ditem->rcItem.top, ditem->rcItem.left + 83,
|
||||
ditem->rcItem.bottom);
|
||||
ditem->rcItem.bottom);
|
||||
DrawText(ditem->hDC,Offset,strlen(Offset), &TextRect,DT_SINGLELINE | DT_VCENTER);
|
||||
|
||||
SetRect(&TextRect,ditem->rcItem.left + 83,ditem->rcItem.top, ditem->rcItem.left + 165,
|
||||
ditem->rcItem.bottom);
|
||||
ditem->rcItem.bottom);
|
||||
DrawText(ditem->hDC,Instruction,strlen(Instruction), &TextRect,DT_SINGLELINE | DT_VCENTER);
|
||||
|
||||
SetRect(&TextRect,ditem->rcItem.left + 165,ditem->rcItem.top, ditem->rcItem.right,
|
||||
ditem->rcItem.bottom);
|
||||
ditem->rcItem.bottom);
|
||||
DrawText(ditem->hDC,Arguments,strlen(Arguments), &TextRect,DT_SINGLELINE | DT_VCENTER);
|
||||
}
|
||||
else
|
||||
|
@ -358,7 +358,7 @@ void Enable_RSP_Commands_Window ( void )
|
|||
si.nMax = (0x1000 >> 2) -1;
|
||||
si.nPos = (*PrgCount >> 2);
|
||||
si.nPage = 30;
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
|
||||
SetRSPCommandViewto( *PrgCount );
|
||||
SetForegroundWindow(RSPCommandshWnd);
|
||||
|
@ -469,8 +469,8 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
if (HIWORD(wParam) == LBN_DBLCLK )
|
||||
{
|
||||
DWORD Location, Selected;
|
||||
Selected = SendMessage(hList,LB_GETCURSEL,(WPARAM)0, (LPARAM)0);
|
||||
Location = RSPCommandLine[Selected].Location;
|
||||
Selected = SendMessage(hList,LB_GETCURSEL,(WPARAM)0, (LPARAM)0);
|
||||
Location = RSPCommandLine[Selected].Location;
|
||||
if (Location != (DWORD)-1)
|
||||
{
|
||||
if (CheckForRSPBPoint(Location))
|
||||
|
@ -507,7 +507,7 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
case IDC_BP_BUTTON:
|
||||
if (DebugInfo.Enter_BPoint_Window != NULL)
|
||||
{
|
||||
DebugInfo.Enter_BPoint_Window();
|
||||
DebugInfo.Enter_BPoint_Window();
|
||||
}
|
||||
break;
|
||||
case IDC_RSP_REGISTERS_BUTTON:
|
||||
|
@ -516,19 +516,19 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
case IDC_R4300I_DEBUGGER_BUTTON:
|
||||
if (DebugInfo.Enter_R4300i_Commands_Window != NULL)
|
||||
{
|
||||
DebugInfo.Enter_R4300i_Commands_Window();
|
||||
DebugInfo.Enter_R4300i_Commands_Window();
|
||||
}
|
||||
break;
|
||||
case IDC_R4300I_REGISTERS_BUTTON:
|
||||
if (DebugInfo.Enter_R4300i_Register_Window != NULL)
|
||||
{
|
||||
DebugInfo.Enter_R4300i_Register_Window();
|
||||
DebugInfo.Enter_R4300i_Register_Window();
|
||||
}
|
||||
break;
|
||||
case IDC_MEMORY_BUTTON:
|
||||
if (DebugInfo.Enter_Memory_Window != NULL)
|
||||
{
|
||||
DebugInfo.Enter_Memory_Window();
|
||||
DebugInfo.Enter_Memory_Window();
|
||||
}
|
||||
break;
|
||||
case IDCANCEL:
|
||||
|
@ -551,7 +551,7 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
case SB_THUMBTRACK:
|
||||
sprintf(Value,"%03X",((short int)HIWORD(wParam) << 2 ));
|
||||
SetWindowText(hAddress,Value);
|
||||
si.cbSize = sizeof(si);
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = (short int)HIWORD(wParam);
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
|
@ -561,7 +561,7 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
{
|
||||
sprintf(Value,"%03X",location + 0x4);
|
||||
SetWindowText(hAddress,Value);
|
||||
si.cbSize = sizeof(si);
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = ((location + 0x4) >> 2);
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
|
@ -570,7 +570,7 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
{
|
||||
sprintf(Value,"%03X",0xF88);
|
||||
SetWindowText(hAddress,Value);
|
||||
si.cbSize = sizeof(si);
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = (0xFFC >> 2);
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
|
@ -581,7 +581,7 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
{
|
||||
sprintf(Value,"%03X",location - 0x4);
|
||||
SetWindowText(hAddress,Value);
|
||||
si.cbSize = sizeof(si);
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = ((location - 0x4) >> 2);
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
|
@ -590,7 +590,7 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
{
|
||||
sprintf(Value,"%03X",0);
|
||||
SetWindowText(hAddress,Value);
|
||||
si.cbSize = sizeof(si);
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = 0;
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
|
@ -601,7 +601,7 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
{
|
||||
sprintf(Value,"%03X",location + 0x74);
|
||||
SetWindowText(hAddress,Value);
|
||||
si.cbSize = sizeof(si);
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = ((location + 0x74) >> 2);
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
|
@ -610,18 +610,18 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
{
|
||||
sprintf(Value,"%03X",0xF88);
|
||||
SetWindowText(hAddress,Value);
|
||||
si.cbSize = sizeof(si);
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = (0xF8F >> 2);
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
if ((location - 0x74) > 0x74 )
|
||||
{
|
||||
sprintf(Value,"%03X",location - 0x74);
|
||||
SetWindowText(hAddress,Value);
|
||||
si.cbSize = sizeof(si);
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = ((location - 0x74) >> 2);
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
|
@ -630,7 +630,7 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
{
|
||||
sprintf(Value,"%03X",0);
|
||||
SetWindowText(hAddress,Value);
|
||||
si.cbSize = sizeof(si);
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = 0;
|
||||
SetScrollInfo(hScrlBar,SB_CTL,&si,TRUE);
|
||||
|
@ -672,7 +672,7 @@ void RSP_Commands_Setup ( HWND hDlg )
|
|||
|
||||
hFunctionlist = CreateWindowEx(0,"COMBOBOX","", WS_CHILD | WS_VSCROLL |
|
||||
CBS_DROPDOWNLIST | CBS_SORT | WS_TABSTOP,352,56,89,150,hDlg,
|
||||
(HMENU)IDC_FUNCTION_COMBO,hinstDLL,NULL);
|
||||
(HMENU)IDC_FUNCTION_COMBO,hinstDLL,NULL);
|
||||
if (hFunctionlist)
|
||||
{
|
||||
SendMessage(hFunctionlist,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||
|
|
|
@ -83,7 +83,7 @@ void Create_RSP_Register_Window ( int Child ) {
|
|||
} else {
|
||||
if (!InRSPRegisterWindow) {
|
||||
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Create_RSP_Register_Window,
|
||||
(LPVOID)TRUE,0, &ThreadID);
|
||||
(LPVOID)TRUE,0, &ThreadID);
|
||||
} else {
|
||||
SetForegroundWindow(RSP_Registers_hDlg);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void HideRSP_RegisterPanel ( int Panel) {
|
|||
break;
|
||||
case Vector2:
|
||||
for (count = 0; count < 16;count ++) { ShowWindow(hVECT2[count], FALSE ); }
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,11 +138,11 @@ void PaintRSP_HiddenPanel (HWND hWnd) {
|
|||
|
||||
rcBox.left = 75; rcBox.top = 35;
|
||||
rcBox.right = 150; rcBox.bottom = 50;
|
||||
FillRect( ps.hdc, &rcBox,(HBRUSH)COLOR_WINDOW);
|
||||
FillRect( ps.hdc, &rcBox,(HBRUSH)COLOR_WINDOW);
|
||||
|
||||
rcBox.left = 365; rcBox.top = 35;
|
||||
rcBox.right = 425; rcBox.bottom = 50;
|
||||
FillRect( ps.hdc, &rcBox,(HBRUSH)COLOR_WINDOW);
|
||||
FillRect( ps.hdc, &rcBox,(HBRUSH)COLOR_WINDOW);
|
||||
|
||||
hOldFont = SelectObject( ps.hdc,
|
||||
GetStockObject(DEFAULT_GUI_FONT) );
|
||||
|
@ -398,7 +398,7 @@ LRESULT CALLBACK RSP_Registers_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
switch (((NMHDR *)lParam)->code) {
|
||||
case TCN_SELCHANGE:
|
||||
InvalidateRect( hTab, &rcDisp, TRUE );
|
||||
HideRSP_RegisterPanel (CurrentPanel);
|
||||
HideRSP_RegisterPanel (CurrentPanel);
|
||||
item.mask = TCIF_PARAM;
|
||||
TabCtrl_GetItem( hTab, TabCtrl_GetCurSel( hTab ), &item );
|
||||
CurrentPanel = (int)item.lParam;
|
||||
|
@ -491,19 +491,19 @@ void SetupRSP_RegistersMain (HWND hDlg) {
|
|||
item.mask = TCIF_TEXT | TCIF_PARAM;
|
||||
item.pszText = " General Purpose ";
|
||||
item.lParam = GeneralPurpose;
|
||||
TabCtrl_InsertItem( hTab,0, &item);
|
||||
TabCtrl_InsertItem( hTab,0, &item);
|
||||
item.lParam = ControlProcessor0;
|
||||
item.pszText = " Control Processor 0 ";
|
||||
TabCtrl_InsertItem( hTab,1, &item);
|
||||
TabCtrl_InsertItem( hTab,1, &item);
|
||||
item.lParam = HiddenRegisters;
|
||||
item.pszText = " Hidden Registers ";
|
||||
TabCtrl_InsertItem( hTab,2, &item);
|
||||
TabCtrl_InsertItem( hTab,2, &item);
|
||||
item.lParam = Vector1;
|
||||
item.pszText = " RSP Vectors $v0 - $v15 ";
|
||||
TabCtrl_InsertItem( hTab,3, &item);
|
||||
TabCtrl_InsertItem( hTab,3, &item);
|
||||
item.lParam = Vector2;
|
||||
item.pszText = " RSP Vectors $v16 - $v31 ";
|
||||
TabCtrl_InsertItem( hTab,4, &item);
|
||||
TabCtrl_InsertItem( hTab,4, &item);
|
||||
}
|
||||
|
||||
SetupRSP_HiddenPanel ( hDlg );
|
||||
|
@ -579,10 +579,10 @@ void ShowRSP_RegisterPanel ( int Panel) {
|
|||
break;
|
||||
case Vector1:
|
||||
for (count = 0; count < 16;count ++) { ShowWindow(hVECT1[count], TRUE ); }
|
||||
break;
|
||||
break;
|
||||
case Vector2:
|
||||
for (count = 0; count < 16;count ++) { ShowWindow(hVECT2[count], TRUE ); }
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -621,7 +621,7 @@ void UpdateRSPRegistersScreen ( void ) {
|
|||
sprintf(RegisterValue," 0x%08X",*RSPInfo.SP_DMA_BUSY_REG);
|
||||
SetWindowText(hCP0[6],RegisterValue);
|
||||
sprintf(RegisterValue," 0x%08X",*RSPInfo.SP_SEMAPHORE_REG);
|
||||
SetWindowText(hCP0[7],RegisterValue);
|
||||
SetWindowText(hCP0[7],RegisterValue);
|
||||
sprintf(RegisterValue," 0x%08X",*RSPInfo.DPC_START_REG);
|
||||
SetWindowText(hCP0[8],RegisterValue);
|
||||
sprintf(RegisterValue," 0x%08X",*RSPInfo.DPC_END_REG);
|
||||
|
@ -658,14 +658,14 @@ void UpdateRSPRegistersScreen ( void ) {
|
|||
RSP_Vect[count].W[2], RSP_Vect[count].W[1], RSP_Vect[count].W[0]);
|
||||
SetWindowText(hVECT1[count],RegisterValue);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case Vector2:
|
||||
for (count = 0; count < 16;count ++) {
|
||||
sprintf(RegisterValue," 0x%08X - %08X - %08X - %08X", RSP_Vect[count + 16].W[3],
|
||||
RSP_Vect[count + 16].W[2], RSP_Vect[count + 16].W[1], RSP_Vect[count + 16].W[0]);
|
||||
SetWindowText(hVECT2[count],RegisterValue);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ DWORD WriteToAccum2 (int Location, int PC, BOOL RecursiveCall) {
|
|||
if (Compiler.bAccum == FALSE) return TRUE;
|
||||
|
||||
if (Instruction_State == DELAY_SLOT) {
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -378,7 +378,7 @@ DWORD WriteToAccum2 (int Location, int PC, BOOL RecursiveCall) {
|
|||
Instruction_State = DELAY_SLOT;
|
||||
break;
|
||||
case DELAY_SLOT:
|
||||
Instruction_State = FINISH_BLOCK;
|
||||
Instruction_State = FINISH_BLOCK;
|
||||
break;
|
||||
}
|
||||
} while (Instruction_State != FINISH_BLOCK);
|
||||
|
@ -455,7 +455,7 @@ BOOL WriteToVectorDest2 (DWORD DestReg, int PC, BOOL RecursiveCall) {
|
|||
if (Compiler.bDest == FALSE) return TRUE;
|
||||
|
||||
if (Instruction_State == DELAY_SLOT) {
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -693,7 +693,7 @@ BOOL WriteToVectorDest2 (DWORD DestReg, int PC, BOOL RecursiveCall) {
|
|||
Instruction_State = DELAY_SLOT;
|
||||
break;
|
||||
case DELAY_SLOT:
|
||||
Instruction_State = FINISH_BLOCK;
|
||||
Instruction_State = FINISH_BLOCK;
|
||||
break;
|
||||
}
|
||||
} while (Instruction_State != FINISH_BLOCK);
|
||||
|
@ -770,7 +770,7 @@ BOOL UseRspFlags (int PC) {
|
|||
if (Compiler.bFlags == FALSE) return TRUE;
|
||||
|
||||
if (Instruction_State == DELAY_SLOT) {
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -971,7 +971,7 @@ BOOL UseRspFlags (int PC) {
|
|||
Instruction_State = DELAY_SLOT;
|
||||
break;
|
||||
case DELAY_SLOT:
|
||||
Instruction_State = FINISH_BLOCK;
|
||||
Instruction_State = FINISH_BLOCK;
|
||||
break;
|
||||
}
|
||||
} while ( Instruction_State != FINISH_BLOCK);
|
||||
|
@ -1058,7 +1058,7 @@ BOOL IsRegisterConstant (DWORD Reg, DWORD * Constant) {
|
|||
if (RspOp.rt == Reg) {
|
||||
if (RspOp.rs == 0) {
|
||||
if (References > 0) {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
Const = (short)RspOp.immediate;
|
||||
References++;
|
||||
|
@ -1572,7 +1572,7 @@ void GetInstructionInfo(DWORD PC, OPCODE * RspOp, OPCODE_INFO * info) {
|
|||
info->StoredReg = RspOp->rt;
|
||||
info->IndexReg = RspOp->base;
|
||||
info->SourceReg1 = UNUSED_OPERAND;
|
||||
info->flags = Store_Operation | GPR_Instruction;
|
||||
info->flags = Store_Operation | GPR_Instruction;
|
||||
break;
|
||||
case RSP_LC2:
|
||||
switch (RspOp->rd) {
|
||||
|
|
|
@ -509,10 +509,10 @@ void ReOrderSubBlock(RSP_BLOCK * Block) {
|
|||
DWORD count;
|
||||
|
||||
if (!Compiler.bReOrdering) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (Block->CurrPC > 0xFF0) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/* find the label or jump closest to us */
|
||||
|
@ -550,7 +550,7 @@ void DetectGPRConstants(RSP_CODE * code) {
|
|||
memset(&code->MipsRegConst, 0, sizeof(DWORD) * 0x20);
|
||||
|
||||
if (!Compiler.bGPRConstants) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
CPU_Message("***** Detecting constants *****");
|
||||
|
||||
|
@ -634,7 +634,7 @@ void LinkBranches(RSP_BLOCK * Block) {
|
|||
RSP_BLOCK Save;
|
||||
|
||||
if (!CurrentBlock.ResolveCount) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
CPU_Message("***** Linking branches (%i) *****", CurrentBlock.ResolveCount);
|
||||
|
||||
|
@ -732,7 +732,7 @@ BOOL IsJumpLabel(DWORD PC) {
|
|||
DWORD Count;
|
||||
|
||||
if (!RspCode.LabelCount) {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (Count = 0; Count < RspCode.LabelCount; Count++) {
|
||||
|
@ -827,7 +827,7 @@ void CompilerRSPBlock ( void ) {
|
|||
|
||||
if (LogRDP && NextInstruction != DELAY_SLOT_DONE){
|
||||
char str[40];
|
||||
sprintf(str,"%X",CompilePC);
|
||||
sprintf(str,"%X",CompilePC);
|
||||
PushImm32(str,CompilePC);
|
||||
Call_Direct(RDP_LogLoc,"RDP_LogLoc");
|
||||
AddConstToX86Reg(x86_ESP, 4);
|
||||
|
@ -860,7 +860,7 @@ void CompilerRSPBlock ( void ) {
|
|||
NextInstruction = NORMAL;
|
||||
CompilePC += 8;
|
||||
if (CompilePC >= 0x1000) {
|
||||
NextInstruction = FINISH_BLOCK;
|
||||
NextInstruction = FINISH_BLOCK;
|
||||
} else if (NULL == *(JumpTable + (CompilePC >> 2))) {
|
||||
/* this is for the new block being compiled now */
|
||||
CPU_Message("**** Continuing static SubBlock (jump table entry added for PC: %04X at X86: %08X) *****", CompilePC, RecompPos);
|
||||
|
@ -923,7 +923,7 @@ DWORD RunRecompilerCPU ( DWORD Cycles ) {
|
|||
** that go out of it, let's rock
|
||||
**/
|
||||
|
||||
LinkBranches(&CurrentBlock);
|
||||
LinkBranches(&CurrentBlock);
|
||||
if (Profiling && !IndvidualBlock) {
|
||||
StopTimer();
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ void CompileBranchExit(DWORD TargetPC, DWORD ContinuePC)
|
|||
{
|
||||
DWORD * X86Loc = NULL;
|
||||
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
CompConstToVariable(TRUE, &BranchCompare, "BranchCompare");
|
||||
JeLabel32("BranchEqual", 0);
|
||||
X86Loc = (DWORD*)(RecompPos - 4);
|
||||
|
@ -187,7 +187,7 @@ void Compile_J ( void ) {
|
|||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
} else if ( NextInstruction == DELAY_SLOT_EXIT_DONE ) {
|
||||
MoveConstToVariable((RSPOpC.target << 2) & 0xFFC,PrgCount,"RSP PC");
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
Ret();
|
||||
} else {
|
||||
CompilerWarning("J error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
|
||||
|
@ -217,7 +217,7 @@ void Compile_JAL ( void ) {
|
|||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
} else if ( NextInstruction == DELAY_SLOT_EXIT_DONE ) {
|
||||
MoveConstToVariable((RSPOpC.target << 2) & 0xFFC,PrgCount,"RSP PC");
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
Ret();
|
||||
} else {
|
||||
CompilerWarning("J error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
|
||||
|
@ -231,7 +231,7 @@ void Compile_BEQ ( void ) {
|
|||
if ( NextInstruction == NORMAL ) {
|
||||
CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC));
|
||||
if (RSPOpC.rs == 0 && RSPOpC.rt == 0) {
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
return;
|
||||
}
|
||||
bDelayAffect = DelaySlotAffectBranch(CompilePC);
|
||||
|
@ -248,7 +248,7 @@ void Compile_BEQ ( void ) {
|
|||
CompX86regToVariable(x86_EAX,&RSP_GPR[RSPOpC.rs].W,GPR_Name(RSPOpC.rs));
|
||||
}
|
||||
SetzVariable(&BranchCompare, "BranchCompare");
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
} else if ( NextInstruction == DELAY_SLOT_DONE ) {
|
||||
DWORD Target = (CompilePC + ((short)RSPOpC.offset << 2) + 4) & 0xFFC;
|
||||
|
||||
|
@ -308,7 +308,7 @@ void Compile_BNE ( void ) {
|
|||
CompX86regToVariable(x86_EAX,&RSP_GPR[RSPOpC.rs].W,GPR_Name(RSPOpC.rs));
|
||||
}
|
||||
SetnzVariable(&BranchCompare, "BranchCompare");
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
} else if ( NextInstruction == DELAY_SLOT_DONE ) {
|
||||
DWORD Target = (CompilePC + ((short)RSPOpC.offset << 2) + 4) & 0xFFC;
|
||||
|
||||
|
@ -349,7 +349,7 @@ void Compile_BLEZ ( void ) {
|
|||
if ( NextInstruction == NORMAL ) {
|
||||
CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC));
|
||||
if (RSPOpC.rs == 0) {
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
return;
|
||||
}
|
||||
bDelayAffect = DelaySlotAffectBranch(CompilePC);
|
||||
|
@ -359,7 +359,7 @@ void Compile_BLEZ ( void ) {
|
|||
}
|
||||
CompConstToVariable(0,&RSP_GPR[RSPOpC.rs].W,GPR_Name(RSPOpC.rs));
|
||||
SetleVariable(&BranchCompare, "BranchCompare");
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
} else if ( NextInstruction == DELAY_SLOT_DONE ) {
|
||||
DWORD Target = (CompilePC + ((short)RSPOpC.offset << 2) + 4) & 0xFFC;
|
||||
|
||||
|
@ -395,7 +395,7 @@ void Compile_BGTZ ( void ) {
|
|||
if ( NextInstruction == NORMAL ) {
|
||||
CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC));
|
||||
if (RSPOpC.rs == 0) {
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
return;
|
||||
}
|
||||
bDelayAffect = DelaySlotAffectBranch(CompilePC);
|
||||
|
@ -405,7 +405,7 @@ void Compile_BGTZ ( void ) {
|
|||
}
|
||||
CompConstToVariable(0,&RSP_GPR[RSPOpC.rs].W,GPR_Name(RSPOpC.rs));
|
||||
SetgVariable(&BranchCompare, "BranchCompare");
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
} else if ( NextInstruction == DELAY_SLOT_DONE ) {
|
||||
DWORD Target = (CompilePC + ((short)RSPOpC.offset << 2) + 4) & 0xFFC;
|
||||
|
||||
|
@ -454,7 +454,7 @@ void Compile_ADDI ( void ) {
|
|||
if (Immediate != 0) {
|
||||
AddConstToX86Reg(x86_EAX, Immediate);
|
||||
}
|
||||
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
|
||||
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -617,7 +617,7 @@ void Compile_LH ( void ) {
|
|||
CompilerWarning("Unaligned LH at constant address PC = %04X", CompilePC);
|
||||
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LH,"RSP_Opcode_LH");
|
||||
} else {
|
||||
char Address[32];
|
||||
char Address[32];
|
||||
sprintf(Address, "Dmem + %Xh", Addr);
|
||||
MoveSxVariableToX86regHalf(RSPInfo.DMEM + Addr, Address, x86_EAX);
|
||||
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
|
||||
|
@ -671,7 +671,7 @@ void Compile_LW ( void ) {
|
|||
CompilerWarning("Unaligned LW at constant address PC = %04X", CompilePC);
|
||||
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LW,"RSP_Opcode_LW");
|
||||
} else {
|
||||
char Address[32];
|
||||
char Address[32];
|
||||
sprintf(Address, "Dmem + %Xh", Addr);
|
||||
MoveVariableToX86reg(RSPInfo.DMEM + Addr, Address, x86_EAX);
|
||||
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
|
||||
|
@ -760,7 +760,7 @@ void Compile_LHU ( void ) {
|
|||
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LHU,"RSP_Opcode_LHU");
|
||||
return;
|
||||
} else {
|
||||
char Address[32];
|
||||
char Address[32];
|
||||
sprintf(Address, "Dmem + %Xh", Addr);
|
||||
MoveZxVariableToX86regHalf(RSPInfo.DMEM + Addr, Address, x86_ECX);
|
||||
MoveX86regToVariable(x86_ECX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
|
||||
|
@ -834,7 +834,7 @@ void Compile_SH ( void ) {
|
|||
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SH,"RSP_Opcode_SH");
|
||||
return;
|
||||
} else {
|
||||
char Address[32];
|
||||
char Address[32];
|
||||
sprintf(Address, "Dmem + %Xh", Addr);
|
||||
MoveVariableToX86regHalf(&RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt), x86_EAX);
|
||||
MoveX86regHalfToVariable(x86_EAX, RSPInfo.DMEM + Addr, Address);
|
||||
|
@ -888,10 +888,10 @@ void Compile_SW ( void ) {
|
|||
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SW,"RSP_Opcode_SW");
|
||||
return;
|
||||
} else {
|
||||
char Address[32];
|
||||
char Address[32];
|
||||
sprintf(Address, "Dmem + %Xh", Addr);
|
||||
MoveVariableToX86reg(&RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt), x86_EAX);
|
||||
MoveX86regToVariable(x86_EAX, RSPInfo.DMEM + Addr, Address);
|
||||
MoveX86regToVariable(x86_EAX, RSPInfo.DMEM + Addr, Address);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -941,7 +941,7 @@ void Compile_SW ( void ) {
|
|||
if (RSPOpC.rt == 0) {
|
||||
XorX86RegToX86Reg(x86_EAX,x86_EAX);
|
||||
} else {
|
||||
MoveVariableToX86reg(&RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt), x86_EAX);
|
||||
MoveVariableToX86reg(&RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt), x86_EAX);
|
||||
}
|
||||
MoveX86regToN64Mem(x86_EAX, x86_EBX);
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ void Compile_Special_SRLV ( void ) {
|
|||
MoveVariableToX86reg(&RSP_GPR[RSPOpC.rs].W, GPR_Name(RSPOpC.rs), x86_ECX);
|
||||
AndConstToX86Reg(x86_ECX, 0x1F);
|
||||
ShiftRightUnsign(x86_EAX);
|
||||
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd));
|
||||
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd));
|
||||
}
|
||||
|
||||
void Compile_Special_SRAV ( void ) {
|
||||
|
@ -1080,7 +1080,7 @@ void Compile_Special_JR (void) {
|
|||
ChangedPC = FALSE;
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
} else if ( NextInstruction == DELAY_SLOT_EXIT_DONE ) {
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
Ret();
|
||||
} else {
|
||||
CompilerWarning("WTF\n\nJR\nNextInstruction = %X", NextInstruction);
|
||||
|
@ -1114,7 +1114,7 @@ void Compile_Special_JALR ( void ) {
|
|||
Ret();
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
} else if ( NextInstruction == DELAY_SLOT_EXIT_DONE ) {
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
NextInstruction = FINISH_SUB_BLOCK;
|
||||
Ret();
|
||||
} else {
|
||||
CompilerWarning("WTF\n\nJALR\nNextInstruction = %X", NextInstruction);
|
||||
|
@ -1361,7 +1361,7 @@ void Compile_RegImm_BLTZ ( void ) {
|
|||
if ( NextInstruction == NORMAL ) {
|
||||
CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC));
|
||||
if (RSPOpC.rs == 0) {
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
return;
|
||||
}
|
||||
bDelayAffect = DelaySlotAffectBranch(CompilePC);
|
||||
|
@ -1371,7 +1371,7 @@ void Compile_RegImm_BLTZ ( void ) {
|
|||
}
|
||||
CompConstToVariable(0,&RSP_GPR[RSPOpC.rs].W,GPR_Name(RSPOpC.rs));
|
||||
SetlVariable(&BranchCompare, "BranchCompare");
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
} else if ( NextInstruction == DELAY_SLOT_DONE ) {
|
||||
DWORD Target = (CompilePC + ((short)RSPOpC.offset << 2) + 4) & 0xFFC;
|
||||
|
||||
|
@ -1404,7 +1404,7 @@ void Compile_RegImm_BGEZ ( void ) {
|
|||
if ( NextInstruction == NORMAL ) {
|
||||
CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC));
|
||||
if (RSPOpC.rs == 0) {
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
return;
|
||||
}
|
||||
bDelayAffect = DelaySlotAffectBranch(CompilePC);
|
||||
|
@ -1414,7 +1414,7 @@ void Compile_RegImm_BGEZ ( void ) {
|
|||
}
|
||||
CompConstToVariable(0,&RSP_GPR[RSPOpC.rs].W,GPR_Name(RSPOpC.rs));
|
||||
SetgeVariable(&BranchCompare, "BranchCompare");
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
} else if ( NextInstruction == DELAY_SLOT_DONE ) {
|
||||
DWORD Target = (CompilePC + ((short)RSPOpC.offset << 2) + 4) & 0xFFC;
|
||||
|
||||
|
@ -1448,12 +1448,12 @@ void Compile_RegImm_BLTZAL ( void ) {
|
|||
CPU_Message(" %X %s",CompilePC,RSPOpcodeName(RSPOpC.Hex,CompilePC));
|
||||
MoveConstToVariable(CompilePC + 8, &RSP_GPR[31].UW, "RA.W");
|
||||
if (RSPOpC.rs == 0) {
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
return;
|
||||
}
|
||||
CompConstToVariable(0,&RSP_GPR[RSPOpC.rs].W,GPR_Name(RSPOpC.rs));
|
||||
SetlVariable(&BranchCompare, "BranchCompare");
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
} else if ( NextInstruction == DELAY_SLOT_DONE ) {
|
||||
DWORD Target = (CompilePC + ((short)RSPOpC.offset << 2) + 4) & 0xFFC;
|
||||
|
||||
|
@ -1493,7 +1493,7 @@ void Compile_RegImm_BGEZAL ( void ) {
|
|||
}
|
||||
CompConstToVariable(0,&RSP_GPR[RSPOpC.rs].W,GPR_Name(RSPOpC.rs));
|
||||
SetgeVariable(&BranchCompare, "BranchCompare");
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
NextInstruction = DO_DELAY_SLOT;
|
||||
} else if ( NextInstruction == DELAY_SLOT_DONE ) {
|
||||
DWORD Target = (CompilePC + ((short)RSPOpC.offset << 2) + 4) & 0xFFC;
|
||||
|
||||
|
@ -1532,14 +1532,14 @@ void Compile_Cop0_MF ( void ) {
|
|||
|
||||
sprintf(str,"%d",RSPOpC.rd);
|
||||
PushImm32(str,RSPOpC.rd);
|
||||
sprintf(str,"%X",CompilePC);
|
||||
sprintf(str,"%X",CompilePC);
|
||||
PushImm32(str,CompilePC);
|
||||
Call_Direct(RDP_LogMF0,"RDP_LogMF0");
|
||||
AddConstToX86Reg(x86_ESP, 8);
|
||||
}
|
||||
|
||||
#ifndef Compile_Cop0
|
||||
Cheat_r4300iOpcode(RSP_Cop0_MF,"RSP_Cop0_MF");
|
||||
Cheat_r4300iOpcode(RSP_Cop0_MF,"RSP_Cop0_MF");
|
||||
if (NextInstruction == NORMAL)
|
||||
{
|
||||
MoveConstToVariable(CompilePC + 4,PrgCount,"RSP PC");
|
||||
|
@ -1625,7 +1625,7 @@ void Compile_Cop0_MT ( void )
|
|||
Push(x86_EAX);
|
||||
sprintf(str,"%d",RSPOpC.rd);
|
||||
PushImm32(str,RSPOpC.rd);
|
||||
sprintf(str,"%X",CompilePC);
|
||||
sprintf(str,"%X",CompilePC);
|
||||
PushImm32(str,CompilePC);
|
||||
Call_Direct(RDP_LogMT0,"RDP_LogMT0");
|
||||
AddConstToX86Reg(x86_ESP, 12);
|
||||
|
@ -2541,7 +2541,7 @@ BOOL Compile_Vector_VMUDH_MMX ( void ) {
|
|||
|
||||
MmxUnpackLowWord(x86_MM0, x86_MM4);
|
||||
MmxUnpackHighWord(x86_MM6, x86_MM4);
|
||||
MmxUnpackLowWord(x86_MM1, x86_MM5);
|
||||
MmxUnpackLowWord(x86_MM1, x86_MM5);
|
||||
MmxUnpackHighWord(x86_MM7, x86_MM5);
|
||||
|
||||
/* Integrate copies */
|
||||
|
@ -3528,7 +3528,7 @@ void Compile_Vector_VABS ( void ) {
|
|||
}
|
||||
if (bWriteToAccum == TRUE) {
|
||||
sprintf(Reg, "RSP_ACCUM[%i].HW[1]", el);
|
||||
MoveX86regHalfToVariable(x86_EDI, &RSP_ACCUM[el].HW[1], Reg);
|
||||
MoveX86regHalfToVariable(x86_EDI, &RSP_ACCUM[el].HW[1], Reg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4689,7 +4689,7 @@ void Compile_Opcode_LDV ( void ) {
|
|||
jne $Loop */
|
||||
|
||||
LoopEntry = RecompPos;
|
||||
CPU_Message(" Loop:");
|
||||
CPU_Message(" Loop:");
|
||||
MoveX86RegToX86Reg(x86_EBX, x86_EAX);
|
||||
XorConstToX86Reg(x86_EAX, 3);
|
||||
MoveN64MemToX86regByte(x86_EDX, x86_EAX);
|
||||
|
@ -4878,9 +4878,9 @@ void Compile_Opcode_LRV ( void ) {
|
|||
MoveN64MemToX86regHalf(x86_EDX, x86_ESI);
|
||||
MoveX86regHalfToX86regPointer(x86_EDX, x86_EAX);
|
||||
|
||||
AddConstToX86Reg(x86_EBX, 2); /* Dmem pointer */
|
||||
SubConstFromX86Reg(x86_EAX, 2); /* Vector pointer */
|
||||
DecX86reg(x86_ECX); /* Loop counter */
|
||||
AddConstToX86Reg(x86_EBX, 2); /* Dmem pointer */
|
||||
SubConstFromX86Reg(x86_EAX, 2); /* Vector pointer */
|
||||
DecX86reg(x86_ECX); /* Loop counter */
|
||||
JneLabel8("Loop", 0);
|
||||
x86_SetBranch8b(RecompPos - 1, Loop);
|
||||
|
||||
|
@ -4965,7 +4965,7 @@ void Compile_Opcode_SSV ( void ) {
|
|||
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 15 - (RSPOpC.del + 1));
|
||||
MoveVariableToX86regHalf(&RSP_Vect[RSPOpC.rt].B[15 - (RSPOpC.del + 1)], Reg, x86_ECX);
|
||||
XorConstToX86Reg(x86_EBX, 2);
|
||||
MoveX86regHalfToN64Mem(x86_ECX, x86_EBX);
|
||||
MoveX86regHalfToN64Mem(x86_ECX, x86_EBX);
|
||||
} else {
|
||||
LeaSourceAndOffset(x86_EAX, x86_EBX, 1);
|
||||
XorConstToX86Reg(x86_EBX, 3);
|
||||
|
@ -5288,7 +5288,7 @@ void Compile_Opcode_SWV ( void ) {
|
|||
/************************** Other functions **************************/
|
||||
|
||||
void Compile_UnknownOpcode (void) {
|
||||
CPU_Message(" %X Unhandled Opcode: %s",CompilePC, RSPOpcodeName(RSPOpC.Hex,CompilePC) );
|
||||
CPU_Message(" %X Unhandled Opcode: %s",CompilePC, RSPOpcodeName(RSPOpC.Hex,CompilePC) );
|
||||
NextInstruction = FINISH_BLOCK;
|
||||
MoveConstToVariable(CompilePC,PrgCount,"RSP PC");
|
||||
MoveConstToVariable(RSPOpC.Hex,&RSPOpC.Hex, "RSPOpC.Hex");
|
||||
|
|
|
@ -748,7 +748,7 @@ void RSP_Sections_VMACF ( OPCODE RspOp, DWORD AccumStyle ) {
|
|||
|
||||
/******************** Microcode Sections *********************/
|
||||
|
||||
static DWORD Section_000_VMADN; /* Yah i know, but leave it */
|
||||
static DWORD Section_000_VMADN; /* Yah i know, but leave it */
|
||||
|
||||
BOOL Check_Section_000(void) {
|
||||
DWORD i;
|
||||
|
@ -809,7 +809,7 @@ void Compile_Section_000(void) {
|
|||
CPU_Message(" %X %s",CompilePC+0x00,RSPOpcodeName(vmudn.Hex,CompilePC + 0x00));
|
||||
if (LogRDP){
|
||||
char str[40];
|
||||
sprintf(str,"%X",CompilePC);
|
||||
sprintf(str,"%X",CompilePC);
|
||||
PushImm32(str,CompilePC);
|
||||
Call_Direct(RDP_LogLoc,"RDP_LogLoc");
|
||||
AddConstToX86Reg(x86_ESP, 4);
|
||||
|
@ -821,7 +821,7 @@ void Compile_Section_000(void) {
|
|||
|
||||
if (LogRDP){
|
||||
char str[40];
|
||||
sprintf(str,"%X",CompilePC+0x04+(i*4));
|
||||
sprintf(str,"%X",CompilePC+0x04+(i*4));
|
||||
PushImm32(str,CompilePC+0x04+(i*4));
|
||||
Call_Direct(RDP_LogLoc,"RDP_LogLoc");
|
||||
AddConstToX86Reg(x86_ESP, 4);
|
||||
|
@ -977,7 +977,7 @@ BOOL Check_Section_002 ( void ) {
|
|||
return FALSE;
|
||||
}
|
||||
if ((op[0].rs & 0xF) < 8) {
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (Count = 1; Count < 10; Count++) {
|
||||
|
@ -1009,13 +1009,13 @@ void Compile_Section_002 ( void ) {
|
|||
|
||||
OPCODE vmudh, vsaw;
|
||||
|
||||
CPU_Message("Compiling: %X to ..., RSP Optimization $002", CompilePC);
|
||||
CPU_Message("Compiling: %X to ..., RSP Optimization $002", CompilePC);
|
||||
for (Count = 0; Count < 0xC; Count++) {
|
||||
RSP_LW_IMEM(CompilePC + (Count * 0x04), &op[Count].Hex);
|
||||
CPU_Message(" %X %s",CompilePC+(Count*0x04),RSPOpcodeName(op[Count].Hex,CompilePC + (Count*0x04)));
|
||||
if (LogRDP){
|
||||
char str[40];
|
||||
sprintf(str,"%X",CompilePC+(Count*0x04));
|
||||
sprintf(str,"%X",CompilePC+(Count*0x04));
|
||||
PushImm32(str,CompilePC+(Count*0x04));
|
||||
Call_Direct(RDP_LogLoc,"RDP_LogLoc");
|
||||
AddConstToX86Reg(x86_ESP, 4);
|
||||
|
@ -1079,10 +1079,10 @@ static void resampler_hle() {
|
|||
UDWORD accum, initial;
|
||||
DWORD const2 = (DWORD)RSP_Vect[18].UHW[4 ^ 7];
|
||||
__int64 const3 = (__int64)((int)RSP_Vect[30].HW[0 ^ 7]) << 16;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
// VMUDM $v23, $v31, $v23 [7]
|
||||
initial.DW = (__int64)((DWORD)RSP_Vect[23].UHW[7 ^ 7]) << 16;
|
||||
initial.DW = (__int64)((DWORD)RSP_Vect[23].UHW[7 ^ 7]) << 16;
|
||||
// VMADH $v23, $v31, $v22 [7]
|
||||
initial.W[1] += (int)RSP_Vect[22].HW[7 ^ 7];
|
||||
|
||||
|
@ -1112,7 +1112,7 @@ static void resampler_hle() {
|
|||
}
|
||||
|
||||
void Compile_Section_003 ( void ) {
|
||||
CPU_Message("Compiling: %X to ..., RSP Optimization $003", CompilePC);
|
||||
CPU_Message("Compiling: %X to ..., RSP Optimization $003", CompilePC);
|
||||
Call_Direct(resampler_hle, "Resampler_HLE");
|
||||
CompilePC += 4 * sizeof(OPCODE);
|
||||
}
|
||||
|
|
|
@ -95,11 +95,11 @@ void AdcX86regToVariable(int x86reg, void * Variable, char * VariableName) {
|
|||
case x86_ESI: PUTDST16(RecompPos,0x3511); break;
|
||||
case x86_EDI: PUTDST16(RecompPos,0x3D11); break;
|
||||
case x86_ESP: PUTDST16(RecompPos,0x2511); break;
|
||||
case x86_EBP: PUTDST16(RecompPos,0x2D11); break;
|
||||
case x86_EBP: PUTDST16(RecompPos,0x2D11); break;
|
||||
default:
|
||||
DisplayError("AddVariableToX86reg\nUnknown x86 Register");
|
||||
}
|
||||
PUTDST32(RecompPos,Variable);
|
||||
PUTDST32(RecompPos,Variable);
|
||||
}
|
||||
|
||||
void AdcX86regHalfToVariable(int x86reg, void * Variable, char * VariableName) {
|
||||
|
@ -114,11 +114,11 @@ void AdcX86regHalfToVariable(int x86reg, void * Variable, char * VariableName) {
|
|||
case x86_ESI: PUTDST16(RecompPos,0x3511); break;
|
||||
case x86_EDI: PUTDST16(RecompPos,0x3D11); break;
|
||||
case x86_ESP: PUTDST16(RecompPos,0x2511); break;
|
||||
case x86_EBP: PUTDST16(RecompPos,0x2D11); break;
|
||||
case x86_EBP: PUTDST16(RecompPos,0x2D11); break;
|
||||
default:
|
||||
DisplayError("AdcX86regHalfToVariable\nUnknown x86 Register");
|
||||
}
|
||||
PUTDST32(RecompPos,Variable);
|
||||
PUTDST32(RecompPos,Variable);
|
||||
}
|
||||
|
||||
void AdcConstToVariable(void *Variable, char *VariableName, BYTE Constant) {
|
||||
|
@ -142,7 +142,7 @@ void AdcConstToX86reg( BYTE Constant, int x86reg ) {
|
|||
default:
|
||||
DisplayError("AdcConstantToX86reg\nUnknown x86 Register");
|
||||
}
|
||||
PUTDST8(RecompPos,Constant);
|
||||
PUTDST8(RecompPos,Constant);
|
||||
}
|
||||
|
||||
void AddConstToVariable (DWORD Const, void *Variable, char *VariableName) {
|
||||
|
@ -207,7 +207,7 @@ void AddVariableToX86reg(int x86reg, void * Variable, char * VariableName) {
|
|||
default:
|
||||
DisplayError("AddVariableToX86reg\nUnknown x86 Register");
|
||||
}
|
||||
PUTDST32(RecompPos,Variable);
|
||||
PUTDST32(RecompPos,Variable);
|
||||
}
|
||||
|
||||
void AddX86regToVariable(int x86reg, void * Variable, char * VariableName) {
|
||||
|
@ -224,7 +224,7 @@ void AddX86regToVariable(int x86reg, void * Variable, char * VariableName) {
|
|||
default:
|
||||
DisplayError("AddVariableToX86reg\nUnknown x86 Register");
|
||||
}
|
||||
PUTDST32(RecompPos,Variable);
|
||||
PUTDST32(RecompPos,Variable);
|
||||
}
|
||||
|
||||
void AddX86regHalfToVariable(int x86reg, void * Variable, char * VariableName) {
|
||||
|
@ -1145,7 +1145,7 @@ void MoveConstToX86reg(DWORD Const, int x86reg) {
|
|||
default:
|
||||
DisplayError("MoveConstToX86reg\nUnknown x86 Register");
|
||||
}
|
||||
PUTDST32(RecompPos,Const);
|
||||
PUTDST32(RecompPos,Const);
|
||||
}
|
||||
|
||||
void MoveOffsetToX86reg(DWORD Const, char * VariableName, int x86reg) {
|
||||
|
@ -1162,7 +1162,7 @@ void MoveOffsetToX86reg(DWORD Const, char * VariableName, int x86reg) {
|
|||
default:
|
||||
DisplayError("MoveOffsetToX86reg\nUnknown x86 Register");
|
||||
}
|
||||
PUTDST32(RecompPos,Const);
|
||||
PUTDST32(RecompPos,Const);
|
||||
}
|
||||
|
||||
void MoveX86regPointerToX86regByte(int Destination, int AddrReg) {
|
||||
|
@ -2609,7 +2609,7 @@ void SubVariableFromX86reg(int x86reg, void * Variable, char * VariableName) {
|
|||
default:
|
||||
DisplayError("SubVariableFromX86reg\nUnknown x86 Register");
|
||||
}
|
||||
PUTDST32(RecompPos,Variable);
|
||||
PUTDST32(RecompPos,Variable);
|
||||
}
|
||||
|
||||
void SubX86regFromVariable(int x86reg, void * Variable, char * VariableName) {
|
||||
|
@ -2626,7 +2626,7 @@ void SubX86regFromVariable(int x86reg, void * Variable, char * VariableName) {
|
|||
default:
|
||||
DisplayError("SubX86regFromVariable\nUnknown x86 Register");
|
||||
}
|
||||
PUTDST32(RecompPos,Variable);
|
||||
PUTDST32(RecompPos,Variable);
|
||||
}
|
||||
|
||||
void SubX86RegToX86Reg(int Destination, int Source) {
|
||||
|
|
|
@ -40,7 +40,7 @@ void Add_BPoint ( void )
|
|||
GetWindowText(hRSPLocation,Title,sizeof(Title));
|
||||
if (!AddRSP_BPoint(AsciiToHex(Title),TRUE )) {
|
||||
SendMessage(hRSPLocation,EM_SETSEL,(WPARAM)0,(LPARAM)-1);
|
||||
SetFocus(hRSPLocation);
|
||||
SetFocus(hRSPLocation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ int AddRSP_BPoint( DWORD Location, int Confirm )
|
|||
int Response;
|
||||
|
||||
sprintf(Message,"Break when:\n\nRSP's Program Counter = 0x%03X\n\nIs this correct?",
|
||||
Location);
|
||||
Location);
|
||||
Response = MessageBox(BPoint_Win_hDlg, Message, "Breakpoint", MB_YESNO | MB_ICONINFORMATION);
|
||||
if (Response == IDNO)
|
||||
{
|
||||
|
@ -142,8 +142,8 @@ void RefreshBpoints ( HWND hList )
|
|||
|
||||
for (count = 0; count < NoOfBpoints; count ++ ) {
|
||||
sprintf(Message," at 0x%03X (RSP)", BPoint[count].Location);
|
||||
location = SendMessage(hList,LB_ADDSTRING,0,(LPARAM)Message);
|
||||
SendMessage(hList,LB_SETITEMDATA,(WPARAM)location,(LPARAM)BPoint[count].Location);
|
||||
location = SendMessage(hList,LB_ADDSTRING,0,(LPARAM)Message);
|
||||
SendMessage(hList,LB_SETITEMDATA,(WPARAM)location,(LPARAM)BPoint[count].Location);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ void RemoveBpoint ( HWND hList, int index )
|
|||
{
|
||||
DWORD location;
|
||||
|
||||
location = SendMessage(hList,LB_GETITEMDATA,(WPARAM)index,0);
|
||||
location = SendMessage(hList,LB_GETITEMDATA,(WPARAM)index,0);
|
||||
RemoveRSPBreakPoint(location);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ void SP_DMA_READ (void)
|
|||
if ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||
{
|
||||
MessageBox(NULL,"SP DMA READ\ncould not fit copy in memory segment","Error",MB_OK);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
Length = ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) | 7) + 1;
|
||||
|
@ -124,7 +124,7 @@ void SP_DMA_WRITE (void)
|
|||
if ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||
{
|
||||
MessageBox(NULL,"SP DMA WRITE\ncould not fit copy in memory segment","Error",MB_OK);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
Length = ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) | 7) + 1;
|
||||
|
|
Loading…
Reference in New Issue