Mapper 205 support

This commit is contained in:
Souryo 2016-01-20 19:32:28 -05:00
parent 521f08bbbc
commit c034133518
5 changed files with 57 additions and 1 deletions

View File

@ -232,7 +232,7 @@ class BaseMapper : public IMemoryHandler, public Snapshotable, public INotificat
return _prgPages[addr >> 8] ? _prgPages[addr >> 8][addr & 0xFF] : 0;
}
void SelectPRGPage(uint16_t slot, uint16_t page, PrgMemoryType memoryType = PrgMemoryType::PrgRom)
virtual void SelectPRGPage(uint16_t slot, uint16_t page, PrgMemoryType memoryType = PrgMemoryType::PrgRom)
{
_prgPageNumbers[slot] = page;

View File

@ -375,6 +375,7 @@
<ClInclude Include="Mapper201.h" />
<ClInclude Include="Mapper202.h" />
<ClInclude Include="Mapper203.h" />
<ClInclude Include="MMC3_205.h" />
<ClInclude Include="Mapper231.h" />
<ClInclude Include="Mapper240.h" />
<ClInclude Include="Mapper242.h" />

View File

@ -404,6 +404,9 @@
<ClInclude Include="Mapper201.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
<ClInclude Include="MMC3_205.h">
<Filter>Nes\Mappers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">

50
Core/MMC3_205.h Normal file
View File

@ -0,0 +1,50 @@
#pragma once
#include "stdafx.h"
#include "MMC3.h"
class MMC3_205 : public MMC3
{
private:
uint8_t _selectedBlock = 0;
protected:
virtual uint16_t RegisterStartAddress() { return 0x6000; }
virtual uint16_t RegisterEndAddress() { return 0xFFFF; }
virtual void StreamState(bool saving)
{
Stream<uint8_t>(_selectedBlock);
MMC3::StreamState(saving);
}
virtual void SelectCHRPage(uint16_t slot, uint16_t page, ChrMemoryType memoryType = ChrMemoryType::Default)
{
if(_selectedBlock >= 2) {
page &= 0x7F;
page |= 0x100;
}
if(_selectedBlock == 1 || _selectedBlock == 3) {
page |= 0x80;
}
MMC3::SelectCHRPage(slot, page, memoryType);
}
virtual void SelectPRGPage(uint16_t slot, uint16_t page, PrgMemoryType memoryType = PrgMemoryType::PrgRom)
{
page &= _selectedBlock <= 1 ? 0x1F : 0x0F;
page |= (_selectedBlock * 0x10);
MMC3::SelectPRGPage(slot, page, memoryType);
}
void WriteRegister(uint16_t addr, uint8_t value)
{
if(addr < 0x8000) {
_selectedBlock = value & 0x03;
UpdateState();
} else {
MMC3::WriteRegister(addr, value);
}
}
};

View File

@ -33,6 +33,7 @@
#include "MMC3.h"
#include "MMC3_115.h"
#include "MMC3_189.h"
#include "MMC3_205.h"
#include "MMC3_ChrRam.h"
#include "MMC4.h"
#include "MMC5.h"
@ -139,6 +140,7 @@ BaseMapper* MapperFactory::GetMapperFromID(ROMLoader &romLoader)
case 201: return new Mapper201();
case 202: return new Mapper202();
case 203: return new Mapper203();
case 205: return new MMC3_205();
case 206: return new Namco108();
case 231: return new Mapper231();
case 232: return new BF9096();