Пример #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);
        }
        public override void Execute(PICController controller)
        {
            PICWatchDogTimer wdt = controller.GetWatchDog();

            wdt.Reset();

            if (controller.GetUnbankedRegisterBit(PICMemory.ADDR_OPTION, PICMemory.OPTION_BIT_PSA))
            {
                controller.SetUnbankedRegisterBit(PICMemory.ADDR_OPTION, PICMemory.OPTION_BIT_PS0, false);
                controller.SetUnbankedRegisterBit(PICMemory.ADDR_OPTION, PICMemory.OPTION_BIT_PS1, false);
                controller.SetUnbankedRegisterBit(PICMemory.ADDR_OPTION, PICMemory.OPTION_BIT_PS2, false);
            }

            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_TO, true);
            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_PD, true);
        }
Пример #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)
        {
            uint Result = controller.GetBankedRegister(Register);

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

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

            uint Carry_Old = controller.GetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_C) ? 1u : 0u;
            uint Carry_New = (Result & 0x80) >> 7;

            Result  = Result << 1;
            Result &= 0xFF;

            Result |= Carry_Old;

            controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_C, Carry_New != 0);

            if (Target)
            {
                controller.SetBankedRegister(Register, Result);
            }
            else
            {
                controller.SetWRegister(Result);
            }
        }
Пример #7
0
 public override void Execute(PICController controller)
 {
     controller.SetBankedRegister(Register, 0x00);
     controller.SetUnbankedRegisterBit(PICMemory.ADDR_STATUS, PICMemory.STATUS_BIT_Z, true);
 }
Пример #8
0
 public override void Execute(PICController controller)
 {
     controller.SetPC_13Bit(controller.PopCallStack());
     controller.SetUnbankedRegisterBit(PICMemory.ADDR_INTCON, PICMemory.INTCON_BIT_GIE, true);
 }