From 06e1472166b3d785d1158466d496900f5b85ce37 Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 28 Oct 2016 13:12:15 -0500 Subject: [PATCH] NesHawk - Support board UNIF_UNL-43272 --- .../BizHawk.Emulation.Cores.csproj | 1 + .../NES/Boards/UNIF/UNIF_UNL-43272.cs | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-43272.cs diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index 6b2884363b..afd021186b 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -767,6 +767,7 @@ + diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-43272.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-43272.cs new file mode 100644 index 0000000000..a12401eb11 --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-43272.cs @@ -0,0 +1,39 @@ +using BizHawk.Common; + +namespace BizHawk.Emulation.Cores.Nintendo.NES +{ + public sealed class UNIF_UNL_43272 : NES.NESBoardBase + { + private int latche; + + public override bool Configure(NES.EDetectionOrigin origin) + { + switch (Cart.board_type) + { + case "UNIF_UNL-43272": + break; + default: + return false; + } + + return true; + } + + public override void SyncState(Serializer ser) + { + ser.Sync("latche", ref latche); + base.SyncState(ser); + } + + public override void WritePRG(int addr, byte value) + { + latche = addr & 65535; + } + + public override byte ReadPRG(int addr) + { + int bank = (latche & 0x38) >> 3; + return ROM[(bank << 15) + addr]; + } + } +}