Reduce the sync footprint slightly with less indirection.

This commit is contained in:
Brandon Wright 2011-06-23 06:14:14 -05:00
parent ebc9b70860
commit 08f5601c5f
4 changed files with 11 additions and 21 deletions

View File

@ -7,19 +7,6 @@ DSP dsp;
#include "SPC_DSP.cpp"
void DSP::step(unsigned clocks) {
clock += clocks;
}
void DSP::synchronize_smp() {
while(clock >= 0) smp.enter();
}
void DSP::enter() {
spc_dsp.run(1);
step(24);
}
uint8 DSP::read(uint8 addr) {
return spc_dsp.read(addr);
}

View File

@ -3,13 +3,11 @@
class DSP : public Processor {
public:
enum { Threaded = false };
alwaysinline void step(unsigned clocks);
alwaysinline void synchronize_smp();
uint8 read(uint8 addr);
void write(uint8 addr, uint8 data);
void enter();
void power();
void reset();

View File

@ -5,11 +5,12 @@ void SMP::tick() {
#ifndef SNES9X
clock += cycle_step_cpu;
#else
clock++;
#endif
dsp.clock -= 24;
synchronize_dsp();
#else
clock++;
dsp.spc_dsp.run(1);
#endif
}
void SMP::op_io() {
@ -77,11 +78,13 @@ void SMP::op_step() {
#ifndef SNES9X
clock += cycle_table_cpu[opcode];
#else
clock += cycle_count_table[opcode];
#endif
dsp.clock -= cycle_table_dsp[opcode];
synchronize_dsp();
#else
clock += cycle_count_table[opcode];
dsp.spc_dsp.run(cycle_count_table[opcode]);
#endif
#endif
}

View File

@ -34,11 +34,13 @@ void SMP::synchronize_cpu() {
}
void SMP::synchronize_dsp() {
#ifndef SNES9X
if(DSP::Threaded == true) {
//if(dsp.clock < 0 && scheduler.sync != Scheduler::SynchronizeMode::All) co_switch(dsp.thread);
} else {
while(dsp.clock < 0) dsp.enter();
}
#endif
}
void SMP::enter() {