From a4c6b9f5ef453c1155e6ead4971fe6b70ff01587 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sat, 13 Aug 2016 08:21:25 -0400 Subject: [PATCH] Mapper 204 support --- Core/Core.vcxproj | 1 + Core/Core.vcxproj.filters | 3 +++ Core/Mapper204.h | 25 +++++++++++++++++++++++++ Core/MapperFactory.cpp | 4 +++- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Core/Mapper204.h diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 622bcdbd..8ef215cd 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -455,6 +455,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 81899e6a..d8cc9f80 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -877,6 +877,9 @@ Nes\Mappers\Unnamed + + Nes\Mappers\Unnamed + diff --git a/Core/Mapper204.h b/Core/Mapper204.h new file mode 100644 index 00000000..1a821976 --- /dev/null +++ b/Core/Mapper204.h @@ -0,0 +1,25 @@ +#pragma once +#include "stdafx.h" +#include "BaseMapper.h" + +class Mapper204 : public BaseMapper +{ +protected: + virtual uint16_t GetPRGPageSize() { return 0x4000; } + virtual uint16_t GetCHRPageSize() { return 0x2000; } + + void InitMapper() + { + WriteRegister(0x8000, 0); + } + + void WriteRegister(uint16_t addr, uint8_t value) + { + uint8_t bitMask = addr & 0x06; + uint8_t page = bitMask + ((bitMask == 0x06) ? 0 : (addr & 0x01)); + SelectPRGPage(0, page); + SelectPRGPage(1, bitMask + ((bitMask == 0x06) ? 1 : (addr & 0x01))); + SelectCHRPage(0, page); + SetMirroringType(addr & 0x10 ? MirroringType::Horizontal : MirroringType::Vertical); + } +}; \ No newline at end of file diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp index cd5fa93b..0b3a77da 100644 --- a/Core/MapperFactory.cpp +++ b/Core/MapperFactory.cpp @@ -60,6 +60,7 @@ #include "Mapper201.h" #include "Mapper202.h" #include "Mapper203.h" +#include "Mapper204.h" #include "Mapper212.h" #include "Mapper213.h" #include "Mapper214.h" @@ -183,7 +184,7 @@ Supported mappers: |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|188|189|===|191| -|192|193|194|195| |197| | |200|201|202|203| |205|206|207| +|192|193|194|195| |197| | |200|201|202|203|204|205|206|207| | |209|210|211|212|213|214| | | |218| | |221|222| | | |225|226|227|228|229|230|231|232|233|234|235| |===|238|===| |240|241|242|243|244|245|246|===|===|249|250|===|252| |254| | @@ -362,6 +363,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData) case 201: return new Mapper201(); case 202: return new Mapper202(); case 203: return new Mapper203(); + case 204: return new Mapper204(); case 205: return new MMC3_205(); case 206: return new Namco108(); case 207: return new TaitoX1005(true);