From 43e6418dac6c578a5516dbd3fdf4425cf543671c Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 22 Aug 2015 11:35:45 -0400 Subject: [PATCH] NESHawk - implement board UNIF_BMC-190in1 --- .../BizHawk.Emulation.Cores.csproj | 1 + .../NES/Boards/UNIF/UNIF_BMC-190in1.cs | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-190in1.cs diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index 9feb51d1c5..33344578f2 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -638,6 +638,7 @@ + diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-190in1.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-190in1.cs new file mode 100644 index 0000000000..22916a9dcd --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-190in1.cs @@ -0,0 +1,50 @@ +using BizHawk.Common; +using BizHawk.Common.NumberExtensions; + +namespace BizHawk.Emulation.Cores.Nintendo.NES +{ + public class UNIF_BMC_190in1 : NES.NESBoardBase + { + private int _reg; + + public override bool Configure(NES.EDetectionOrigin origin) + { + switch (Cart.board_type) + { + case "UNIF_BMC-190in1": + break; + default: + return false; + } + + return true; + } + + public override void SyncState(Serializer ser) + { + base.SyncState(ser); + ser.Sync("reg", ref _reg); + + } + public override void WritePRG(int addr, byte value) + { + _reg = (addr >> 2) & 7; + SetMirrorType(addr.Bit(0) ? EMirrorType.Horizontal : EMirrorType.Vertical); + } + + public override byte ReadPPU(int addr) + { + if (addr < 0x2000) + { + return VROM[(_reg * 0x2000) + (addr & 0x1FFF)]; + } + + return base.ReadPPU(addr); + } + + public override byte ReadPRG(int addr) + { + return ROM[(_reg * 0x4000) + (addr & 0x3FFF)]; + } + } +}