Mapper 176 support (Work for the Waixing games, but not for the multicarts)

This commit is contained in:
Souryo 2016-06-19 11:13:25 -04:00
parent 5b6d06c1f1
commit 923fc072ee
4 changed files with 63 additions and 0 deletions

View file

@ -574,6 +574,7 @@
<ClInclude Include="VsControlManager.h" />
<ClInclude Include="VsSystem.h" />
<ClInclude Include="ScaleFilter.h" />
<ClInclude Include="Waixing176.h" />
<ClInclude Include="WaveRecorder.h" />
<ClInclude Include="Zapper.h" />
</ItemGroup>

View file

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

View file

@ -105,6 +105,7 @@
#include "VRC6.h"
#include "VRC7.h"
#include "VsSystem.h"
#include "Waixing176.h"
BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
{
@ -220,6 +221,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 157: return new BandaiFcg();
case 159: return new BandaiFcg();
case 163: return new Nanjing();
case 176: return new Waixing176();
case 180: return new UnRom_180();
case 184: return new Sunsoft184();
case 185: return new CNROM(true);

57
Core/Waixing176.h Normal file
View file

@ -0,0 +1,57 @@
#pragma once
#include "BaseMapper.h"
class Waixing176 : public BaseMapper
{
private:
bool _registersEnabled;
protected:
uint16_t GetPRGPageSize() { return 0x2000; }
uint16_t GetCHRPageSize() { return 0x2000; }
uint16_t RegisterStartAddress() { return 0x5000; }
uint16_t RegisterEndAddress() { return 0x5FFF; }
void InitMapper()
{
_registersEnabled = false;
SelectPRGPage(0, 0);
SelectPRGPage(1, 1);
SelectPRGPage(2, (GetPRGPageCount() - 2) & 0x3F);
SelectPRGPage(3, (GetPRGPageCount() - 1) & 0x3F);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
switch(addr) {
case 0x5001:
if(_registersEnabled) {
SelectPrgPage4x(0, value*4);
}
break;
case 0x5010:
if(value == 0x24) {
_registersEnabled = true;
}
break;
case 0x5011:
if(_registersEnabled) {
SelectPrgPage4x(0, (value >> 1) * 4);
}
break;
case 0x5FF1:
SelectPrgPage4x(0, (value >> 1) * 4);
break;
case 0x5FF2:
if(!HasChrRam()) {
SelectCHRPage(0, value);
}
break;
}
}
};