예제 #1
0
        public override void Execute(PIC Pic, BytecodeLine Line)
        {
            int  Command    = Line.Command;
            int  RegAddress = Command & 0x7F;
            bool D          = (Command & 0x80) != 0;

            byte Value = Pic.RegisterMap.Get(RegAddress);

            Value = Calculate(Pic, Line, Value);

            if (AffectsZFlag)
            {
                Pic.RegisterMap.ZeroBit = Value == 0;
            }

            if (D)
            {
                Pic.RegisterMap.Set(Value, RegAddress);
            }
            else
            {
                Pic.WRegister.Value = Value;
            }

            Pic.RegisterMap.ProgrammCounter++;
        }
예제 #2
0
        public override void Execute(PIC Pic, BytecodeLine Line)
        {
            int Command = Line.Command;
            int Literal = Command & 0xFF;

            if (Calculate(Pic, Line, Literal))
            {
                Pic.RegisterMap.ProgrammCounter++;
            }
        }
예제 #3
0
 public override byte Calculate(PIC Pic, BytecodeLine Line, byte Value, int BitPosition)
 {
     if (!Helper.CheckBit(BitPosition, Value))
     {
         Cycles = 1;
     }
     else
     {
         Cycles = 2;
         Pic.RegisterMap.ProgrammCounter++; // Nächster Befehl muss übersprungen werden
     }
     return(Value);
 }
        public override void Execute(PIC Pic, BytecodeLine Line)
        {
            int Command     = Line.Command;
            int RegAddress  = Command & 0x7F;
            int BitPosition = (Command >> 7) & 0x7;

            byte Value    = Pic.RegisterMap.Get(RegAddress);
            byte NewValue = Calculate(Pic, Line, Value, BitPosition);

            if (Value != NewValue)
            {
                Pic.RegisterMap.Set(NewValue, RegAddress);
            }

            Pic.RegisterMap.ProgrammCounter++;
        }
예제 #5
0
 /// <summary>
 /// Führt die in Command kodierte Funktion aus
 /// </summary>
 /// <param name="Command">Befehl</param>
 /// <param name="Line">Zu Befehl gehörige Zeile</param>
 private void ExecuteFunction(int Command, BytecodeLine Line)
 {
     for (int X = 0; X < Functions.Length; X++)
     {
         BaseFunction Func = Functions[X];
         if (Func.Match(Command))
         {
             Func.Execute(this, Line);
             int Cycles = Func.Cycles;
             for (int C = 0; C < Cycles; C++)
             {
                 TMR0.Tick(false);
             }
             Runtime.Value += Cycles * CycleTime.Value;
             break;
         }
     }
 }
예제 #6
0
 public override void Execute(PIC Pic, BytecodeLine Line)
 {
     Pic.RegisterMap.ProgrammCounter++;
 }
예제 #7
0
 public override byte Calculate(PIC Pic, BytecodeLine Line, byte Value, int BitPosition)
 {
     return(Helper.SetBit(BitPosition, Value));
 }
예제 #8
0
 /// <summary>
 /// Wird vom Pic aufgerufen um die Funktion auszuführen. Der Programmcounter muss innerhalb dieses Aufrufes von der Funktion selbst erhöht werden.
 /// </summary>
 /// <param name="Pic"></param>
 /// <param name="Line">Aktuelle Bytecode Zeile</param>
 public abstract void Execute(PIC Pic, BytecodeLine Line);
예제 #9
0
 /// <summary>
 /// Wird vom Pic aufgerufen um festzustellen ob der aktuelle Befehl dieser Funktion entspricht
 /// </summary>
 /// <param name="Line">Aktuelle Bytecode Zeile</param>
 /// <returns></returns>
 public bool Match(BytecodeLine Line)
 {
     return(Match(Line.Command));
 }
예제 #10
0
 /// <summary>
 /// Berechnet den neuen Wert eines Registers
 /// </summary>
 /// <param name="Pic"></param>
 /// <param name="Line"></param>
 /// <param name="Value">Ausgelesener Wert</param>
 /// <returns>Neuer Wert</returns>
 public abstract byte Calculate(PIC Pic, BytecodeLine Line, byte Value);
 /// <summary>
 /// Berechnet den neuen Wert eines Registers
 /// </summary>
 /// <param name="Pic">Pic Context</param>
 /// <param name="Line">Aktuelle Quellcode Zeile</param>
 /// <param name="Value">Ausgelesener Wert</param>
 /// <param name="BitPosition">Bit Position Parameter</param>
 /// <returns>Neuer Wert</returns>
 public abstract byte Calculate(PIC Pic, BytecodeLine Line, byte Value, int BitPosition);
예제 #12
0
 /// <summary>
 /// Berechnet den neuen Wert eines Registers
 /// Der Wert wird / muss in dieser Funktion gesetzt werden
 /// </summary>
 /// <param name="Pic">Pic Context</param>
 /// <param name="Line">Aktuelle Quellcode Zeile</param>
 /// <param name="Literal">Literal Parameter</param>
 /// <returns>True wenn PC um 1 erhöht werden soll</returns>
 public abstract bool Calculate(PIC Pic, BytecodeLine Line, int Literal);