Atari 7800 - break up implementations into separate files and some other reorg

This commit is contained in:
adelikat 2014-11-30 16:01:01 +00:00
parent 135752a215
commit a251cacce6
5 changed files with 160 additions and 131 deletions

View File

@ -86,14 +86,14 @@
<Link>VersionInfo.cs</Link>
</Compile>
<Compile Include="Calculator\TI83.IMemoryDomains.cs">
<DependentUpon>TI83.cs</DependentUpon>
<DependentUpon>TI83.cs</DependentUpon>
</Compile>
<Compile Include="Calculator\TI83.ISettable.cs">
<DependentUpon>TI83.cs</DependentUpon>
<DependentUpon>TI83.cs</DependentUpon>
</Compile>
<Compile Include="Calculator\TI83.cs" />
<Compile Include="Calculator\TI83.IDebuggable.cs">
<DependentUpon>TI83.cs</DependentUpon>
<DependentUpon>TI83.cs</DependentUpon>
</Compile>
<Compile Include="Calculator\TI83LinkPort.cs" />
<Compile Include="Computers\Commodore64\C64.Core.cs" />
@ -151,19 +151,19 @@
<Compile Include="Computers\Commodore64\UserPort\UserPortDevice.cs" />
<Compile Include="Consoles\Atari\2600\Atari2600.cs" />
<Compile Include="Consoles\Atari\2600\Atari2600.Core.cs">
<DependentUpon>Atari2600.cs</DependentUpon>
<DependentUpon>Atari2600.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Atari\2600\Atari2600.IDebuggable.cs">
<DependentUpon>Atari2600.cs</DependentUpon>
<DependentUpon>Atari2600.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Atari\2600\Atari2600.IMemoryDomains.cs">
<DependentUpon>Atari2600.cs</DependentUpon>
<DependentUpon>Atari2600.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Atari\2600\Atari2600.ISettable.cs">
<DependentUpon>Atari2600.cs</DependentUpon>
<DependentUpon>Atari2600.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Atari\2600\Atari2600.RomHeuristics.cs">
<DependentUpon>Atari2600.cs</DependentUpon>
<DependentUpon>Atari2600.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Atari\2600\Mappers\m0840.cs" />
<Compile Include="Consoles\Atari\2600\Mappers\m3E.cs" />
@ -206,9 +206,17 @@
<Compile Include="Consoles\Atari\2600\Tia\Tia.MissleData.cs" />
<Compile Include="Consoles\Atari\2600\Tia\Tia.PlayerData.cs" />
<Compile Include="Consoles\Atari\2600\Tia\Tia.PlayfieldData.cs" />
<Compile Include="Consoles\Atari\7800\Atari7800.Core.cs" />
<Compile Include="Consoles\Atari\7800\Atari7800.cs" />
<Compile Include="Consoles\Atari\7800\Atari7800.IDebuggable.cs">
<DependentUpon>Atari7800.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Atari\7800\Atari7800.IMemoryDomains.cs">
<DependentUpon>Atari7800.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Atari\7800\Atari7800Control.cs" />
<Compile Include="Consoles\Atari\7800\Atari7800.ISaveRam.cs">
<DependentUpon>Atari7800.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Atari\lynx\LibLynx.cs" />
<Compile Include="Consoles\Atari\lynx\Lynx.cs" />
<Compile Include="Consoles\Coleco\ColecoVision.cs" />
@ -242,7 +250,7 @@
<DependentUpon>N64.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Nintendo\N64\N64.ISettable.cs">
<DependentUpon>N64.cs</DependentUpon>
<DependentUpon>N64.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Nintendo\N64\N64Input.cs" />
<Compile Include="Consoles\Nintendo\N64\N64Settings.cs" />

View File

@ -1,21 +1,12 @@
using System;
using System.Collections.Generic;
using EMU7800.Core;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Atari.Atari7800
{
partial class Atari7800
public partial class Atari7800 : IDebuggable
{
public byte[] rom;
//Bios7800 NTSC_BIOS;
//Bios7800 PAL_BIOS;
public byte[] hsbios;
public byte[] bios;
Cart cart;
MachineBase theMachine;
EMU7800.Win.GameProgram GameInfo;
public byte[] hsram = new byte[2048];
public IDictionary<string, int> GetCpuFlagsAndRegisters()
{
return new Dictionary<string, int>

View File

@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
using EMU7800.Core;
namespace BizHawk.Emulation.Cores.Atari.Atari7800
{
public partial class Atari7800 : IMemoryDomains
{
private List<MemoryDomain> _MemoryDomains;
public MemoryDomainList MemoryDomains { get; private set; }
public void SetupMemoryDomains(HSC7800 hsc7800)
{
// reset memory domains
if (_MemoryDomains == null)
{
_MemoryDomains = new List<MemoryDomain>();
if (theMachine is Machine7800)
{
_MemoryDomains.Add(new MemoryDomain(
"RAM1", 0x800, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
if (addr < 0 || addr >= 0x800)
throw new ArgumentOutOfRangeException();
return ((Machine7800)theMachine).RAM1[(ushort)addr];
},
delegate(int addr, byte val)
{
if (addr < 0 || addr >= 0x800)
throw new ArgumentOutOfRangeException();
((Machine7800)theMachine).RAM1[(ushort)addr] = val;
}));
_MemoryDomains.Add(new MemoryDomain(
"RAM2", 0x800, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
if (addr < 0 || addr >= 0x800)
throw new ArgumentOutOfRangeException();
return ((Machine7800)theMachine).RAM2[(ushort)addr];
},
delegate(int addr, byte val)
{
if (addr < 0 || addr >= 0x800)
throw new ArgumentOutOfRangeException();
((Machine7800)theMachine).RAM2[(ushort)addr] = val;
}));
_MemoryDomains.Add(new MemoryDomain(
"BIOS ROM", bios.Length, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
return bios[addr];
},
delegate(int addr, byte val)
{
}));
if (hsc7800 != null)
{
_MemoryDomains.Add(new MemoryDomain(
"HSC ROM", hsbios.Length, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
return hsbios[addr];
},
delegate(int addr, byte val)
{
}));
_MemoryDomains.Add(new MemoryDomain(
"HSC RAM", hsram.Length, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
return hsram[addr];
},
delegate(int addr, byte val)
{
hsram[addr] = val;
}));
}
_MemoryDomains.Add(new MemoryDomain(
"System Bus", 65536, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
if (addr < 0 || addr >= 0x10000)
throw new ArgumentOutOfRangeException();
return theMachine.Mem[(ushort)addr];
},
delegate(int addr, byte val)
{
if (addr < 0 || addr >= 0x10000)
throw new ArgumentOutOfRangeException();
theMachine.Mem[(ushort)addr] = val;
}));
}
else // todo 2600?
{
}
MemoryDomains = new MemoryDomainList(_MemoryDomains);
}
}
}
}

