some misc cleanups in atari 2600 mappers

This commit is contained in:
adelikat 2020-02-17 18:07:51 -06:00
parent fd793322f9
commit 48c9ada3e7
15 changed files with 28 additions and 35 deletions

View File

@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{ {
} }
// 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) // 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 { get; set; }
} }
} }

View File

@ -10,9 +10,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private int _gameTotal; private int _gameTotal;
private int _currentGame; private int _currentGame;
public Multicart2K(int gametotal) public Multicart2K(int gameTotal)
{ {
_gameTotal = gametotal; _gameTotal = gameTotal;
_currentGame = 0; _currentGame = 0;
} }
@ -44,12 +44,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
return base.ReadMemory(addr); return base.ReadMemory(addr);
} }
return this.Core.Rom[(addr & 0x7FF) + (_currentGame * 2048)]; return Core.Rom[(addr & 0x7FF) + (_currentGame * 2048)];
} }
public override byte PeekMemory(ushort addr) public override byte PeekMemory(ushort addr) => ReadMemory(addr);
{
return ReadMemory(addr);
}
} }
} }

View File

@ -10,9 +10,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private int _gameTotal; private int _gameTotal;
private int _currentGame; private int _currentGame;
public Multicart4K(int gametotal) public Multicart4K(int gameTotal)
{ {
_gameTotal = gametotal; _gameTotal = gameTotal;
_currentGame = 0; _currentGame = 0;
} }
@ -47,9 +47,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
return Core.Rom[(addr & 0xFFF) + (_currentGame * 4096)]; return Core.Rom[(addr & 0xFFF) + (_currentGame * 4096)];
} }
public override byte PeekMemory(ushort addr) public override byte PeekMemory(ushort addr) => ReadMemory(addr);
{
return ReadMemory(addr);
}
} }
} }

View File

@ -12,9 +12,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private int _gameTotal; private int _gameTotal;
private int _currentGame; private int _currentGame;
public Multicart8K(int gametotal) public Multicart8K(int gameTotal)
{ {
_gameTotal = gametotal; _gameTotal = gameTotal;
_currentGame = 0; _currentGame = 0;
} }

View File

@ -9,12 +9,9 @@
return base.ReadMemory(addr); return base.ReadMemory(addr);
} }
return this.Core.Rom[addr & 0x7FF]; return Core.Rom[addr & 0x7FF];
} }
public override byte PeekMemory(ushort addr) public override byte PeekMemory(ushort addr) => ReadMemory(addr);
{
return ReadMemory(addr);
}
} }
} }

View File

@ -102,7 +102,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
else if (addr == 0x003F) else if (addr == 0x003F)
{ {
_hasRam = false; _hasRam = false;
if ((value << 11) < Core.Rom.Length) if (value << 11 < Core.Rom.Length)
{ {
_lowbank2K = value; _lowbank2K = value;
} }

View File

@ -12,9 +12,6 @@
return Core.Rom[addr & 0xFFF]; return Core.Rom[addr & 0xFFF];
} }
public override byte PeekMemory(ushort addr) public override byte PeekMemory(ushort addr) => ReadMemory(addr);
{
return ReadMemory(addr);
}
} }
} }

View File

@ -2,7 +2,7 @@
using System.Linq; using System.Linq;
using BizHawk.Common; using BizHawk.Common;
/** /*
This is the cartridge class for Arcadia (aka Starpath) Supercharger This is the cartridge class for Arcadia (aka Starpath) Supercharger
games. Christopher Salomon provided most of the technical details games. Christopher Salomon provided most of the technical details
used in creating this class. A good description of the Supercharger used in creating this class. A good description of the Supercharger

View File

@ -292,7 +292,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private void WriteMem(ushort addr, byte value, bool poke) private void WriteMem(ushort addr, byte value, bool poke)
{ {
// Mimicking the 6532 logic for accesing port A, for testing // Mimicking the 6532 logic for accessing port A, for testing
////var isPortA = false; // adelikat: Commented out this variable to remove a warning. Should this be deleted or is this supposed to be actually used? ////var isPortA = false; // adelikat: Commented out this variable to remove a warning. Should this be deleted or is this supposed to be actually used?
if ((addr & 0x0200) == 0) // If the RS bit is not set, this is a ram write if ((addr & 0x0200) == 0) // If the RS bit is not set, this is a ram write

View File

@ -241,7 +241,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private float _fractionalClocks; // Fractional DPC music OSC clocks unused during the last update private float _fractionalClocks; // Fractional DPC music OSC clocks unused during the last update
private byte[] _dspData; private byte[] _dspData;
public byte[] DspData => _dspData ?? (_dspData = Core.Rom.Skip(8192).Take(2048).ToArray()); public byte[] DspData => _dspData ??= Core.Rom.Skip(8192).Take(2048).ToArray();
public override void Dispose() public override void Dispose()
{ {
@ -502,7 +502,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
// Using bits 7, 5, 4, & 3 of the shift register compute the input // Using bits 7, 5, 4, & 3 of the shift register compute the input
// bit for the shift register // bit for the shift register
var bit = _randomInputBits[((_currentRandomVal >> 3) & 0x07) | var bit = _randomInputBits[((_currentRandomVal >> 3) & 0x07) |
(((_currentRandomVal & 0x80) > 0) ? 0x08 : 0x00)]; ((_currentRandomVal & 0x80) > 0 ? 0x08 : 0x00)];
// Update the shift register // Update the shift register
_currentRandomVal = (byte)((_currentRandomVal << 1) | bit); _currentRandomVal = (byte)((_currentRandomVal << 1) | bit);

View File

@ -29,7 +29,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private float _fractionalClocks; // Fractional DPC music OSC clocks unused during the last update private float _fractionalClocks; // Fractional DPC music OSC clocks unused during the last update
private byte[] _dspData; private byte[] _dspData;
public byte[] DspData => _dspData ?? (_dspData = Core.Rom.Skip(8192).Take(2048).ToArray()); public byte[] DspData => _dspData ??= Core.Rom.Skip(8192).Take(2048).ToArray();
// Table for computing the input bit of the random number generator's // Table for computing the input bit of the random number generator's
// shift register (it's the NOT of the EOR of four bits) // shift register (it's the NOT of the EOR of four bits)

View File

@ -50,10 +50,11 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
if (addr < 0x1080) if (addr < 0x1080)
{ {
_ram[(addr & 0x7F)] = 0xFF; // Reading from the write port triggers an unwanted write of open bus _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 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)]; return _ram[(addr & 0x7F)];
} }

View File

@ -52,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 _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 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)]; return _ram[(addr & 0x7F)];
} }

View File

@ -39,7 +39,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_ram[(addr & 0x7F)] = 0xFF; // Reading from the write port triggers an unwanted write of open bus _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 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)]; return _ram[(addr & 0x7F)];
} }

View File

@ -202,6 +202,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=avisynth/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=avisynth/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=backbuffer/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=backbuffer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=backcolor/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=backcolor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bankswitched/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bankswitching/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=bankswitching/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bezier/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Bezier/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bicubic/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=bicubic/@EntryIndexedValue">True</s:Boolean>
@ -322,6 +323,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Missle/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Missle/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=mmsys/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=mmsys/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=MOTW/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=MOTW/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Multicart/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Multidisk/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=Multidisk/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=multidump/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=multidump/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=multilines/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/UserDictionary/Words/=multilines/@EntryIndexedValue">True</s:Boolean>