Пример #1
0
        public override byte Calculate(PIC Pic, Data.BytecodeLine Line, byte Value)
        {
            int NewValue = Pic.WRegister.Value + Value;

            Pic.RegisterMap.CarryBit        = NewValue > 0xFF;
            Pic.RegisterMap.DigitalCarryBit = ((Pic.WRegister.Value & 0xF) + (Value & 0xF)) > 0xF;
            return((byte)NewValue);
        }
Пример #2
0
        public override byte Calculate(PIC Pic, Data.BytecodeLine Line, byte Value)
        {
            int NewValue = Value << 1;

            NewValue = NewValue + (Pic.RegisterMap.CarryBit ? 1 : 0);
            Pic.RegisterMap.CarryBit = (NewValue & 0x100) != 0;
            return((byte)NewValue);
        }
Пример #3
0
        public override bool Calculate(PIC Pic, Data.BytecodeLine Line, int Literal)
        {
            int NewValue = Pic.WRegister.Value ^ Literal;

            Pic.RegisterMap.ZeroBit = NewValue == 0;
            Pic.WRegister.Value     = (byte)NewValue;
            return(true);
        }
Пример #4
0
        public override void Execute(PIC Pic, Data.BytecodeLine Line)
        {
            int Command    = Line.Command;
            int RegAddress = Command & 0x7F;

            Pic.RegisterMap.Set(Pic.WRegister.Value, RegAddress);

            Pic.RegisterMap.ProgrammCounter++;
        }
Пример #5
0
        public override void Execute(PIC Pic, Data.BytecodeLine Line)
        {
            int NewAddress = Line.Command & 0x7FF;
            int PC         = Pic.RegisterMap.ProgrammCounter;

            Pic.Stack.Push(PC + 1);

            Pic.RegisterMap.ProgrammCounter = NewAddress;
        }
Пример #6
0
        public override byte Calculate(PIC Pic, Data.BytecodeLine Line, byte Value)
        {
            int CarryValue = Pic.RegisterMap.CarryBit ? 1 : 0;
            int NewCarry   = Value & 0x1;
            int NewValue   = CarryValue << 8 + Value >> 1;

            Pic.RegisterMap.CarryBit = NewCarry != 0;

            return((byte)NewValue);
        }
Пример #7
0
        public override bool Calculate(PIC Pic, Data.BytecodeLine Line, int Literal)
        {
            int NewValue = Literal - Pic.WRegister.Value;

            Pic.RegisterMap.CarryBit        = NewValue > 0;
            Pic.RegisterMap.DigitalCarryBit = ((Pic.WRegister.Value & 0xF) + (Literal & 0xF)) > 0xF;
            Pic.RegisterMap.ZeroBit         = NewValue == 0;
            Pic.WRegister.Value             = (byte)NewValue;
            return(true);
        }
Пример #8
0
        public override void Execute(PIC Pic, Data.BytecodeLine Line)
        {
            int Command = Line.Command;

            byte NewValue = 0;

            Pic.RegisterMap.ZeroBit = true;
            Pic.WRegister.Value     = NewValue;

            Pic.RegisterMap.ProgrammCounter++;
        }
Пример #9
0
        public override void Execute(PIC Pic, Data.BytecodeLine Line)
        {
            int Command    = Line.Command;
            int RegAddress = Command & 0x7F;

            byte NewValue = 0;

            Pic.RegisterMap.ZeroBit = true;
            Pic.RegisterMap.Set(NewValue, RegAddress);

            Pic.RegisterMap.ProgrammCounter++;
        }
Пример #10
0
        public override byte Calculate(PIC Pic, Data.BytecodeLine Line, byte Value)
        {
            int WComp = ~Pic.WRegister.Value;

            WComp += 0x1;

            int NewValue = Value + WComp;


            Pic.RegisterMap.CarryBit = NewValue >= 0;
            NewValue = (byte)NewValue;
            Pic.RegisterMap.DigitalCarryBit = (Value & 0xF) + (WComp & 0xF) > 0xF;
            return((byte)NewValue);
        }
Пример #11
0
        public override byte Calculate(PIC Pic, Data.BytecodeLine Line, byte Value)
        {
            byte NewValue = (byte)(Value + 1);

            if (NewValue == 0)
            {
                Cycles = 2;
                Pic.RegisterMap.ProgrammCounter++;
            }
            else
            {
                Cycles = 1;
            }
            return(NewValue);
        }
Пример #12
0
 public override bool Calculate(PIC Pic, Data.BytecodeLine Line, int Literal)
 {
     Pic.WRegister.Value             = (byte)Literal;
     Pic.RegisterMap.ProgrammCounter = Pic.Stack.Pop();
     return(false);
 }
Пример #13
0
 public override void Execute(PIC Pic, Data.BytecodeLine Line)
 {
     Pic.RegisterMap.ProgrammCounter = Pic.Stack.Pop();
 }
Пример #14
0
 public override byte Calculate(PIC Pic, Data.BytecodeLine Line, byte Value)
 {
     return((byte)~Value);
 }
Пример #15
0
 public override void Execute(PIC Pic, Data.BytecodeLine Line)
 {
     //TODO!
 }
Пример #16
0
 public override void Execute(PIC Pic, Data.BytecodeLine Line)
 {
     Pic.RegisterMap.ProgrammCounter       = Pic.Stack.Pop();
     Pic.RegisterMap.GlobalInterruptEnable = true;
 }
Пример #17
0
 public override byte Calculate(PIC Pic, Data.BytecodeLine Line, byte Value)
 {
     return((byte)(Pic.WRegister.Value & Value));
 }
Пример #18
0
        public override byte Calculate(PIC Pic, Data.BytecodeLine Line, byte Value)
        {
            int NewValue = Value >> 4 + ((Value & 0xF) << 4);

            return((byte)NewValue);
        }