diff --git a/Core/BandaiKaraoke.h b/Core/BandaiKaraoke.h new file mode 100644 index 00000000..a49d8dfd --- /dev/null +++ b/Core/BandaiKaraoke.h @@ -0,0 +1,47 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" +#include "ControlManager.h" +#include "StandardController.h" + +class BandaiKaraoke : public BaseMapper +{ +protected: + virtual uint16_t GetPRGPageSize() { return 0x4000; } + virtual uint16_t GetCHRPageSize() { return 0x2000; } + virtual bool AllowRegisterRead() { return true; } + + void InitMapper() + { + AddRegisterRange(0x6000, 0x7FFF, MemoryOperation::Read); + RemoveRegisterRange(0x8000, 0xFFFF, MemoryOperation::Read); + + SelectPRGPage(0, 0); + SelectPRGPage(1, 0x07); + SelectCHRPage(0, 0); + } + + uint8_t ReadRegister(uint16_t addr) + { + //Microphone not implemented - always return A/B buttons as not pressed + return 0x03; + } + + void WriteRegister(uint16_t addr, uint8_t value) + { + if(value & 0x10) { + //Select internal rom + SelectPRGPage(0, value & 0x07); + } else { + //Select expansion rom + if(_prgSize >= 0x40000) { + SelectPRGPage(0, (value & 0x07) | 0x08); + } else { + //Open bus for roms that don't contain the expansion rom + RemoveCpuMemoryMapping(0x8000, 0xBFFF); + } + } + + SetMirroringType(value & 0x20 ? MirroringType::Horizontal : MirroringType::Vertical); + } +}; \ No newline at end of file diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 58700b2b..d237fdd8 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -405,6 +405,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 92449111..a4f3107c 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -844,6 +844,9 @@ Nes\Mappers\MMC + + Nes\Mappers\Bandai + diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index 21452b40..4c3384c1 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -7,6 +7,7 @@ #include "AXROM.h" #include "Bandai74161_7432.h" #include "BandaiFcg.h" +#include "BandaiKaraoke.h" #include "Bmc51.h" #include "Bmc63.h" #include "Bmc235.h" @@ -171,7 +172,7 @@ Supported mappers: |===|===|===|===|132|133| |===| |137|138|139|140|141|142|143| |144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159| | |===| |163|164|165|166|167|168|===|170|171|172|173|===|175| -|176|177|178|179|180| |182| |184|185| |187| |189|===|191| +|176|177|178|179|180| |182| |184|185| |187|188|189|===|191| |192|193|194|195| |197| | |200|201|202|203| |205|206|207| | |209|210|211|212| | | | | |218| | |221| | | | |225|226|227|228| |230|231|232| |234|235| |===| |===| @@ -337,6 +338,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case 184: return new Sunsoft184(); case 185: return new CNROM(true); case 187: return new MMC3_187(); + case 188: return new BandaiKaraoke(); case 189: return new MMC3_189(); case 191: return new MMC3_ChrRam(0x80, 0xFF, 2); case 192: return new MMC3_ChrRam(0x08, 0x0B, 4);