Loosen SMP<->DSP synchronization.

This commit is contained in:
Brandon Wright 2011-06-27 15:41:17 -05:00
parent 02a3b83c87
commit 91e69af029
3 changed files with 13 additions and 2 deletions

View File

@ -560,6 +560,7 @@ void S9xAPUExecute (void)
void S9xAPUEndScanline (void)
{
S9xAPUExecute();
SNES::dsp.synchronize();
if (SNES::dsp.spc_dsp.sample_count() >= APU_MINIMUM_SAMPLE_BLOCK || !spc::sound_in_sync)
S9xLandSamples();

View File

@ -1,12 +1,22 @@
#include "SPC_DSP.h"
#include <stdio.h>
class DSP : public Processor {
public:
inline uint8 read(uint8 addr) {
synchronize ();
return spc_dsp.read(addr);
}
inline void synchronize (void) {
if (clock) {
spc_dsp.run (clock);
clock = 0;
}
}
inline void write(uint8 addr, uint8 data) {
synchronize ();
spc_dsp.write(addr, data);
}

View File

@ -9,7 +9,7 @@ void SMP::tick() {
synchronize_dsp();
#else
clock++;
dsp.spc_dsp.run(1);
dsp.clock++;
#endif
}
@ -82,7 +82,7 @@ void SMP::op_step() {
synchronize_dsp();
#else
clock += cycle_count_table[opcode];
dsp.spc_dsp.run(cycle_count_table[opcode]);
dsp.clock += cycle_count_table[opcode];
#endif