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

n2xmc.h (1500B)


      1 #pragma once
      2 
      3 #include "n2xfrontpanel.h"
      4 #include "n2xhdi08.h"
      5 #include "n2xflash.h"
      6 #include "n2xtypes.h"
      7 
      8 #include "mc68k/mc68k.h"
      9 
     10 #include "hardwareLib/sciMidi.h"
     11 
     12 namespace n2x
     13 {
     14 	class Rom;
     15 
     16 	class Microcontroller final : public mc68k::Mc68k
     17 	{
     18 	public:
     19 		explicit Microcontroller(Hardware& _hardware, const Rom& _rom);
     20 
     21 		auto& getHdi08A() { return m_hdi08A.getHdi08(); }
     22 		auto& getHdi08B() { return m_hdi08B.getHdi08(); }
     23 		auto& getMidi() { return m_midi; }
     24 
     25 		uint32_t exec() override;
     26 
     27 		auto getPrevPC() const { return m_prevPC; }
     28 
     29 		auto& getFrontPanel() { return m_panel; }
     30 		const auto& getFrontPanel() const { return m_panel; }
     31 
     32 		uint16_t readImm16(const uint32_t _addr) override
     33 		{
     34 			return mc68k::memoryOps::readU16(m_romRam.data(), _addr & (m_romRam.size()-1));
     35 		}
     36 		uint32_t readImm32(const uint32_t _addr) const
     37 		{
     38 			return mc68k::memoryOps::readU32(m_romRam.data(), _addr & (m_romRam.size()-1));
     39 		}
     40 		uint16_t read16(uint32_t _addr) override;
     41 		uint8_t read8(uint32_t _addr) override;
     42 
     43 		void write16(uint32_t _addr, uint16_t _val) override;
     44 		void write8(uint32_t _addr, uint8_t _val) override;
     45 
     46 	private:
     47 		// rom at $000000, ram at $100000, dsps at $200000, we use one buffer for both rom and ram and a power of two sized buffer helps with faster access
     48 		std::array<uint8_t, g_dspBothAddress> m_romRam;
     49 
     50 		Flash m_flash;
     51 
     52 		Hdi08DspA m_hdi08A;
     53 		Hdi08DspB m_hdi08B;
     54 		Hdi08DspBoth m_hdi08;
     55 
     56 		FrontPanel m_panel;
     57 
     58 		uint32_t m_prevPC;
     59 		hwLib::SciMidi m_midi;
     60 	};
     61 }