NesHawk - support board UNIF_BMC-NTD-03

This commit is contained in:
adelikat 2016-10-28 13:05:10 -05:00
parent 0a85b24b88
commit 96f0fcb7a8
2 changed files with 64 additions and 0 deletions

View File

@ -762,6 +762,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-Ghostbusters63in1.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-GS-2004.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-GS-2013.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-NTD-03.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-T-262.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMC-WS.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_BMCFK23C.cs" />

View File

@ -0,0 +1,63 @@
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class UNIF_BMC_NTD_03 : NES.NESBoardBase
{
private int latche;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "UNIF_BMC-NTD-03":
break;
default:
return false;
}
return true;
}
public override void SyncState(Serializer ser)
{
ser.Sync("latche", ref latche);
base.SyncState(ser);
}
public override void WritePRG(int addr, byte value)
{
latche = addr & 65535;
SetMirrorType(addr.Bit(10) ? EMirrorType.Horizontal : EMirrorType.Vertical);
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
int bank = ((latche & 0x0300) >> 5) | (latche & 7);
return VROM[(bank << 13) + addr];
}
return base.ReadPPU(addr);
}
public override byte ReadPRG(int addr)
{
int prg = ((latche >> 10) & 0x1E);
if (latche.Bit(7))
{
int bank = prg | ((latche >> 6) & 1);
return ROM[(bank << 14) + (addr & 0x3FFF)];
}
else
{
int bank = prg >> 1;
return ROM[( bank << 15) + addr];
}
}
}
}