diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index e6358a92..352941be 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -383,6 +383,7 @@ + diff --git a/Core/Mapper15.h b/Core/Mapper15.h new file mode 100644 index 00000000..12b914c2 --- /dev/null +++ b/Core/Mapper15.h @@ -0,0 +1,49 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" + +class Mapper15 : public BaseMapper +{ +protected: + virtual uint16_t GetPRGPageSize() { return 0x2000; } + virtual uint16_t GetCHRPageSize() { return 0x2000; } + + void InitMapper() + { + WriteRegister(0x8000, 0); + SelectCHRPage(0, 0); + } + + void WriteRegister(uint16_t addr, uint8_t value) + { + SetMirroringType(value & 0x40 ? MirroringType::Horizontal : MirroringType::Vertical); + + uint8_t subBank = value >> 7; + uint8_t bank = (value & 0x7F) << 1; + switch(addr & 0x03) { + case 0: + SelectPRGPage(0, bank ^ subBank); + SelectPRGPage(1, (bank + 1) ^ subBank); + SelectPRGPage(2, (bank + 2) ^ subBank); + SelectPRGPage(3, (bank + 3) ^ subBank); + break; + + case 1: + case 3: + bank |= subBank; + SelectPRGPage(0, bank); + SelectPRGPage(1, bank + 1); + SelectPRGPage(2, bank + ((addr & 0x02) ? 0 : 1)); + SelectPRGPage(3, bank + 1); + break; + + case 2: + bank |= subBank; + SelectPRGPage(0, bank); + SelectPRGPage(1, bank); + SelectPRGPage(2, bank); + SelectPRGPage(3, bank); + break; + } + } +}; diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index 9611e321..4afc960a 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -21,6 +21,7 @@ #include "JalecoJf17_19.h" #include "JalecoJfxx.h" #include "JalecoSs88006.h" +#include "Mapper15.h" #include "Mapper57.h" #include "Mapper58.h" #include "Mapper61.h" @@ -110,6 +111,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case 11: return new ColorDreams(); case 12: return new MMC3_12(); case 13: return new CpRom(); + case 15: return new Mapper15(); case 16: break; //18 games case 18: return new JalecoSs88006(); case 19: break; //16 games