Added support for mapper 320 (BMC-830425C-4391T)

This commit is contained in:
Sour 2018-07-08 15:57:38 -04:00
parent d72f659713
commit dd6c011b10
5 changed files with 62 additions and 1 deletions

55
Core/Bmc830425C4391T.h Normal file
View File

@ -0,0 +1,55 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Bmc830425C4391T : public BaseMapper
{
private:
uint8_t _innerReg;
uint8_t _outerReg;
uint8_t _prgMode;
protected:
virtual uint16_t GetPRGPageSize() override { return 0x4000; }
virtual uint16_t GetCHRPageSize() override { return 0x2000; }
void InitMapper() override
{
_innerReg = 0;
_outerReg = 0;
_prgMode = 0;
SelectCHRPage(0, 0);
UpdateState();
}
void StreamState(bool saving) override
{
BaseMapper::StreamState(saving);
Stream(_innerReg, _outerReg, _prgMode);
}
void UpdateState()
{
if(_prgMode) {
//UNROM mode
SelectPRGPage(0, (_innerReg & 0x07) | (_outerReg << 3));
SelectPRGPage(1, 0x07 | (_outerReg << 3));
} else {
//UOROM mode
//FIXME: Mermaid game doesn't work
SelectPRGPage(0, _innerReg | (_outerReg << 3));
SelectPRGPage(1, 0x0F | (_outerReg << 3));
}
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
_innerReg = value & 0x0F;
if((addr & 0xF0E0) == 0xF0E0) {
_outerReg = addr & 0x0F;
_prgMode = (addr >> 4) & 0x01;
}
UpdateState();
}
};

View File

@ -522,6 +522,7 @@
<ClInclude Include="Bmc80013B.h" />
<ClInclude Include="Bmc8157.h" />
<ClInclude Include="Bmc830118C.h" />
<ClInclude Include="Bmc830425C4391T.h" />
<ClInclude Include="Bmc8in1.h" />
<ClInclude Include="BmcGn45.h" />
<ClInclude Include="BmcHpxx.h" />

View File

@ -1456,6 +1456,9 @@
<ClInclude Include="ResetTxrom.h">
<Filter>Nes\Mappers\Unif</Filter>
</ClInclude>
<ClInclude Include="Bmc830425C4391T.h">
<Filter>Nes\Mappers\Unif</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

View File

@ -32,6 +32,7 @@
#include "Bmc80013B.h"
#include "Bmc810544CA1.h"
#include "Bmc830118C.h"
#include "Bmc830425C4391T.h"
#include "Bmc8in1.h"
#include "BmcG146.h"
#include "BmcGn45.h"
@ -586,7 +587,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 315: break; //830134C
//316-318
case 319: return new Hp898f();
case 320: break; //830425C-4391T
case 320: return new Bmc830425C4391T();
//321
case 322: break; //K-3033
case 323: break; //FARID_SLROM_8-IN-1

View File

@ -17,6 +17,7 @@ std::unordered_map<string, int> UnifLoader::_boardMappings = std::unordered_map<
{ "70in1", 236 },
{ "70in1B", 236 },
{ "810544-C-A1", 261 },
{ "830425C-4391T", 320 },
{ "8157", 301 },
{ "8237", 215 },
{ "8237A", UnifBoards::Unl8237A },