Global Variable: Rename _Reg to g_Reg
This commit is contained in:
parent
c219c0ab6a
commit
3a73b759ad
|
@ -85,7 +85,7 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
|
|||
}
|
||||
if (SendDlgItemMessage(IDC_USE_ALT_PC,BM_GETSTATE, 0,0) != BST_CHECKED)
|
||||
{
|
||||
DumpPC = _Reg->m_PROGRAM_COUNTER;
|
||||
DumpPC = g_Reg->m_PROGRAM_COUNTER;
|
||||
}
|
||||
//disable buttons
|
||||
::EnableWindow(GetDlgItem(IDC_E_START_ADDR),FALSE);
|
||||
|
|
|
@ -197,10 +197,10 @@ void CInterpreterCPU::InPermLoop (void) {
|
|||
//if (CPU_Type == CPU_SyncCores) { SyncRegisters.CP0[9] +=5; }
|
||||
|
||||
/* Interrupts enabled */
|
||||
if (( _Reg->STATUS_REGISTER & STATUS_IE ) == 0 ||
|
||||
( _Reg->STATUS_REGISTER & STATUS_EXL ) != 0 ||
|
||||
( _Reg->STATUS_REGISTER & STATUS_ERL ) != 0 ||
|
||||
( _Reg->STATUS_REGISTER & 0xFF00) == 0)
|
||||
if (( g_Reg->STATUS_REGISTER & STATUS_IE ) == 0 ||
|
||||
( g_Reg->STATUS_REGISTER & STATUS_EXL ) != 0 ||
|
||||
( g_Reg->STATUS_REGISTER & STATUS_ERL ) != 0 ||
|
||||
( g_Reg->STATUS_REGISTER & 0xFF00) == 0)
|
||||
{
|
||||
if (_Plugins->Gfx()->UpdateScreen != NULL) { _Plugins->Gfx()->UpdateScreen(); }
|
||||
//CurrentFrame = 0;
|
||||
|
@ -293,7 +293,7 @@ void CInterpreterCPU::ExecuteCPU (void )
|
|||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
} else {
|
||||
_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
|
||||
g_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
|
||||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ void CInterpreterCPU::ExecuteOps ( int Cycles )
|
|||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
} else {
|
||||
_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
|
||||
g_Reg->DoTLBReadMiss(R4300iOp::m_NextInstruction == JUMP,PROGRAM_COUNTER);
|
||||
R4300iOp::m_NextInstruction = NORMAL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,22 +4,22 @@
|
|||
bool DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 );
|
||||
|
||||
#define ADDRESS_ERROR_EXCEPTION(Address,FromRead) \
|
||||
_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
||||
g_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;
|
||||
|
||||
//#define TEST_COP1_USABLE_EXCEPTION
|
||||
#define TEST_COP1_USABLE_EXCEPTION \
|
||||
if ((_Reg->STATUS_REGISTER & STATUS_CU1) == 0) {\
|
||||
_Reg->DoCopUnusableException(m_NextInstruction == JUMP,1);\
|
||||
if ((g_Reg->STATUS_REGISTER & STATUS_CU1) == 0) {\
|
||||
g_Reg->DoCopUnusableException(m_NextInstruction == JUMP,1);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;\
|
||||
}
|
||||
|
||||
#define TLB_READ_EXCEPTION(Address) \
|
||||
_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\
|
||||
g_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;
|
||||
|
@ -1199,7 +1199,7 @@ void R4300iOp32::COP0_MT (void) {
|
|||
_GPR[m_Opcode.rt].UW[0],CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
if (m_Opcode.rd == 11) { //Compare
|
||||
LogMessage("%08X: Cause register changed from %08X to %08X",(*_PROGRAM_COUNTER),
|
||||
_Reg->CAUSE_REGISTER, (_Reg->CAUSE_REGISTER & ~CAUSE_IP7));
|
||||
g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1233,13 +1233,13 @@ void R4300iOp32::COP0_MT (void) {
|
|||
case 11: //Compare
|
||||
_SystemTimer->UpdateTimers();
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP7;
|
||||
g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP7;
|
||||
_SystemTimer->UpdateCompareTimer();
|
||||
break;
|
||||
case 12: //Status
|
||||
if ((_CP0[m_Opcode.rd] ^ _GPR[m_Opcode.rt].UW[0]) != 0) {
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
_Reg->FixFpuLocations();
|
||||
g_Reg->FixFpuLocations();
|
||||
} else {
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
}
|
||||
|
@ -1248,7 +1248,7 @@ void R4300iOp32::COP0_MT (void) {
|
|||
g_Notify->DisplayError("Left kernel mode ??");
|
||||
#endif
|
||||
}
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->CheckInterrupts();
|
||||
break;
|
||||
case 13: //cause
|
||||
_CP0[m_Opcode.rd] &= 0xFFFFCFF;
|
||||
|
|
|
@ -57,22 +57,22 @@ const int R4300iOp::LWL_SHIFT[4] = { 0, 8, 16, 24};
|
|||
const int R4300iOp::LWR_SHIFT[4] = { 24, 16 ,8, 0 };
|
||||
|
||||
#define ADDRESS_ERROR_EXCEPTION(Address,FromRead) \
|
||||
_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
||||
g_Reg->DoAddressError(m_NextInstruction == JUMP,Address,FromRead);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;
|
||||
|
||||
//#define TEST_COP1_USABLE_EXCEPTION
|
||||
#define TEST_COP1_USABLE_EXCEPTION \
|
||||
if ((_Reg->STATUS_REGISTER & STATUS_CU1) == 0) {\
|
||||
_Reg->DoCopUnusableException(m_NextInstruction == JUMP,1);\
|
||||
if ((g_Reg->STATUS_REGISTER & STATUS_CU1) == 0) {\
|
||||
g_Reg->DoCopUnusableException(m_NextInstruction == JUMP,1);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;\
|
||||
}
|
||||
|
||||
#define TLB_READ_EXCEPTION(Address) \
|
||||
_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\
|
||||
g_Reg->DoTLBReadMiss(m_NextInstruction == JUMP,Address);\
|
||||
m_NextInstruction = JUMP;\
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);\
|
||||
return;
|
||||
|
@ -1454,13 +1454,13 @@ void R4300iOp::SPECIAL_JALR (void) {
|
|||
}
|
||||
|
||||
void R4300iOp::SPECIAL_SYSCALL (void) {
|
||||
_Reg->DoSysCallException(m_NextInstruction == JUMP);
|
||||
g_Reg->DoSysCallException(m_NextInstruction == JUMP);
|
||||
m_NextInstruction = JUMP;
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
|
||||
void R4300iOp::SPECIAL_BREAK (void) {
|
||||
_Reg->DoBreakException(m_NextInstruction == JUMP);
|
||||
g_Reg->DoBreakException(m_NextInstruction == JUMP);
|
||||
m_NextInstruction = JUMP;
|
||||
m_JumpToLocation = (*_PROGRAM_COUNTER);
|
||||
}
|
||||
|
@ -1802,7 +1802,7 @@ void R4300iOp::COP0_MT (void) {
|
|||
_GPR[m_Opcode.rt].UW[0],CRegName::Cop0[m_Opcode.rd], _CP0[m_Opcode.rd]);
|
||||
if (m_Opcode.rd == 11) { //Compare
|
||||
LogMessage("%08X: Cause register changed from %08X to %08X",(*_PROGRAM_COUNTER),
|
||||
_Reg->CAUSE_REGISTER, (_Reg->CAUSE_REGISTER & ~CAUSE_IP7));
|
||||
g_Reg->CAUSE_REGISTER, (g_Reg->CAUSE_REGISTER & ~CAUSE_IP7));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1836,13 +1836,13 @@ void R4300iOp::COP0_MT (void) {
|
|||
case 11: //Compare
|
||||
_SystemTimer->UpdateTimers();
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP7;
|
||||
g_Reg->FAKE_CAUSE_REGISTER &= ~CAUSE_IP7;
|
||||
_SystemTimer->UpdateCompareTimer();
|
||||
break;
|
||||
case 12: //Status
|
||||
if ((_CP0[m_Opcode.rd] ^ _GPR[m_Opcode.rt].UW[0]) != 0) {
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
_Reg->FixFpuLocations();
|
||||
g_Reg->FixFpuLocations();
|
||||
} else {
|
||||
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
|
||||
}
|
||||
|
@ -1851,7 +1851,7 @@ void R4300iOp::COP0_MT (void) {
|
|||
g_Notify->DisplayError("Left kernel mode ??");
|
||||
#endif
|
||||
}
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->CheckInterrupts();
|
||||
break;
|
||||
case 13: //cause
|
||||
_CP0[m_Opcode.rd] &= 0xFFFFCFF;
|
||||
|
@ -1872,12 +1872,12 @@ void R4300iOp::COP0_CO_TLBR (void) {
|
|||
|
||||
void R4300iOp::COP0_CO_TLBWI (void) {
|
||||
if (!bUseTlb()) { return; }
|
||||
g_TLB->WriteEntry(_Reg->INDEX_REGISTER & 0x1F,FALSE);
|
||||
g_TLB->WriteEntry(g_Reg->INDEX_REGISTER & 0x1F,FALSE);
|
||||
}
|
||||
|
||||
void R4300iOp::COP0_CO_TLBWR (void) {
|
||||
if (!bUseTlb()) { return; }
|
||||
g_TLB->WriteEntry(_Reg->RANDOM_REGISTER & 0x1F,true);
|
||||
g_TLB->WriteEntry(g_Reg->RANDOM_REGISTER & 0x1F,true);
|
||||
}
|
||||
|
||||
void R4300iOp::COP0_CO_TLBP (void) {
|
||||
|
@ -1887,15 +1887,15 @@ void R4300iOp::COP0_CO_TLBP (void) {
|
|||
|
||||
void R4300iOp::COP0_CO_ERET (void) {
|
||||
m_NextInstruction = JUMP;
|
||||
if ((_Reg->STATUS_REGISTER & STATUS_ERL) != 0) {
|
||||
m_JumpToLocation = _Reg->ERROREPC_REGISTER;
|
||||
_Reg->STATUS_REGISTER &= ~STATUS_ERL;
|
||||
if ((g_Reg->STATUS_REGISTER & STATUS_ERL) != 0) {
|
||||
m_JumpToLocation = g_Reg->ERROREPC_REGISTER;
|
||||
g_Reg->STATUS_REGISTER &= ~STATUS_ERL;
|
||||
} else {
|
||||
m_JumpToLocation = _Reg->EPC_REGISTER;
|
||||
_Reg->STATUS_REGISTER &= ~STATUS_EXL;
|
||||
m_JumpToLocation = g_Reg->EPC_REGISTER;
|
||||
g_Reg->STATUS_REGISTER &= ~STATUS_EXL;
|
||||
}
|
||||
(*_LLBit) = 0;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->CheckInterrupts();
|
||||
m_TestTimer = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,12 @@ DWORD CAudio::GetStatus ( void )
|
|||
|
||||
void CAudio::LenChanged ( void )
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (_Reg->AI_LEN_REG = %d)",_Reg->AI_LEN_REG);
|
||||
if (_Reg->AI_LEN_REG != 0)
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Start (g_Reg->AI_LEN_REG = %d)",g_Reg->AI_LEN_REG);
|
||||
if (g_Reg->AI_LEN_REG != 0)
|
||||
{
|
||||
if (_Reg->AI_LEN_REG >= 0x20000)
|
||||
if (g_Reg->AI_LEN_REG >= 0x20000)
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": *** Ignoring Write, To Large (%X)",_Reg->AI_LEN_REG);
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": *** Ignoring Write, To Large (%X)",g_Reg->AI_LEN_REG);
|
||||
} else {
|
||||
m_Status |= 0x80000000;
|
||||
if (_SystemTimer->GetTimer(CSystemTimer::AiTimer) == 0)
|
||||
|
@ -52,11 +52,11 @@ void CAudio::LenChanged ( void )
|
|||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Set Timer AI_LEN_REG: %d m_CountsPerByte: %d",_Reg->AI_LEN_REG,m_CountsPerByte);
|
||||
_SystemTimer->SetTimer(CSystemTimer::AiTimer,_Reg->AI_LEN_REG * m_CountsPerByte,false);
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Set Timer AI_LEN_REG: %d m_CountsPerByte: %d",g_Reg->AI_LEN_REG,m_CountsPerByte);
|
||||
_SystemTimer->SetTimer(CSystemTimer::AiTimer,g_Reg->AI_LEN_REG * m_CountsPerByte,false);
|
||||
} else {
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Increasing Second Buffer (m_SecondBuff %d Increase: %d)",m_SecondBuff,_Reg->AI_LEN_REG);
|
||||
m_SecondBuff += _Reg->AI_LEN_REG;
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Increasing Second Buffer (m_SecondBuff %d Increase: %d)",m_SecondBuff,g_Reg->AI_LEN_REG);
|
||||
m_SecondBuff += g_Reg->AI_LEN_REG;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -81,8 +81,8 @@ void CAudio::TimerDone ( void )
|
|||
_SystemTimer->SetTimer(CSystemTimer::AiTimer,m_SecondBuff * m_CountsPerByte,false);
|
||||
m_SecondBuff = 0;
|
||||
} else {
|
||||
_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||
g_Reg->CheckInterrupts();
|
||||
m_Status &= 0x7FFFFFFF;
|
||||
}
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": Done",m_SecondBuff);
|
||||
|
@ -102,7 +102,7 @@ void CAudio::SetViIntr ( DWORD /*VI_INTR_TIME*/ )
|
|||
|
||||
void CAudio::SetFrequency (DWORD Dacrate, DWORD System)
|
||||
{
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ "(Dacrate: %X System: %d): AI_BITRATE_REG = %X",Dacrate,System,_Reg->AI_BITRATE_REG);
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ "(Dacrate: %X System: %d): AI_BITRATE_REG = %X",Dacrate,System,g_Reg->AI_BITRATE_REG);
|
||||
DWORD Frequency;
|
||||
|
||||
switch (System) {
|
||||
|
|
|
@ -20,97 +20,97 @@ void CDMA::OnFirstDMA (void) {
|
|||
void CDMA::PI_DMA_READ (void) {
|
||||
// PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||
|
||||
if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_RD_LEN_REG + 1 > g_MMU->RdramSize()) {
|
||||
if ( g_Reg->PI_DRAM_ADDR_REG + g_Reg->PI_RD_LEN_REG + 1 > g_MMU->RdramSize()) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
g_Notify->DisplayError("PI_DMA_READ not in Memory");
|
||||
#endif
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( _Reg->PI_CART_ADDR_REG >= 0x08000000 && _Reg->PI_CART_ADDR_REG <= 0x08010000) {
|
||||
if ( g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG <= 0x08010000) {
|
||||
if (g_System->m_SaveUsing == SaveChip_Auto) { g_System->m_SaveUsing = SaveChip_Sram; }
|
||||
if (g_System->m_SaveUsing == SaveChip_Sram) {
|
||||
m_Sram.DmaToSram(
|
||||
g_MMU->Rdram() + _Reg->PI_DRAM_ADDR_REG,
|
||||
_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
_Reg->PI_RD_LEN_REG + 1
|
||||
g_MMU->Rdram() + g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
g_Reg->PI_RD_LEN_REG + 1
|
||||
);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_FlashRam) {
|
||||
m_FlashRam.DmaToFlashram(
|
||||
g_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
|
||||
_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
_Reg->PI_WR_LEN_REG + 1
|
||||
g_MMU->Rdram()+g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
g_Reg->PI_WR_LEN_REG + 1
|
||||
);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_FlashRam)
|
||||
{
|
||||
g_Notify->DisplayError("**** FLashRam DMA Read address %X *****",_Reg->PI_CART_ADDR_REG);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Notify->DisplayError("**** FLashRam DMA Read address %X *****",g_Reg->PI_CART_ADDR_REG);
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
g_Notify->DisplayError("PI_DMA_READ where are you dmaing to ?");
|
||||
#endif
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
void CDMA::PI_DMA_WRITE (void) {
|
||||
|
||||
_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||
if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 > g_MMU->RdramSize())
|
||||
g_Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY;
|
||||
if ( g_Reg->PI_DRAM_ADDR_REG + g_Reg->PI_WR_LEN_REG + 1 > g_MMU->RdramSize())
|
||||
{
|
||||
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError("PI_DMA_WRITE not in Memory"); }
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( _Reg->PI_CART_ADDR_REG >= 0x08000000 && _Reg->PI_CART_ADDR_REG <= 0x08010000) {
|
||||
if ( g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG <= 0x08010000) {
|
||||
if (g_System->m_SaveUsing == SaveChip_Auto) { g_System->m_SaveUsing = SaveChip_Sram; }
|
||||
if (g_System->m_SaveUsing == SaveChip_Sram) {
|
||||
m_Sram.DmaFromSram(
|
||||
g_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
|
||||
_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
_Reg->PI_WR_LEN_REG + 1
|
||||
g_MMU->Rdram()+g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
g_Reg->PI_WR_LEN_REG + 1
|
||||
);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
return;
|
||||
}
|
||||
if (g_System->m_SaveUsing == SaveChip_FlashRam) {
|
||||
m_FlashRam.DmaFromFlashram(
|
||||
g_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
|
||||
_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
_Reg->PI_WR_LEN_REG + 1
|
||||
g_MMU->Rdram()+g_Reg->PI_DRAM_ADDR_REG,
|
||||
g_Reg->PI_CART_ADDR_REG - 0x08000000,
|
||||
g_Reg->PI_WR_LEN_REG + 1
|
||||
);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( _Reg->PI_CART_ADDR_REG >= 0x10000000 && _Reg->PI_CART_ADDR_REG <= 0x1FBFFFFF)
|
||||
if ( g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FBFFFFF)
|
||||
{
|
||||
DWORD i;
|
||||
#ifdef tofix
|
||||
|
@ -123,22 +123,22 @@ void CDMA::PI_DMA_WRITE (void) {
|
|||
#endif
|
||||
BYTE * ROM = _Rom->GetRomAddress();
|
||||
BYTE * RDRAM = g_MMU->Rdram();
|
||||
_Reg->PI_CART_ADDR_REG -= 0x10000000;
|
||||
if (_Reg->PI_CART_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 < _Rom->GetRomSize()) {
|
||||
for (i = 0; i < _Reg->PI_WR_LEN_REG + 1; i ++) {
|
||||
*(RDRAM+((_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||
g_Reg->PI_CART_ADDR_REG -= 0x10000000;
|
||||
if (g_Reg->PI_CART_ADDR_REG + g_Reg->PI_WR_LEN_REG + 1 < _Rom->GetRomSize()) {
|
||||
for (i = 0; i < g_Reg->PI_WR_LEN_REG + 1; i ++) {
|
||||
*(RDRAM+((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
} else {
|
||||
DWORD Len;
|
||||
Len = _Rom->GetRomSize() - _Reg->PI_CART_ADDR_REG;
|
||||
Len = _Rom->GetRomSize() - g_Reg->PI_CART_ADDR_REG;
|
||||
for (i = 0; i < Len; i ++) {
|
||||
*(RDRAM+((_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||
*(RDRAM+((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
|
||||
}
|
||||
for (i = Len; i < _Reg->PI_WR_LEN_REG + 1 - Len; i ++) {
|
||||
*(RDRAM+((_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = 0;
|
||||
for (i = Len; i < g_Reg->PI_WR_LEN_REG + 1 - Len; i ++) {
|
||||
*(RDRAM+((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = 0;
|
||||
}
|
||||
}
|
||||
_Reg->PI_CART_ADDR_REG += 0x10000000;
|
||||
g_Reg->PI_CART_ADDR_REG += 0x10000000;
|
||||
|
||||
if (!g_System->DmaUsed())
|
||||
{
|
||||
|
@ -147,76 +147,76 @@ void CDMA::PI_DMA_WRITE (void) {
|
|||
}
|
||||
if (g_Recompiler && g_Recompiler->bSMM_PIDMA())
|
||||
{
|
||||
g_Recompiler->ClearRecompCode_Phys(_Reg->PI_DRAM_ADDR_REG, _Reg->PI_WR_LEN_REG,CRecompiler::Remove_DMA);
|
||||
g_Recompiler->ClearRecompCode_Phys(g_Reg->PI_DRAM_ADDR_REG, g_Reg->PI_WR_LEN_REG,CRecompiler::Remove_DMA);
|
||||
}
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
//ChangeTimer(PiTimer,(int)(PI_WR_LEN_REG * 8.9) + 50);
|
||||
//ChangeTimer(PiTimer,(int)(PI_WR_LEN_REG * 8.9));
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError("PI_DMA_WRITE not in ROM"); }
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
|
||||
}
|
||||
|
||||
void CDMA::SP_DMA_READ (void) {
|
||||
_Reg->SP_DRAM_ADDR_REG &= 0x1FFFFFFF;
|
||||
g_Reg->SP_DRAM_ADDR_REG &= 0x1FFFFFFF;
|
||||
|
||||
if (_Reg->SP_DRAM_ADDR_REG > g_MMU->RdramSize()) {
|
||||
if (g_Reg->SP_DRAM_ADDR_REG > g_MMU->RdramSize()) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
g_Notify->DisplayError("SP DMA\nSP_DRAM_ADDR_REG not in RDRam space");
|
||||
#endif
|
||||
_Reg->SP_DMA_BUSY_REG = 0;
|
||||
_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_Reg->SP_RD_LEN_REG + 1 + (_Reg->SP_MEM_ADDR_REG & 0xFFF) > 0x1000) {
|
||||
if (g_Reg->SP_RD_LEN_REG + 1 + (g_Reg->SP_MEM_ADDR_REG & 0xFFF) > 0x1000) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
g_Notify->DisplayError("SP DMA\ncould not fit copy in memory segement");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_Reg->SP_MEM_ADDR_REG & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
if ((_Reg->SP_DRAM_ADDR_REG & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
if (((_Reg->SP_RD_LEN_REG + 1) & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
if ((g_Reg->SP_MEM_ADDR_REG & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
if ((g_Reg->SP_DRAM_ADDR_REG & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
if (((g_Reg->SP_RD_LEN_REG + 1) & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
|
||||
memcpy( g_MMU->Dmem() + (_Reg->SP_MEM_ADDR_REG & 0x1FFF), g_MMU->Rdram() + _Reg->SP_DRAM_ADDR_REG,
|
||||
_Reg->SP_RD_LEN_REG + 1 );
|
||||
memcpy( g_MMU->Dmem() + (g_Reg->SP_MEM_ADDR_REG & 0x1FFF), g_MMU->Rdram() + g_Reg->SP_DRAM_ADDR_REG,
|
||||
g_Reg->SP_RD_LEN_REG + 1 );
|
||||
|
||||
_Reg->SP_DMA_BUSY_REG = 0;
|
||||
_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
}
|
||||
|
||||
void CDMA::SP_DMA_WRITE (void) {
|
||||
if (_Reg->SP_DRAM_ADDR_REG > g_MMU->RdramSize()) {
|
||||
if (g_Reg->SP_DRAM_ADDR_REG > g_MMU->RdramSize()) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
g_Notify->DisplayError("SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRam space");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (_Reg->SP_WR_LEN_REG + 1 + (_Reg->SP_MEM_ADDR_REG & 0xFFF) > 0x1000) {
|
||||
if (g_Reg->SP_WR_LEN_REG + 1 + (g_Reg->SP_MEM_ADDR_REG & 0xFFF) > 0x1000) {
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
g_Notify->DisplayError("SP DMA WRITE\ncould not fit copy in memory segement");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_Reg->SP_MEM_ADDR_REG & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
if ((_Reg->SP_DRAM_ADDR_REG & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
if (((_Reg->SP_WR_LEN_REG + 1) & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
if ((g_Reg->SP_MEM_ADDR_REG & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
if ((g_Reg->SP_DRAM_ADDR_REG & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
if (((g_Reg->SP_WR_LEN_REG + 1) & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); }
|
||||
|
||||
memcpy( g_MMU->Rdram() + _Reg->SP_DRAM_ADDR_REG, g_MMU->Dmem() + (_Reg->SP_MEM_ADDR_REG & 0x1FFF),
|
||||
_Reg->SP_WR_LEN_REG + 1);
|
||||
memcpy( g_MMU->Rdram() + g_Reg->SP_DRAM_ADDR_REG, g_MMU->Dmem() + (g_Reg->SP_MEM_ADDR_REG & 0x1FFF),
|
||||
g_Reg->SP_WR_LEN_REG + 1);
|
||||
|
||||
_Reg->SP_DMA_BUSY_REG = 0;
|
||||
_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
g_Reg->SP_DMA_BUSY_REG = 0;
|
||||
g_Reg->SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -144,9 +144,9 @@ void CPifRam::PifRamWrite (void) {
|
|||
break;
|
||||
case 0x08:
|
||||
m_PifRam[0x3F] = 0;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
g_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
g_Reg->CheckInterrupts();
|
||||
break;
|
||||
case 0x10:
|
||||
memset(m_PifRom,0,0x7C0);
|
||||
|
@ -206,7 +206,7 @@ void CPifRam::SI_DMA_READ (void)
|
|||
BYTE * PifRamPos = m_PifRam;
|
||||
BYTE * RDRAM = g_MMU->Rdram();
|
||||
|
||||
DWORD & SI_DRAM_ADDR_REG = _Reg->SI_DRAM_ADDR_REG;
|
||||
DWORD & SI_DRAM_ADDR_REG = g_Reg->SI_DRAM_ADDR_REG;
|
||||
if ((int)SI_DRAM_ADDR_REG > (int)RdramSize())
|
||||
{
|
||||
if (bShowPifRamErrors())
|
||||
|
@ -288,9 +288,9 @@ void CPifRam::SI_DMA_READ (void)
|
|||
if (bDelaySI()) {
|
||||
_SystemTimer->SetTimer(CSystemTimer::SiTimer,0x900,false);
|
||||
} else {
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
g_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ void CPifRam::SI_DMA_WRITE (void)
|
|||
{
|
||||
BYTE * PifRamPos = m_PifRam;
|
||||
|
||||
DWORD & SI_DRAM_ADDR_REG = _Reg->SI_DRAM_ADDR_REG;
|
||||
DWORD & SI_DRAM_ADDR_REG = g_Reg->SI_DRAM_ADDR_REG;
|
||||
if ((int)SI_DRAM_ADDR_REG > (int)RdramSize())
|
||||
{
|
||||
if (bShowPifRamErrors())
|
||||
|
@ -384,9 +384,9 @@ void CPifRam::SI_DMA_WRITE (void)
|
|||
if (bDelaySI()) {
|
||||
_SystemTimer->SetTimer(CSystemTimer::SiTimer,0x900,false);
|
||||
} else {
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
g_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ void CSystemEvents::ExecuteEvents ( void )
|
|||
case SysEvent_ResetCPU_Soft:
|
||||
_SystemTimer->SetTimer(CSystemTimer::SoftResetTimer,0x3000000,false);
|
||||
_Plugins->Gfx()->ShowCFB();
|
||||
_Reg->FAKE_CAUSE_REGISTER |= CAUSE_IP4;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->FAKE_CAUSE_REGISTER |= CAUSE_IP4;
|
||||
g_Reg->CheckInterrupts();
|
||||
_Plugins->Gfx()->SoftReset();
|
||||
break;
|
||||
case SysEvent_ResetCPU_SoftDone:
|
||||
|
@ -65,31 +65,31 @@ void CSystemEvents::ExecuteEvents ( void )
|
|||
g_System->m_Profile.ResetCounters();
|
||||
break;
|
||||
case SysEvent_ExecuteInterrupt:
|
||||
_Reg->DoIntrException(false);
|
||||
g_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_SP:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SP;
|
||||
_Reg->DoIntrException(false);
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_SP;
|
||||
g_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_SI:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
_Reg->DoIntrException(false);
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
g_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_AI:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||
_Reg->DoIntrException(false);
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_AI;
|
||||
g_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_VI:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_VI;
|
||||
_Reg->DoIntrException(false);
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_VI;
|
||||
g_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_PI:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->DoIntrException(false);
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_Interrupt_DP:
|
||||
_Reg->MI_INTR_REG |= MI_INTR_DP;
|
||||
_Reg->DoIntrException(false);
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_DP;
|
||||
g_Reg->DoIntrException(false);
|
||||
break;
|
||||
case SysEvent_SaveMachineState:
|
||||
if (!g_System->SaveState())
|
||||
|
|
|
@ -144,11 +144,11 @@ void CSystemTimer::UpdateTimers ( void )
|
|||
if (TimeTaken != 0)
|
||||
{
|
||||
m_LastUpdate = m_NextTimer;
|
||||
_Reg->COUNT_REGISTER += TimeTaken;
|
||||
_Reg->RANDOM_REGISTER -= TimeTaken / CountPerOp();
|
||||
while ((int)_Reg->RANDOM_REGISTER < (int)_Reg->WIRED_REGISTER)
|
||||
g_Reg->COUNT_REGISTER += TimeTaken;
|
||||
g_Reg->RANDOM_REGISTER -= TimeTaken / CountPerOp();
|
||||
while ((int)g_Reg->RANDOM_REGISTER < (int)g_Reg->WIRED_REGISTER)
|
||||
{
|
||||
_Reg->RANDOM_REGISTER += 32 - _Reg->WIRED_REGISTER;
|
||||
g_Reg->RANDOM_REGISTER += 32 - g_Reg->WIRED_REGISTER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,8 +169,8 @@ void CSystemTimer::TimerDone (void)
|
|||
*/
|
||||
switch (m_Current) {
|
||||
case CSystemTimer::CompareTimer:
|
||||
_Reg->FAKE_CAUSE_REGISTER |= CAUSE_IP7;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->FAKE_CAUSE_REGISTER |= CAUSE_IP7;
|
||||
g_Reg->CheckInterrupts();
|
||||
UpdateCompareTimer();
|
||||
break;
|
||||
case CSystemTimer::SoftResetTimer:
|
||||
|
@ -179,15 +179,15 @@ void CSystemTimer::TimerDone (void)
|
|||
break;
|
||||
case CSystemTimer::SiTimer:
|
||||
_SystemTimer->StopTimer(CSystemTimer::SiTimer);
|
||||
_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_SI;
|
||||
g_Reg->SI_STATUS_REG |= SI_STATUS_INTERRUPT;
|
||||
g_Reg->CheckInterrupts();
|
||||
break;
|
||||
case CSystemTimer::PiTimer:
|
||||
_SystemTimer->StopTimer(CSystemTimer::PiTimer);
|
||||
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_PI;
|
||||
g_Reg->CheckInterrupts();
|
||||
break;
|
||||
case CSystemTimer::ViTimer:
|
||||
try
|
||||
|
@ -198,8 +198,8 @@ void CSystemTimer::TimerDone (void)
|
|||
{
|
||||
WriteTraceF(TraceError,"Exception caught in Refresh Screen\nFile: %s\nLine: %d",__FILE__,__LINE__);
|
||||
}
|
||||
_Reg->MI_INTR_REG |= MI_INTR_VI;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->MI_INTR_REG |= MI_INTR_VI;
|
||||
g_Reg->CheckInterrupts();
|
||||
break;
|
||||
case CSystemTimer::RspTimer:
|
||||
_SystemTimer->StopTimer(CSystemTimer::RspTimer);
|
||||
|
@ -211,8 +211,8 @@ void CSystemTimer::TimerDone (void)
|
|||
break;
|
||||
case CSystemTimer::RSPTimerDlist:
|
||||
_SystemTimer->StopTimer(CSystemTimer::RSPTimerDlist);
|
||||
_Reg->m_GfxIntrReg |= MI_INTR_DP;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->m_GfxIntrReg |= MI_INTR_DP;
|
||||
g_Reg->CheckInterrupts();
|
||||
break;
|
||||
case CSystemTimer::AiTimer:
|
||||
_SystemTimer->StopTimer(CSystemTimer::AiTimer);
|
||||
|
@ -230,9 +230,9 @@ void CSystemTimer::TimerDone (void)
|
|||
void CSystemTimer::SetCompareTimer ( void )
|
||||
{
|
||||
DWORD NextCompare = 0x7FFFFFFF;
|
||||
if (_Reg)
|
||||
if (g_Reg)
|
||||
{
|
||||
NextCompare = _Reg->COMPARE_REGISTER - _Reg->COUNT_REGISTER;
|
||||
NextCompare = g_Reg->COMPARE_REGISTER - g_Reg->COUNT_REGISTER;
|
||||
if ((NextCompare & 0x80000000) != 0)
|
||||
{
|
||||
NextCompare = 0x7FFFFFFF;
|
||||
|
|
|
@ -60,7 +60,7 @@ void CTLB::Probe (void) {
|
|||
int Counter;
|
||||
|
||||
WriteTrace(TraceTLB,"TLB Probe");
|
||||
_Reg->INDEX_REGISTER |= 0x80000000;
|
||||
g_Reg->INDEX_REGISTER |= 0x80000000;
|
||||
for (Counter = 0; Counter < 32; Counter ++)
|
||||
{
|
||||
if (!m_tlb[Counter].EntryDefined)
|
||||
|
@ -71,13 +71,13 @@ void CTLB::Probe (void) {
|
|||
DWORD & TlbEntryHiValue = m_tlb[Counter].EntryHi.Value;
|
||||
DWORD Mask = ~m_tlb[Counter].PageMask.Mask << 13;
|
||||
DWORD TlbValueMasked = TlbEntryHiValue & Mask;
|
||||
DWORD EntryHiMasked = _Reg->ENTRYHI_REGISTER & Mask;
|
||||
DWORD EntryHiMasked = g_Reg->ENTRYHI_REGISTER & Mask;
|
||||
|
||||
if (TlbValueMasked == EntryHiMasked) {
|
||||
if ((TlbEntryHiValue & 0x100) != 0 || //Global
|
||||
((TlbEntryHiValue & 0xFF) == (_Reg->ENTRYHI_REGISTER & 0xFF))) //SameAsid
|
||||
((TlbEntryHiValue & 0xFF) == (g_Reg->ENTRYHI_REGISTER & 0xFF))) //SameAsid
|
||||
{
|
||||
_Reg->INDEX_REGISTER = Counter;
|
||||
g_Reg->INDEX_REGISTER = Counter;
|
||||
int FastIndx = Counter << 1;
|
||||
m_FastTlb[FastIndx].Probed = true;
|
||||
m_FastTlb[FastIndx + 1].Probed = true;
|
||||
|
@ -88,18 +88,18 @@ void CTLB::Probe (void) {
|
|||
}
|
||||
|
||||
void CTLB::ReadEntry (void) {
|
||||
DWORD index = _Reg->INDEX_REGISTER & 0x1F;
|
||||
DWORD index = g_Reg->INDEX_REGISTER & 0x1F;
|
||||
|
||||
_Reg->PAGE_MASK_REGISTER = m_tlb[index].PageMask.Value ;
|
||||
_Reg->ENTRYHI_REGISTER = (m_tlb[index].EntryHi.Value & ~m_tlb[index].PageMask.Value) ;
|
||||
_Reg->ENTRYLO0_REGISTER = m_tlb[index].EntryLo0.Value;
|
||||
_Reg->ENTRYLO1_REGISTER = m_tlb[index].EntryLo1.Value;
|
||||
g_Reg->PAGE_MASK_REGISTER = m_tlb[index].PageMask.Value ;
|
||||
g_Reg->ENTRYHI_REGISTER = (m_tlb[index].EntryHi.Value & ~m_tlb[index].PageMask.Value) ;
|
||||
g_Reg->ENTRYLO0_REGISTER = m_tlb[index].EntryLo0.Value;
|
||||
g_Reg->ENTRYLO1_REGISTER = m_tlb[index].EntryLo1.Value;
|
||||
}
|
||||
|
||||
void CTLB::WriteEntry (int index, bool Random) {
|
||||
int FastIndx;
|
||||
|
||||
WriteTraceF(TraceTLB,"Write Entry %02d %d %08X %08X %08X %08X ",index,Random,_Reg->PAGE_MASK_REGISTER,_Reg->ENTRYHI_REGISTER,_Reg->ENTRYLO0_REGISTER,_Reg->ENTRYLO1_REGISTER);
|
||||
WriteTraceF(TraceTLB,"Write Entry %02d %d %08X %08X %08X %08X ",index,Random,g_Reg->PAGE_MASK_REGISTER,g_Reg->ENTRYHI_REGISTER,g_Reg->ENTRYLO0_REGISTER,g_Reg->ENTRYLO1_REGISTER);
|
||||
|
||||
//Check to see if entry is unmapping it self
|
||||
if (m_tlb[index].EntryDefined) {
|
||||
|
@ -126,13 +126,13 @@ void CTLB::WriteEntry (int index, bool Random) {
|
|||
for ( FastIndx = index << 1; FastIndx <= (index << 1) + 1; FastIndx++) {
|
||||
if (!m_FastTlb[FastIndx].ValidEntry) { continue; }
|
||||
if (!m_FastTlb[FastIndx].VALID) { continue; }
|
||||
if (m_tlb[index].PageMask.Value == _Reg->PAGE_MASK_REGISTER &&
|
||||
m_tlb[index].EntryHi.Value == _Reg->ENTRYHI_REGISTER)
|
||||
if (m_tlb[index].PageMask.Value == g_Reg->PAGE_MASK_REGISTER &&
|
||||
m_tlb[index].EntryHi.Value == g_Reg->ENTRYHI_REGISTER)
|
||||
{
|
||||
if (FastIndx == (index << 1) && m_tlb[index].EntryLo0.Value == _Reg->ENTRYLO0_REGISTER) {
|
||||
if (FastIndx == (index << 1) && m_tlb[index].EntryLo0.Value == g_Reg->ENTRYLO0_REGISTER) {
|
||||
continue;
|
||||
}
|
||||
if (FastIndx != (index << 1) && m_tlb[index].EntryLo1.Value == _Reg->ENTRYLO1_REGISTER) {
|
||||
if (FastIndx != (index << 1) && m_tlb[index].EntryLo1.Value == g_Reg->ENTRYLO1_REGISTER) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -141,10 +141,10 @@ void CTLB::WriteEntry (int index, bool Random) {
|
|||
}
|
||||
|
||||
//fill in m_tlb entry
|
||||
m_tlb[index].PageMask.Value = _Reg->PAGE_MASK_REGISTER;
|
||||
m_tlb[index].EntryHi.Value = _Reg->ENTRYHI_REGISTER;
|
||||
m_tlb[index].EntryLo0.Value = _Reg->ENTRYLO0_REGISTER;
|
||||
m_tlb[index].EntryLo1.Value = _Reg->ENTRYLO1_REGISTER;
|
||||
m_tlb[index].PageMask.Value = g_Reg->PAGE_MASK_REGISTER;
|
||||
m_tlb[index].EntryHi.Value = g_Reg->ENTRYHI_REGISTER;
|
||||
m_tlb[index].EntryLo0.Value = g_Reg->ENTRYLO0_REGISTER;
|
||||
m_tlb[index].EntryLo1.Value = g_Reg->ENTRYLO1_REGISTER;
|
||||
m_tlb[index].EntryDefined = true;
|
||||
SetupTLB_Entry(index,Random);
|
||||
m_CB->TLB_Changed();
|
||||
|
|
|
@ -529,7 +529,7 @@ bool CN64System::SetActiveSystem( bool bActive )
|
|||
g_Recompiler = m_Recomp;
|
||||
g_MMU = &m_MMU_VM;
|
||||
g_TLB = &m_TLB;
|
||||
_Reg = &m_Reg;
|
||||
g_Reg = &m_Reg;
|
||||
_Audio = &m_Audio;
|
||||
//_Labels = NULL; //???
|
||||
_SystemTimer = &m_SystemTimer;
|
||||
|
@ -561,7 +561,7 @@ bool CN64System::SetActiveSystem( bool bActive )
|
|||
g_Recompiler = NULL;
|
||||
g_MMU = NULL;
|
||||
g_TLB = NULL;
|
||||
_Reg = NULL;
|
||||
g_Reg = NULL;
|
||||
_Audio = NULL;
|
||||
_Labels = NULL;
|
||||
_SystemTimer = NULL;
|
||||
|
@ -1205,7 +1205,7 @@ bool CN64System::SaveState(void)
|
|||
|
||||
DWORD dwWritten, SaveID_0 = 0x23D8A6C8, SaveID_1 = 0x56D2CD23;
|
||||
DWORD RdramSize = g_Settings->LoadDword(Game_RDRamSize);
|
||||
DWORD MiInterReg = _Reg->MI_INTR_REG;
|
||||
DWORD MiInterReg = g_Reg->MI_INTR_REG;
|
||||
DWORD NextViTimer = m_SystemTimer.GetTimer(CSystemTimer::ViTimer);
|
||||
if (g_Settings->LoadDword(Setting_AutoZipInstantSave)) {
|
||||
zipFile file;
|
||||
|
@ -1597,7 +1597,7 @@ void CN64System::RunRSP ( void ) {
|
|||
_SystemTimer->SetTimer(CSystemTimer::RspTimer,0x200,false);
|
||||
}
|
||||
WriteTrace(TraceRSP, "RunRSP: check interrupts");
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
|
|||
|
||||
if (TargetPC != (DWORD)-1)
|
||||
{
|
||||
MoveConstToVariable(TargetPC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
MoveConstToVariable(TargetPC,&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
UpdateCounters(ExitRegSet,TargetPC <= JumpPC && JumpPC != -1, reason == CExitInfo::Normal);
|
||||
} else {
|
||||
UpdateCounters(ExitRegSet,false,reason == CExitInfo::Normal);
|
||||
|
@ -255,7 +255,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
|
|||
{
|
||||
bool bDelay = m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT;
|
||||
PushImm32(bDelay ? "true" : "false", bDelay);
|
||||
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
|
||||
MoveConstToX86reg((DWORD)g_Reg,x86_ECX);
|
||||
Call_Direct(AddressOf(&CRegisters::DoSysCallException), "CRegisters::DoSysCallException");
|
||||
if (g_SyncSystem) {
|
||||
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
|
||||
|
@ -269,7 +269,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
|
|||
bool bDelay = m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT;
|
||||
PushImm32("1",1);
|
||||
PushImm32(bDelay ? "true" : "false", bDelay);
|
||||
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
|
||||
MoveConstToX86reg((DWORD)g_Reg,x86_ECX);
|
||||
Call_Direct(AddressOf(&CRegisters::DoCopUnusableException), "CRegisters::DoCopUnusableException");
|
||||
if (g_SyncSystem) {
|
||||
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
|
||||
|
@ -298,7 +298,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
|
|||
MoveVariableToX86reg(_TLBLoadAddress,"_TLBLoadAddress",x86_EDX);
|
||||
Push(x86_EDX);
|
||||
PushImm32(m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT);
|
||||
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
|
||||
MoveConstToX86reg((DWORD)g_Reg,x86_ECX);
|
||||
Call_Direct(AddressOf(&CRegisters::DoTLBReadMiss),"CRegisters::DoTLBReadMiss");
|
||||
if (g_SyncSystem) {
|
||||
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
|
||||
|
@ -844,7 +844,7 @@ void CCodeSection::SetContinueAddress (DWORD JumpPC, DWORD TargetPC)
|
|||
|
||||
void CCodeSection::CompileCop1Test (void) {
|
||||
if (m_RegWorkingSet.FpuBeenUsed()) { return; }
|
||||
TestVariable(STATUS_CU1,&_Reg->STATUS_REGISTER,"STATUS_REGISTER");
|
||||
TestVariable(STATUS_CU1,&g_Reg->STATUS_REGISTER,"STATUS_REGISTER");
|
||||
CompileExit(m_CompilePC,m_CompilePC,m_RegWorkingSet,CExitInfo::COP1_Unuseable,FALSE,JeLabel32);
|
||||
m_RegWorkingSet.FpuBeenUsed() = TRUE;
|
||||
}
|
||||
|
@ -936,7 +936,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
|
|||
{
|
||||
m_RegWorkingSet.WriteBackRegisters();
|
||||
UpdateCounters(m_RegWorkingSet,false,true);
|
||||
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
MoveConstToVariable(m_CompilePC,&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
if (g_SyncSystem) {
|
||||
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
|
||||
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
|
||||
|
@ -949,7 +949,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
|
|||
{
|
||||
m_RegWorkingSet.WriteBackRegisters();
|
||||
UpdateCounters(m_RegWorkingSet,false,true);
|
||||
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
MoveConstToVariable(m_CompilePC,&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
if (g_SyncSystem) {
|
||||
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
|
||||
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
|
||||
|
@ -966,7 +966,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
|
|||
/*if (m_CompilePC >= 0x801C1AF8 && m_CompilePC <= 0x801C1C00 && m_NextInstruction == NORMAL)
|
||||
{
|
||||
UpdateCounters(m_RegWorkingSet,false,true);
|
||||
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
MoveConstToVariable(m_CompilePC,&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
if (g_SyncSystem) {
|
||||
BeforeCallDirect(m_RegWorkingSet);
|
||||
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
|
||||
|
@ -984,7 +984,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
|
|||
{
|
||||
m_RegWorkingSet.WriteBackRegisters();
|
||||
UpdateCounters(m_RegWorkingSet,false,true);
|
||||
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
MoveConstToVariable(m_CompilePC,&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
if (g_SyncSystem) {
|
||||
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
|
||||
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
|
||||
|
@ -999,7 +999,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
|
|||
{
|
||||
m_RegWorkingSet.WriteBackRegisters();
|
||||
UpdateCounters(m_RegWorkingSet,false,true);
|
||||
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
MoveConstToVariable(m_CompilePC,&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
if (g_SyncSystem) {
|
||||
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
|
||||
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
|
||||
|
@ -1009,7 +1009,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
|
|||
{
|
||||
m_RegWorkingSet.WriteBackRegisters();
|
||||
UpdateCounters(m_RegWorkingSet,false,true);
|
||||
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
MoveConstToVariable(m_CompilePC,&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
if (g_SyncSystem) {
|
||||
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
|
||||
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
CRecompiler::CRecompiler(CProfiling & Profile, bool & EndEmulation ) :
|
||||
m_Profile(Profile),
|
||||
PROGRAM_COUNTER(_Reg->m_PROGRAM_COUNTER),
|
||||
PROGRAM_COUNTER(g_Reg->m_PROGRAM_COUNTER),
|
||||
m_EndEmulation(EndEmulation)
|
||||
{
|
||||
ResetMemoryStackPos();
|
||||
|
@ -85,7 +85,7 @@ void CRecompiler::RecompilerMain_VirtualTable ( void )
|
|||
{
|
||||
if (!_TransVaddr->ValidVaddr(PC))
|
||||
{
|
||||
_Reg->DoTLBReadMiss(false,PC);
|
||||
g_Reg->DoTLBReadMiss(false,PC);
|
||||
if (!_TransVaddr->ValidVaddr(PC))
|
||||
{
|
||||
g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PC);
|
||||
|
@ -504,7 +504,7 @@ void CRecompiler::RecompilerMain_Lookup_TLB( void )
|
|||
{
|
||||
if (!_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr))
|
||||
{
|
||||
_Reg->DoTLBReadMiss(false,PROGRAM_COUNTER);
|
||||
g_Reg->DoTLBReadMiss(false,PROGRAM_COUNTER);
|
||||
if (!_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr))
|
||||
{
|
||||
g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER);
|
||||
|
@ -604,7 +604,7 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB( void )
|
|||
{
|
||||
if (!_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr))
|
||||
{
|
||||
_Reg->DoTLBReadMiss(false,PROGRAM_COUNTER);
|
||||
g_Reg->DoTLBReadMiss(false,PROGRAM_COUNTER);
|
||||
if (!_TransVaddr->TranslateVaddr(PROGRAM_COUNTER, PhysicalAddr))
|
||||
{
|
||||
g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER);
|
||||
|
@ -974,18 +974,18 @@ void CRecompiler::ClearRecompCode_Virt(DWORD Address, int length,REMOVE_REASON R
|
|||
|
||||
void CRecompiler::ResetMemoryStackPos( void )
|
||||
{
|
||||
if (_Reg->m_GPR[29].UW[0] == 0)
|
||||
if (g_Reg->m_GPR[29].UW[0] == 0)
|
||||
{
|
||||
m_MemoryStack = NULL;
|
||||
return;
|
||||
}
|
||||
if (g_MMU == NULL || _Reg == NULL)
|
||||
if (g_MMU == NULL || g_Reg == NULL)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
if (_Reg->m_GPR[29].UW[0] < 0x80000000 || _Reg->m_GPR[29].UW[0] >= 0xC0000000)
|
||||
if (g_Reg->m_GPR[29].UW[0] < 0x80000000 || g_Reg->m_GPR[29].UW[0] >= 0xC0000000)
|
||||
{
|
||||
g_Notify->BreakPoint(__FILE__,__LINE__);
|
||||
}
|
||||
m_MemoryStack = (DWORD)(g_MMU->Rdram() + (_Reg->m_GPR[29].UW[0] & 0x1FFFFFFF));
|
||||
m_MemoryStack = (DWORD)(g_MMU->Rdram() + (g_Reg->m_GPR[29].UW[0] & 0x1FFFFFFF));
|
||||
}
|
||||
|
|
|
@ -4053,7 +4053,7 @@ void CRecompilerOps::COP0_MT (void) {
|
|||
} else {
|
||||
MoveX86regToVariable(Map_TempReg(x86_Any,m_Opcode.rt,FALSE), &_CP0[m_Opcode.rd], CRegName::Cop0[m_Opcode.rd]);
|
||||
}
|
||||
AndConstToVariable((DWORD)~CAUSE_IP7,&_Reg->FAKE_CAUSE_REGISTER,"FAKE_CAUSE_REGISTER");
|
||||
AndConstToVariable((DWORD)~CAUSE_IP7,&g_Reg->FAKE_CAUSE_REGISTER,"FAKE_CAUSE_REGISTER");
|
||||
BeforeCallDirect(m_RegWorkingSet);
|
||||
MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX);
|
||||
Call_Direct(AddressOf(&CSystemTimer::UpdateCompareTimer), "CSystemTimer::UpdateCompareTimer");
|
||||
|
@ -4095,7 +4095,7 @@ void CRecompilerOps::COP0_MT (void) {
|
|||
JeLabel8("FpuFlagFine",0);
|
||||
Jump = m_RecompPos - 1;
|
||||
BeforeCallDirect(m_RegWorkingSet);
|
||||
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
|
||||
MoveConstToX86reg((DWORD)g_Reg,x86_ECX);
|
||||
Call_Direct(AddressOf(&CRegisters::FixFpuLocations),"CRegisters::FixFpuLocations");
|
||||
|
||||
AfterCallDirect(m_RegWorkingSet);
|
||||
|
@ -4104,7 +4104,7 @@ void CRecompilerOps::COP0_MT (void) {
|
|||
//TestConstToX86Reg(STATUS_FR,OldStatusReg);
|
||||
//BreakPoint(__FILE__,__LINE__); //m_Section->CompileExit(m_CompilePC+4,m_RegWorkingSet,ExitResetRecompCode,FALSE,JneLabel32);
|
||||
BeforeCallDirect(m_RegWorkingSet);
|
||||
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
|
||||
MoveConstToX86reg((DWORD)g_Reg,x86_ECX);
|
||||
Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
|
||||
AfterCallDirect(m_RegWorkingSet);
|
||||
}
|
||||
|
@ -4135,7 +4135,7 @@ void CRecompilerOps::COP0_MT (void) {
|
|||
#endif
|
||||
}
|
||||
BeforeCallDirect(m_RegWorkingSet);
|
||||
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
|
||||
MoveConstToX86reg((DWORD)g_Reg,x86_ECX);
|
||||
Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
|
||||
AfterCallDirect(m_RegWorkingSet);
|
||||
break;
|
||||
|
@ -4162,7 +4162,7 @@ void CRecompilerOps::COP0_CO_TLBWI( void) {
|
|||
if (!bUseTlb()) { return; }
|
||||
BeforeCallDirect(m_RegWorkingSet);
|
||||
PushImm32("FALSE",FALSE);
|
||||
MoveVariableToX86reg(&_Reg->INDEX_REGISTER,"INDEX_REGISTER",x86_ECX);
|
||||
MoveVariableToX86reg(&g_Reg->INDEX_REGISTER,"INDEX_REGISTER",x86_ECX);
|
||||
AndConstToX86Reg(x86_ECX,0x1F);
|
||||
Push(x86_ECX);
|
||||
MoveConstToX86reg((DWORD)g_TLB,x86_ECX);
|
||||
|
@ -4182,7 +4182,7 @@ void CRecompilerOps::COP0_CO_TLBWR( void) {
|
|||
Call_Direct(AddressOf(&CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers");
|
||||
|
||||
PushImm32("true",true);
|
||||
MoveVariableToX86reg(&_Reg->RANDOM_REGISTER,"RANDOM_REGISTER",x86_ECX);
|
||||
MoveVariableToX86reg(&g_Reg->RANDOM_REGISTER,"RANDOM_REGISTER",x86_ECX);
|
||||
AndConstToX86Reg(x86_ECX,0x1F);
|
||||
Push(x86_ECX);
|
||||
MoveConstToX86reg((DWORD)g_TLB,x86_ECX);
|
||||
|
@ -4201,15 +4201,15 @@ void CRecompilerOps::COP0_CO_TLBP( void) {
|
|||
}
|
||||
|
||||
void compiler_COP0_CO_ERET (void) {
|
||||
if ((_Reg->STATUS_REGISTER & STATUS_ERL) != 0) {
|
||||
_Reg->m_PROGRAM_COUNTER = _Reg->ERROREPC_REGISTER;
|
||||
_Reg->STATUS_REGISTER &= ~STATUS_ERL;
|
||||
if ((g_Reg->STATUS_REGISTER & STATUS_ERL) != 0) {
|
||||
g_Reg->m_PROGRAM_COUNTER = g_Reg->ERROREPC_REGISTER;
|
||||
g_Reg->STATUS_REGISTER &= ~STATUS_ERL;
|
||||
} else {
|
||||
_Reg->m_PROGRAM_COUNTER = _Reg->EPC_REGISTER;
|
||||
_Reg->STATUS_REGISTER &= ~STATUS_EXL;
|
||||
g_Reg->m_PROGRAM_COUNTER = g_Reg->EPC_REGISTER;
|
||||
g_Reg->STATUS_REGISTER &= ~STATUS_EXL;
|
||||
}
|
||||
_Reg->m_LLBit = 0;
|
||||
_Reg->CheckInterrupts();
|
||||
g_Reg->m_LLBit = 0;
|
||||
g_Reg->CheckInterrupts();
|
||||
}
|
||||
|
||||
void CRecompilerOps::COP0_CO_ERET( void) {
|
||||
|
@ -5057,7 +5057,7 @@ void CRecompilerOps::UnknownOpcode (void) {
|
|||
|
||||
m_RegWorkingSet.WriteBackRegisters();
|
||||
UpdateCounters(m_RegWorkingSet,false,true);
|
||||
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
MoveConstToVariable(m_CompilePC,&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
if (g_SyncSystem) {
|
||||
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
|
||||
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
|
||||
|
@ -5158,7 +5158,7 @@ void CRecompilerOps::CompileSystemCheck (DWORD TargetPC, const CRegInfo & RegSet
|
|||
DWORD * Jump = (DWORD *)(m_RecompPos - 4);
|
||||
if (TargetPC != (DWORD)-1)
|
||||
{
|
||||
MoveConstToVariable(TargetPC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
MoveConstToVariable(TargetPC,&g_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
|
||||
}
|
||||
|
||||
CRegInfo RegSetCopy(RegSet);
|
||||
|
|
|
@ -140,7 +140,7 @@ void CRegInfo::FixRoundModel(FPU_ROUND RoundMethod )
|
|||
if (RoundMethod == RoundDefault)
|
||||
{
|
||||
x86Reg RoundReg = Map_TempReg(x86_Any,-1,FALSE);
|
||||
MoveVariableToX86reg(&_Reg->m_RoundingModel,"m_RoundingModel", RoundReg);
|
||||
MoveVariableToX86reg(&g_Reg->m_RoundingModel,"m_RoundingModel", RoundReg);
|
||||
ShiftLeftSignImmed(RoundReg,2);
|
||||
OrX86RegToX86Reg(reg,RoundReg);
|
||||
SetX86Protected(RoundReg,false);
|
||||
|
@ -307,22 +307,22 @@ void CRegInfo::Load_FPR_ToTop ( int Reg, int RegToLoad, FPU_STATE Format)
|
|||
switch (Format) {
|
||||
case FPU_Dword:
|
||||
sprintf(Name,"m_FPR_S[%d]",RegToLoad);
|
||||
MoveVariableToX86reg(&_Reg->m_FPR_S[RegToLoad],Name,TempReg);
|
||||
MoveVariableToX86reg(&g_Reg->m_FPR_S[RegToLoad],Name,TempReg);
|
||||
fpuLoadIntegerDwordFromX86Reg(&StackTopPos(),TempReg);
|
||||
break;
|
||||
case FPU_Qword:
|
||||
sprintf(Name,"m_FPR_D[%d]",RegToLoad);
|
||||
MoveVariableToX86reg(&_Reg->m_FPR_D[RegToLoad],Name,TempReg);
|
||||
MoveVariableToX86reg(&g_Reg->m_FPR_D[RegToLoad],Name,TempReg);
|
||||
fpuLoadIntegerQwordFromX86Reg(&StackTopPos(),TempReg);
|
||||
break;
|
||||
case FPU_Float:
|
||||
sprintf(Name,"m_FPR_S[%d]",RegToLoad);
|
||||
MoveVariableToX86reg(&_Reg->m_FPR_S[RegToLoad],Name,TempReg);
|
||||
MoveVariableToX86reg(&g_Reg->m_FPR_S[RegToLoad],Name,TempReg);
|
||||
fpuLoadDwordFromX86Reg(&StackTopPos(),TempReg);
|
||||
break;
|
||||
case FPU_Double:
|
||||
sprintf(Name,"m_FPR_D[%d]",RegToLoad);
|
||||
MoveVariableToX86reg(&_Reg->m_FPR_D[RegToLoad],Name,TempReg);
|
||||
MoveVariableToX86reg(&g_Reg->m_FPR_D[RegToLoad],Name,TempReg);
|
||||
fpuLoadQwordFromX86Reg(&StackTopPos(),TempReg);
|
||||
break;
|
||||
#ifndef EXTERNAL_RELEASE
|
||||
|
|
|
@ -6,7 +6,7 @@ CN64System * g_SyncSystem = NULL;
|
|||
CRecompiler * g_Recompiler = NULL;
|
||||
CMipsMemory * g_MMU = NULL; //Memory of the n64
|
||||
CTLB * g_TLB = NULL; //TLB Unit
|
||||
CRegisters * _Reg = NULL; //Current Register Set attacted to the g_MMU
|
||||
CRegisters * g_Reg = NULL; //Current Register Set attacted to the g_MMU
|
||||
CNotification * g_Notify = NULL;
|
||||
CPlugins * _Plugins = NULL;
|
||||
CN64Rom * _Rom = NULL; //The current rom that this system is executing.. it can only execute one file at the time
|
||||
|
|
|
@ -7,7 +7,7 @@ extern CN64System * g_SyncSystem;
|
|||
extern CRecompiler * g_Recompiler;
|
||||
extern CMipsMemory * g_MMU; //Memory of the n64
|
||||
extern CTLB * g_TLB; //TLB Unit
|
||||
extern CRegisters * _Reg; //Current Register Set attacted to the g_MMU
|
||||
extern CRegisters * g_Reg; //Current Register Set attached to the g_MMU
|
||||
extern CPlugins * _Plugins;
|
||||
extern CN64Rom * _Rom; //The current rom that this system is executing.. it can only execute one file at the time
|
||||
extern CAudio * _Audio;
|
||||
|
|
|
@ -188,13 +188,13 @@ bool CAudioPlugin::Initiate ( CN64System * System, CMainGui * RenderWindow ) {
|
|||
Info.RDRAM = g_MMU->Rdram();
|
||||
Info.DMEM = g_MMU->Dmem();
|
||||
Info.IMEM = g_MMU->Imem();
|
||||
Info.MI__INTR_REG = &_Reg->m_AudioIntrReg;
|
||||
Info.AI__DRAM_ADDR_REG = &_Reg->AI_DRAM_ADDR_REG;
|
||||
Info.AI__LEN_REG = &_Reg->AI_LEN_REG;
|
||||
Info.AI__CONTROL_REG = &_Reg->AI_CONTROL_REG;
|
||||
Info.AI__STATUS_REG = &_Reg->AI_STATUS_REG;
|
||||
Info.AI__DACRATE_REG = &_Reg->AI_DACRATE_REG;
|
||||
Info.AI__BITRATE_REG = &_Reg->AI_BITRATE_REG;
|
||||
Info.MI__INTR_REG = &g_Reg->m_AudioIntrReg;
|
||||
Info.AI__DRAM_ADDR_REG = &g_Reg->AI_DRAM_ADDR_REG;
|
||||
Info.AI__LEN_REG = &g_Reg->AI_LEN_REG;
|
||||
Info.AI__CONTROL_REG = &g_Reg->AI_CONTROL_REG;
|
||||
Info.AI__STATUS_REG = &g_Reg->AI_STATUS_REG;
|
||||
Info.AI__DACRATE_REG = &g_Reg->AI_DACRATE_REG;
|
||||
Info.AI__BITRATE_REG = &g_Reg->AI_BITRATE_REG;
|
||||
Info.CheckInterrupts = DummyCheckInterrupts;
|
||||
|
||||
m_Initilized = InitiateAudio(Info) != 0;
|
||||
|
@ -207,7 +207,7 @@ bool CAudioPlugin::Initiate ( CN64System * System, CMainGui * RenderWindow ) {
|
|||
m_hAudioThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)AudioThread, (LPVOID)this,0, &ThreadID);
|
||||
}
|
||||
|
||||
if (_Reg->AI_DACRATE_REG != 0) {
|
||||
if (g_Reg->AI_DACRATE_REG != 0) {
|
||||
DacrateChanged(SYSTEM_NTSC);
|
||||
}
|
||||
return m_Initilized;
|
||||
|
@ -273,8 +273,8 @@ void CAudioPlugin::DacrateChanged (SystemType Type)
|
|||
if (!Initilized()) { return; }
|
||||
WriteTraceF(TraceAudio,__FUNCTION__ ": SystemType: %s", Type == SYSTEM_NTSC ? "SYSTEM_NTSC" : "SYSTEM_PAL");
|
||||
|
||||
//DWORD Frequency = _Reg->AI_DACRATE_REG * 30;
|
||||
//DWORD CountsPerSecond = (_Reg->VI_V_SYNC_REG != 0 ? (_Reg->VI_V_SYNC_REG + 1) * g_Settings->LoadDword(Game_ViRefreshRate) : 500000) * 60;
|
||||
//DWORD Frequency = g_Reg->AI_DACRATE_REG * 30;
|
||||
//DWORD CountsPerSecond = (g_Reg->VI_V_SYNC_REG != 0 ? (g_Reg->VI_V_SYNC_REG + 1) * g_Settings->LoadDword(Game_ViRefreshRate) : 500000) * 60;
|
||||
m_DacrateChanged(Type);
|
||||
}
|
||||
|
||||
|
|
|
@ -254,29 +254,29 @@ bool CGfxPlugin::Initiate ( CN64System * System, CMainGui * RenderWindow ) {
|
|||
Info.RDRAM = g_MMU->Rdram();
|
||||
Info.DMEM = g_MMU->Dmem();
|
||||
Info.IMEM = g_MMU->Imem();
|
||||
Info.MI__INTR_REG = &_Reg->m_GfxIntrReg;
|
||||
Info.DPC__START_REG = &_Reg->DPC_START_REG;
|
||||
Info.DPC__END_REG = &_Reg->DPC_END_REG;
|
||||
Info.DPC__CURRENT_REG = &_Reg->DPC_CURRENT_REG;
|
||||
Info.DPC__STATUS_REG = &_Reg->DPC_STATUS_REG;
|
||||
Info.DPC__CLOCK_REG = &_Reg->DPC_CLOCK_REG;
|
||||
Info.DPC__BUFBUSY_REG = &_Reg->DPC_BUFBUSY_REG;
|
||||
Info.DPC__PIPEBUSY_REG = &_Reg->DPC_PIPEBUSY_REG;
|
||||
Info.DPC__TMEM_REG = &_Reg->DPC_TMEM_REG;
|
||||
Info.VI__STATUS_REG = &_Reg->VI_STATUS_REG;
|
||||
Info.VI__ORIGIN_REG = &_Reg->VI_ORIGIN_REG;
|
||||
Info.VI__WIDTH_REG = &_Reg->VI_WIDTH_REG;
|
||||
Info.VI__INTR_REG = &_Reg->VI_INTR_REG;
|
||||
Info.VI__V_CURRENT_LINE_REG = &_Reg->VI_CURRENT_REG;
|
||||
Info.VI__TIMING_REG = &_Reg->VI_TIMING_REG;
|
||||
Info.VI__V_SYNC_REG = &_Reg->VI_V_SYNC_REG;
|
||||
Info.VI__H_SYNC_REG = &_Reg->VI_H_SYNC_REG;
|
||||
Info.VI__LEAP_REG = &_Reg->VI_LEAP_REG;
|
||||
Info.VI__H_START_REG = &_Reg->VI_H_START_REG;
|
||||
Info.VI__V_START_REG = &_Reg->VI_V_START_REG;
|
||||
Info.VI__V_BURST_REG = &_Reg->VI_V_BURST_REG;
|
||||
Info.VI__X_SCALE_REG = &_Reg->VI_X_SCALE_REG;
|
||||
Info.VI__Y_SCALE_REG = &_Reg->VI_Y_SCALE_REG;
|
||||
Info.MI__INTR_REG = &g_Reg->m_GfxIntrReg;
|
||||
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
||||
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
||||
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
||||
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
||||
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
||||
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
||||
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
||||
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
||||
Info.VI__STATUS_REG = &g_Reg->VI_STATUS_REG;
|
||||
Info.VI__ORIGIN_REG = &g_Reg->VI_ORIGIN_REG;
|
||||
Info.VI__WIDTH_REG = &g_Reg->VI_WIDTH_REG;
|
||||
Info.VI__INTR_REG = &g_Reg->VI_INTR_REG;
|
||||
Info.VI__V_CURRENT_LINE_REG = &g_Reg->VI_CURRENT_REG;
|
||||
Info.VI__TIMING_REG = &g_Reg->VI_TIMING_REG;
|
||||
Info.VI__V_SYNC_REG = &g_Reg->VI_V_SYNC_REG;
|
||||
Info.VI__H_SYNC_REG = &g_Reg->VI_H_SYNC_REG;
|
||||
Info.VI__LEAP_REG = &g_Reg->VI_LEAP_REG;
|
||||
Info.VI__H_START_REG = &g_Reg->VI_H_START_REG;
|
||||
Info.VI__V_START_REG = &g_Reg->VI_V_START_REG;
|
||||
Info.VI__V_BURST_REG = &g_Reg->VI_V_BURST_REG;
|
||||
Info.VI__X_SCALE_REG = &g_Reg->VI_X_SCALE_REG;
|
||||
Info.VI__Y_SCALE_REG = &g_Reg->VI_Y_SCALE_REG;
|
||||
|
||||
m_Initilized = InitiateGFX(Info) != 0;
|
||||
//jabo had a bug so I call CreateThread so his dllmain gets called again
|
||||
|
|
|
@ -240,26 +240,26 @@ bool CRSP_Plugin::Initiate ( CPlugins * Plugins, CN64System * System )
|
|||
Info.IMEM = g_MMU->Imem();
|
||||
Info.MemoryBswaped = FALSE;
|
||||
|
||||
Info.MI__INTR_REG = &_Reg->m_RspIntrReg;
|
||||
Info.MI__INTR_REG = &g_Reg->m_RspIntrReg;
|
||||
|
||||
Info.SP__MEM_ADDR_REG = &_Reg->SP_MEM_ADDR_REG;
|
||||
Info.SP__DRAM_ADDR_REG = &_Reg->SP_DRAM_ADDR_REG;
|
||||
Info.SP__RD_LEN_REG = &_Reg->SP_RD_LEN_REG;
|
||||
Info.SP__WR_LEN_REG = &_Reg->SP_WR_LEN_REG;
|
||||
Info.SP__STATUS_REG = &_Reg->SP_STATUS_REG;
|
||||
Info.SP__DMA_FULL_REG = &_Reg->SP_DMA_FULL_REG;
|
||||
Info.SP__DMA_BUSY_REG = &_Reg->SP_DMA_BUSY_REG;
|
||||
Info.SP__PC_REG = &_Reg->SP_PC_REG;
|
||||
Info.SP__SEMAPHORE_REG = &_Reg->SP_SEMAPHORE_REG;
|
||||
Info.SP__MEM_ADDR_REG = &g_Reg->SP_MEM_ADDR_REG;
|
||||
Info.SP__DRAM_ADDR_REG = &g_Reg->SP_DRAM_ADDR_REG;
|
||||
Info.SP__RD_LEN_REG = &g_Reg->SP_RD_LEN_REG;
|
||||
Info.SP__WR_LEN_REG = &g_Reg->SP_WR_LEN_REG;
|
||||
Info.SP__STATUS_REG = &g_Reg->SP_STATUS_REG;
|
||||
Info.SP__DMA_FULL_REG = &g_Reg->SP_DMA_FULL_REG;
|
||||
Info.SP__DMA_BUSY_REG = &g_Reg->SP_DMA_BUSY_REG;
|
||||
Info.SP__PC_REG = &g_Reg->SP_PC_REG;
|
||||
Info.SP__SEMAPHORE_REG = &g_Reg->SP_SEMAPHORE_REG;
|
||||
|
||||
Info.DPC__START_REG = &_Reg->DPC_START_REG;
|
||||
Info.DPC__END_REG = &_Reg->DPC_END_REG;
|
||||
Info.DPC__CURRENT_REG = &_Reg->DPC_CURRENT_REG;
|
||||
Info.DPC__STATUS_REG = &_Reg->DPC_STATUS_REG;
|
||||
Info.DPC__CLOCK_REG = &_Reg->DPC_CLOCK_REG;
|
||||
Info.DPC__BUFBUSY_REG = &_Reg->DPC_BUFBUSY_REG;
|
||||
Info.DPC__PIPEBUSY_REG = &_Reg->DPC_PIPEBUSY_REG;
|
||||
Info.DPC__TMEM_REG = &_Reg->DPC_TMEM_REG;
|
||||
Info.DPC__START_REG = &g_Reg->DPC_START_REG;
|
||||
Info.DPC__END_REG = &g_Reg->DPC_END_REG;
|
||||
Info.DPC__CURRENT_REG = &g_Reg->DPC_CURRENT_REG;
|
||||
Info.DPC__STATUS_REG = &g_Reg->DPC_STATUS_REG;
|
||||
Info.DPC__CLOCK_REG = &g_Reg->DPC_CLOCK_REG;
|
||||
Info.DPC__BUFBUSY_REG = &g_Reg->DPC_BUFBUSY_REG;
|
||||
Info.DPC__PIPEBUSY_REG = &g_Reg->DPC_PIPEBUSY_REG;
|
||||
Info.DPC__TMEM_REG = &g_Reg->DPC_TMEM_REG;
|
||||
|
||||
InitiateRSP(Info,&CycleCount);
|
||||
m_Initilized = true;
|
||||
|
|
Loading…
Reference in New Issue