public CpuValue GetValueAt(int address, int length) { if (address < 0 || address >= MemorySize) { throw new IncorrectMemoryAddressException(); } return(CpuValue.FromBinary(Blocks.Skip(address).Take(length))); }
public void SetValue(CpuValue value, int address) { if (address < 0 || address >= MemorySize) { throw new IncorrectMemoryAddressException(); } for (var i = address; i < value.Size + address; i++) { Blocks[i] = value.Bin[i - address] == '1' ? CpuBinary.One : CpuBinary.Zero; } }