Ejemplo n.º 1
0
        public CodeLineData GetCodeLineData(int lineIndex)
        {
            AddressInfo?address = _symbolProvider.GetLineAddress(_file, lineIndex);

            CodeLineData data = new CodeLineData(_cpuType)
            {
                Address          = GetLineAddress(lineIndex),
                AbsoluteAddress  = address.HasValue ? address.Value.Address : -1,
                EffectiveAddress = -1,
                Flags            = LineFlags.VerifiedCode
            };

            //TODO

            /*if(prgAddress >= 0) {
             *      int opSize = DebugApi.GetDisassemblyOpSize(_prgRom[prgAddress]);
             *      string byteCode = "";
             *      for(int i = prgAddress, end = prgAddress + opSize; i < end && i < _prgRom.Length; i++) {
             *              byteCode += "$" + _prgRom[i].ToString("X2") + " ";
             *      }
             *      data.ByteCode = byteCode;
             * }*/

            string text    = _file.Data[lineIndex];
            string trimmed = text.TrimStart();

            data.CustomIndent = (text.Length - trimmed.Length) * 10;

            int commentIndex;

            if (_isC)
            {
                commentIndex = trimmed.IndexOf("//");
            }
            else
            {
                commentIndex = trimmed.IndexOfAny(new char[] { ';', '.' });
            }

            if (commentIndex >= 0)
            {
                data.Comment = trimmed.Substring(commentIndex);
                data.Text    = trimmed.Substring(0, commentIndex).TrimEnd();
            }
            else
            {
                data.Comment = "";
                data.Text    = trimmed;
            }

            return(data);
        }