Exemple #1
0
        public static void SUBLW(Data.Command com)
        {
            byte k = com.GetLowByte();

            byte result = BitwiseSubstract(k, Data.GetRegisterW());

            Data.SetRegisterW(result);
        }
Exemple #2
0
        public static void ADDLW(Data.Command com)
        {
            byte k = com.GetLowByte();

            byte result = BitwiseAdd(Data.GetRegisterW(), k);

            Data.SetRegisterW(result);
        }
        /// <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());
            }
        }
Exemple #4
0
        public static void XORLW(Data.Command com)
        {
            byte k = com.GetLowByte();

            byte result = (byte)(Data.GetRegisterW() ^ k);

            CheckZFlag(result);
            Data.SetRegisterW(result);
        }
Exemple #5
0
        public static void ANDWF(Data.Command com)
        {
            byte d = (byte)(com.GetLowByte() & 128);
            byte f = (byte)(com.GetLowByte() & 127);

            byte result = (byte)(Data.GetRegisterW() & Data.GetRegister(Data.AddressResolution(f)));

            DirectionalWrite(d, f, result);
        }
Exemple #6
0
        public static void SUBWF(Data.Command com)
        {
            byte d = (byte)(com.GetLowByte() & 128);
            byte f = (byte)(com.GetLowByte() & 127);

            byte result = BitwiseSubstract(Data.GetRegister(Data.AddressResolution(f)), Data.GetRegisterW());

            DirectionalWrite(d, f, result);
        }
Exemple #7
0
        public static void MOVWF(Data.Command com)
        {
            byte f = (byte)(com.GetLowByte() & 127);

            Data.SetRegister(Data.AddressResolution(f), Data.GetRegisterW());
        }