From f10b51558bf63b351aebccde30e75bb55a0bed2e Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 18 Mar 2020 15:58:53 -0500 Subject: [PATCH] Atari 2600 - make MapperBase abstract and make HardReset() abstract since we need implementations to properly reset variables (we can't get rid of hard reset so easily, since HardReset is the mechanism that multi-cart roms use --- .../Consoles/Atari/2600/Mappers/MapperBase.cs | 10 ++++------ .../Consoles/Atari/2600/Mappers/m0840.cs | 1 - .../Consoles/Atari/2600/Mappers/m2K.cs | 2 ++ .../Consoles/Atari/2600/Mappers/m3E.cs | 1 - .../Consoles/Atari/2600/Mappers/m3F.cs | 1 - .../Consoles/Atari/2600/Mappers/m4A50.cs | 2 -- .../Consoles/Atari/2600/Mappers/m4K.cs | 2 ++ .../Consoles/Atari/2600/Mappers/mAR.cs | 1 - .../Consoles/Atari/2600/Mappers/mCM.cs | 2 -- .../Consoles/Atari/2600/Mappers/mCV.cs | 1 - .../Consoles/Atari/2600/Mappers/mDPC.cs | 2 -- .../Consoles/Atari/2600/Mappers/mDPCPlus.cs | 2 -- .../Consoles/Atari/2600/Mappers/mE0.cs | 1 - .../Consoles/Atari/2600/Mappers/mE7.cs | 1 - .../Consoles/Atari/2600/Mappers/mEF.cs | 1 - .../Consoles/Atari/2600/Mappers/mEFSC.cs | 1 - .../Consoles/Atari/2600/Mappers/mF0.cs | 1 - .../Consoles/Atari/2600/Mappers/mF4.cs | 1 - .../Consoles/Atari/2600/Mappers/mF4SC.cs | 1 - .../Consoles/Atari/2600/Mappers/mF6.cs | 1 - .../Consoles/Atari/2600/Mappers/mF6SC.cs | 1 - .../Consoles/Atari/2600/Mappers/mF8.cs | 1 - .../Consoles/Atari/2600/Mappers/mF8SC.cs | 1 - .../Consoles/Atari/2600/Mappers/mF8_sega.cs | 1 - .../Consoles/Atari/2600/Mappers/mFA.cs | 1 - .../Consoles/Atari/2600/Mappers/mFA2.cs | 1 - .../Consoles/Atari/2600/Mappers/mFE.cs | 2 ++ .../Consoles/Atari/2600/Mappers/mMC.cs | 2 ++ .../Consoles/Atari/2600/Mappers/mSB.cs | 1 - .../Consoles/Atari/2600/Mappers/mUA.cs | 1 - .../Consoles/Atari/2600/Mappers/mX07.cs | 1 - 31 files changed, 12 insertions(+), 36 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs index a91421c1a8..31d33a1796 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs @@ -2,9 +2,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { - public class MapperBase + public abstract class MapperBase { - public MapperBase(Atari2600 core) + protected MapperBase(Atari2600 core) { Core = core; } @@ -33,11 +33,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { } - public virtual void HardReset() - { - } + public abstract void HardReset(); // This is here purely for mapper 3E because it needs the 13th bit to determine bankswitching (but only receives the first 12 on read memory) - public bool Bit13 { get; set; } + public bool Bit13 { protected get; set; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m0840.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m0840.cs index 550865003c..911571cf3a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m0840.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m0840.cs @@ -38,7 +38,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _bank4K = 0; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m2K.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m2K.cs index 701f8a595b..8ca78082bf 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m2K.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m2K.cs @@ -6,6 +6,8 @@ { } + public override void HardReset() { } + public override byte ReadMemory(ushort addr) { if (addr < 0x1000) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs index 500b6ad8da..91c607693c 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs @@ -48,7 +48,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _ramBank1K = 0; _hasRam = false; _ram = new byte[256 * 1024]; - base.HardReset(); } public override byte ReadMemory(ushort addr) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3F.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3F.cs index c0f45d8f6e..fdd0b71877 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3F.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3F.cs @@ -37,7 +37,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _lowBank2K = 0; - base.HardReset(); } public override byte ReadMemory(ushort addr) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs index 588a6a1872..893af99e73 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs @@ -126,8 +126,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _sliceHigh = 0; _sliceLow = 0; _sliceMiddle = 0; - - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4K.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4K.cs index feba337201..79d84e95c7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4K.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4K.cs @@ -6,6 +6,8 @@ { } + public override void HardReset() { } + public override byte ReadMemory(ushort addr) { if (addr < 0x1000) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs index adaf632f60..a5cc6a1220 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs @@ -155,7 +155,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _elapsedCycles = 0; InitializeSettings(); - base.HardReset(); } public override void SyncState(Serializer ser) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs index b1d00be36f..69da53896a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs @@ -203,8 +203,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _column = 0; _funcKey = false; _shiftKey = false; - - base.HardReset(); } public override void SyncState(Serializer ser) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs index 58758aab82..2466d9e0ff 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs @@ -34,7 +34,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _ram = new byte[1024]; - base.HardReset(); } public override byte ReadMemory(ushort addr) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPC.cs index f87f2df574..caa76d2bc7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPC.cs @@ -276,8 +276,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _currentRandomVal = 0; _elapsedCycles = 85; _fractionalClocks = 0; - - base.HardReset(); } public override void ClockCpu() diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs index ccae489c7e..404b839909 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs @@ -65,8 +65,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _currentRandomVal = 0; _elapsedCycles = 85; _fractionalClocks = 0; - - base.HardReset(); } public override void ClockCpu() diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE0.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE0.cs index 6992aa7589..65f4253e2e 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE0.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE0.cs @@ -45,7 +45,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _toggle1 = 0; _toggle2 = 0; _toggle3 = 0; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs index 906d1b5a78..d330a17f53 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs @@ -54,7 +54,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _ramBank1Toggle = 0; _ram = new byte[2048]; _enableRam0 = false; - base.HardReset(); } public override byte[] CartRam => _ram; diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEF.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEF.cs index d66b94c7cd..0ee978669b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEF.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEF.cs @@ -28,7 +28,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _toggle = 0; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs index 9e70a0e51b..4392a6f498 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs @@ -29,7 +29,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { _bank4K = 0; _ram = new byte[128]; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF0.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF0.cs index 353ba8bc9f..c6ba498933 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF0.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF0.cs @@ -34,7 +34,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _bank = 0; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4.cs index c154a7247d..e0e331ca68 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4.cs @@ -26,7 +26,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _toggle = 0; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs index 34c6a3925c..901138966e 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs @@ -28,7 +28,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { _bank4K = 0; _ram = new byte[128]; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6.cs index 05b81511dd..52b85c1ed6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6.cs @@ -28,7 +28,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _toggle = 0; - base.HardReset(); } private byte ReadMem(ushort addr, bool peek) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs index 350962aded..241262d64a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs @@ -28,7 +28,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { _bank4K = 0; _ram = new byte[128]; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8.cs index c8f1d4857a..685729d644 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8.cs @@ -36,7 +36,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _bank4K = 0; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs index 027281422f..fde5cdef98 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs @@ -21,7 +21,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { _bank4K = 0; _ram = new byte[128]; - base.HardReset(); } public override void SyncState(Serializer ser) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8_sega.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8_sega.cs index 7dbef6bf9a..f71e1b5ac0 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8_sega.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8_sega.cs @@ -25,7 +25,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _bank4K = 1; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA.cs index 58be409c31..5b86509b80 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA.cs @@ -35,7 +35,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { _toggle = 0; _ram = new byte[256]; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs index 7dfe123ffe..c2b57bf373 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs @@ -30,7 +30,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { _bank4K = 0; _ram = new byte[256]; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFE.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFE.cs index 2889b2de74..6e30d4aa36 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFE.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFE.cs @@ -60,6 +60,8 @@ { } + public override void HardReset() { } + public override byte ReadMemory(ushort addr) { if (addr < 0x1000) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mMC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mMC.cs index 38990a988e..8e41a87571 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mMC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mMC.cs @@ -64,5 +64,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { throw new NotImplementedException(); } + + public override void HardReset() { } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mSB.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mSB.cs index 6122f3a6b7..0d708b95c1 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mSB.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mSB.cs @@ -25,7 +25,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _bank4K = 0; - base.HardReset(); } public override byte ReadMemory(ushort addr) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mUA.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mUA.cs index a97df758e8..80551ba397 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mUA.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mUA.cs @@ -28,7 +28,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _toggle = 0; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mX07.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mX07.cs index ac9b55d63e..75c8769025 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mX07.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mX07.cs @@ -50,7 +50,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void HardReset() { _romBank2K = 0; - base.HardReset(); } public override byte ReadMemory(ushort addr) => ReadMem(addr, false);