2013-11-04 00:36:15 +00:00
|
|
|
|
using BizHawk.Common;
|
|
|
|
|
|
2013-11-13 03:32:25 +00:00
|
|
|
|
namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
2012-03-31 20:32:40 +00:00
|
|
|
|
{
|
2012-04-29 21:01:06 +00:00
|
|
|
|
/*
|
|
|
|
|
This was used by Commavid. It allowed for both ROM and RAM on the cartridge,
|
|
|
|
|
without using bankswitching. There's 2K of ROM and 1K of RAM.
|
|
|
|
|
|
|
|
|
|
2K of ROM is mapped at 1800-1FFF.
|
|
|
|
|
1K of RAM is mapped in at 1000-17FF.
|
|
|
|
|
|
|
|
|
|
The read port is at 1000-13FF.
|
|
|
|
|
The write port is at 1400-17FF.
|
|
|
|
|
|
|
|
|
|
Example games:
|
|
|
|
|
Magicard
|
|
|
|
|
*/
|
|
|
|
|
|
2014-04-02 21:27:14 +00:00
|
|
|
|
internal class mCV: MapperBase
|
2012-03-31 20:32:40 +00:00
|
|
|
|
{
|
2014-04-03 19:58:47 +00:00
|
|
|
|
private ByteBuffer _auxRam = new ByteBuffer(1024);
|
2012-04-02 17:13:38 +00:00
|
|
|
|
|
|
|
|
|
public override byte ReadMemory(ushort addr)
|
|
|
|
|
{
|
|
|
|
|
if (addr < 0x1000)
|
2014-04-03 19:58:47 +00:00
|
|
|
|
{
|
2012-04-02 17:13:38 +00:00
|
|
|
|
return base.ReadMemory(addr);
|
2014-04-03 19:58:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (addr < 0x1400)
|
|
|
|
|
{
|
|
|
|
|
return _auxRam[(addr & 0x3FF)];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (addr >= 0x1800 && addr < 0x2000)
|
|
|
|
|
{
|
2014-04-05 14:13:05 +00:00
|
|
|
|
return Core.Rom[(addr & 0x7FF)];
|
2014-04-03 19:58:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base.ReadMemory(addr);
|
2012-04-02 17:13:38 +00:00
|
|
|
|
}
|
2013-03-11 01:46:12 +00:00
|
|
|
|
|
|
|
|
|
public override byte PeekMemory(ushort addr)
|
|
|
|
|
{
|
|
|
|
|
return ReadMemory(addr);
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-02 17:13:38 +00:00
|
|
|
|
public override void WriteMemory(ushort addr, byte value)
|
|
|
|
|
{
|
|
|
|
|
if (addr < 0x1000)
|
2014-04-03 19:58:47 +00:00
|
|
|
|
{
|
2012-04-02 17:13:38 +00:00
|
|
|
|
base.WriteMemory(addr, value);
|
2014-04-03 19:58:47 +00:00
|
|
|
|
}
|
2012-04-02 17:13:38 +00:00
|
|
|
|
else if (addr >= 0x1400 && addr < 0x1800)
|
2014-04-03 19:58:47 +00:00
|
|
|
|
{
|
|
|
|
|
_auxRam[(addr & 0x3FF)] = value;
|
|
|
|
|
}
|
2012-04-02 17:13:38 +00:00
|
|
|
|
}
|
2012-03-31 20:32:40 +00:00
|
|
|
|
|
2012-04-02 17:13:38 +00:00
|
|
|
|
public override void SyncState(Serializer ser)
|
|
|
|
|
{
|
|
|
|
|
base.SyncState(ser);
|
2014-04-03 19:58:47 +00:00
|
|
|
|
ser.Sync("aux_ram", ref _auxRam);
|
2012-04-02 17:13:38 +00:00
|
|
|
|
}
|
2012-03-31 20:32:40 +00:00
|
|
|
|
}
|
|
|
|
|
}
|