public static InstructionSet ReadLst(string file) { Regex rgxZahl = new Regex(@"^[0-9]$*"); InstructionSet result = new InstructionSet(); // einlesen LST-File mithilfe Filepfad StreamReader sr = new StreamReader(file); // jeweils aktuelle Zeile string line; int counter = 0; while ((line = sr.ReadLine()) != null) { // Mind. 9 Zeichen für valide Addresse mit Opcode if (line.Length < 9) { result.AddLine(line); } else { if (IsNotEmpty(line.Substring(0, 4)) && IsNotEmpty(line.Substring(5, 4))) { result.AddInstruction(ParseInstruction(line.Substring(5, 4)), counter); } } result.AddLine(line); counter++; // Regex Prüfung ob Zeile (line) mit Zahl beginnt //if (rgxZahl.IsMatch(line)) //{ // Aufsplittung der Zeile (line) an Leerzeichen // string[] ausgabe = line.Split(' '); // result.AddInstruction(ParseInstruction(ausgabe[1])); //} } return(result); }
public void LoadLST(String filename) { instructionSet = InstructionDecoder.ReadLst(filename); Program.mainForm.HighlightLine(instructionSet.GetFirstInstruction().GetLineNumber()); }
public PicSimulator() { instructionSet = new InstructionSet(); registerSet = new RegisterSet(); }