diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 47679139e5..1cd7d3df26 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -158,6 +158,7 @@ + diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper120.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper120.cs new file mode 100644 index 0000000000..e72fb66ebf --- /dev/null +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Mapper120.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BizHawk.Emulation.Consoles.Nintendo +{ + class Mapper120 : NES.NESBoardBase + { + //Used by Tobidase Daisakusen (FDS Conversion). Undocumented by Disch docs, this implementation is based on FCEUX + + byte prg_reg; + + public override bool Configure(NES.EDetectionOrigin origin) + { + switch (Cart.board_type) + { + case "MAPPER120": + break; + default: + return false; + } + SetMirrorType(EMirrorType.Vertical); + return true; + } + + public override void SyncState(Serializer ser) + { + ser.Sync("prg_reg", ref prg_reg); + base.SyncState(ser); + } + + public override void WriteEXP(int addr, byte value) + { + if (addr == 0x01FF) + { + prg_reg = (byte)(value & 0x07); + } + } + + public override byte ReadWRAM(int addr) + { + return ROM[((prg_reg & 7) * 0x2000) + (addr & 0x1FFF)]; + } + + public override byte ReadPRG(int addr) + { + return ROM[0x10000 + addr]; + } + } +}