Atari 2600 - implement the Cart Ram memory domain

This commit is contained in:
adelikat 2014-04-11 01:31:10 +00:00
parent 2200b05dc2
commit 74cc3aad14
11 changed files with 111 additions and 0 deletions

View File

@ -72,6 +72,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
(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);
}

View File

@ -6,6 +6,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
public Atari2600 Core { get; set; }
public virtual bool HasCartRam
{
get { return false; }
}
public virtual ByteBuffer CartRam
{
get { return new ByteBuffer(0); }
}
public virtual byte ReadMemory(ushort addr)
{
return Core.BaseReadMemory(addr);
@ -28,5 +38,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public virtual void ClockCpu() { }
public virtual void HardReset() { }
}
}

View File

@ -27,6 +27,16 @@ 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 ByteBuffer CartRam
{
get { return _ram; }
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);

View File

@ -42,6 +42,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private int _mySliceLow;
private int _mySliceMiddle;
public override bool HasCartRam
{
get { return true; }
}
public override ByteBuffer CartRam
{
get { return _myRam; }
}
public override byte ReadMemory(ushort addr)
{
byte val = 0;

View File

@ -21,6 +21,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
throw new NotImplementedException();
}
public override bool HasCartRam
{
get { return true; }
}
public override ByteBuffer CartRam
{
get { return _ram; }
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);

View File

@ -20,6 +20,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
private ByteBuffer _ram = new ByteBuffer(1024);
public override bool HasCartRam
{
get { return true; }
}
public override ByteBuffer CartRam
{
get { return _ram; }
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);

View File

@ -12,6 +12,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private int _bank4k;
private ByteBuffer _ram = new ByteBuffer(128);
public override bool HasCartRam
{
get { return true; }
}
public override ByteBuffer CartRam
{
get { return _ram; }
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);

View File

@ -11,6 +11,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private int _bank4k;
private ByteBuffer _ram = new ByteBuffer(128);
public override bool HasCartRam
{
get { return true; }
}
public override ByteBuffer CartRam
{
get { return _ram; }
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);

View File

@ -11,6 +11,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private int _bank4k;
private ByteBuffer _ram = new ByteBuffer(128);
public override bool HasCartRam
{
get { return true; }
}
public override ByteBuffer CartRam
{
get { return _ram; }
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);

View File

@ -11,6 +11,16 @@ 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 ByteBuffer CartRam
{
get { return _ram; }
}
public override void HardReset()
{
_bank_4K = 0;

View File

@ -13,6 +13,16 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
private int _bank4k;
private ByteBuffer _ram = new ByteBuffer(256);
public override bool HasCartRam
{
get { return true; }
}
public override ByteBuffer CartRam
{
get { return _ram; }
}
public override void SyncState(Serializer ser)
{
base.SyncState(ser);