o add my bsnes branch

This commit is contained in:
David Voswinkel
2009-05-12 20:05:00 +02:00
parent 1c30d3db56
commit 091b82a7ef
402 changed files with 68660 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
#ifdef SSMP_CPP
void sSMP::add_clocks(unsigned clocks) {
scheduler.addclocks_smp(clocks);
}
void sSMP::tick_timers() {
t0.tick();
t1.tick();
t2.tick();
}
#endif

View File

@@ -0,0 +1,34 @@
template<uint8 cycle_frequency>
class sSMPTimer {
public:
uint8 target;
uint8 stage1_ticks, stage2_ticks, stage3_ticks;
bool enabled;
void tick() {
//stage 1 increment
stage1_ticks++;
if(stage1_ticks < cycle_frequency) return;
stage1_ticks -= cycle_frequency;
if(enabled == false) return;
//stage 2 increment
stage2_ticks++;
if(stage2_ticks != target) return;
//stage 3 increment
stage2_ticks = 0;
stage3_ticks++;
stage3_ticks &= 15;
}
};
sSMPTimer<128> t0;
sSMPTimer<128> t1;
sSMPTimer< 16> t2;
alwaysinline void add_clocks(unsigned clocks);
alwaysinline void tick_timers();
uint32 clocks_executed();