예제 #1
0
 private void Reset()
 {
     Stop();
     Data.Reset();
     UpdateUI();
 }
예제 #2
0
 private void PortBChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     Data.SetRegister(Data.Registers.PORTB, Data.BoolArrayToByte(View.PortB.ToArray <bool>()));
     UpdateUI();
 }
예제 #3
0
 private void TrisAChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     Data.SetRegister(Data.Registers.TRISA, Data.BoolArrayToByte(View.TrisA.ToArray <bool>()));
     UpdateUI();
 }
예제 #4
0
        /// <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());
            }
        }
예제 #5
0
 public bool IsBreakpointHit()
 {
     return(SourceFile.LineHasBreakpoint(Data.GetPC()));
 }
예제 #6
0
 private bool IsPCOutOfRange()
 {
     return(Data.GetPC() >= Data.GetProgram().Count);
 }