T8SuitePro.Disassembler.findLabels C# (CSharp) Method

findLabels() private method

private findLabels ( string inputfile ) : CommonSuite.MNemonicCollection
inputfile string
return CommonSuite.MNemonicCollection
        private MNemonicCollection findLabels(string inputfile)
        {
            _labels = new MNemonicCollection();
            uint i, t, seg, adr;
            long addr, endaddr, adrcntr, trgaddr, trgaddr1, trgaddr2, trgaddr3, offaddr;

            byte ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10;
            //byte n1, n2, n3, n4;
            //uint infile = 0, outfile = 0,
            uint addoff = 0;
            string inname, outname, offsetval;
            //byte inname[80], outname[80], offsetval[40];
            //byte str[80],cmd[80];
            string str, cmd;
            str = string.Empty;
            for (int temp = 0; temp < 8; temp++)
            {
                A_reg.SetValue(0, temp);
                D_reg.SetValue(0, temp);
            }
            swap = 0;
            addr = offaddr = 0;

            inname = inputfile;
            adrcntr = 0L;
            FileStream fsbr = new FileStream(inname, FileMode.Open, FileAccess.Read);
            if (fsbr == null) return _labels;
            BinaryReader br = new BinaryReader(fsbr);
            if (br == null)
            {
                fsbr.Close();
                return _labels;
            }
            fsbr.Position = addr;
            adrcntr = addr;
            // iterate through all functions
            // first get all the pointers to work from
            func_count = 0;
            FileInfo fi = new FileInfo(inputfile);
            CastProgressEvent("Start analyzing", 0, ProgressType.PassOne);
            long[] adresses = Trionic8File.GetVectorAddresses(inputfile);
            for (int vec = 1; vec < adresses.Length; vec++)
            {
                int percentage = (vec * 100) / adresses.Length;
                CastProgressEvent("Analyzing", percentage, ProgressType.PassOne);
                long vector = adresses[vec];

                if (vector != 0 && vector < fi.Length)
                {
                    try
                    {
                        LoadLabels(vector, fsbr, br, 0);
                    }
                    catch (Exception E)
                    {
                        logger.Debug("Failed to handle vector: " + E.Message);
                    }
                }
            }

            logger.Debug("Found " + _labels.Count.ToString() + " in pass one");
            foreach (MNemonicHelper label in _labels)
            {
                if (label.Address == adresses[1]) logger.Debug("Found start pointer!");
            }
            return _labels;
        }