Пример #1
0
        public override void Execute(PICController controller)
        {
            uint a = controller.GetBankedRegister(Register);
            uint b = controller.GetWRegister();

            bool carry;

            bool dc = BinaryHelper.getSubtractionDigitCarry(a, b);

            if (carry = a < b)
            {
                a += 0x100;
            }

            uint Result = a - b;

            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_Z, (Result % 0x100) == 0);
            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_DC, dc);
            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_C, !carry);

            Result %= 0x100;

            if (Target)
            {
                controller.SetBankedRegister(Register, Result);
            }
            else
            {
                controller.SetWRegister(Result);
            }
        }
Пример #2
0
        public override void Execute(PICController controller)
        {
            uint Result = controller.GetWRegister() & Literal;

            controller.SetWRegister(Result);
            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_Z, Result == 0);
        }
Пример #3
0
        public override void Execute(PICController controller)
        {
            uint Result = controller.GetWRegister() & controller.GetBankedRegister(Register);

            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_Z, Result == 0);

            if (Target)
            {
                controller.SetBankedRegister(Register, Result);
            }
            else
            {
                controller.SetWRegister(Result);
            }
        }
Пример #4
0
        public override void Execute(PICController controller)
        {
            uint a = controller.GetBankedRegister(Register);
            uint b = controller.GetWRegister();

            uint Result = a + b;
            bool dc     = BinaryHelper.getAdditionDigitCarry(a, b);

            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_Z, (Result % 0x100) == 0);
            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_DC, dc);
            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_C, Result > 0xFF);

            Result %= 0x100;

            if (Target)
            {
                controller.SetBankedRegister(Register, Result);
            }
            else
            {
                controller.SetWRegister(Result);
            }
        }
Пример #5
0
 public override void Execute(PICController controller)
 {
     controller.SetBankedRegister(Register, controller.GetWRegister());
 }
Пример #6
0
        private void onIdle()
        {
            IdleCounter.Inc();

            if (controller != null)
            {
                UpdateRegister();
                UpdateStackDisplay();

                IconBar.SetPC(controller.GetSCLineForPC(controller.GetPC()));

                lblFreqModel.Text          = FormatFreq((uint)controller.Frequency.Frequency);
                lblFreqView.Text           = FormatFreq((uint)IdleCounter.Frequency);
                lblRunTime.Text            = FormatRuntime(controller.GetRunTime());
                lblRegW.Text               = "0x" + string.Format("{0:X02}", controller.GetWRegister());
                lblRegPC.Text              = "0x" + string.Format("{0:X04}", controller.GetPC());
                lblQuartzFreq.Text         = FormatFreq(controller.EmulatedFrequency);
                btnSetQuartzFreq.IsEnabled = true;
                lblWatchDogTmr.Text        = string.Format("{0:000.000} %", controller.GetWatchDogPerc() * 100);
                chkbxWatchdog.IsEnabled    = true;
                chkbxWatchdog.IsChecked    = controller.IsWatchDogEnabled();

                regClock_0.UpdateUI(controller);
                regClock_1.UpdateUI(controller);
                regClock_2.UpdateUI(controller);
                regClock_3.UpdateUI(controller);

                regClock_0.IsEnabled = controller.Mode == PICControllerMode.WAITING || controller.Mode == PICControllerMode.PAUSED;
                regClock_1.IsEnabled = controller.Mode == PICControllerMode.WAITING || controller.Mode == PICControllerMode.PAUSED;
                regClock_2.IsEnabled = controller.Mode == PICControllerMode.WAITING || controller.Mode == PICControllerMode.PAUSED;
                regClock_3.IsEnabled = controller.Mode == PICControllerMode.WAITING || controller.Mode == PICControllerMode.PAUSED;

                rs232_link.Update(controller);
            }
            else
            {
                ClearRegister();
                ClearStackDisplay();

                IconBar.SetPC(0);

                lblFreqModel.Text          = FormatFreq(0);
                lblFreqView.Text           = FormatFreq(0);
                lblRunTime.Text            = FormatRuntime(0);
                lblRegW.Text               = "0x" + string.Format("{0:X02}", 0);
                lblRegPC.Text              = "0x" + string.Format("{0:X04}", 0);
                lblQuartzFreq.Text         = FormatFreq(0);
                btnSetQuartzFreq.IsEnabled = false;
                lblWatchDogTmr.Text        = string.Format("{0:000,000} %", 0);
                chkbxWatchdog.IsEnabled    = false;

                regClock_0.ResetUI();
                regClock_1.ResetUI();
                regClock_2.ResetUI();
                regClock_3.ResetUI();

                regClock_0.IsEnabled = false;
                regClock_1.IsEnabled = false;
                regClock_2.IsEnabled = false;
                regClock_3.IsEnabled = false;

                rs232_link.Update(controller);
            }

            txtCode.IsReadOnly = controller != null && controller.Mode != PICControllerMode.WAITING;
            CommandManager.InvalidateRequerySuggested();
        }