UNIF: Added support for BMC-60311C boards

This commit is contained in:
Sour 2018-06-25 13:35:40 -04:00
parent b5d460ffb3
commit 86231c94e3
6 changed files with 91 additions and 0 deletions

83
Core/Bmc60311C.h Normal file
View file

@ -0,0 +1,83 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Bmc60311C : public BaseMapper
{
private:
uint8_t _innerPrg;
uint8_t _outerPrg;
uint8_t _mode;
protected:
uint16_t GetPRGPageSize() override { return 0x4000; }
uint16_t GetCHRPageSize() override { return 0x2000; }
uint16_t RegisterStartAddress() override { return 0x6000; }
uint16_t RegisterEndAddress() override { return 0xFFFF; }
void InitMapper() override
{
_innerPrg = 0;
_outerPrg = 0;
_mode = 0;
UpdateState();
SelectCHRPage(0, 0);
}
void StreamState(bool saving) override
{
BaseMapper::StreamState(saving);
Stream(_innerPrg, _outerPrg, _mode);
}
void UpdateState()
{
uint8_t page = _outerPrg | ((_mode & 0x04) ? 0 : _innerPrg);
switch(_mode & 0x03) {
case 0:
//0: NROM-128: Same inner/outer 16 KiB bank at CPU $8000-$BFFF and $C000-$FFFF
SelectPRGPage(0, page);
SelectPRGPage(1, page);
break;
case 1:
//1: NROM-256: 32 kiB bank at CPU $8000-$FFFF (Selected inner/outer bank SHR 1)
SelectPrgPage2x(0, page & 0xFE);
break;
case 2:
//2: UNROM: Inner/outer bank at CPU $8000-BFFF, fixed inner bank 7 within outer bank at $C000-$FFFF
SelectPRGPage(0, page);
SelectPRGPage(1, _outerPrg | 7);
break;
case 3:
//Unknown
break;
}
SetMirroringType(_mode & 0x08 ? MirroringType::Horizontal : MirroringType::Vertical);
}
void WriteRegister(uint16_t addr, uint8_t value) override
{
if(addr >= 0x8000) {
_innerPrg = value & 0x07;
UpdateState();
} else {
switch(addr & 0xE001) {
case 0x6000:
_mode = value & 0x0F;
UpdateState();
break;
case 0x6001:
_outerPrg = value;
UpdateState();
break;
}
}
}
};

View file

@ -518,6 +518,7 @@
<ClInclude Include="BaseSoundManager.h" />
<ClInclude Include="BatteryManager.h" />
<ClInclude Include="BattleBox.h" />
<ClInclude Include="Bmc60311C.h" />
<ClInclude Include="Bmc80013B.h" />
<ClInclude Include="Bmc8157.h" />
<ClInclude Include="Bmc830118C.h" />

View file

@ -1453,6 +1453,9 @@
<ClInclude Include="IMemoryManager.h">
<Filter>Nes\MemoryManager</Filter>
</ClInclude>
<ClInclude Include="Bmc60311C.h">
<Filter>Nes\Mappers\Unif</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

View file

@ -25,6 +25,7 @@
#include "Bmc190in1.h"
#include "Bmc235.h"
#include "Bmc255.h"
#include "Bmc60311C.h"
#include "Bmc8157.h"
#include "Bmc80013B.h"
#include "Bmc810544CA1.h"
@ -544,6 +545,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case UnifBoards::Bmc70in1: return new Bmc70in1();
case UnifBoards::Bmc70in1B: return new Bmc70in1();
case UnifBoards::Bmc190in1: return new Bmc190in1();
case UnifBoards::Bmc60311C: return new Bmc60311C();
case UnifBoards::Bmc810544CA1: return new Bmc810544CA1();
case UnifBoards::Bmc830118C: return new Bmc830118C();
case UnifBoards::Bmc80013B: return new Bmc80013B();

View file

@ -72,5 +72,6 @@ namespace UnifBoards {
BmcGn45,
UnlDripGame,
SssNrom256,
Bmc60311C,
};
}

View file

@ -161,4 +161,5 @@ std::unordered_map<string, int> UnifLoader::_boardMappings = std::unordered_map<
{ "HPxx", UnifBoards::BmcHpxx },
{ "GN-45", UnifBoards::BmcGn45 }, //Doesn't actually exist as a UNIF file (used to assign a mapper to GN-45 boards)
{ "DRIPGAME", UnifBoards::UnlDripGame },
{ "60311C", UnifBoards::Bmc60311C },
};