NesHawk - support board UNIF_UNL-KS7012

This commit is contained in:
adelikat 2016-10-28 15:32:16 -05:00
parent 7893184435
commit ea57a4daee
2 changed files with 61 additions and 0 deletions

View File

@ -774,6 +774,7 @@
<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" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-KS7012.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-SHERO.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-TF1201.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL_DripGame.cs" />

View File

@ -0,0 +1,60 @@
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public class UNIF_UNL_KS7012 : NES.NESBoardBase
{
private int reg;
private byte[] wram = new byte[8192];
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "UNIF_UNL-KS7012":
break;
default:
return false;
}
reg = 0xFF;
SetMirrorType(Cart.pad_h, Cart.pad_v);
return true;
}
public override void SyncState(Serializer ser)
{
ser.Sync("reg", ref reg);
base.SyncState(ser);
}
public override void WritePRG(int addr, byte value)
{
addr += 0x8000;
switch (addr)
{
case 0xE0A0:
reg = 0; break;
case 0xEE36:
reg = 1; break;
}
}
public override byte ReadWRAM(int addr)
{
return wram[addr];
//int offset = ROM.Length - 0x2000;
//return ROM[offset + addr];
}
public override void WriteWRAM(int addr, byte value)
{
wram[addr] = value;
}
public override byte ReadPRG(int addr)
{
return ROM[((reg & 1) << 15) + addr];
}
}
}