MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / CPU_EXECUTE_OP

Function CPU_EXECUTE_OP

Source/Core/Dynamo.cpp:130–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128// before execution.
129//*****************************************************************************
130template< bool TraceEnabled > DAEDALUS_FORCEINLINE void CPU_EXECUTE_OP()
131{
132
133 u8 * p_Instruction {};
134 CPU_FETCH_INSTRUCTION( p_Instruction, gCPUState.CurrentPC );
135 OpCode op_code = *(OpCode*)p_Instruction;
136
137 // Cache instruction base pointer (used for SpeedHack() @ R4300.0)
138 gLastAddress = p_Instruction;
139
140#ifdef DAEDALUS_BREAKPOINTS_ENABLED
141 op_code = GetCorrectOp( op_code );
142#endif
143
144 #ifdef DAEDALUS_ENABLE_SYNCHRONISATION
145 SYNCH_POINT( DAED_SYNC_REG_PC, gCPUState.CurrentPC, "Program Counter doesn't match" );
146 SYNCH_POINT( DAED_SYNC_FRAGMENT_PC, gCPUState.CurrentPC + gCPUState.Delay, "Program Counter/Delay doesn't match while interpreting" );
147 SYNCH_POINT( DAED_SYNC_REG_PC, gCPUState.CPUControl[C0_COUNT]._u32, "Count doesn't match" );
148 #endif
149 if( TraceEnabled )
150 {
151 #ifdef DAEDALUS_ENABLE_ASSERTS
152 DAEDALUS_ASSERT( gTraceRecorder.IsTraceActive(), "If TraceEnabled is set, trace should be active" );
153 #endif
154 u32 pc( gCPUState.CurrentPC ) ;
155 bool branch_delay_slot( gCPUState.Delay == EXEC_DELAY );
156
157 R4300_ExecuteInstruction(op_code);
158 gGPR[0]._u64 = 0; //Ensure r0 is zero
159
160 bool branch_taken( gCPUState.Delay == DO_DELAY );
161
162 CPU_UpdateTrace( pc, op_code, branch_delay_slot, branch_taken );
163 }
164 else
165 {
166 #ifdef DAEDALUS_ENABLE_ASSERTS
167 DAEDALUS_ASSERT( !gTraceRecorder.IsTraceActive(), "If TraceEnabled is not set, trace should be inactive" );
168 #endif
169 R4300_ExecuteInstruction(op_code);
170 gGPR[0]._u64 = 0; //Ensure r0 is zero
171
172#ifdef DAEDALUS_PROFILE_EXECUTION
173 gTotalInstructionsEmulated++;
174#endif
175 }
176 #ifdef DAEDALUS_ENABLE_SYNCHRONISATION
177 SYNCH_POINT( DAED_SYNC_REGS, CPU_ProduceRegisterHash(), "Registers don't match" );
178 #endif
179 // Increment count register
180 gCPUState.CPUControl[C0_COUNT]._u32 = gCPUState.CPUControl[C0_COUNT]._u32 + COUNTER_INCREMENT_PER_OP;
181
182 if (CPU_ProcessEventCycles( COUNTER_INCREMENT_PER_OP ) )
183 {
184 CPU_HANDLE_COUNT_INTERRUPT();
185 }
186
187 switch (gCPUState.Delay)

Callers

nothing calls this directly

Calls 9

GetCorrectOpFunction · 0.85
R4300_ExecuteInstructionFunction · 0.85
CPU_UpdateTraceFunction · 0.85
CPU_ProduceRegisterHashFunction · 0.85
CPU_ProcessEventCyclesFunction · 0.85
INCREMENT_PCFunction · 0.85
CPU_SetPCFunction · 0.85
IsTraceActiveMethod · 0.80

Tested by

no test coverage detected