| 128 | // before execution. |
| 129 | //***************************************************************************** |
| 130 | template< 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) |
nothing calls this directly
no test coverage detected