MB-AY8913 fix so that no AY changes get dumped (#770)

. Needed for read of AY8913 regs too, during built-in debugger stepping (mb-audit)
This commit is contained in:
tomcw 2021-01-30 10:31:31 +00:00
parent a3666edf48
commit 024e97ac9b

View File

@ -468,6 +468,7 @@ sound_write_buf_pstereo( libspectrum_signed_word * out, int c )
#define AY_ENV_HOLD 1
#define HZ_COMMON_DENOMINATOR 50
#include "Log.h"
void CAY8910::sound_ay_overlay( void )
{
@ -492,9 +493,24 @@ void CAY8910::sound_ay_overlay( void )
sfreq = sound_generator_freq / HZ_COMMON_DENOMINATOR;
// cpufreq = machine_current->timings.processor_speed / HZ_COMMON_DENOMINATOR;
cpufreq = (libspectrum_dword) (m_fCurrentCLK_AY8910 / HZ_COMMON_DENOMINATOR); // [TC]
int dbgCount=0;
for( f = 0; f < ay_change_count; f++ )
{
ay_change[f].ofs = (USHORT) (( ay_change[f].tstates * sfreq ) / cpufreq); // [TC] Added cast
if (ay_change[f].ofs >= sound_generator_framesiz) // [TC] Ensure that all ay_change's get processed
{
ay_change[f].ofs = sound_generator_framesiz-1; // [TC] - as parent, sound_frame(), just dumps outstanding changes (ay_change_count=0)
dbgCount++;
}
}
#if defined(_DEBUG) && 1
if (dbgCount)
{
LogOutput("ay_change: saved %d\n", dbgCount); // [TC] previously would've been dumped!
}
#endif
libspectrum_signed_word* pBuf1 = g_ppSoundBuffers[0];
libspectrum_signed_word* pBuf2 = g_ppSoundBuffers[1];
libspectrum_signed_word* pBuf3 = g_ppSoundBuffers[2];