View File

@ -0,0 +1,26 @@
using System;
using BizHawk.Emulation.Common;
using EMU7800.Core;
namespace BizHawk.Emulation.Cores.Atari.Atari7800
{
public partial class Atari7800 : ISaveRam
{
public byte[] CloneSaveRam()
{
return (byte[])hsram.Clone();
}
public void StoreSaveRam(byte[] data)
{
Buffer.BlockCopy(data, 0, hsram, 0, data.Length);
}
public bool SaveRamModified
{
get
{
return GameInfo.MachineType == MachineType.A7800PAL || GameInfo.MachineType == MachineType.A7800NTSC;
}
}
}
}

View File

@ -30,6 +30,14 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
TIATables.PALPalette[i] |= unchecked((int)0xff000000);
}
public byte[] rom;
public byte[] hsbios;
public byte[] bios;
Cart cart;
MachineBase theMachine;
EMU7800.Win.GameProgram GameInfo;
public byte[] hsram = new byte[2048];
public string SystemId { get { return "A78"; } } // TODO 2600?
public GameInfo game;
@ -62,8 +70,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
public CoreComm CoreComm { get; private set; }
public bool DeterministicEmulation { get; set; }
private List<MemoryDomain> _MemoryDomains;
public MemoryDomainList MemoryDomains { get; private set; }
public int Frame { get { return _frame; } set { _frame = value; } }
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
@ -72,27 +78,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
private int _lagcount = 0;
private int _frame = 0;
#region saveram
public byte[] CloneSaveRam()
{
return (byte[])hsram.Clone();
}
public void StoreSaveRam(byte[] data)
{
Buffer.BlockCopy(data, 0, hsram, 0, data.Length);
}
public bool SaveRamModified
{
get
{
return GameInfo.MachineType == MachineType.A7800PAL || GameInfo.MachineType == MachineType.A7800NTSC;
}
}
#endregion
public void Dispose()
{
if (avProvider != null)
@ -255,92 +240,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
CoreComm.VsyncNum = theMachine.FrameHZ;
CoreComm.VsyncDen = 1;
// reset memory domains
if (_MemoryDomains == null)
{
_MemoryDomains = new List<MemoryDomain>();
if (theMachine is Machine7800)
{
_MemoryDomains.Add(new MemoryDomain(
"RAM1", 0x800, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
if (addr < 0 || addr >= 0x800)
throw new ArgumentOutOfRangeException();
return ((Machine7800)theMachine).RAM1[(ushort)addr];
},
delegate(int addr, byte val)
{
if (addr < 0 || addr >= 0x800)
throw new ArgumentOutOfRangeException();
((Machine7800)theMachine).RAM1[(ushort)addr] = val;
}));
_MemoryDomains.Add(new MemoryDomain(
"RAM2", 0x800, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
if (addr < 0 || addr >= 0x800)
throw new ArgumentOutOfRangeException();
return ((Machine7800)theMachine).RAM2[(ushort)addr];
},
delegate(int addr, byte val)
{
if (addr < 0 || addr >= 0x800)
throw new ArgumentOutOfRangeException();
((Machine7800)theMachine).RAM2[(ushort)addr] = val;
}));
_MemoryDomains.Add(new MemoryDomain(
"BIOS ROM", bios.Length, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
return bios[addr];
},
delegate(int addr, byte val)
{
}));
if (hsc7800 != null)
{
_MemoryDomains.Add(new MemoryDomain(
"HSC ROM", hsbios.Length, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
return hsbios[addr];
},
delegate(int addr, byte val)
{
}));
_MemoryDomains.Add(new MemoryDomain(
"HSC RAM", hsram.Length, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
return hsram[addr];
},
delegate(int addr, byte val)
{
hsram[addr] = val;
}));
}
_MemoryDomains.Add(new MemoryDomain(
"System Bus", 65536, MemoryDomain.Endian.Unknown,
delegate(int addr)
{
if (addr < 0 || addr >= 0x10000)
throw new ArgumentOutOfRangeException();
return theMachine.Mem[(ushort)addr];
},
delegate(int addr, byte val)
{
if (addr < 0 || addr >= 0x10000)
throw new ArgumentOutOfRangeException();
theMachine.Mem[(ushort)addr] = val;
}));
}
else // todo 2600?
{
}
MemoryDomains = new MemoryDomainList(_MemoryDomains);
}
SetupMemoryDomains(hsc7800);
}
#region audio\video