NesHawk - start mapper 125 - something is wrong but I can't figure out what

This commit is contained in:
adelikat 2016-10-29 12:03:32 -05:00
parent 00d07b8602
commit 1af2c0ce17
2 changed files with 59 additions and 0 deletions

View File

@ -616,6 +616,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper108.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper116.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper120.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper125.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper132.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper136.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\Mapper142.cs" />

View File

@ -0,0 +1,58 @@
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
public sealed class Mapper125 : NES.NESBoardBase
{
private byte reg;
private int prg_bank_mask_8k;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "MAPPER125":
case "UNIF_UNL-LH32":
break;
default:
return false;
}
prg_bank_mask_8k = Cart.prg_size / 8 - 1;
return true;
}
public override void SyncState(Serializer ser)
{
ser.Sync("reg", ref reg);
base.SyncState(ser);
}
public override void WriteWRAM(int addr, byte value)
{
if (addr == 0)
{
reg = value;
}
}
public override byte ReadPRG(int addr)
{
int bank = 0;
if (addr < 0x2000) { bank = prg_bank_mask_8k - 3; }
else if (addr < 0x4000) { bank = prg_bank_mask_8k - 2; }
else if (addr < 0x6000) { bank = prg_bank_mask_8k - 1; }
else { bank = prg_bank_mask_8k; }
bank &= prg_bank_mask_8k;
return ROM[(bank << 13) + (addr & 0x1FFF)];
}
public override byte ReadWRAM(int addr)
{
return ROM[((reg & prg_bank_mask_8k) << 13) + addr];
}
}
}