diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 0c1481b1..4c237dad 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -476,6 +476,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 06cfde04..3eeb5c01 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -931,6 +931,9 @@ Misc + + Nes\Mappers\MMC + diff --git a/Core/MMC3_134.h b/Core/MMC3_134.h new file mode 100644 index 00000000..fa5e814e --- /dev/null +++ b/Core/MMC3_134.h @@ -0,0 +1,53 @@ +#pragma once + +#include "stdafx.h" +#include "MMC3.h" + +class MMC3_134 : public MMC3 +{ +private: + uint8_t _exReg; + + void SelectCHRPage(uint16_t slot, uint16_t page, ChrMemoryType memoryType = ChrMemoryType::Default) override + { + BaseMapper::SelectCHRPage(slot, (page & 0xFF) | ((_exReg & 0x20) << 3), memoryType); + } + + void SelectPRGPage(uint16_t slot, uint16_t page, PrgMemoryType memoryType = PrgMemoryType::PrgRom) override + { + BaseMapper::SelectPRGPage(slot, (page & 0x1F) | ((_exReg & 0x02) << 4), memoryType); + } + + void InitMapper() override + { + MMC3::InitMapper(); + + AddRegisterRange(0x6001, 0x6001, MemoryOperation::Write); + } + + void Reset(bool softReset) override + { + BaseMapper::Reset(softReset); + + if(softReset) { + _exReg = 0; + MMC3::UpdateState(); + } + } + + void StreamState(bool saving) override + { + MMC3::StreamState(saving); + Stream(_exReg); + } + + void WriteRegister(uint16_t addr, uint8_t value) override + { + if(addr == 0x6001) { + _exReg = value; + MMC3::UpdateState(); + } else { + MMC3::WriteRegister(addr, value); + } + } +}; \ No newline at end of file diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index a138832c..1ef28c28 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -101,6 +101,7 @@ #include "MMC3_114.h" #include "MMC3_115.h" #include "MMC3_121.h" +#include "MMC3_134.h" #include "MMC3_165.h" #include "MMC3_182.h" #include "MMC3_187.h" @@ -192,7 +193,7 @@ Supported mappers: | 80|===| 82| |===| 85| 86| 87| 88| 89| 90| 91| 92| 93| 94| 95| | 96| 97|===| 99|...|101|===|103| |105|106|107|108|===|===|===| |112|113|114|115| |117|118|119|120|121|===| |===| | |===| -|===|===|===|===|132|133| |===|136|137|138|139|140|141|142|143| +|===|===|===|===|132|133|134|===|136|137|138|139|140|141|142|143| |144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159| |---|===|162|163|164|165|166|167|168|===|170|171|172|173|===|175| |176|177|178|179|180|---|182|183|184|185|186|187|188|189|===|191| @@ -325,6 +326,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case 121: return new MMC3_121(); case 132: return new Txc22211A(); case 133: return new Sachen_133(); + case 134: return new MMC3_134(); case 136: return new Sachen_136(); case 137: return new Sachen8259(Sachen8259Variant::Sachen8259D); case 138: return new Sachen8259(Sachen8259Variant::Sachen8259B);