/// <summary> /// Allows accress to the memory. /// </summary> /// <remarks> /// Changes are stored to and retrieved from /// the Delta object. /// </remarks> /// <param name="address">The address of the memory location</param> /// <returns>The value of the addressed memory location</returns> public ushort this[ushort address] { get { ushort value = _memory[(int)address]; Delta.ReadLocations.Add(address); DataDelta.WrittenLocation location; if (Delta.WrittenLocations.TryGetValue(address, out location)) { value = location.Value; } return(value); } set { if (Delta.WrittenLocations.ContainsKey(address)) { Delta.WrittenLocations[address].Value = value; } else { DataDelta.WrittenLocation location = new DataDelta.WrittenLocation(); location.Address = address; location.OldValue = _memory[address]; location.Value = value; Delta.WrittenLocations.Add(address, location); } } }
/// <summary> /// Allows accress to the memory. /// </summary> /// <remarks> /// Changes are stored to and retrieved from /// the Delta object. /// </remarks> /// <param name="address">The address of the memory location</param> /// <returns>The value of the addressed memory location</returns> public ushort this[ushort address] { get { ushort value = _memory[(int)address]; Delta.ReadLocations.Add(address); DataDelta.WrittenLocation location; if (Delta.WrittenLocations.TryGetValue(address, out location)) { value = location.Value; } return value; } set { if (Delta.WrittenLocations.ContainsKey(address)) { Delta.WrittenLocations[address].Value = value; } else { DataDelta.WrittenLocation location = new DataDelta.WrittenLocation(); location.Address = address; location.OldValue = _memory[address]; location.Value = value; Delta.WrittenLocations.Add(address, location); } } }