NesHawk - Attempt UNIF_UNL-LH10, something is messed up though, nametable is off

This commit is contained in:
adelikat 2016-11-04 13:20:29 -05:00
parent 4da414aced
commit a979721415
2 changed files with 92 additions and 0 deletions

View File

@ -782,6 +782,7 @@
<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-KS7013B.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\UNIF\UNIF_UNL-LH10.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,91 @@
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class UNIF_UNL_LH10 : NES.NESBoardBase
{
private ByteBuffer reg = new ByteBuffer(8);
private int cmd;
private int prg_bank_mask_8;
public override bool Configure(NES.EDetectionOrigin origin)
{
//configure
switch (Cart.board_type)
{
case "UNIF_UNL-LH10":
NES._isVS = true;
break;
default:
return false;
}
prg_bank_mask_8 = Cart.prg_size / 8 - 1;
//SetMirrorType(Cart.pad_h, Cart.pad_v);
SetMirrorType(EMirrorType.Vertical);
return true;
}
public override void Dispose()
{
reg.Dispose();
base.Dispose();
}
public override void SyncState(Serializer ser)
{
ser.Sync("reg", ref reg);
ser.Sync("cmd", ref cmd);
base.SyncState(ser);
}
public override void WritePRG(int addr, byte value)
{
addr += 0x8000;
if (addr < 0xC000 || addr >= 0xE000)
{
switch (addr & 0xE001)
{
case 0x8000: cmd = value & 7; break;
case 0x8001: reg[cmd] = value; break;
}
}
}
public override byte ReadWRAM(int addr)
{
return ROM[ROM.Length - 0x4000 + addr];
}
public override byte ReadPRG(int addr)
{
int bank = 0;
if (addr < 0x2000)
{
bank = reg[6];
}
else if (addr < 0x4000)
{
bank = reg[7];
}
else if (addr < 0x6000)
{
bank = 4;
}
else
{
bank = 0xFF;
}
bank &= prg_bank_mask_8;
return ROM[(bank << 13) + (addr & 0x1FFF)];
}
public override byte ReadPPU(int addr)
{
return base.ReadPPU(addr);
}
}
}