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

54 lines
1.2 KiB
C#
Raw Normal View History

using BizHawk.Common;
namespace BizHawk.Emulation.Consoles.Atari._2600
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
*/
2012-03-31 20:32:40 +00:00
class mCV: MapperBase
{
2012-04-02 17:13:38 +00:00
ByteBuffer aux_ram = new ByteBuffer(1024);
public override byte ReadMemory(ushort addr)
{
if (addr < 0x1000)
return base.ReadMemory(addr);
else if (addr < 0x1400)
return aux_ram[(addr & 0x3FF)];
else if (addr >= 0x1800 && addr < 0x2000)
return core.rom[(addr & 0x7FF)];
else return base.ReadMemory(addr);
}
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)
base.WriteMemory(addr, value);
else if (addr >= 0x1400 && addr < 0x1800)
aux_ram[(addr & 0x3FF)] = value;
}
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 aux_ram);
}
2012-03-31 20:32:40 +00:00
}
}