2013-11-04 00:36:15 +00:00
|
|
|
|
using BizHawk.Common;
|
|
|
|
|
|
2013-11-12 19:22:09 +00:00
|
|
|
|
namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
2012-11-27 05:11:40 +00:00
|
|
|
|
{
|
|
|
|
|
// used as Color RAM in C64
|
|
|
|
|
|
2013-08-24 17:30:46 +00:00
|
|
|
|
sealed public class Chip2114
|
2012-11-27 05:11:40 +00:00
|
|
|
|
{
|
2013-11-04 00:36:15 +00:00
|
|
|
|
byte[] ram;
|
2012-11-27 05:11:40 +00:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-14 05:05:17 +00:00
|
|
|
|
public byte Read(int addr)
|
2012-11-27 05:11:40 +00:00
|
|
|
|
{
|
2013-08-14 05:33:10 +00:00
|
|
|
|
return ram[addr & 0x3FF];
|
2012-11-27 05:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
public int ReadInt(int addr)
|
|
|
|
|
{
|
|
|
|
|
return ram[addr & 0x3FF];
|
|
|
|
|
}
|
2013-08-23 08:57:20 +00:00
|
|
|
|
|
2012-12-03 08:38:12 +00:00
|
|
|
|
public void SyncState(Serializer ser)
|
|
|
|
|
{
|
2013-11-04 00:36:15 +00:00
|
|
|
|
SaveState.SyncObject(ser, this);
|
|
|
|
|
}
|
2012-12-03 08:38:12 +00:00
|
|
|
|
|
2013-08-14 05:05:17 +00:00
|
|
|
|
public void Write(int addr, byte val)
|
2012-11-27 05:11:40 +00:00
|
|
|
|
{
|
|
|
|
|
ram[addr & 0x3FF] = (byte)(val & 0xF);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|