Ejemplo n.º 1
0
 public CpuValue GetValueAt(int address, int length)
 {
     if (address < 0 || address >= MemorySize)
     {
         throw new IncorrectMemoryAddressException();
     }
     return(CpuValue.FromBinary(Blocks.Skip(address).Take(length)));
 }
Ejemplo n.º 2
0
        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;
            }
        }