gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 2f91b32a0254bf30926082ce0916fb7e6fc8c039
parent e0a7c8a27c84b9e35eefb693b60098318141e862
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sun, 28 Jul 2024 22:55:17 +0200

more cleanup

Diffstat:
Msource/hardwareLib/CMakeLists.txt | 1+
Asource/hardwareLib/dspBootCode.h | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msource/mqLib/mqdsp.cpp | 10+++++-----
Msource/nord/n2x/n2xLib/n2xdsp.cpp | 59++++++++++-------------------------------------------------
Msource/nord/n2x/n2xLib/n2xhardware.cpp | 22----------------------
Msource/nord/n2x/n2xLib/n2xhardware.h | 1-
Msource/wLib/CMakeLists.txt | 1-
Dsource/wLib/dspBootCode.h | 74--------------------------------------------------------------------------
Msource/xtLib/xtDSP.cpp | 4++--
9 files changed, 92 insertions(+), 154 deletions(-)

diff --git a/source/hardwareLib/CMakeLists.txt b/source/hardwareLib/CMakeLists.txt @@ -5,6 +5,7 @@ add_library(hardwareLib STATIC) set(SOURCES am29f.cpp am29f.h + dspBootCode.h haltDSP.cpp haltDSP.h i2c.cpp i2c.h i2cFlash.cpp i2cFlash.h diff --git a/source/hardwareLib/dspBootCode.h b/source/hardwareLib/dspBootCode.h @@ -0,0 +1,74 @@ +#pragma once + +#include <cstdint> + +namespace hwLib +{ + static constexpr uint32_t g_dspBootCode56362[] = + { + 0x350013, 0x0afa23, 0xff0035, 0x0afa22, + 0xff000e, 0x0afa01, 0xff0022, 0x0afa20, + 0xff005e, 0x61f400, 0xff1000, 0x050c8f, + 0x0afa00, 0xff0021, 0x31a900, 0x0afa01, + 0xff0012, 0x0ad161, 0x04d191, 0x019191, + 0xff0013, 0x044894, 0x019191, 0xff0016, + 0x045094, 0x221100, 0x06c800, 0xff001f, + 0x019191, 0xff001c, 0x009814, 0x000000, + 0x050c5a, 0x050c5d, 0x62f400, 0xd00000, + 0x08f4b8, 0xd00409, 0x060680, 0xff0029, + 0x07da8a, 0x0c1c10, 0x219000, 0x219100, + 0x06c800, 0xff0033, 0x060380, 0xff0031, + 0x07da8a, 0x0c1c10, 0x07588c, 0x000000, + 0x050c46, 0x0afa02, 0xff005c, 0x0afa01, + 0xff003e, 0x0afa00, 0xff0046, 0x08f484, + 0x000038, 0x050c0b, 0x0afa20, 0xff0043, + 0x08f484, 0x005018, 0x050c06, 0x08f484, + 0x000218, 0x050c03, 0x08f484, 0x001c1e, + 0x0a8426, 0x0a8380, 0xff0049, 0x084806, + 0x0a8380, 0xff004c, 0x085006, 0x221100, + 0x06c800, 0xff0059, 0x0a83a0, 0xff0058, + 0x0a8383, 0xff0052, 0x00008c, 0x050c03, + 0x085846, 0x000000, 0x0000b9, 0x0ae180, + 0x0afa01, 0xff005f, 0x050c00, 0x66f41b, + 0xff0090, 0x0503a6, 0x04cfdd, 0x013f03, + 0x013e23, 0x045517, 0x060980, 0xff008b, + 0x07de85, 0x07de84, 0x07de86, 0x300013, + 0x70f400, 0x001600, 0x06d820, 0x4258a2, + 0x320013, 0x72f400, 0x000c00, 0x06da20, + 0x075a86, 0x300013, 0x06d800, 0xff007d, + 0x54e000, 0x200063, 0x200018, 0x5cd800, + 0x200043, 0x200018, 0x320013, 0x06da00, + 0xff0083, 0x07da8c, 0x200053, 0x200018, + 0x022d07, 0x08d73c, 0x0d104a, 0x000005, + 0x013d03, 0x00008c, 0x050c02, 0x017d03, + 0x000200, 0x000086 + }; + + static constexpr uint32_t g_dspBootCode56303[] = + { + 0x240a13, 0x0afa02, 0xff0028, 0x0afa01, + 0xff0009, 0x0afa00, 0xff0011, 0x0af080, + 0xff0014, 0x0afa20, 0xff000e, 0x08f484, + 0x005018, 0x050c09, 0x08f484, 0x000218, + 0x050c06, 0x08f484, 0x001c1e, 0x050c03, + 0x08f484, 0x000038, 0x0a8426, 0x0a8380, + 0xff0017, 0x084806, 0x0a8380, 0xff001a, + 0x085006, 0x221100, 0x06c800, 0xff0026, + 0x0a83a0, 0xff0026, 0x0a8383, 0xff0020, + 0x00008c, 0x050c02, 0x085846, 0x050c52, + 0x0afa01, 0xff0048, 0x07f41c, 0x000302, + 0x07f41b, 0x00c000, 0x07f41f, 0x000007, + 0x060680, 0xff0038, 0x019382, 0xff0032, + 0x044a98, 0x019381, 0xff0035, 0x04ca95, + 0x0c1c10, 0x219000, 0x219100, 0x06c800, + 0xff0046, 0x060380, 0xff0045, 0x019382, + 0xff003f, 0x044a98, 0x019381, 0xff0042, + 0x04ca95, 0x0c1c10, 0x07588c, 0x050c12, + 0x62f400, 0xd00000, 0x08f4b8, 0xd00409, + 0x060680, 0xff004f, 0x07da8a, 0x0c1c10, + 0x219000, 0x219100, 0x06c800, 0xff0058, + 0x060380, 0xff0057, 0x07da8a, 0x0c1c10, + 0x060380, 0xff0057, 0x07da8a, 0x0c1c10, + 0x07588c, 0x0000b9, 0x0ae180 + }; +} diff --git a/source/mqLib/mqdsp.cpp b/source/mqLib/mqdsp.cpp @@ -8,7 +8,7 @@ #include "mc68k/hdi08.h" -#include "wLib/dspBootCode.h" +#include "hardwareLib/dspBootCode.h" #include "dsp56kEmu/aar.h" @@ -55,12 +55,12 @@ namespace mqLib } // rewrite bootloader to work at address g_bootCodeBase instead of $ff0000 - for(uint32_t i=0; i<std::size(wLib::g_dspBootCode); ++i) + for(uint32_t i=0; i<std::size(hwLib::g_dspBootCode56362); ++i) { - uint32_t code = wLib::g_dspBootCode[i]; - if((wLib::g_dspBootCode[i] & 0xffff00) == 0xff0000) + uint32_t code = hwLib::g_dspBootCode56362[i]; + if((hwLib::g_dspBootCode56362[i] & 0xffff00) == 0xff0000) { - code = g_bootCodeBase | (wLib::g_dspBootCode[i] & 0xff); + code = g_bootCodeBase | (hwLib::g_dspBootCode56362[i] & 0xff); } m_memory.set(dsp56k::MemArea_P, i + g_bootCodeBase, code); diff --git a/source/nord/n2x/n2xLib/n2xdsp.cpp b/source/nord/n2x/n2xLib/n2xdsp.cpp @@ -1,8 +1,10 @@ #include "n2xdsp.h" #include "n2xhardware.h" + #include "dsp56kDebugger/debugger.h" #include "dsp56kEmu/dspthread.h" +#include "hardwareLib/dspBootCode.h" #include "mc68k/hdi08.h" namespace n2x @@ -12,47 +14,6 @@ namespace n2x static constexpr dsp56k::TWord g_pMemSize = 0x004000; static constexpr dsp56k::TWord g_bootCodeBase = 0x003f00; - // DSP56362 bootloader - static constexpr uint32_t g_dspBootCode[] = - { - 0x350013, 0x0afa23, 0xff0035, 0x0afa22, - 0xff000e, 0x0afa01, 0xff0022, 0x0afa20, - 0xff005e, 0x61f400, 0xff1000, 0x050c8f, - 0x0afa00, 0xff0021, 0x31a900, 0x0afa01, - 0xff0012, 0x0ad161, 0x04d191, 0x019191, - 0xff0013, 0x044894, 0x019191, 0xff0016, - 0x045094, 0x221100, 0x06c800, 0xff001f, - 0x019191, 0xff001c, 0x009814, 0x000000, - 0x050c5a, 0x050c5d, 0x62f400, 0xd00000, - 0x08f4b8, 0xd00409, 0x060680, 0xff0029, - 0x07da8a, 0x0c1c10, 0x219000, 0x219100, - 0x06c800, 0xff0033, 0x060380, 0xff0031, - 0x07da8a, 0x0c1c10, 0x07588c, 0x000000, - 0x050c46, 0x0afa02, 0xff005c, 0x0afa01, - 0xff003e, 0x0afa00, 0xff0046, 0x08f484, - 0x000038, 0x050c0b, 0x0afa20, 0xff0043, - 0x08f484, 0x005018, 0x050c06, 0x08f484, - 0x000218, 0x050c03, 0x08f484, 0x001c1e, - 0x0a8426, 0x0a8380, 0xff0049, 0x084806, - 0x0a8380, 0xff004c, 0x085006, 0x221100, - 0x06c800, 0xff0059, 0x0a83a0, 0xff0058, - 0x0a8383, 0xff0052, 0x00008c, 0x050c03, - 0x085846, 0x000000, 0x0000b9, 0x0ae180, - 0x0afa01, 0xff005f, 0x050c00, 0x66f41b, - 0xff0090, 0x0503a6, 0x04cfdd, 0x013f03, - 0x013e23, 0x045517, 0x060980, 0xff008b, - 0x07de85, 0x07de84, 0x07de86, 0x300013, - 0x70f400, 0x001600, 0x06d820, 0x4258a2, - 0x320013, 0x72f400, 0x000c00, 0x06da20, - 0x075a86, 0x300013, 0x06d800, 0xff007d, - 0x54e000, 0x200063, 0x200018, 0x5cd800, - 0x200043, 0x200018, 0x320013, 0x06da00, - 0xff0083, 0x07da8c, 0x200053, 0x200018, - 0x022d07, 0x08d73c, 0x0d104a, 0x000005, - 0x013d03, 0x00008c, 0x050c02, 0x017d03, - 0x000200, 0x000086 - }; - namespace { dsp56k::DefaultMemoryValidator g_memValidator; @@ -120,12 +81,12 @@ namespace n2x } // rewrite bootloader to work at address g_bootCodeBase instead of $ff0000 - for(uint32_t i=0; i<std::size(g_dspBootCode); ++i) + for(uint32_t i=0; i<std::size(hwLib::g_dspBootCode56362); ++i) { - uint32_t code = g_dspBootCode[i]; - if((g_dspBootCode[i] & 0xffff00) == 0xff0000) + uint32_t code = hwLib::g_dspBootCode56362[i]; + if((hwLib::g_dspBootCode56362[i] & 0xffff00) == 0xff0000) { - code = g_bootCodeBase | (g_dspBootCode[i] & 0xff); + code = g_bootCodeBase | (hwLib::g_dspBootCode56362[i] & 0xff); } m_memory.set(dsp56k::MemArea_P, i + g_bootCodeBase, code); @@ -183,10 +144,10 @@ namespace n2x { if(_needMoreData) { - m_hardware.ucYieldLoop([&] - { - return dsp().hasPendingInterrupts(); - }); + hwLib::ScopedResumeDSP rB(m_hardware.getDSPB().getHaltDSP()); + + while(dsp().hasPendingInterrupts()) + std::this_thread::yield(); } hdiTransferDSPtoUC(); } diff --git a/source/nord/n2x/n2xLib/n2xhardware.cpp b/source/nord/n2x/n2xLib/n2xhardware.cpp @@ -37,28 +37,6 @@ namespace n2x m_remainingUcCycles -= static_cast<int64_t>(deltaCycles); } - void Hardware::ucYieldLoop(const std::function<bool()>& _continue) - { - hwLib::ScopedResumeDSP rB(m_dspB.getHaltDSP()); - - while(_continue()) - { -// if(m_processAudio) - { - std::this_thread::yield(); - } -/* else - { - if(m_esaiFrameIndex) - { - std::unique_lock uLock(m_esaiFrameAddedMutex); - m_esaiFrameAddedCv.wait(uLock); - } - } - */ - } - } - void Hardware::processAudio(uint32_t _frames, const uint32_t _latency) { ensureBufferSize(_frames); diff --git a/source/nord/n2x/n2xLib/n2xhardware.h b/source/nord/n2x/n2xLib/n2xhardware.h @@ -17,7 +17,6 @@ namespace n2x void processUC(); Microcontroller& getUC() {return m_uc; } - void ucYieldLoop(const std::function<bool()>& _continue); const auto& getAudioOutputs() const { return m_audioOutputs; } diff --git a/source/wLib/CMakeLists.txt b/source/wLib/CMakeLists.txt @@ -5,7 +5,6 @@ project(wLib) add_library(wLib STATIC) set(SOURCES - dspBootCode.h lcd.cpp lcd.h lcdfonts.cpp lcdfonts.h wDevice.cpp wDevice.h diff --git a/source/wLib/dspBootCode.h b/source/wLib/dspBootCode.h @@ -1,74 +0,0 @@ -#pragma once - -#include <cstdint> - -namespace wLib -{ - static constexpr uint32_t g_dspBootCode[] = - { - 0x350013, 0x0afa23, 0xff0035, 0x0afa22, - 0xff000e, 0x0afa01, 0xff0022, 0x0afa20, - 0xff005e, 0x61f400, 0xff1000, 0x050c8f, - 0x0afa00, 0xff0021, 0x31a900, 0x0afa01, - 0xff0012, 0x0ad161, 0x04d191, 0x019191, - 0xff0013, 0x044894, 0x019191, 0xff0016, - 0x045094, 0x221100, 0x06c800, 0xff001f, - 0x019191, 0xff001c, 0x009814, 0x000000, - 0x050c5a, 0x050c5d, 0x62f400, 0xd00000, - 0x08f4b8, 0xd00409, 0x060680, 0xff0029, - 0x07da8a, 0x0c1c10, 0x219000, 0x219100, - 0x06c800, 0xff0033, 0x060380, 0xff0031, - 0x07da8a, 0x0c1c10, 0x07588c, 0x000000, - 0x050c46, 0x0afa02, 0xff005c, 0x0afa01, - 0xff003e, 0x0afa00, 0xff0046, 0x08f484, - 0x000038, 0x050c0b, 0x0afa20, 0xff0043, - 0x08f484, 0x005018, 0x050c06, 0x08f484, - 0x000218, 0x050c03, 0x08f484, 0x001c1e, - 0x0a8426, 0x0a8380, 0xff0049, 0x084806, - 0x0a8380, 0xff004c, 0x085006, 0x221100, - 0x06c800, 0xff0059, 0x0a83a0, 0xff0058, - 0x0a8383, 0xff0052, 0x00008c, 0x050c03, - 0x085846, 0x000000, 0x0000b9, 0x0ae180, - 0x0afa01, 0xff005f, 0x050c00, 0x66f41b, - 0xff0090, 0x0503a6, 0x04cfdd, 0x013f03, - 0x013e23, 0x045517, 0x060980, 0xff008b, - 0x07de85, 0x07de84, 0x07de86, 0x300013, - 0x70f400, 0x001600, 0x06d820, 0x4258a2, - 0x320013, 0x72f400, 0x000c00, 0x06da20, - 0x075a86, 0x300013, 0x06d800, 0xff007d, - 0x54e000, 0x200063, 0x200018, 0x5cd800, - 0x200043, 0x200018, 0x320013, 0x06da00, - 0xff0083, 0x07da8c, 0x200053, 0x200018, - 0x022d07, 0x08d73c, 0x0d104a, 0x000005, - 0x013d03, 0x00008c, 0x050c02, 0x017d03, - 0x000200, 0x000086 - }; - - static constexpr uint32_t g_dspBootCode56303[] = - { - 0x240a13, 0x0afa02, 0xff0028, 0x0afa01, - 0xff0009, 0x0afa00, 0xff0011, 0x0af080, - 0xff0014, 0x0afa20, 0xff000e, 0x08f484, - 0x005018, 0x050c09, 0x08f484, 0x000218, - 0x050c06, 0x08f484, 0x001c1e, 0x050c03, - 0x08f484, 0x000038, 0x0a8426, 0x0a8380, - 0xff0017, 0x084806, 0x0a8380, 0xff001a, - 0x085006, 0x221100, 0x06c800, 0xff0026, - 0x0a83a0, 0xff0026, 0x0a8383, 0xff0020, - 0x00008c, 0x050c02, 0x085846, 0x050c52, - 0x0afa01, 0xff0048, 0x07f41c, 0x000302, - 0x07f41b, 0x00c000, 0x07f41f, 0x000007, - 0x060680, 0xff0038, 0x019382, 0xff0032, - 0x044a98, 0x019381, 0xff0035, 0x04ca95, - 0x0c1c10, 0x219000, 0x219100, 0x06c800, - 0xff0046, 0x060380, 0xff0045, 0x019382, - 0xff003f, 0x044a98, 0x019381, 0xff0042, - 0x04ca95, 0x0c1c10, 0x07588c, 0x050c12, - 0x62f400, 0xd00000, 0x08f4b8, 0xd00409, - 0x060680, 0xff004f, 0x07da8a, 0x0c1c10, - 0x219000, 0x219100, 0x06c800, 0xff0058, - 0x060380, 0xff0057, 0x07da8a, 0x0c1c10, - 0x060380, 0xff0057, 0x07da8a, 0x0c1c10, - 0x07588c, 0x0000b9, 0x0ae180 - }; -} diff --git a/source/xtLib/xtDSP.cpp b/source/xtLib/xtDSP.cpp @@ -1,6 +1,6 @@ #include "xtDSP.h" -#include "wLib/dspBootCode.h" +#include "hardwareLib/dspBootCode.h" #include "xtHardware.h" #if DSP56300_DEBUGGER @@ -51,7 +51,7 @@ namespace xt m_dsp.getJit().notifyProgramMemWrite(i); } - const auto& bootCode = wLib::g_dspBootCode56303; + const auto& bootCode = hwLib::g_dspBootCode56303; // rewrite bootloader to work at address g_bootCodeBase instead of $ff0000 for(uint32_t i=0; i<std::size(bootCode); ++i)