public static void AnalyseLoop(TraceFile traceFile)
        {
            List <TraceLine> instructions = traceFile.FindInstruction("DBFa");
            TraceLine        line         = instructions.First();

            System.Console.WriteLine(String.Format("{0}: {1} - D1: {2}", line.address, line.instruction, line.D1));
            for (int lineIndex = 0; lineIndex < traceFile.linesInOrder.Count; lineIndex++)
            {
                string address = traceFile.linesInOrder[lineIndex].address;
                if (line.instruction.Contains(address.Substring(3).Trim()))
                {
                    System.Console.WriteLine(String.Format("{0}: {1} - A5: {2} A4: {3}", traceFile.addressesToLines[address].address, traceFile.addressesToLines[address].instruction, traceFile.addressesToLines[address].A5, traceFile.addressesToLines[address].A4));
                    while (line.address != address)
                    {
                        address = traceFile.linesInOrder[++lineIndex].address;
                        System.Console.WriteLine(String.Format("{0}: {1} - {2} A4: {3}", traceFile.addressesToLines[address].address, traceFile.addressesToLines[address].instruction, traceFile.addressesToLines[address].A5, traceFile.addressesToLines[address].A4));
                    }
                    break;
                }
            }
        }
Esempio n. 2
0
        public void LoadTraceFile()
        {
            if (fileLoaded)
            {
                return;
            }
            var fs = new FileStream(nameAndPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

            using (var sr = new StreamReader(fs))
            {
                var task = Task.Factory.StartNew(() =>
                {
                    stopLoadingTraceFile = false;
                    Console.WriteLine("Reading Trace File, press A to Abort");
                    while (Console.ReadKey().Key != ConsoleKey.A && !fileLoaded)
                    {
                        Thread.Sleep(1);
                    }
                    stopLoadingTraceFile = true;
                });

                while (!stopLoadingTraceFile)
                {
                    string line = sr.ReadLine();
                    if (line == null)
                    {
                        fileLoaded = true;
                        break;
                    }
                    if (line.Length < 14)
                    {
                        continue;
                    }
                    string address = line.Substring(0, 7);
                    addressesToLines[address] = new TraceLine(line);
                    linesInOrder.Add(new TraceLine(line));
                    Thread.Sleep(1);
                }
            }
        }