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

xtUc.h (1417B)


      1 #pragma once
      2 
      3 #include "xtButtons.h"
      4 #include "xtFlash.h"
      5 #include "xtLcd.h"
      6 #include "xtLeds.h"
      7 #include "xtPic.h"
      8 #include "xtTypes.h"
      9 
     10 #include "mc68k/mc68k.h"
     11 #include "mc68k/hdi08periph.h"
     12 
     13 namespace xt
     14 {
     15 	class Rom;
     16 
     17 	using xtHdi08A = mc68k::Hdi08Periph<0xfe000>;
     18 
     19 	class XtUc final : public mc68k::Mc68k
     20 	{
     21 	public:
     22 		XtUc(const Rom& _rom);
     23 		uint32_t exec() override;
     24 
     25 		uint16_t readImm16(uint32_t _addr) override;
     26 		uint16_t read16(uint32_t _addr) override;
     27 		uint8_t read8(uint32_t _addr) override;
     28 
     29 		void write16(uint32_t _addr, uint16_t _val) override;
     30 		void write8(uint32_t _addr, uint8_t _val) override;
     31 
     32 		xtHdi08A& getHdi08A() { return m_hdiA; }
     33 
     34 		bool requestDSPReset() const { return m_dspResetRequest; }
     35 		void notifyDSPBooted() { m_dspResetCompleted = true; }
     36 
     37 		void onPortQSWritten();
     38 
     39 		void setButton(ButtonType _type, bool _pressed);
     40 
     41 		void setLcdDirtyCallback(const Pic::DirtyCallback& _callback);
     42 		void setLedsDirtyCallback(const Pic::DirtyCallback& _callback);
     43 
     44 		Lcd& getLcd() { return m_lcd; }
     45 		bool getLedState(LedType _led) const;
     46 		bool getButton(ButtonType _button) const;
     47 
     48 		auto& getRomRuntimeData() { return m_romRuntimeData; }
     49 
     50 	private:
     51 		std::array<uint8_t, g_ramSize> m_memory;
     52 		std::array<uint8_t, g_romSize> m_romRuntimeData;
     53 
     54 		xtHdi08A m_hdiA;
     55 		Flash m_flash;
     56 		Pic m_pic;
     57 		Lcd m_lcd;
     58 
     59 		bool m_dspResetRequest = false;
     60 		bool m_dspResetCompleted = false;
     61 	};
     62 }