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); }
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); } } }
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; }