void StartInterpreterCPU (usf_state_t * state) {
	state->NextInstruction = NORMAL;

	while(state->cpu_running) {
		ExecuteInterpreterOpCode(state);
	}

	state->cpu_stopped = 1;

}
示例#2
0
void RunFunction(usf_state_t * state, uint32_t address) {
    uint32_t oldPC = state->PROGRAM_COUNTER, oldRA = state->GPR[31].UW[0], la = state->NextInstruction;
    int callStack = 0;
    
    state->NextInstruction = NORMAL;
    state->PROGRAM_COUNTER = address;
    
    while( (state->PROGRAM_COUNTER != oldRA) || callStack) {
        
       	if(state->PROGRAM_COUNTER == address)
            callStack++;
        
        ExecuteInterpreterOpCode(state);
        
        if(state->PROGRAM_COUNTER == oldRA)
            callStack--;
    }
    
    state->PROGRAM_COUNTER = oldPC;
    state->GPR[31].UW[0] = oldRA;
    state->NextInstruction = la;
}
示例#3
0
void StartInterpreterCPU (usf_state_t * state) {
    const int safety_count_max = 20000000;
    int safety_count = safety_count_max;
    size_t last_sample_buffer_count = state->sample_buffer_count;
    
	state->NextInstruction = NORMAL;

	while(state->cpu_running) {
		ExecuteInterpreterOpCode(state);
        if (!--safety_count) {
            if (last_sample_buffer_count == state->sample_buffer_count) {
                DisplayError( state, "Emulator core is not generating any samples after 20 million instructions" );
                break;
            } else {
                safety_count = safety_count_max;
                last_sample_buffer_count = state->sample_buffer_count;
            }
        }
	}

	state->cpu_stopped = 1;

}