protected ImmutableState(ImmutableState prev, Register register, ushort value) { _memory = prev._memory; _regs = prev._regs.Set((int)register, value); _deviceStates = prev._deviceStates; _memoryMap = prev._memoryMap; }
public MutableState() { _memory = new ushort[Dcpu.MAX_ADDRESS + 1]; _regs = new ushort[11]; _memoryMap = new MemoryMap(); _deviceStates = new Dictionary<string, DeviceState>(); }
protected ImmutableState(ushort[] memory) { _memory = new PersistentArray<ushort>(memory); _regs = new PersistentArray<ushort>(11); _deviceStates = new Dictionary<string, DeviceState>(); _memoryMap = new MemoryMap(); }
public ImmutableState() { _memory = new PersistentArray<ushort>(Dcpu.MAX_ADDRESS + 1); _regs = new PersistentArray<ushort>(11); _deviceStates = new Dictionary<string, DeviceState>(); _memoryMap = new MemoryMap(); }
protected ImmutableState(ImmutableState prev, IEvent e) { _memory = prev._memory; _regs = prev._regs; _memoryMap = prev._memoryMap; _deviceStates = new Dictionary<string, DeviceState>(prev._deviceStates); _deviceStates[e.DeviceId] = _deviceStates[e.DeviceId].Handle(e); }
protected ImmutableState(ImmutableState prev, ushort from, ushort to, DeviceState device) { _memory = prev._memory; _regs = prev._regs; _memoryMap = new MemoryMap(prev._memoryMap); _memoryMap.Map(from, to, device.Id); _deviceStates = new Dictionary<string,DeviceState>(prev._deviceStates); _deviceStates[device.Id] = device; }
protected ImmutableState(ImmutableState prev, ushort addr, ushort value) { _memory = prev._memory; _regs = prev._regs; _memoryMap = prev._memoryMap; var deviceId = prev._memoryMap[addr]; if (deviceId == null) { _memory = _memory.Set(addr, value); _deviceStates = prev._deviceStates; } else { _deviceStates = new Dictionary<string, DeviceState>(prev._deviceStates); _deviceStates[deviceId] = prev._deviceStates[deviceId].Write(addr, value); } }
public MemoryMap(MemoryMap map) { _mappedRanges = new List<MappedRange>(); _mappedRanges.AddRange(map._mappedRanges); }