NesHawk - MILLIONS OF MOAR GAMEZ!!!

This commit is contained in:
adelikat 2015-08-23 22:36:15 -04:00
parent 2e6ba68327
commit 4723ec8acc
2 changed files with 61 additions and 0 deletions

View File

@ -551,6 +551,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper203.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper204.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper212.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper213.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" />

View File

@ -0,0 +1,60 @@
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
// 9999999-in-1 [p2]
// http://wiki.nesdev.com/w/index.php/INES_Mapper_213
public class Mapper213 : NES.NESBoardBase
{
private int _reg;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "MAPPER213":
break;
default:
return false;
}
SetMirrorType(Cart.pad_h, Cart.pad_v);
_reg = 65535;
return true;
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("_reg", ref _reg);
}
public override void WritePRG(int addr, byte value)
{
addr += 0x8000;
_reg = addr;
SetMirrorType(addr.Bit(3) ? EMirrorType.Vertical : EMirrorType.Horizontal);
}
public override byte ReadPRG(int addr)
{
int bank = (_reg >> 1) & 3;
return ROM[(bank * 0x8000) + (addr & 0x7FFF)];
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
int bank = (_reg >> 3) & 7;
return VROM[(bank * 0x2000) + (addr & 0x1FFF)];
}
return base.ReadPPU(addr);
}
}
}