nes mapper 37: "Super Mario Bros. / Tetris / Nintendo World Cup" licensed multicart (E)

This commit is contained in:
goyuken 2012-10-15 16:02:23 +00:00
parent 556d428406
commit feb124bc89
2 changed files with 56 additions and 0 deletions

View File

@ -198,6 +198,7 @@
<Compile Include="Consoles\Nintendo\NES\Boards\MLT-MAX15.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\HKROM.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper012.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper037.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper044.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper049.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\MMC3_family\Mapper052.cs" />

View File

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Consoles.Nintendo
{
// mmc3 multi, PAL, "Super Mario Bros. / Tetris / Nintendo World Cup"
public class Mapper037 : MMC3Board_Base
{
int exreg;
public override bool Configure(NES.EDetectionOrigin origin)
{
switch (Cart.board_type)
{
case "MAPPER037":
case "PAL-ZZ":
break;
default:
return false;
}
AssertPrg(256);
AssertChr(256);
BaseSetup();
//mmc3.MMC3Type = ??
exreg = 0;
return true;
}
public override void SyncState(Serializer ser)
{
ser.Sync("exreg", ref exreg);
base.SyncState(ser);
}
public override void WriteWRAM(int addr, byte value)
{
if (!mmc3.wram_enable || mmc3.wram_write_protect)
return;
exreg = value & 7;
mmc3.Sync(); // unneeded?
}
protected override int Get_CHRBank_1K(int addr)
{
return base.Get_CHRBank_1K(addr) | (exreg << 5 & 0x80);
}
protected override int Get_PRGBank_8K(int addr)
{
return (exreg << 2 & 0x10) | ((exreg & 3) == 3 ? 8 : 0) | (base.Get_PRGBank_8K(addr) & (exreg << 1 | 7));
}
}
}