public void DisplayCurrentCode() { RefreshSourceMaps(); // // Select active files in the source file list // SourceFiles.ClearSelected(); foreach (SourceMap s in _sourceMaps) { foreach (string fileName in s.GetSourceFiles()) { for (int i = 0; i < SourceFiles.Items.Count; i++) { if (fileName == (string)SourceFiles.Items[i]) { SourceFiles.SetSelected(i, true); } } } } // // Find the source line that matches the current TPC, if any. // int tpc = _system.CP.TPC[(int)_system.CP.CurrentTask]; foreach (SourceMap s in _sourceMaps) { SourceEntry entry = s.GetExactSourceForAddress((ushort)tpc); if (entry != null) { // WE GOT ONE!!! SourceDisplay.AttachMap(s); SourceDisplay.SelectSourceEntry(entry, false, false /* cp */); // Select the source file in the source list for (int i = 0; i < SourceFiles.Items.Count; i++) { if (entry.SourcePath == (string)SourceFiles.Items[i]) { SourceFiles.SetSelected(i, true); } } break; } } // // Highlight the line in the disassembly as well. // Disassembly.SelectAddress(tpc); }