Mapper 156 support (Daou Infosys)

This commit is contained in:
Souryo 2016-06-18 12:49:53 -04:00
parent 58163ee067
commit 62ab7676b5
4 changed files with 76 additions and 0 deletions

View File

@ -394,6 +394,7 @@
<ClInclude Include="BF9096.h" />
<ClInclude Include="BF909x.h" />
<ClInclude Include="BnRom.h" />
<ClInclude Include="DaouInfosys.h" />
<ClInclude Include="DebugState.h" />
<ClInclude Include="DefaultVideoFilter.h" />
<ClInclude Include="ExpressionEvaluator.h" />

View File

@ -634,6 +634,9 @@
<ClInclude Include="JalecoJf13.h">
<Filter>Nes\Mappers\Jaleco</Filter>
</ClInclude>
<ClInclude Include="DaouInfosys.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

70
Core/DaouInfosys.h Normal file
View File

@ -0,0 +1,70 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class DaouInfosys : public BaseMapper
{
private:
uint8_t _chrLow[8];
uint8_t _chrHigh[8];
protected:
virtual uint16_t RegisterStartAddress() { return 0xC000; }
virtual uint16_t RegisterEndAddress() { return 0xC014; }
virtual uint16_t GetPRGPageSize() { return 0x4000; }
virtual uint16_t GetCHRPageSize() { return 0x400; }
void InitMapper()
{
memset(_chrLow, 0, sizeof(_chrLow));
memset(_chrHigh, 0, sizeof(_chrHigh));
SelectPRGPage(1, -1);
SetMirroringType(MirroringType::ScreenAOnly);
}
void StreamState(bool saving)
{
BaseMapper::StreamState(saving);
ArrayInfo<uint8_t> chrLow{ _chrLow, 8 };
ArrayInfo<uint8_t> chrHigh{ _chrHigh, 8 };
Stream(chrLow, chrHigh);
if(!saving) {
UpdateChrBanks();
}
}
void UpdateChrBanks()
{
for(int i = 0; i < 8; i++) {
SelectCHRPage(i, (_chrHigh[i] << 8) | _chrLow[i]);
}
}
void WriteRegister(uint16_t addr, uint8_t value)
{
switch(addr) {
case 0xC000: case 0xC001: case 0xC002: case 0xC003:
case 0xC004: case 0xC005: case 0xC006: case 0xC007:
case 0xC008: case 0xC009: case 0xC00A: case 0xC00B:
case 0xC00C: case 0xC00D: case 0xC00E: case 0xC00F:
{
uint8_t bank = (addr & 0x03) + ((addr >= 0xC008) ? 4 : 0);
uint8_t* arr = (addr & 0x04) ? _chrHigh : _chrLow;
arr[bank] = value;
UpdateChrBanks();
break;
}
case 0xC010:
SelectPRGPage(0, value);
break;
case 0xC014:
SetMirroringType((value & 0x01) == 0x01 ? MirroringType::Horizontal : MirroringType::Vertical);
break;
}
}
};

View File

@ -11,6 +11,7 @@
#include "CNROM.h"
#include "CpRom.h"
#include "ColorDreams.h"
#include "DaouInfosys.h"
#include "FDS.h"
#include "FrontFareast.h"
#include "GxRom.h"
@ -201,6 +202,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 152: return new Bandai74161_7432(true);
case 153: return new BandaiFcg();
case 154: return new Namco108_154();
case 156: return new DaouInfosys();
case 157: return new BandaiFcg();
case 159: return new BandaiFcg();
case 163: return new Nanjing();