#pragma once #include "Mapper.h" #include namespace sn { class MapperMMC3 : public Mapper { public: MapperMMC3(Cartridge &cart, std::function interrupt_cb, std::function mirroring_cb); Byte readPRG(Address addr); void writePRG(Address addr, Byte value); NameTableMirroring getNameTableMirroring(); Byte readCHR(Address addr); void writeCHR(Address addr, Byte value); void scanlineIRQ(); private: // Control variables uint32_t m_targetRegister; bool m_prgBankMode; bool m_chrInversion; uint32_t m_bankRegister[8]; bool m_irqEnabled; Byte m_irqCounter; Byte m_irqLatch; bool m_irqReloadPending; std::vector m_prgRam; std::vector m_mirroringRam; const Byte *m_prgBank0; const Byte *m_prgBank1; const Byte *m_prgBank2; const Byte *m_prgBank3; std::array m_chrBanks; NameTableMirroring m_mirroring; std::function m_mirroringCallback; std::function m_interruptCallback; }; } // namespace sn