BizHawk/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Chip2114.cs

52 lines
792 B
C#
Raw Normal View History

using BizHawk.Common;
2013-11-12 19:22:09 +00:00
namespace BizHawk.Emulation.Cores.Computers.Commodore64
{
// used as Color RAM in C64
sealed public class Chip2114
{
byte[] ram;
public Chip2114()
{
HardReset();
}
public void HardReset()
{
ram = new byte[0x400];
}
public byte Peek(int addr)
{
return ram[addr & 0x3FF];
}
public void Poke(int addr, byte val)
{
ram[addr & 0x3FF] = (byte)(val & 0xF);
}
public byte Read(int addr)
{
return ram[addr & 0x3FF];
}
public int ReadInt(int addr)
{
return ram[addr & 0x3FF];
}
public void SyncState(Serializer ser)
{
SaveState.SyncObject(ser, this);
}
public void Write(int addr, byte val)
{
ram[addr & 0x3FF] = (byte)(val & 0xF);
}
}
}