NesHawk - implement mapper 136

This commit is contained in:
adelikat 2015-08-19 20:17:59 -04:00
parent 2d8d51c951
commit 9054f56f52
2 changed files with 76 additions and 0 deletions

View File

@ -531,6 +531,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper116.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper120.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper132.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper136.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper143.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper156.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper164.cs" />

View File

@ -0,0 +1,75 @@
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
// Mei Loi Siu Ji (Metal Fighter) (Sachen) [!]
public sealed class Mapper136 : NES.NESBoardBase
{
private int _chrBankMask_8k;
private int _chrRegister;
public override bool Configure(NES.EDetectionOrigin origin)
{
//configure
switch (Cart.board_type)
{
case "MAPPER136":
break;
default:
return false;
}
_chrBankMask_8k = Cart.chr_size / 8 - 1;
return true;
}
public override void WriteEXP(int addr, byte value)
{
if ((addr & 0x103) == 0x102)
{
_chrRegister = value + 3;
}
else
{
base.WriteEXP(addr, value);
}
}
public override void WritePRG(int addr, byte value)
{
if ((addr & 0x103) == 0x102)
{
_chrRegister = value + 3;
}
}
public override byte ReadEXP(int addr)
{
if (addr == 0x100)
{
return (byte)((_chrRegister & 0x3F) | (NES.DB & 0xC0));
}
else
{
return base.ReadEXP(addr);
}
}
public override byte ReadPPU(int addr)
{
if (addr < 0x2000)
{
int bank = _chrRegister & _chrBankMask_8k;
return VROM[(bank * 0x2000) + (addr & 0x1FFF)];
}
return base.ReadPPU(addr);
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);
ser.Sync("chrRegister", ref _chrRegister);
}
}
}