Mapper 51 support

This commit is contained in:
Souryo 2016-07-20 23:17:55 -04:00
parent c765de3519
commit 650019fbff
4 changed files with 67 additions and 2 deletions

59
Core/Bmc51.h Normal file
View File

@ -0,0 +1,59 @@
#pragma once
#include "stdafx.h"
#include "BaseMapper.h"
class Bmc51 : public BaseMapper
{
private:
uint8_t _bank;
uint8_t _mode;
protected:
virtual uint16_t GetPRGPageSize() { return 0x2000; }
virtual uint16_t GetCHRPageSize() { return 0x2000; }
uint16_t RegisterStartAddress() { return 0x6000; }
uint16_t RegisterEndAddress() { return 0xFFFF; }
void InitMapper()
{
_bank = 0;
_mode = 1;
UpdateState();
}
void StreamState(bool saving)
{
BaseMapper::StreamState(saving);
Stream(_bank, _mode);
if(!saving) {
UpdateState();
}
}
void UpdateState()
{
if(_mode & 0x01) {
SelectPrgPage4x(0, _bank << 2);
SetCpuMemoryMapping(0x6000, 0x7FFF, (0x23 | (_bank << 2)), PrgMemoryType::PrgRom);
} else {
SelectPrgPage2x(0, (_bank << 2) | _mode);
SelectPrgPage2x(1, _bank << 2 | 0x0E);
SetCpuMemoryMapping(0x6000, 0x7FFF, (0x2F | (_bank << 2)), PrgMemoryType::PrgRom);
}
SetMirroringType(_mode == 0x03 ? MirroringType::Horizontal : MirroringType::Vertical);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
if(addr <= 0x7FFF) {
_mode = ((value >> 3) & 0x02) | ((value >> 1) & 0x01);
} else if(addr >= 0xC000 && addr <= 0xDFFF) {
_bank = value & 0x0F;
_mode = ((value >> 3) & 0x02) | (_mode & 0x01);
} else {
_bank = value & 0x0F;
}
UpdateState();
}
};

View File

@ -411,6 +411,7 @@
<ClInclude Include="BaseSoundFilter.h" />
<ClInclude Include="BF9096.h" />
<ClInclude Include="BF909x.h" />
<ClInclude Include="Bmc51.h" />
<ClInclude Include="BnRom.h" />
<ClInclude Include="Caltron41.h" />
<ClInclude Include="ColorDreams46.h" />

View File

@ -772,6 +772,9 @@
<ClInclude Include="Bmc235.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
<ClInclude Include="Bmc51.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

View File

@ -7,6 +7,8 @@
#include "AXROM.h"
#include "Bandai74161_7432.h"
#include "BandaiFcg.h"
#include "Bmc51.h"
#include "Bmc235.h"
#include "BnRom.h"
#include "BF909x.h"
#include "BF9096.h"
@ -18,7 +20,6 @@
#include "DaouInfosys.h"
#include "FDS.h"
#include "FrontFareast.h"
#include "Bmc235.h"
#include "GxRom.h"
#include "Henggedianzi177.h"
#include "Henggedianzi179.h"
@ -138,7 +139,7 @@ Supported mappers: (... denotes bad mappers, --- denotes potentially bad mapper
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13| | 15|
| 16| 17| 18| 19|...| 21| 22| 23| 24| 25| 26| 27| 28| | | 31|
| 32| 33| 34| | 36| 37| 38|---| 40| 41| 42|---| 44| 45| 46| 47|
| 48| 49| 50| | 52| | | | 56| 57| 58| | 60| 61| 62| |
| 48| 49| 50| 51| 52| | | | 56| 57| 58| | 60| 61| 62| |
| 64| 65| 66| 67| 68| 69| 70| 71| 72| 73| 74| 75| 76| 77| 78| 79|
| 80| | 82| | | 85| 86| 87| 88| 89| | 91| 92| 93| 94| 95|
| | 97| | 99|...|101| | | | | |107| | | | |
@ -213,6 +214,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 48: return new TaitoTc0690();
case 49: return new MMC3_49();
case 50: return new Mapper50();
case 51: return new Bmc51();
case 52: return new MMC3_52();
case 56: return new Kaiser202();
case 57: return new Mapper57();