Atari 2600 - code refactoring, separating out memory domain code to its own file, no functionality changes
This commit is contained in:
parent
d003be9cda
commit
66dcccf651
|
@ -176,6 +176,7 @@
|
|||
<Compile Include="Computers\Commodore64\Tape\VIC1530.cs" />
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.cs" />
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.Core.cs" />
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.IMemoryDomains.cs" />
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.RomHeuristics.cs" />
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.Settings.cs" />
|
||||
<Compile Include="Consoles\Atari\2600\Mappers\m0840.cs" />
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
using System.Collections.Generic;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||
{
|
||||
public partial class Atari2600 : IMemoryDomains
|
||||
{
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
private void SetupMemoryDomains()
|
||||
{
|
||||
var domains = new List<MemoryDomain>
|
||||
{
|
||||
new MemoryDomain(
|
||||
"Main RAM",
|
||||
128,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => Ram[addr],
|
||||
(addr, value) => Ram[addr] = value),
|
||||
new MemoryDomain(
|
||||
"TIA",
|
||||
16,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => _tia.ReadMemory((ushort)addr, true),
|
||||
(addr, value) => this._tia.WriteMemory((ushort)addr, value)),
|
||||
new MemoryDomain(
|
||||
"PIA",
|
||||
1024,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => M6532.ReadMemory((ushort)addr, true),
|
||||
(addr, value) => M6532.WriteMemory((ushort)addr, value)),
|
||||
new MemoryDomain(
|
||||
"System Bus",
|
||||
8192,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => _mapper.PeekMemory((ushort) addr),
|
||||
(addr, value) => _mapper.PokeMemory((ushort) addr, value))
|
||||
};
|
||||
|
||||
if (_mapper is mDPC) // TODO: also mDPCPlus
|
||||
{
|
||||
domains.Add(new MemoryDomain(
|
||||
"DPC",
|
||||
2048,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => (_mapper as mDPC).DspData[addr],
|
||||
(addr, value) => (_mapper as mDPC).DspData[addr] = value));
|
||||
}
|
||||
|
||||
if (_mapper.HasCartRam)
|
||||
{
|
||||
domains.Add(new MemoryDomain(
|
||||
"Cart Ram",
|
||||
_mapper.CartRam.Len,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => _mapper.CartRam[addr],
|
||||
(addr, value) => _mapper.CartRam[addr] = value));
|
||||
}
|
||||
|
||||
MemoryDomains = new MemoryDomainList(domains);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,34 +30,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
Settings = (A2600Settings)settings ?? new A2600Settings();
|
||||
SyncSettings = (A2600SyncSettings)syncSettings ?? new A2600SyncSettings();
|
||||
|
||||
var domains = new List<MemoryDomain>
|
||||
{
|
||||
new MemoryDomain(
|
||||
"Main RAM",
|
||||
128,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => Ram[addr],
|
||||
(addr, value) => Ram[addr] = value),
|
||||
new MemoryDomain(
|
||||
"TIA",
|
||||
16,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => _tia.ReadMemory((ushort)addr, true),
|
||||
(addr, value) => this._tia.WriteMemory((ushort)addr, value)),
|
||||
new MemoryDomain(
|
||||
"PIA",
|
||||
1024,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => M6532.ReadMemory((ushort)addr, true),
|
||||
(addr, value) => M6532.WriteMemory((ushort)addr, value)),
|
||||
new MemoryDomain(
|
||||
"System Bus",
|
||||
8192,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => _mapper.PeekMemory((ushort) addr),
|
||||
(addr, value) => _mapper.PokeMemory((ushort) addr, value))
|
||||
};
|
||||
|
||||
CoreComm.CpuTraceAvailable = true;
|
||||
Rom = rom;
|
||||
_game = game;
|
||||
|
@ -69,28 +41,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
|
||||
Console.WriteLine("Game uses mapper " + game.GetOptionsDict()["m"]);
|
||||
RebootCore();
|
||||
|
||||
if (_mapper is mDPC) // TODO: also mDPCPlus
|
||||
{
|
||||
domains.Add(new MemoryDomain(
|
||||
"DPC",
|
||||
2048,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => (_mapper as mDPC).DspData[addr],
|
||||
(addr, value) => (_mapper as mDPC).DspData[addr] = value));
|
||||
}
|
||||
|
||||
if (_mapper.HasCartRam)
|
||||
{
|
||||
domains.Add(new MemoryDomain(
|
||||
"Cart Ram",
|
||||
_mapper.CartRam.Len,
|
||||
MemoryDomain.Endian.Little,
|
||||
addr => _mapper.CartRam[addr],
|
||||
(addr, value) => _mapper.CartRam[addr] = value));
|
||||
}
|
||||
|
||||
MemoryDomains = new MemoryDomainList(domains);
|
||||
SetupMemoryDomains();
|
||||
}
|
||||
|
||||
public string SystemId { get { return "A26"; } }
|
||||
|
@ -132,8 +83,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
|
||||
public A2600SyncSettings SyncSettings { get; private set; }
|
||||
|
||||
public MemoryDomainList MemoryDomains { get; private set; }
|
||||
|
||||
public static readonly ControllerDefinition Atari2600ControllerDefinition = new ControllerDefinition
|
||||
{
|
||||
Name = "Atari 2600 Basic Controller",
|
||||
|
|
Loading…
Reference in New Issue