NesHawk - implement mapper 214

This commit is contained in:
adelikat 2015-08-21 23:23:33 -04:00
parent 1916ba0042
commit 1e454a46fe
2 changed files with 54 additions and 0 deletions

View File

@ -548,6 +548,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper202.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper203.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper204.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper214.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper218.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper222.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper225.cs" />

View File

@ -0,0 +1,53 @@
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
// Super Gun 20-in-1
// http://wiki.nesdev.com/w/index.php/INES_Mapper_214
public class Mapper214 : NES.NESBoardBase
{
private int _chrReg, _prgReg;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "MAPPER214":
break;
default:
return false;
}
SetMirrorType(EMirrorType.Vertical);
return true;
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("chrReg", ref _chrReg);
}
public override void WritePRG(int addr, byte value)
{
_chrReg = addr & 3;
_prgReg = (addr >> 2) & 3;
}
public override byte ReadPRG(int addr)
{
return ROM[(_prgReg * 0x4000) + (addr & 0x3FFF)];
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
return VROM[(_chrReg * 0x2000) + (addr & 0x1FFF)];
}
return base.ReadPPU(addr);
}
}
}