UNIF BMC-12-in-1 board support

This commit is contained in:
Souryo 2016-11-11 17:39:52 -05:00
parent c3edf7a951
commit 15669262ee
6 changed files with 59 additions and 2 deletions

50
Core/Bmc12in1.h Normal file
View File

@ -0,0 +1,50 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Bmc12in1 : public BaseMapper
{
private:
uint8_t _regs[2];
uint8_t _mode;
protected:
uint16_t GetPRGPageSize() override { return 0x4000; }
uint16_t GetCHRPageSize() override { return 0x1000; }
void InitMapper() override
{
_regs[0] = _regs[1] = 0;
_mode = 0;
UpdateState();
}
void StreamState(bool saving)
{
BaseMapper::StreamState(saving);
Stream(_regs[0], _regs[1], _mode);
}
void UpdateState()
{
uint8_t bank = (_mode & 0x03) << 3;
SelectCHRPage(0, (_regs[0] >> 3) | (bank << 2));
SelectCHRPage(1, (_regs[1] >> 3) | (bank << 2));
if(_mode & 0x08) {
SelectPrgPage2x(0, bank | (_regs[0] & 0x06));
} else {
SelectPRGPage(0, bank | (_regs[0] & 0x07));
SelectPRGPage(1, bank | 0x07);
}
SetMirroringType(_mode & 0x04 ? MirroringType::Horizontal : MirroringType::Vertical);
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
switch(addr & 0xE000) {
case 0xA000: _regs[0] = value; UpdateState(); break;
case 0xC000: _regs[1] = value; UpdateState(); break;
case 0xE000: _mode = value & 0x0F; UpdateState(); break;
}
}
};

View File

@ -418,6 +418,7 @@
<ClInclude Include="BF9096.h" />
<ClInclude Include="BF909x.h" />
<ClInclude Include="Bmc11160.h" />
<ClInclude Include="Bmc12in1.h" />
<ClInclude Include="Bmc190in1.h" />
<ClInclude Include="Bmc255.h" />
<ClInclude Include="Bmc51.h" />

View File

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

View File

@ -17,6 +17,7 @@
#include "BF909x.h"
#include "BF9096.h"
#include "Bmc11160.h"
#include "Bmc12in1.h"
#include "Bmc51.h"
#include "Bmc63.h"
#include "Bmc70in1.h"
@ -476,6 +477,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case UnifBoards::Ax5705: return new Ax5705();
case UnifBoards::Bb: return new Bb();
case UnifBoards::Bmc11160: return new Bmc11160();
case UnifBoards::Bmc12in1: return new Bmc12in1();
case UnifBoards::Bmc70in1: return new Bmc70in1();
case UnifBoards::Bmc70in1B: return new Bmc70in1();
case UnifBoards::Bmc190in1: return new Bmc190in1();

View File

@ -34,6 +34,7 @@ namespace UnifBoards {
Ac08,
BmcG146,
BmdNtd03,
Bmc11160
Bmc11160,
Bmc12in1
};
}

View File

@ -10,7 +10,7 @@ class UnifLoader
private:
std::unordered_map<string, int> _boardMappings = {
{ "11160", UnifBoards::Bmc11160 },
{ "12-IN-1", UnifBoards::UnknownBoard },
{ "12-IN-1", UnifBoards::Bmc12in1 },
{ "13in1JY110", UnifBoards::UnknownBoard },
{ "190in1", UnifBoards::Bmc190in1 },
{ "22211", 132 },