Implement Mapper238/UNIF_UNL-603-5052

This commit is contained in:
adelikat 2016-09-16 11:28:56 -04:00
parent 8bf4d6e5bc
commit 92f18928fb
2 changed files with 61 additions and 0 deletions

View File

@ -684,6 +684,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper197.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper205.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper219.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper238.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper245.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper249.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper250.cs" />

View File

@ -0,0 +1,60 @@
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
// Adapted from FCEUX src
public sealed class Mapper238 : MMC3Board_Base
{
private readonly int[] lut = { 0x00, 0x02, 0x02, 0x03 };
private byte reg;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "MAPPER238": // Nestopia suggests this board is mapper 238, I do not have any ROMs with this ines header info to confirm
case "UNIF_UNL-603-5052":
break;
}
BaseSetup();
return true;
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("reg", ref reg);
}
public override byte ReadEXP(int addr)
{
if (addr < 0x20)
{
return base.ReadEXP(addr);
}
return reg;
}
public override byte ReadWRAM(int addr)
{
return reg;
}
public override void WriteEXP(int addr, byte value)
{
if (addr < 0x20)
{
base.WriteEXP(addr, value);
}
reg = (byte)lut[value & 3];
}
public override void WriteWRAM(int addr, byte value)
{
reg = (byte)lut[value & 3];
}
}
}