From 296458540104422538cf5d1def5e5a3ce5460128 Mon Sep 17 00:00:00 2001 From: adelikat Date: Mon, 24 Apr 2017 10:09:17 -0500 Subject: [PATCH] misc code cleanups in Atari 2600 --- .../Consoles/Atari/2600/Atari2600.cs | 16 ++-- .../Consoles/Atari/2600/M6532.cs | 18 ++-- .../Consoles/Atari/2600/Mappers/MapperBase.cs | 26 +++--- .../Atari/2600/Mappers/Multicart2K.cs | 3 +- .../Atari/2600/Mappers/Multicart4K.cs | 3 +- .../Atari/2600/Mappers/Multicart8K.cs | 3 +- .../Consoles/Atari/2600/Mappers/m3E.cs | 10 +-- .../Consoles/Atari/2600/Mappers/m4A50.cs | 26 +++--- .../Consoles/Atari/2600/Mappers/mAR.cs | 59 ++++++------- .../Consoles/Atari/2600/Mappers/mCM.cs | 82 ++++++++---------- .../Consoles/Atari/2600/Mappers/mCV.cs | 15 +--- .../Consoles/Atari/2600/Mappers/mDPC.cs | 16 ++-- .../Consoles/Atari/2600/Mappers/mDPCPlus.cs | 8 +- .../Consoles/Atari/2600/Mappers/mE7.cs | 13 +-- .../Consoles/Atari/2600/Mappers/mEFSC.cs | 10 +-- .../Consoles/Atari/2600/Mappers/mF4SC.cs | 13 +-- .../Consoles/Atari/2600/Mappers/mF6SC.cs | 10 +-- .../Consoles/Atari/2600/Mappers/mF8SC.cs | 10 +-- .../Consoles/Atari/2600/Mappers/mF8_sega.cs | 2 +- .../Consoles/Atari/2600/Mappers/mFA2.cs | 10 +-- .../Consoles/Atari/2600/Mappers/mFE.cs | 4 +- .../Consoles/Atari/2600/Mappers/mSB.cs | 6 +- .../Consoles/Atari/2600/Tia/TIA.cs | 83 ++++--------------- .../Consoles/Atari/2600/Tia/Tia.MissleData.cs | 21 +++-- .../Consoles/Atari/2600/Tia/Tia.PlayerData.cs | 15 ++-- BizHawk.sln.DotSettings | 1 + 26 files changed, 177 insertions(+), 306 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs index 03df0d3511..9ad5c67b1a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs @@ -11,8 +11,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 "Atari2600Hawk", "Micro500, adelikat, natt", isPorted: false, - isReleased: true - )] + isReleased: true)] [ServiceNotApplicable(typeof(ISaveRam), typeof(IDriveLight))] public partial class Atari2600 : IEmulator, IStatable, IDebuggable, IInputPollable, IRegionable, ICreateGameDBEntries, ISettable @@ -64,18 +63,15 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 ser.Register(_dcfilter); } - public IEmulatorServiceProvider ServiceProvider { get; private set; } + public IEmulatorServiceProvider ServiceProvider { get; } - public DisplayType Region - { - get { return _pal ? DisplayType.PAL : Common.DisplayType.NTSC; } - } + public DisplayType Region => _pal ? DisplayType.PAL : DisplayType.NTSC; public string SystemId => "A26"; public string BoardName => _mapper.GetType().Name; - public CoreComm CoreComm { get; private set; } + public CoreComm CoreComm { get; } public ControllerDefinition ControllerDefinition { get { return Atari2600ControllerDefinition; } } @@ -117,7 +113,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _islag = false; } - public void Dispose() { } + public void Dispose() + { + } private static bool DetectPal(GameInfo game, byte[] rom) { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/M6532.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/M6532.cs index 198285cf61..8d1393d4a6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/M6532.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/M6532.cs @@ -7,9 +7,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { private readonly Atari2600 _core; - public byte DDRa = 0x00; - public byte DDRb = 0x00; - public byte outputA = 0x00; + private byte DDRa = 0x00; + private byte DDRb = 0x00; + private byte outputA = 0x00; public TimerData Timer; @@ -79,12 +79,13 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 return Timer.Value; } + // TODO: fix this to match real behaviour // This is an undocumented instruction whose behaviour is more dynamic then indicated here if ((registerAddr & 0x5) == 0x5) { // Read interrupt flag - if (Timer.InterruptFlag) //Timer.InterruptEnabled && ) + if (Timer.InterruptFlag) // Timer.InterruptEnabled && ) { return 0xC0; } @@ -118,7 +119,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // Write to Timer/1 Timer.PrescalerShift = 0; Timer.Value = value; - Timer.PrescalerCount = 0;// 1 << Timer.PrescalerShift; + Timer.PrescalerCount = 0; // 1 << Timer.PrescalerShift; Timer.InterruptFlag = false; } else if (registerAddr == 0x05) @@ -126,7 +127,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // Write to Timer/8 Timer.PrescalerShift = 3; Timer.Value = value; - Timer.PrescalerCount = 0;// 1 << Timer.PrescalerShift; + Timer.PrescalerCount = 0; // 1 << Timer.PrescalerShift; Timer.InterruptFlag = false; } else if (registerAddr == 0x06) @@ -134,7 +135,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // Write to Timer/64 Timer.PrescalerShift = 6; Timer.Value = value; - Timer.PrescalerCount = 0;// 1 << Timer.PrescalerShift; + Timer.PrescalerCount = 0; // 1 << Timer.PrescalerShift; Timer.InterruptFlag = false; } else if (registerAddr == 0x07) @@ -142,7 +143,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // Write to Timer/1024 Timer.PrescalerShift = 10; Timer.Value = value; - Timer.PrescalerCount = 0;// 1 << Timer.PrescalerShift; + Timer.PrescalerCount = 0; // 1 << Timer.PrescalerShift; Timer.InterruptFlag = false; } } @@ -224,7 +225,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 ser.Sync("interruptEnabled", ref InterruptEnabled); ser.Sync("interruptFlag", ref InterruptFlag); } - } } } \ No newline at end of file diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs index bfd2820af8..efb239607b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/MapperBase.cs @@ -6,15 +6,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { public Atari2600 Core { get; set; } - public virtual bool HasCartRam - { - get { return false; } - } + public virtual bool HasCartRam => false; - public virtual ByteBuffer CartRam - { - get { return new ByteBuffer(0); } - } + public virtual ByteBuffer CartRam => new ByteBuffer(0); public virtual byte ReadMemory(ushort addr) { @@ -36,13 +30,21 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 Core.BasePokeMemory(addr, value); } - public virtual void SyncState(Serializer ser) { } + public virtual void SyncState(Serializer ser) + { + } - public virtual void Dispose() { } + public virtual void Dispose() + { + } - public virtual void ClockCpu() { } + public virtual void ClockCpu() + { + } - public virtual void HardReset() { } + public virtual 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; } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart2K.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart2K.cs index 1f742d0df9..d0da83d7d7 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart2K.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart2K.cs @@ -1,5 +1,4 @@ -using System.Linq; -using BizHawk.Common; +using BizHawk.Common; namespace BizHawk.Emulation.Cores.Atari.Atari2600 { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart4K.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart4K.cs index 07631d053d..84a71c5336 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart4K.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart4K.cs @@ -1,5 +1,4 @@ -using System.Linq; -using BizHawk.Common; +using BizHawk.Common; namespace BizHawk.Emulation.Cores.Atari.Atari2600 { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart8K.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart8K.cs index 69f948e301..390ccefdcb 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart8K.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/Multicart8K.cs @@ -1,5 +1,4 @@ -using System.Linq; -using BizHawk.Common; +using BizHawk.Common; namespace BizHawk.Emulation.Cores.Atari.Atari2600 { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs index db3a8ac93a..81287f70a2 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m3E.cs @@ -27,15 +27,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private bool _hasRam; private ByteBuffer _ram = new ByteBuffer(256 * 1024); // Up to 256k - public override bool HasCartRam - { - get { return true; } - } + public override bool HasCartRam => true; - public override ByteBuffer CartRam - { - get { return _ram; } - } + public override ByteBuffer CartRam => _ram; public override void SyncState(Serializer ser) { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs index bd3bc8f96a..538e8ce427 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/m4A50.cs @@ -56,7 +56,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private int _sliceLow; private int _sliceMiddle; - private byte[] _romImage = null; + private byte[] _romImage; private byte[] RomImage { get @@ -67,14 +67,14 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // Supported file sizes are 32/64/128K, which are duplicated if necessary _romImage = new byte[131072]; - if(Core.Rom.Length < 65536) + if (Core.Rom.Length < 65536) { for (int i = 0; i < 4; i++) { Array.Copy(Core.Rom, 0, _romImage, 32768 * i, 32768); } } - else if(Core.Rom.Length < 131072) + else if (Core.Rom.Length < 131072) { for (int i = 0; i < 2; i++) { @@ -87,15 +87,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 } } - public override bool HasCartRam - { - get { return true; } - } + public override bool HasCartRam => true; - public override ByteBuffer CartRam - { - get { return _ram; } - } + public override ByteBuffer CartRam => _ram; public override void Dispose() { @@ -121,7 +115,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 base.SyncState(ser); } - public override void HardReset() { _ram = new ByteBuffer(32768); @@ -169,18 +162,20 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 else if (addr < 0x2000) // 256B region from 0x1f00 - 0x1fff { val = RomImage[(addr & 0xff) + (RomImage.Length - 256)]; - if (((_lastData & 0xe0) == 0x60) && ((_lastAddress >= 0x1000) || - (_lastAddress < 0x200)) && !peek) + if ((_lastData & 0xe0) == 0x60 && (_lastAddress >= 0x1000 || + _lastAddress < 0x200) && !peek) { _sliceHigh = (_sliceHigh & 0xf0ff) | ((addr & 0x8) << 8) | ((addr & 0x70) << 4); } } + if (!peek) { _lastData = val; _lastAddress = (ushort)(addr & 0x1fff); } + return val; } @@ -228,7 +223,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 else if (addr < 0x2000 && !poke) // 256B region at 0x1f00 - 0x1fff { if (((_lastData & 0xe0) == 0x60) && - ((_lastAddress >= 0x1000) || (_lastAddress < 0x200)) && !poke) + (_lastAddress >= 0x1000 || (_lastAddress < 0x200)) && !poke) { _sliceHigh = (_sliceHigh & 0xf0ff) | ((addr & 0x8) << 8) | ((addr & 0x70) << 4); @@ -304,6 +299,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _sliceMiddle = _sliceMiddle ^ 0x1000; } } + // Zero-page hotspots for upper page // 0xf4, 0xf6, 0xfc, 0xfe for ROM // 0xf5, 0xf7, 0xfd, 0xff for RAM diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs index 81c0eeba24..6ea2096c01 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mAR.cs @@ -1,8 +1,6 @@ using System; -using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Text; + using BizHawk.Common; /** This is the cartridge class for Arcadia (aka Starpath) Supercharger @@ -43,9 +41,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private ByteBuffer _superChargerImage = new ByteBuffer(8192); private IntBuffer _imageOffsets = new IntBuffer(2); - private bool _writePending = false; - private int _distinctAccesses = 0; - private bool _writeEnabled = false; + private bool _writePending; + private int _distinctAccesses; + private bool _writeEnabled; private byte _dataHoldRegister; private byte _numberOfLoadImages; private ByteBuffer _loadedImages; @@ -60,7 +58,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // TODO: clean this stuff up /*****************************************/ int size = Core.Rom.Length; - _size = Core.Rom.Length < 8448 ? 8448 : Core.Rom.Length; //8448 or Rom size, whichever is bigger + _size = Core.Rom.Length < 8448 ? 8448 : Core.Rom.Length; // 8448 or Rom size, whichever is bigger _numberOfLoadImages = (byte)(_size / 8448); @@ -75,9 +73,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { for (int i = size; i < _size; i++) { - _loadedImages[i] = DefaultHeader[i]; + _loadedImages[i] = _defaultHeader[i]; } } + /*****************************************/ InitializeRom(); @@ -86,7 +85,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 #region SuperCharger Data - private readonly byte[] DummyRomCode = { + private readonly byte[] _dummyRomCode = + { 0xa5, 0xfa, 0x85, 0x80, 0x4c, 0x18, 0xf8, 0xff, 0xff, 0xff, 0x78, 0xd8, 0xa0, 0x00, 0xa2, 0x00, 0x94, 0x00, 0xe8, 0xd0, 0xfb, 0x4c, 0x50, 0xf8, @@ -126,7 +126,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 0xfa, 0x00, 0xcd, 0xf8, 0xff, 0x4c }; - private readonly byte[] DefaultHeader = { + private readonly byte[] _defaultHeader = + { 0xac, 0xfa, 0x0f, 0x18, 0x62, 0x00, 0x24, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c, @@ -163,15 +164,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 #endregion - public override bool HasCartRam - { - get { return true; } - } + public override bool HasCartRam => true; - public override ByteBuffer CartRam - { - get { return _superChargerImage; } - } + public override ByteBuffer CartRam => _superChargerImage; public override void HardReset() { @@ -235,18 +230,26 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private byte ReadMem(ushort addr, bool peek) { - if (addr < 0x1000) { if (peek) { return base.PeekMemory(addr); } else { return base.ReadMemory(addr); } } + if (addr < 0x1000) + { + if (peek) + { + return base.PeekMemory(addr); + } + + return base.ReadMemory(addr); + } /*---------------------------*/ - if (addr == 0x1850 && _imageOffsets[1] == (3 << 11)) + if (addr == 0x1850 && _imageOffsets[1] == 3 << 11) { LoadIntoRam(Core.MemoryDomains["System Bus"].PeekByte(0x80)); // Get load that's being accessed (BIOS places load number at 0x80) // TODO: a better way to do this return _superChargerImage[(addr & 0x7FF) + _imageOffsets[1]]; } - if (_writePending && // Cancel any pending write if more than 5 distinct accesses have occurred // TODO: Modify to handle when the distinct counter wraps around... - (Core.DistinctAccessCount > _distinctAccesses + 5)) + if (_writePending // Cancel any pending write if more than 5 distinct accesses have occurred // TODO: Modify to handle when the distinct counter wraps around... + && Core.DistinctAccessCount > _distinctAccesses + 5) { _writePending = false; } @@ -263,10 +266,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { _writePending = false; BankConfiguration(_dataHoldRegister); - } else if (_writeEnabled && _writePending && - Core.DistinctAccessCount == (_distinctAccesses + 5)) + Core.DistinctAccessCount == _distinctAccesses + 5) { if ((addr & 0x800) == 0) { @@ -315,6 +317,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _distinctAccesses = Core.DistinctAccessCount; _writePending = true; } + // Is the bank configuration hotspot being accessed? else if (!poke && (addr & 0x1FFF) == 0x1FF8) { @@ -362,10 +365,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // The scrom.asm code checks a value at offset 109 as follows: // 0xFF -> do a complete jump over the SC BIOS progress bars code // 0x00 -> show SC BIOS progress bars as normal - DummyRomCode[109] = (byte)(Core.SyncSettings.FastScBios ? 0xFF : 0x00); + _dummyRomCode[109] = (byte)(Core.SyncSettings.FastScBios ? 0xFF : 0x00); // Stella does this, but randomness is bad for determinacy! Hopefully we don't really need it - //ourDummyROMCode[281] = mySystem->randGenerator().next(); + // ourDummyROMCode[281] = mySystem->randGenerator().next(); // Initialize ROM with illegal 6502 opcode that causes a real 6502 to jam for (int i = 0; i < 2048; i++) @@ -374,9 +377,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 } // Copy the "dummy" Supercharger BIOS code into the ROM area - for (int i = 0; i < DummyRomCode.Length; i++) + for (int i = 0; i < _dummyRomCode.Length; i++) { - _superChargerImage[(3 << 11) + i] = DummyRomCode[i]; + _superChargerImage[(3 << 11) + i] = _dummyRomCode[i]; } // Finally set 6502 vectors to point to initial load code at 0xF80A of BIOS diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs index e4005b6eab..f259cf0deb 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCM.cs @@ -1,6 +1,5 @@ using BizHawk.Common; using BizHawk.Common.NumberExtensions; -using System; namespace BizHawk.Emulation.Cores.Atari.Atari2600 { @@ -182,10 +181,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private ByteBuffer _ram = new ByteBuffer(2048); private int _bank4K = 3; // On Start up, controller port is all 1's, so start on the last bank, flags enabled private bool _disableRam = true; - private bool _writeMode = false; - private int _column = 0; - public bool _func_key = false; - public bool _shift_key = false; + private bool _writeMode; + private int _column; + private bool _funcKey; + private bool _shiftKey; public override void Dispose() { @@ -200,74 +199,67 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _disableRam = true; _writeMode = true; _column = 0; - _func_key = false; - _shift_key = false; + _funcKey = false; + _shiftKey = false; base.HardReset(); } public override void SyncState(Serializer ser) { - // TODO ser.Sync("cartRam", ref _ram); ser.Sync("bank4k", ref _bank4K); ser.Sync("column", ref _column); ser.Sync("disableRam", ref _disableRam); ser.Sync("writeMode", ref _writeMode); - ser.Sync("FuncKey", ref _func_key); - ser.Sync("ShiftKey", ref _shift_key); + ser.Sync("FuncKey", ref _funcKey); + ser.Sync("ShiftKey", ref _shiftKey); base.SyncState(ser); } private byte ReadMem(ushort addr, bool peek) { - // A unique feature of the keyboard is that it changes the operation of inputs 0-3 // by holding them high in the no-button-pressed state. // However exposing this behaviour to the rest of the system would be overly cunmbersome // so instead we bypass these cases here - - - if ((addr & 0x000F) == 8 && (addr & 0x1080)==0 && addr<1000) + if ((addr & 0x000F) == 8 && (addr & 0x1080) == 0 && addr < 1000) { // if func key pressed - if (_func_key == true) + if (_funcKey) { return 0x80; } - else - { - return 0; - } + return 0; } - else if ((addr & 0x000F) == 9 && (addr & 0x1080) == 0 && addr < 1000) + + if ((addr & 0x000F) == 9 && (addr & 0x1080) == 0 && addr < 1000) { return 0x80; } - else if ((addr & 0x000F) == 0xA && (addr & 0x1080) == 0 && addr < 1000) + + if ((addr & 0x000F) == 0xA && (addr & 0x1080) == 0 && addr < 1000) { return 0x80; } - else if ((addr & 0x000F) == 0xB && (addr & 0x1080) == 0 && addr < 1000) + + if ((addr & 0x000F) == 0xB && (addr & 0x1080) == 0 && addr < 1000) { // if shift key pressed - if (_shift_key == true) + if (_shiftKey) { return 0x80; } - else - { - return 0; - } + + return 0; } - else if (addr < 0x1000) + + if (addr < 0x1000) { return base.ReadMemory(addr); } - - // Lower 2K is always the first 2K of the ROM bank // Upper 2K is also Rom if ram is enabled @@ -298,19 +290,17 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private void WriteMem(ushort addr, byte value, bool poke) { - //Mimicking the 6532 logic for accesing port A, for testing + // Mimicking the 6532 logic for accesing port A, for testing var isPortA = false; if ((addr & 0x0200) == 0) // If the RS bit is not set, this is a ram write { - } else { // If bit 0x0010 is set, and bit 0x0004 is set, this is a timer write if ((addr & 0x0014) == 0x0014) { - } // If bit 0x0004 is not set, bit 0x0010 is ignored and @@ -321,7 +311,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 if (registerAddr == 0x00) { - if (addr != 640 && addr>=0x280) // register addresses are only above 0x280 + if (addr != 640 && addr >= 0x280) // register addresses are only above 0x280 { // Write Output reg A isPortA = true; @@ -330,24 +320,23 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 } } - - if (addr == 0x280 && !poke) //Stella uses only 280 - //if (isPortA && !poke) + if (addr == 0x280 && !poke) // Stella uses only 280 + ////if (isPortA && !poke) { var bit5 = value.Bit(5); var bit4 = value.Bit(4); - //D5 RAM direction. (high = write, low = read) - //0 -> enable RAM writing (if D4 = 1) - //D4 = RAM enable: 1 = disable RAM, 0 = enable RAM + // D5 RAM direction. (high = write, low = read) + // 0 -> enable RAM writing (if D4 = 1) + // D4 = RAM enable: 1 = disable RAM, 0 = enable RAM _disableRam = bit4; - //_writeMode = bit5 || bit4; // ?? Am I interpretting this correctly? + _writeMode = (value & 0x30) == 0x20; _bank4K = value & 0x03; - //D6 = 1 -> increase key column (0 to 9) - //D5 = 1 -> reset key column to 0 (if D4 = 0) + // D6 = 1 -> increase key column (0 to 9) + // D5 = 1 -> reset key column to 0 (if D4 = 0) if (bit5 && !bit4) { _column = 0; @@ -366,15 +355,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _ram[addr & 0x7FF] = value; } } - if (addr<0x1000) { + + if (addr < 0x1000) + { base.WriteMemory(addr, value); } - } public override void WriteMemory(ushort addr, byte value) { - WriteMem(addr, value, false); + WriteMem(addr, value, false); } public override void PokeMemory(ushort addr, byte value) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs index ee312005b9..b60b939710 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs @@ -15,20 +15,13 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 Example games: Magicard */ - - internal class mCV: MapperBase + internal class mCV : MapperBase { private ByteBuffer _ram = new ByteBuffer(1024); - public override bool HasCartRam - { - get { return true; } - } + public override bool HasCartRam => true; - public override ByteBuffer CartRam - { - get { return _ram; } - } + public override ByteBuffer CartRam => _ram; public override void SyncState(Serializer ser) { @@ -44,8 +37,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public override void Dispose() { - base.Dispose(); _ram.Dispose(); + base.Dispose(); } 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 f3e0319096..106f6c82b6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPC.cs @@ -225,6 +225,10 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 */ internal class mDPC : MapperBase { + // Table for computing the input bit of the random number generator's + // shift register (it's the NOT of the EOR of four bits) + private readonly byte[] _randomInputBits = { 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1 }; + private IntBuffer _counters = new IntBuffer(8); private ByteBuffer _tops = new ByteBuffer(8); private ByteBuffer _flags = new ByteBuffer(8); @@ -237,17 +241,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private float _fractionalClocks; // Fractional DPC music OSC clocks unused during the last update private byte[] _dspData; - public byte[] DspData - { - get - { - return _dspData ?? (_dspData = Core.Rom.Skip(8192).Take(2048).ToArray()); - } - } - - // Table for computing the input bit of the random number generator's - // shift register (it's the NOT of the EOR of four bits) - private readonly byte[] _randomInputBits = { 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1 }; + public byte[] DspData => _dspData ?? (_dspData = Core.Rom.Skip(8192).Take(2048).ToArray()); public override void Dispose() { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs index 799f9e99d0..4bfdfe1879 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mDPCPlus.cs @@ -29,13 +29,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private float _fractionalClocks; // Fractional DPC music OSC clocks unused during the last update private byte[] _dspData; - public byte[] DspData - { - get - { - return _dspData ?? (_dspData = Core.Rom.Skip(8192).Take(2048).ToArray()); - } - } + public byte[] DspData => _dspData ?? (_dspData = Core.Rom.Skip(8192).Take(2048).ToArray()); // Table for computing the input bit of the random number generator's // shift register (it's the NOT of the EOR of four bits) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs index 3fb8f14703..82799d4f51 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mE7.cs @@ -60,15 +60,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _ram.Dispose(); } - public override bool HasCartRam - { - get { return true; } - } + public override bool HasCartRam => true; - public override ByteBuffer CartRam - { - get { return _ram; } - } + public override ByteBuffer CartRam => _ram; private byte ReadMem(ushort addr, bool peek) { @@ -100,12 +94,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 if (addr < 0x1900) // Ram 1 Write port { return _ram[RamBank1Offset + (_rambank1Toggle * 0x100) + (addr & 0xFF)] = 0xFF; // Reading from the 256b write port @1800 riggers an unwanted write - } if (addr < 0x1A00) // Ram 1 Read port { - return _ram[(RamBank1Offset + _rambank1Toggle * 0x100) + (addr & 0xFF)]; + return _ram[RamBank1Offset + (_rambank1Toggle * 0x100) + (addr & 0xFF)]; } if (addr < 0x2000) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs index 6e6fbe7355..a8ad9c5b07 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mEFSC.cs @@ -12,15 +12,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private int _bank4k; private ByteBuffer _ram = new ByteBuffer(128); - public override bool HasCartRam - { - get { return true; } - } + public override bool HasCartRam => true; - public override ByteBuffer CartRam - { - get { return _ram; } - } + public override ByteBuffer CartRam => _ram; public override void SyncState(Serializer ser) { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs index 1c7928ffe8..624631384d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF4SC.cs @@ -11,15 +11,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private int _bank4k; private ByteBuffer _ram = new ByteBuffer(128); - public override bool HasCartRam - { - get { return true; } - } + public override bool HasCartRam => true; - public override ByteBuffer CartRam - { - get { return _ram; } - } + public override ByteBuffer CartRam => _ram; public override void SyncState(Serializer ser) { @@ -58,7 +52,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _ram[(addr & 0x7F)] = 0xFF; // Reading from the write port triggers an unwanted write of open bus return 0xFF; // 0xFF is used for deterministic emulation, in reality it would be a random value based on pins being high or low } - else if (addr < 0x1100) + + if (addr < 0x1100) { return _ram[(addr & 0x7F)]; } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs index 666971f2c0..caa6eaf579 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF6SC.cs @@ -11,15 +11,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private int _bank4k; private ByteBuffer _ram = new ByteBuffer(128); - public override bool HasCartRam - { - get { return true; } - } + public override bool HasCartRam => true; - public override ByteBuffer CartRam - { - get { return _ram; } - } + public override ByteBuffer CartRam => _ram; public override void SyncState(Serializer ser) { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs index 7d2bb4ed49..2e67d62d76 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8SC.cs @@ -11,15 +11,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private int _bank_4K; private ByteBuffer _ram = new ByteBuffer(128); - public override bool HasCartRam - { - get { return true; } - } + public override bool HasCartRam => true; - public override ByteBuffer CartRam - { - get { return _ram; } - } + public override ByteBuffer CartRam => _ram; public override void HardReset() { 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 f26cf9ff62..50dc0c866b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8_sega.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mF8_sega.cs @@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 internal class mF8_sega : MapperBase { - private int _bank4K=1; + private int _bank4K = 1; public override void SyncState(Serializer ser) { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs index 8022f94a32..56015e293d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFA2.cs @@ -13,15 +13,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 private int _bank4k; private ByteBuffer _ram = new ByteBuffer(256); - public override bool HasCartRam - { - get { return true; } - } + public override bool HasCartRam => true; - public override ByteBuffer CartRam - { - get { return _ram; } - } + public override ByteBuffer CartRam => _ram; public override void SyncState(Serializer ser) { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFE.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFE.cs index 715fdfaadd..cca8c8983d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFE.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mFE.cs @@ -1,6 +1,4 @@ -using BizHawk.Common; - -namespace BizHawk.Emulation.Cores.Atari.Atari2600 +namespace BizHawk.Emulation.Cores.Atari.Atari2600 { /* FE (Activision special) diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mSB.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mSB.cs index 3c25e593dc..f978fb10b6 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mSB.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mSB.cs @@ -9,10 +9,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 internal class mSB : MapperBase { private int _bank4K; - private int myStartBank - { - get { return (Core.Rom.Length >> 12) - 1; } - } + private int myStartBank => (Core.Rom.Length >> 12) - 1; + public override void SyncState(Serializer ser) { base.SyncState(ser); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/TIA.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/TIA.cs index 803aff1a52..0e13a61709 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/TIA.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/TIA.cs @@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 #region palette - const int BackColor = unchecked((int)0xff000000); + private const int BackColor = unchecked((int)0xff000000); static TIA() { @@ -230,22 +230,15 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // in all cases, the TIA has 228 clocks per scanline // the NTSC TIA has a clock rate of 3579575hz // the PAL/SECAM TIA has a clock rate of 3546894hz - private bool _pal; - public int NominalNumScanlines - { - get - { - return _pal ? 312 : 262; - } - } + public int NominalNumScanlines => _pal ? 312 : 262; public void GetFrameRate(out int num, out int den) { // TODO when sound timing is made exact: // NTSC refclock is actually 315 / 88 mhz - //3546895 + // 3546895 int clockrate = _pal ? 3546895 : 3579545; int clocksperframe = 228 * NominalNumScanlines; @@ -347,20 +340,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _palette = _pal ? secam ? SECAMPalette : PALPalette : NTSCPalette; } - public int CurrentScanLine - { - get { return _CurrentScanLine; } - } + public int CurrentScanLine => _CurrentScanLine; - public bool IsVBlank - { - get { return _vblankEnabled; } - } + public bool IsVBlank => _vblankEnabled; - public bool IsVSync - { - get { return _vsyncEnabled; } - } + public bool IsVSync => _vsyncEnabled; /// /// a count of lines emulated; incremented by the TIA but not used by it @@ -382,19 +366,13 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 return 320; } - return 275; // 275 comes from NTSC specs and the actual pixel clock of a 2600 TIA + return 275; // 275 comes from NTSC specs and the actual pixel clock of a 2600 TIA } } - public int VirtualHeight - { - get { return BufferHeight; } - } + public int VirtualHeight => BufferHeight; - public int BufferWidth - { - get { return ScreenWidth; } - } + public int BufferWidth => ScreenWidth; public int BufferHeight { @@ -407,10 +385,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 } } - public int BackgroundColor - { - get { return _core.Settings.BackgroundColor.ToArgb(); } - } + public int BackgroundColor => _core.Settings.BackgroundColor.ToArgb(); public int[] GetVideoBuffer() { @@ -493,12 +468,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _vblankEnabled = (vblank_value & 0x02) != 0; vblank_delay = 0; } - } - - - //delay latch to new playfield register + // delay latch to new playfield register if (pf0_updater == true) { pf0_delay_clock++; @@ -527,7 +499,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 } } - //delay latch to missile enable + // delay latch to missile enable if (enam0_delay > 0) { enam0_delay++; @@ -536,7 +508,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 enam0_delay = 0; _player0.Missile.Enabled = enam0_val; } - } if (enam1_delay > 0) @@ -547,7 +518,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 enam1_delay = 0; _player1.Missile.Enabled = enam1_val; } - } // delay latch to ball enable @@ -559,7 +529,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 enamb_delay = 0; _ball.Enabled = enamb_val; } - } // delay latch to player graphics registers @@ -572,7 +541,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 _player0.Grp = prg0_val; _player1.Dgrp = _player1.Grp; } - } if (prg1_delay > 0) @@ -587,7 +555,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // TODO: Find a game that uses this functionality and test it _ball.Denabled = _ball.Enabled; } - } // HMP write delay @@ -615,7 +582,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 if (_hsyncCnt <= 0) { _core.Cpu.RDY = true; - } // Assume we're on the left side of the screen for now @@ -654,7 +620,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 collisions |= CXPF; } - // ---- Player 0 ---- collisions |= _player0.Tick() ? CXP0 : (byte)0x00; @@ -749,9 +714,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 if (_playField.Priority && (collisions & CXPF) != 0 && _core.Settings.ShowPlayfield) { - pixelColor = _palette[_playField.PfColor]; - } // Handle vblank @@ -799,18 +762,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 } } - - - - // Handle HMOVE if (_hmove.HMoveEnabled) { - if (_hmove.DecCntEnabled) { - - // Actually do stuff only evey 4 pulses if (_hmove.HMoveCnt == 0) { @@ -1032,7 +988,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 } } - // do the audio sampling if (_hsyncCnt == 36 || _hsyncCnt == 148) { @@ -1195,9 +1150,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 mask = 0x7f; } - //some bits of the databus will be undriven when a read call is made. Our goal here is to sort out what + // some bits of the databus will be undriven when a read call is made. Our goal here is to sort out what // happens to the undriven pins. Most of the time, they will be in whatever state they were when previously - //assigned in some other bus access, so let's go with that. + // assigned in some other bus access, so let's go with that. coll += (byte)(mask & bus_state); if (!peek) bus_state = (int)coll; @@ -1626,15 +1581,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 throw new NotSupportedException("Async is not available"); } - public bool CanProvideAsync - { - get { return false; } - } + public bool CanProvideAsync => false; - public SyncSoundMode SyncMode - { - get { return SyncSoundMode.Sync; } - } + public SyncSoundMode SyncMode => SyncSoundMode.Sync; public void SetSyncMode(SyncSoundMode mode) { diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.MissleData.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.MissleData.cs index 0a65d8201c..e5760f26e8 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.MissleData.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.MissleData.cs @@ -15,32 +15,31 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public byte Collisions; // Resp commands do not trigger start signals for main copies. We need to model this - public int Draw_To; - public byte ScanCnt; - public bool ScanCntInit; - public int Start_Signal; - public int Signal_Reached; + private int Draw_To; + private byte ScanCnt; + private bool ScanCntInit; + private int Start_Signal; + private int Signal_Reached; public bool Tick() { var result = false; - if (ScanCntInit==true) + if (ScanCntInit == true) { if (ScanCnt < (1 << Size) && Enabled && !ResetToPlayer) { result = true; ScanCnt++; - } else + } + else { ScanCntInit = false; } } - - /* // At hPosCnt == 0, start drawing the missile, if enabled if (HPosCnt < (1 << Size)) @@ -122,8 +121,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // Counter loops at 160 HPosCnt %= 160; - //our goal here is to send a start signal 4 clocks before drawing begins. The properly emulates - //drawing on a real TIA + // our goal here is to send a start signal 4 clocks before drawing begins. The properly emulates + // drawing on a real TIA if (HPosCnt == 156 || HPosCnt == 12 || HPosCnt == 28 || HPosCnt == 60) { Start_Signal = HPosCnt; diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.PlayerData.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.PlayerData.cs index 89f92aee84..67c59993da 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.PlayerData.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Tia/Tia.PlayerData.cs @@ -21,8 +21,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public byte Collisions; // Resp commands do not trigger start signals for main copies. We need to model this - public int Start_Signal; - public int Signal_Reached; + private int Start_Signal; + private int Signal_Reached; public bool Tick() { @@ -114,7 +114,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // At counter position 0 we should initalize the scan counter. // Note that for double and quad sized players that the scan counter is not started immediately. - if (Start_Signal==160) + if (Start_Signal == 160) { ScanCnt = 0; Start_Signal++; @@ -156,11 +156,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 // Counter loops at 160 HPosCnt %= 160; - //our goal here is to send a start signal 4 clocks before drawing begins. This properly emulates - //drawing on a real TIA - if (HPosCnt==156 || HPosCnt==12 || HPosCnt==28 || HPosCnt==60) + // our goal here is to send a start signal 4 clocks before drawing begins. This properly emulates + // drawing on a real TIA + if (HPosCnt == 156 || HPosCnt == 12 || HPosCnt == 28 || HPosCnt == 60) { - Start_Signal = HPosCnt-1; + Start_Signal = HPosCnt - 1; Signal_Reached = HPosCnt + 5; } @@ -168,6 +168,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 { Start_Signal++; } + return result; } diff --git a/BizHawk.sln.DotSettings b/BizHawk.sln.DotSettings index 356266de69..2515376bc7 100644 --- a/BizHawk.sln.DotSettings +++ b/BizHawk.sln.DotSettings @@ -47,5 +47,6 @@ SGX SNES TI + TIA <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /> \ No newline at end of file