Mapper 227 support

This commit is contained in:
Souryo 2016-06-19 11:42:55 -04:00
parent a9517ccd29
commit 7d4ab35ff5
4 changed files with 57 additions and 0 deletions

View File

@ -424,6 +424,7 @@
<ClInclude Include="Mapper218.h" />
<ClInclude Include="Mapper225.h" />
<ClInclude Include="Mapper226.h" />
<ClInclude Include="Mapper227.h" />
<ClInclude Include="Mapper230.h" />
<ClInclude Include="Mapper241.h" />
<ClInclude Include="Mapper60.h" />

View File

@ -661,6 +661,9 @@
<ClInclude Include="Waixing176.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
<ClInclude Include="Mapper227.h">
<Filter>Nes\Mappers\Unnamed</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

51
Core/Mapper227.h Normal file
View File

@ -0,0 +1,51 @@
#pragma once
#include "BaseMapper.h"
class Mapper227 : public BaseMapper
{
protected:
uint16_t GetPRGPageSize() { return 0x4000; }
uint16_t GetCHRPageSize() { return 0x2000; }
void InitMapper()
{
WriteRegister(0x8000, 0);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
uint16_t prgBank = ((addr >> 2) & 0x1F) | ((addr & 0x100) >> 3);
bool sFlag = (addr & 0x01) == 0x01;
bool lFlag = ((addr >> 9) & 0x01) == 0x01;
bool prgMode = ((addr >> 7) & 0x01) == 0x01;
if(prgMode) {
if(sFlag) {
SelectPrgPage2x(0, prgBank & 0xFE);
} else {
SelectPRGPage(0, prgBank);
SelectPRGPage(1, prgBank);
}
} else {
if(sFlag){
if(lFlag) {
SelectPRGPage(0, prgBank & 0x3E);
SelectPRGPage(1, prgBank | 0x07);
} else {
SelectPRGPage(0, prgBank & 0x3E);
SelectPRGPage(1, prgBank & 0x38);
}
} else {
if(lFlag) {
SelectPRGPage(0, prgBank);
SelectPRGPage(1, prgBank | 0x07);
} else {
SelectPRGPage(0, prgBank);
SelectPRGPage(1, prgBank & 0x38);
}
}
}
SetMirroringType((addr & 0x02) == 0x02 ? MirroringType::Horizontal : MirroringType::Vertical);
}
};

View File

@ -42,6 +42,7 @@
#include "Mapper218.h"
#include "Mapper225.h"
#include "Mapper226.h"
#include "Mapper227.h"
#include "Mapper230.h"
#include "Mapper231.h"
#include "Mapper240.h"
@ -242,6 +243,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 218: return new Mapper218();
case 225: return new Mapper225();
case 226: return new Mapper226();
case 227: return new Mapper227();
case 228: return new ActionEnterprises();
case 230: return new Mapper230();
case 231: return new Mapper231();