/// <summary> /// Refreshes data for all UI elements BUT the file register view /// </summary> public void UpdateUIWithoutFileRegister() { View.TrisA = new ObservableCollection <bool>(Data.ByteToBoolArray(Data.GetRegister(Data.Registers.TRISA))); View.TrisB = new ObservableCollection <bool>(Data.ByteToBoolArray(Data.GetRegister(Data.Registers.TRISB))); View.PortA = new ObservableCollection <bool>(Data.ByteToBoolArray(Data.GetRegister(Data.Registers.PORTA))); View.PortB = new ObservableCollection <bool>(Data.ByteToBoolArray(Data.GetRegister(Data.Registers.PORTB))); View.TrisA.CollectionChanged += new NotifyCollectionChangedEventHandler(TrisAChanged); View.TrisB.CollectionChanged += new NotifyCollectionChangedEventHandler(TrisBChanged); View.PortA.CollectionChanged += new NotifyCollectionChangedEventHandler(PortAChanged); View.PortB.CollectionChanged += new NotifyCollectionChangedEventHandler(PortBChanged); View.Status = new ObservableCollection <string>(Data.ByteToStringArray(Data.GetRegister(Data.Registers.STATUS))); View.Option = new ObservableCollection <string>(Data.ByteToStringArray(Data.GetRegister(Data.Registers.OPTION))); View.Intcon = new ObservableCollection <string>(Data.ByteToStringArray(Data.GetRegister(Data.Registers.INTCON))); View.StackDisplay = new ObservableCollection <string>(Data.GetStack().Select(x => x.ToString("D4")).ToArray()); View.SFRValues[0] = Data.GetRegisterW().ToString("X2"); View.SFRValues[1] = Data.GetRegister(Data.Registers.PCL).ToString("X2"); View.SFRValues[2] = Data.GetRegister(Data.Registers.PCLATH).ToString("X2"); View.SFRValues[3] = Data.GetPC().ToString("D2"); View.SFRValues[4] = Data.GetRegister(Data.Registers.STATUS).ToString("X2"); View.SFRValues[5] = Data.GetRegister(Data.Registers.FSR).ToString("X2"); View.SFRValues[6] = Data.GetRegister(Data.Registers.OPTION).ToString("X2"); View.SFRValues[7] = Data.GetRegister(Data.Registers.TMR0).ToString("X2"); View.SFRValues[8] = "1:" + Data.GetPrePostscalerRatio(); if (Data.GetRegisterBit(Data.Registers.OPTION, Data.Flags.Option.PSA)) { View.PrePostScalerText = "Postscaler"; //Postscaler assigned to WDT } else { View.PrePostScalerText = "Prescaler"; //Prescaler assigned to TMR0 } if (StepTimer.Enabled) { View.StartStopButtonText = "Stop"; } else { View.StartStopButtonText = "Start"; } if (Data.GetPC() < Data.GetProgram().Count) { View.SFRValues[9] = Data.InstructionLookup(Data.GetProgram()[Data.GetPC()]).ToString(); } else { View.SFRValues[9] = "N/A"; } View.Runtime = Data.GetRuntime(); View.Watchdog = Data.GetWatchdog(); if (SourceFile != null) { HighlightSourceLine(Data.GetPC()); } }
/// <summary> /// Step function. Executes current command of loaded program and increases PC /// </summary> /// <returns>false if within program bounds, true if PC left program bounds</returns> public static void PCStep() { if (Data.IsProgramInitialized()) { if (!Data.IsSleeping()) { if (Data.GetPC() < Data.GetProgram().Count) { Data.Command com = Data.GetProgram()[Data.GetPC()]; Data.IncPC(); InstructionProcessor.Execute(Data.InstructionLookup(com), com); } else //PC has left program area { Data.IncPC(); } } SkipCycle(); } }