Mapper 220 support

This commit is contained in:
Souryo 2016-10-30 10:32:01 -04:00
parent d2cac18235
commit 9aa6f1deaf
4 changed files with 66 additions and 1 deletions

View file

@ -466,6 +466,7 @@
<ClInclude Include="Mapper214.h" /> <ClInclude Include="Mapper214.h" />
<ClInclude Include="Mapper216.h" /> <ClInclude Include="Mapper216.h" />
<ClInclude Include="Mapper218.h" /> <ClInclude Include="Mapper218.h" />
<ClInclude Include="Mapper220.h" />
<ClInclude Include="Mapper221.h" /> <ClInclude Include="Mapper221.h" />
<ClInclude Include="Mapper222.h" /> <ClInclude Include="Mapper222.h" />
<ClInclude Include="Mapper225.h" /> <ClInclude Include="Mapper225.h" />

View file

@ -955,6 +955,9 @@
<ClInclude Include="MMC3_Coolboy.h"> <ClInclude Include="MMC3_Coolboy.h">
<Filter>Nes\Mappers\MMC</Filter> <Filter>Nes\Mappers\MMC</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Mapper220.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="stdafx.cpp"> <ClCompile Include="stdafx.cpp">

59
Core/Mapper220.h Normal file
View file

@ -0,0 +1,59 @@
#pragma once
#include "BaseMapper.h"
//Only seems to be for Gyruss (mapper 220) - other games marked as mapper 220 are not supported by any emulator that I could find (or remapped to another board type).
class Mapper220 : public BaseMapper
{
private:
uint8_t _regs[8];
protected:
uint16_t GetPRGPageSize() { return 0x0800; }
uint16_t GetCHRPageSize() { return 0x2000; }
void InitMapper() override
{
memset(_regs, 0, sizeof(_regs));
SelectCHRPage(0, 0);
UpdateState();
}
void StreamState(bool saving) override
{
BaseMapper::StreamState(saving);
ArrayInfo<uint8_t> regs{ _regs, 8 };
Stream(regs);
if(!saving) {
UpdateState();
}
}
void UpdateState()
{
const int regOrder[8] = { 4, 5, 6, 7, 0, 1, 2, 3 };
for(int i = 0; i < 8; i++) {
SetCpuMemoryMapping(0x6000 + i * 0x800, 0x67FF + i * 0x800, _regs[regOrder[i]], PrgMemoryType::PrgRom);
}
SelectPrgPage4x(1, 0x34);
SelectPrgPage4x(2, 0x38);
SelectPrgPage4x(3, 0x3C);
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
if(addr < 0xA000) {
SetMirroringType(value & 0x01 ? MirroringType::Vertical : MirroringType::Horizontal);
} else if(addr >= 0xB000 && addr < 0xF000) {
uint32_t regIndex = ((addr - 0xB000) >> 11) | ((addr >> 1) & 0x01);
if(addr & 0x01) {
_regs[regIndex] = (_regs[regIndex] & 0x0F) | (value << 4);
} else {
_regs[regIndex] = (_regs[regIndex] & 0xF0) | (value & 0x0F);
}
UpdateState();
}
}
};

View file

@ -70,6 +70,7 @@
#include "Mapper214.h" #include "Mapper214.h"
#include "Mapper216.h" #include "Mapper216.h"
#include "Mapper218.h" #include "Mapper218.h"
#include "Mapper220.h"
#include "Mapper221.h" #include "Mapper221.h"
#include "Mapper222.h" #include "Mapper222.h"
#include "Mapper225.h" #include "Mapper225.h"
@ -205,7 +206,7 @@ Supported mappers:
|---|===|162|163|164|165|166|167|168|===|170|171|172|173|===|175| |---|===|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| |176|177|178|179|180|---|182|183|184|185|186|187|188|189|===|191|
|192|193|194|195|196|197| |199|200|201|202|203|204|205|206|207| |192|193|194|195|196|197| |199|200|201|202|203|204|205|206|207|
| |209|210|211|212|213|214|215|216|217|218|219| |221|222| | | |209|210|211|212|213|214|215|216|217|218|219|220|221|222| |
| |225|226|227|228|229|230|231|232|233|234|235| |===|238|===| | |225|226|227|228|229|230|231|232|233|234|235| |===|238|===|
|240|241|242|243|244|245|246|===|===|249|250|===|252|253|254|255| |240|241|242|243|244|245|246|===|===|249|250|===|252|253|254|255|
----------------------------------------------------------------- -----------------------------------------------------------------
@ -412,6 +413,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 217: return new MMC3_217(); case 217: return new MMC3_217();
case 218: return new Mapper218(); case 218: return new Mapper218();
case 219: return new MMC3_219(); case 219: return new MMC3_219();
case 220: return new Mapper220();
case 221: return new Mapper221(); case 221: return new Mapper221();
case 222: return new Mapper222(); case 222: return new Mapper222();
case 225: return new Mapper225(); case 225: return new Mapper225();