Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libsnes/bsnes/snes/alt/smp/timing.cpp
2 views
1
template<unsigned cycle_frequency>
2
void SMP::Timer<cycle_frequency>::tick() {
3
if(++stage1_ticks < cycle_frequency) return;
4
5
stage1_ticks = 0;
6
if(enable == false) return;
7
8
if(++stage2_ticks != target) return;
9
10
stage2_ticks = 0;
11
stage3_ticks = (stage3_ticks + 1) & 15;
12
}
13
14
template<unsigned cycle_frequency>
15
void SMP::Timer<cycle_frequency>::tick(unsigned clocks) {
16
stage1_ticks += clocks;
17
if(stage1_ticks < cycle_frequency) return;
18
19
stage1_ticks -= cycle_frequency;
20
if(enable == false) return;
21
22
if(++stage2_ticks != target) return;
23
24
stage2_ticks = 0;
25
stage3_ticks = (stage3_ticks + 1) & 15;
26
}
27
28