#ifdef SMP_CPP void SMP::add_clocks(unsigned clocks) { step(clocks); synchronize_dsp(); } void SMP::cycle_edge() { timer0.tick(); timer1.tick(); timer2.tick(); //TEST register S-SMP speed control //24 clocks have already been added for this cycle at this point switch(status.clock_speed) { case 0: break; //100% speed case 1: add_clocks(24); break; // 50% speed case 2: break; // 0% speed -- locks S-SMP -- handled in outer loop case 3: add_clocks(24 * 9); break; // 10% speed } } template void SMP::Timer::tick() { //stage 0 increment stage0_ticks += smp.status.timer_step; if(stage0_ticks < timer_frequency) return; stage0_ticks -= timer_frequency; //stage 1 increment stage1_ticks ^= 1; synchronize_stage1(); } template void SMP::Timer::synchronize_stage1() { bool new_line = stage1_ticks; if(smp.status.timers_enable == false) new_line = false; if(smp.status.timers_disable == true) new_line = false; bool old_line = current_line; current_line = new_line; if(old_line != 1 || new_line != 0) return; //only pulse on 1->0 transition //stage 2 increment if(enable == false) return; if(++stage2_ticks != target) return; //stage 3 increment stage2_ticks = 0; stage3_ticks = (stage3_ticks + 1) & 15; } #endif