public SourceCodeLocation GetLocation(int lineNo) { if ((lineNo < 0) || (lineNo >= sourceCodeLines.Count)) { return(null); } SourceCodeLine line = sourceCodeLines[lineNo]; if ((line.LineNo < 0) && (lineNo > 0)) { line = sourceCodeLines[lineNo - 1]; if (line.LineNo < 0) { line = sourceCodeLines[lineNo - 2]; if (line.LineNo < 0) { return(null); } } } return(new SourceCodeLocation(line.FileName, line.FilePart, line.LineNo)); }
public PIC(string Sourcefile) { CrystalFrequencyType.DataChanged += _CrystalFrequencyType_DataChanged; CrystalFrequency.DataChanged += _CrystalFrequency_DataChanged; RunTimer.Tick += RunTimer_Tick; RunTimer.Interval = 5; RegisterMap = new RegisterFileMap(this); //Einlesen der lst Datei CurrentFile = (new FileInfo(Sourcefile).Name); BytecodeReader Reader = new BytecodeReader(); LSTLine[] LSTLines = Reader.ReadSourcecode(Sourcefile); // Aufteilen des Codes in Quellcode (ASM) und Bytecode SourceCode = new SourceCodeLine[LSTLines.Length]; List <BytecodeLine> ByteCode = new List <BytecodeLine>(); for (int X = 0; X < SourceCode.Length; X++) { SourceCode[X] = new SourceCodeLine(LSTLines[X]); if (LSTLines[X].ContainsBytecode) { ByteCode.Add(new BytecodeLine(LSTLines[X], X)); } } this.ByteCode = ByteCode.ToArray(); // Alle verfügbaren Funktionen werden in einem Array angeordnet (schneller als in einer Liste) List <BaseFunction> Functions = new List <BaseFunction>(); Functions.Add(new AddLW()); Functions.Add(new AddWF()); Functions.Add(new AndLW()); Functions.Add(new AndWF()); Functions.Add(new BcF()); Functions.Add(new BsF()); Functions.Add(new BtFSC()); Functions.Add(new BtFSS()); Functions.Add(new Call()); Functions.Add(new ClrF()); Functions.Add(new ClrW()); Functions.Add(new ClrWdt()); Functions.Add(new ComF()); Functions.Add(new DecF()); Functions.Add(new DecFSZ()); Functions.Add(new Goto()); Functions.Add(new IncF()); Functions.Add(new IncFSZ()); Functions.Add(new IOrLW()); Functions.Add(new IOrWF()); Functions.Add(new MovF()); Functions.Add(new MovLW()); Functions.Add(new MovWF()); Functions.Add(new NOP()); Functions.Add(new RetLW()); Functions.Add(new Return()); Functions.Add(new RlF()); Functions.Add(new RrF()); Functions.Add(new SubLW()); Functions.Add(new SubWF()); Functions.Add(new SwapF()); Functions.Add(new XOrLW()); Functions.Add(new XOrWF()); Functions.Add(new RetFIE()); this.Functions = Functions.ToArray(); TMR0 = new Timer.Timer0(this); EEProm = new EEPROM.EEPROM(this); ComPort = new SerialCom(this); }