BizHawk/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/mCV.cs

67 lines
1.3 KiB
C#
Raw Normal View History

using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Atari.Atari2600
2012-03-31 20:32:40 +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
*/
internal class mCV: MapperBase
2012-03-31 20:32:40 +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)
{
2012-04-02 17:13:38 +00:00
return base.ReadMemory(addr);
}
if (addr < 0x1400)
{
return _auxRam[(addr & 0x3FF)];
}
if (addr >= 0x1800 && addr < 0x2000)
{
return Core.Rom[(addr & 0x7FF)];
}
return base.ReadMemory(addr);
2012-04-02 17:13:38 +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)
{
2012-04-02 17:13:38 +00:00
base.WriteMemory(addr, value);
}
2012-04-02 17:13:38 +00:00
else if (addr >= 0x1400 && addr < 0x1800)
{
_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);
ser.Sync("aux_ram", ref _auxRam);
2012-04-02 17:13:38 +00:00
}
2012-03-31 20:32:40 +00:00
}
}