Beispiel #1
0
 protected ImmutableState(ImmutableState prev, Register register, ushort value)
 {
     _memory = prev._memory;
     _regs = prev._regs.Set((int)register, value);
     _deviceStates = prev._deviceStates;
     _memoryMap = prev._memoryMap;
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
 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;
 }
Beispiel #4
0
 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);
     }
 }