diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 9198471301..6dde8e636a 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -198,6 +198,7 @@ + diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper037.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper037.cs new file mode 100644 index 0000000000..3b84e4ca5e --- /dev/null +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/MMC3_family/Mapper037.cs @@ -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)); + } + } +}