diff --git a/Core/DeltaModulationChannel.cpp b/Core/DeltaModulationChannel.cpp index 76c4a718..9f9d7266 100644 --- a/Core/DeltaModulationChannel.cpp +++ b/Core/DeltaModulationChannel.cpp @@ -209,15 +209,24 @@ void DeltaModulationChannel::SetEnabled(bool enabled) _needToRun = false; } else if(_bytesRemaining == 0) { InitSample(); - _needInit = true; + + //Delay a number of cycles based on odd/even cycles + //Allows behavior to match dmc_dma_start_test + if((_console->GetCpu()->GetCycleCount() & 0x01) == 0) { + _needInit = 2; + } else { + _needInit = 3; + } } } bool DeltaModulationChannel::NeedToRun() { - if(_needInit && (_console->GetCpu()->GetCycleCount() & 0x01) == 0) { - StartDmcTransfer(); - _needInit = false; + if(_needInit > 0) { + _needInit--; + if(_needInit == 0) { + StartDmcTransfer(); + } } return _needToRun; } diff --git a/Core/DeltaModulationChannel.h b/Core/DeltaModulationChannel.h index 436a3fe9..01ddbc3f 100644 --- a/Core/DeltaModulationChannel.h +++ b/Core/DeltaModulationChannel.h @@ -26,7 +26,7 @@ private: uint8_t _bitsRemaining = 0; bool _silenceFlag = true; bool _needToRun = false; - bool _needInit = false; + uint8_t _needInit = 0; uint8_t _lastValue4011 = 0;