Exemple #1
0
 public void slewValue(Instruction.Value rate)
 {
 }
Exemple #2
0
 public void setValue(Instruction.Value value)
 {
     if (value.typ == Instruction.Type.BOOLEAN)
     {
         if (value.b)
             startTime = Planetarium.GetUniversalTime();
         else
             startTime = -1.0;
     }
 }
Exemple #3
0
 public void setValue(Instruction.Value value)
 {
     if (value.typ == Instruction.Type.BOOLEAN)
     {
         mValue = value.b;
         mChange = true;
     }
 }
Exemple #4
0
 public void setValue(Instruction.Value value)
 {
     if (value.typ == Instruction.Type.DOUBLE)
     {
         setTo(value.d);
     }
 }
Exemple #5
0
 public void slewValue(Instruction.Value rate)
 {
     if (rate.typ == Instruction.Type.DOUBLE)
     {
         mSlewRate += rate.d;
     }
 }
Exemple #6
0
 public void hibernate(Instruction src)
 {
     if (isHibernating) return;
     if (!instructions.Contains(src)) // can't happen
         throw new Instruction.ExecError("hibernated instruction not in program");
     hibernationLine = instructions.IndexOf(src);
     isHibernating = true;
     Logging.Log(string.Format("Hibernated from line {0:D}: {1}", hibernationLine, src.ToString()));
 }
Exemple #7
0
 public void setValue(Instruction.Value value)
 {
     if (value.typ == Instruction.Type.BOOLEAN && value.b)
     {
         mQueued++;
     }
 }
Exemple #8
0
 public bool AddInstruction(string text, bool lastValue, bool skip)
 {
     Instruction i;
     try
     {
         i = new Instruction(text);
     }
     catch (Instruction.ParseError exc)
     {
         Logging.Message(exc.ToString());
         return false;
     }
     if (i.imemWords > imemWords)
     {
         Logging.Message("Insufficient IMEM for " + i.mText);
         return false;
     }
     if (i.requiresLevelTrigger && !hasLevelTrigger)
     {
         Logging.Message("Processor does not support level triggers");
         Logging.Message("  " + i.mText);
         return false;
     }
     if (i.requiresLogicOps && !hasLogicOps)
     {
         Logging.Message("Processor does not support logical operators");
         Logging.Message("  " + i.mText);
         return false;
     }
     if (i.requiresArithOps && !hasArithOps)
     {
         Logging.Message("Processor does not support arithmetic operators");
         Logging.Message("  " + i.mText);
         return false;
     }
     instructions.Add(i);
     imemWords -= i.imemWords;
     //Logging.Log("Added instruction: " + i.mText);
     return true;
 }
Exemple #9
0
 public void setValue(Instruction.Value value)
 {
     if (value.typ == Instruction.Type.NAME)
     {
         mValue = value.n;
     }
     else if (value.typ == Instruction.Type.TUPLE && value.l.Count == 2)
     {
         Instruction.Value hdg = value.l[0], pitch = value.l[1];
         if (hdg.typ == Instruction.Type.DOUBLE && pitch.typ == Instruction.Type.DOUBLE)
         {
             mValue = string.Format("customHP({0},{1})", hdg.d, pitch.d);
             mHdg = hdg.d;
             mPitch = pitch.d;
         }
     }
     else if (value.typ == Instruction.Type.TUPLE && value.l.Count == 3)
     {
         Instruction.Value hdg = value.l[0], pitch = value.l[1], roll = value.l[2];
         if (hdg.typ == Instruction.Type.DOUBLE && pitch.typ == Instruction.Type.DOUBLE && roll.typ == Instruction.Type.DOUBLE)
         {
             mValue = string.Format("customHPR({0},{1},{2})", hdg.d, pitch.d, roll.d);
             mHdg = hdg.d;
             mPitch = pitch.d;
             mRoll = roll.d;
         }
     }
 }
Exemple #10
0
 public void setValue(Instruction.Value value)
 {
     if (value.typ == Instruction.Type.BOOLEAN)
     {
         mProcessor.latchState[mIndex] = value.b;
     }
 }
Exemple #11
0
 public void wake(Instruction.Value dest)
 {
     if (dest.typ != Instruction.Type.NAME)
         return;
     Processor pDest = mProcessor.findByName(dest.n);
     if (pDest == null)
     {
         Logging.Log(String.Format("No processor \"{0}\" found", dest.n));
         return;
     }
     pDest.wakeup();
 }
Exemple #12
0
 public void irq(Instruction.Value value)
 {
     Instruction.Value dest = null, vector = null;
     if (value.typ == Instruction.Type.TUPLE && value.l.Count == 2)
     {
         dest = value.l[0];
         vector = value.l[1];
     }
     else if (value.typ == Instruction.Type.NAME)
     {
         dest = value;
         vector = new Instruction.Value(0.0);
     }
     if (dest.typ != Instruction.Type.NAME)
         return;
     if (vector.typ != Instruction.Type.DOUBLE)
         return;
     Processor pDest = mProcessor.findByName(dest.n);
     if (pDest == null)
     {
         Logging.Log(String.Format("No processor \"{0}\" found", dest.n));
         return;
     }
     int vect = (int)Math.Round(vector.d);
     pDest.setLatch(vect);
 }