diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index 33344578f2..7d1049f76e 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -640,6 +640,7 @@ + Code 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 index 22916a9dcd..81f22b44bb 100644 --- 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 @@ -26,6 +26,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES ser.Sync("reg", ref _reg); } + public override void WritePRG(int addr, byte value) { _reg = (addr >> 2) & 7; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-GS-2004.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-GS-2004.cs new file mode 100644 index 0000000000..7d8d814c02 --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/UNIF/UNIF_BMC-GS-2004.cs @@ -0,0 +1,61 @@ +using BizHawk.Common; + +namespace BizHawk.Emulation.Cores.Nintendo.NES +{ + public class UNIF_BMC_GS_2004 : NES.NESBoardBase + { + private int _reg = 0xFF; + + private int _prgMask32k; + private int _wramPage; + + public override bool Configure(NES.EDetectionOrigin origin) + { + switch (Cart.board_type) + { + case "UNIF_BMC-GS-2004": + break; + default: + return false; + } + + + _prgMask32k = (Cart.prg_size - 8) / 32 - 1; + + // Last 8k of Prg goes into 6000-7FFF + _wramPage = ((Cart.prg_size - 8) / 32) * 0x8000; + + SetMirrorType(EMirrorType.Vertical); + + return true; + } + + public override void NESSoftReset() + { + _reg = 0xFF; + base.NESSoftReset(); + } + + public override void SyncState(Serializer ser) + { + base.SyncState(ser); + ser.Sync("reg", ref _reg); + + } + + public override void WritePRG(int addr, byte value) + { + _reg = value; + } + + public override byte ReadWRAM(int addr) + { + return ROM[_wramPage + (addr & 0x1FFF)]; + } + + public override byte ReadPRG(int addr) + { + return ROM[((_reg & _prgMask32k) * 0x8000) + (addr & 0x7FFF)]; + } + } +}