Beispiel #1
0
        /// <summary>
        /// Load the specified Input.
        /// </summary>
        /// <param name="Input">Input.</param>
        public override Executeable Load(byte[] Input)
        {
            DIFExecuteable Return = new DIFExecuteable();
            DIFInstruction cInst = new DIFInstruction(Instruction.OpType.Null);
            byte           cNow; int cPos = 0;

            while (cPos < Input.Length)
            {
                cNow = Input[cPos];
                switch (cNow)
                {
                case 0:
                    if (cInst.Op == Instruction.OpType.Null)
                    {
                        cInst = new DIFInstruction(OpTypeFromByte(Input[++cPos]));
                    }
                    else
                    {
                        cInst.Param.Add(cNow);
                    }
                    break;

                case 255:
                    Return.AddInst(cInst);
                    cInst = new DIFInstruction(Instruction.OpType.Null);
                    break;

                default:
                    cInst.Param.Add(cNow);
                    break;
                }
                cPos++;
            }
            return(Return);
        }
Beispiel #2
0
 /// <summary>
 /// Adds the instruction.
 /// </summary>
 /// <param name="ins">instruction.</param>
 public void AddInst(DIFInstruction ins)
 {
     insts.Add(ins);
 }