mirror of https://github.com/bsnes-emu/bsnes.git
27 lines
621 B
C++
27 lines
621 B
C++
template<uint cycle_frequency>
|
|
auto SMP::Timer<cycle_frequency>::tick() -> void {
|
|
if(++stage1_ticks < cycle_frequency) return;
|
|
|
|
stage1_ticks = 0;
|
|
if(enable == false) return;
|
|
|
|
if(++stage2_ticks != target) return;
|
|
|
|
stage2_ticks = 0;
|
|
stage3_ticks = (stage3_ticks + 1) & 15;
|
|
}
|
|
|
|
template<uint cycle_frequency>
|
|
auto SMP::Timer<cycle_frequency>::tick(uint clocks) -> void {
|
|
stage1_ticks += clocks;
|
|
if(stage1_ticks < cycle_frequency) return;
|
|
|
|
stage1_ticks -= cycle_frequency;
|
|
if(enable == false) return;
|
|
|
|
if(++stage2_ticks != target) return;
|
|
|
|
stage2_ticks = 0;
|
|
stage3_ticks = (stage3_ticks + 1) & 15;
|
|
}
|