u16 DSPLLE::DSP_WriteControlRegister(u16 _uFlag) { UDSPControl Temp(_uFlag); if (!m_InitMixer) { if (!Temp.DSPHalt) { InitMixer(); } } DSPInterpreter::WriteCR(_uFlag); // Check if the CPU has set an external interrupt (CR_EXTERNAL_INT) // and immediately process it, if it has. if (_uFlag & 2) { if (!m_bDSPThread) { DSPCore_CheckExternalInterrupt(); DSPCore_CheckExceptions(); } else { DSPCore_SetExternalInterrupt(true); } } return DSPInterpreter::ReadCR(); }
void Step() { DSPCore_CheckExceptions(); g_dsp.step_counter++; #if PROFILE g_dsp.err_pc = g_dsp.pc; ProfilerAddDelta(g_dsp.err_pc, 1); if (g_dsp.step_counter == 1) { ProfilerInit(); } if ((g_dsp.step_counter & 0xFFFFF) == 0) { ProfilerDump(g_dsp.step_counter); } #endif u16 opc = dsp_fetch_code(); ExecuteInstruction(UDSPInstruction(opc)); if (DSPAnalyzer::code_flags[g_dsp.pc - 1] & DSPAnalyzer::CODE_LOOP_END) HandleLoop(); }
// Delegate to JIT or interpreter as appropriate. // Handle state changes and stepping. int DSPCore_RunCycles(int cycles) { if (dspjit) { if (g_dsp.external_interrupt_waiting) { DSPCore_CheckExternalInterrupt(); DSPCore_CheckExceptions(); DSPCore_SetExternalInterrupt(false); } cyclesLeft = cycles; DSPCompiledCode pExecAddr = (DSPCompiledCode)dspjit->enterDispatcher; pExecAddr(); if (g_dsp.reset_dspjit_codespace) dspjit->ClearIRAMandDSPJITCodespaceReset(); return cyclesLeft; } while (cycles > 0) { switch (core_state) { case DSPCORE_RUNNING: // Seems to slow things down #if defined(_DEBUG) || defined(DEBUGFAST) cycles = DSPInterpreter::RunCyclesDebug(cycles); #else cycles = DSPInterpreter::RunCycles(cycles); #endif break; case DSPCORE_STEPPING: step_event.Wait(); if (core_state != DSPCORE_STEPPING) continue; DSPInterpreter::Step(); cycles--; DSPHost::UpdateDebugger(); break; case DSPCORE_STOP: break; } } return cycles; }
u16 DSPLLE::DSP_WriteControlRegister(u16 _uFlag) { DSPInterpreter::WriteCR(_uFlag); if (_uFlag & 2) { if (!m_bDSPThread) { DSPCore_CheckExternalInterrupt(); DSPCore_CheckExceptions(); } else { // External interrupt pending: this is the zelda ucode. // Disable the DSP thread because there is no performance gain. requestDisableThread = true; DSPCore_SetExternalInterrupt(true); } } return DSPInterpreter::ReadCR(); }