From 5805bb5d43cc37cbbba63bb81cd57ca62c562306 Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 28 Oct 2016 13:23:09 -0500 Subject: [PATCH] NesHawk - support board UNIF_UNL-AC08 --- .../BizHawk.Emulation.Cores.csproj | 1 + .../Nintendo/NES/Boards/UNIF/UNIF_UNL-AC08.cs | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AC08.cs diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index afd021186b..f8495cb4df 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -768,6 +768,7 @@ + diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AC08.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AC08.cs new file mode 100644 index 0000000000..8d391e2a5d --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_UNL-AC08.cs @@ -0,0 +1,61 @@ +using BizHawk.Common; +using BizHawk.Common.NumberExtensions; + +namespace BizHawk.Emulation.Cores.Nintendo.NES +{ + public sealed class UNIF_UNL_AC08 : NES.NESBoardBase + { + private int reg; + + public override bool Configure(NES.EDetectionOrigin origin) + { + switch (Cart.board_type) + { + case "UNIF_UNL-AC08": + break; + default: + return false; + } + + return true; + } + + public override void SyncState(Serializer ser) + { + ser.Sync("reg", ref reg); + base.SyncState(ser); + } + + public override void WriteEXP(int addr, byte value) + { + if (addr == 0x25) + { + SetMirrorType(value.Bit(3) ? EMirrorType.Horizontal : EMirrorType.Vertical); + } + + base.WriteEXP(addr, value); + } + + public override void WritePRG(int addr, byte value) + { + if (addr == 1) + { + reg = (value >> 1) & 0x0F; + } + else + { + reg = value & 0x0F; + } + } + + public override byte ReadWRAM(int addr) + { + return ROM[(reg << 13) + addr]; + } + + public override byte ReadPRG(int addr) + { + return ROM[0x20000 + addr]; + } + } +}