NesHawk - support board UNIF_UNL-BB

This commit is contained in:
adelikat 2016-10-28 15:11:34 -05:00
parent 5805bb5d43
commit 7893184435
2 changed files with 68 additions and 0 deletions

View File

@ -770,6 +770,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-43272.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-AC08.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-AX5705.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-BB.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-CC-21.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-EDU2000.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-KOF97.cs" />

View File

@ -0,0 +1,67 @@
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class UNIF_UNL_BB : NES.NESBoardBase
{
private byte reg, chr;
private int prg_mask_32k;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "UNIF_UNL-BB":
break;
default:
return false;
}
reg = 0xFF;
prg_mask_32k = Cart.prg_size / 32 - 1;
SetMirrorType(Cart.pad_h, Cart.pad_v);
return true;
}
public override void SyncState(Serializer ser)
{
ser.Sync("reg", ref reg);
ser.Sync("chr", ref chr);
base.SyncState(ser);
}
public override void WritePRG(int addr, byte value)
{
addr += 0x8000;
if ((addr & 0x9000) == 0x8000)
{
reg = chr = value;
}
else
{
chr = (byte)(value & 1);
}
}
public override byte ReadWRAM(int addr)
{
return ROM[((reg & 3) << 13) + addr];
}
public override byte ReadPRG(int addr)
{
return ROM[(prg_mask_32k << 15) + addr];
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
return VROM[((chr & 3) << 13) + addr];
}
return base.ReadPPU(addr);
}
}
}