commit 62c887ef33ee4efb936a4c4b0eda8818b2011721
parent a103ecb37415f0b397d62dcea7bcdfb0e80f594f
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Sun, 7 Jul 2024 15:41:41 +0200
fix DSP boot might be delayed on slow machines, causing integration tests to fail
Diffstat:
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/source/virusLib/romfile.cpp b/source/virusLib/romfile.cpp
@@ -15,6 +15,7 @@
#include "demoplaybackTI.h"
#include "dsp56kEmu/memory.h"
+#include "dsp56kEmu/threadtools.h"
namespace virusLib
{
@@ -343,9 +344,17 @@ std::thread ROMFile::bootDSP(dsp56k::DSP& dsp, dsp56k::HDI08& _hdi08) const
// dsp.memory().saveAssembly((m_file + "_BootROM.asm").c_str(), bootRom.offset, bootRom.size, false, false, &periph);
// Attach command stream
- std::thread feedCommandStream([&]()
+ size_t i=0;
+ while(!_hdi08.dataRXFull() && i < m_commandStream.size())
+ _hdi08.writeRX(&m_commandStream[i++], 1);
+
+ std::thread feedCommandStream([&_hdi08, this, i]()
{
- _hdi08.writeRX(m_commandStream);
+ if(i >= m_commandStream.size())
+ return;
+
+ dsp56k::ThreadTools::setCurrentThreadPriority(dsp56k::ThreadPriority::Highest);
+ _hdi08.writeRX(&m_commandStream[i], m_commandStream.size() - i);
});
// Initialize the DSP