Example #1
0
        private bool compile()
        {
            instructions = new List <KPU.Processor.Instruction>();
            mLoaded      = false;
            int imemWords = 0;

            foreach (string line in mText.Split('\n'))
            {
                if (line.Length == 0)
                {
                    continue;
                }
                KPU.Processor.Instruction i;
                try
                {
                    i = new KPU.Processor.Instruction(line);
                }
                catch (KPU.Processor.Instruction.ParseError exc)
                {
                    Logging.Message("Bad line " + line);
                    Logging.Message(exc.ToString());
                    return(false);
                }
                instructions.Add(i);
                imemWords += i.imemWords;
            }
            Logging.Message(string.Format("Output IMEM: {0:D} words", imemWords));
            return(true);
        }
Example #2
0
 public void Load(ConfigNode node)
 {
     if (node.HasValue("programName"))
         name = node.GetValue("programName");
     if (node.HasValue("programDesc"))
         description = Util.unEscapeNewlines(node.GetValue("programDesc"));
     if (node.HasNode("Instructions"))
     {
         ConfigNode iln = node.GetNode("Instructions");
         foreach (string isn in iln.GetValues("code"))
         {
             KPU.Processor.Instruction insn = new KPU.Processor.Instruction(isn);
             code.Add(insn);
         }
     }
 }
Example #3
0
 private bool compile()
 {
     instructions = new List<KPU.Processor.Instruction>();
     mLoaded = false;
     int imemWords = 0;
     foreach (string line in mText.Split('\n'))
     {
         if (line.Length == 0) continue;
         KPU.Processor.Instruction i;
         try
         {
             i = new KPU.Processor.Instruction(line);
         }
         catch (KPU.Processor.Instruction.ParseError exc)
         {
             Logging.Message("Bad line " + line);
             Logging.Message(exc.ToString());
             return false;
         }
         instructions.Add(i);
         imemWords += i.imemWords;
     }
     Logging.Message(string.Format("Output IMEM: {0:D} words", imemWords));
     return true;
 }
Example #4
0
 public void Load(ConfigNode node)
 {
     if (node.HasValue("programName"))
         name = node.GetValue("programName");
     if (node.HasValue("programDesc"))
         description = Util.unEscapeNewlines(node.GetValue("programDesc"));
     if (node.HasNode("Instructions"))
     {
         ConfigNode iln = node.GetNode("Instructions");
         foreach (string isn in iln.GetValues("code"))
         {
             KPU.Processor.Instruction insn = new KPU.Processor.Instruction(isn);
             code.Add(insn);
         }
     }
 }