Ejemplo n.º 1
0
        RichTextBoxWithLineNumbers.LineDrawArgs setTextFromLineNo(int lineno)
        {
            string       linenostr = lineno.ToString();
            LineDrawArgs ret       = new LineDrawArgs()
            {
                Text = linenostr
            };

            if (this.ProjectEditorComponent == null)
            {
                return(ret);
            }
            if (this.ProjectEditorComponent.Assembler == null)
            {
                return(ret);
            }
            if (this.ProjectEditorComponent.Assembler.Lines == null)
            {
                return(ret);
            }

            lineno--;

            if (lineno < this.ProjectEditorComponent.Assembler.Lines.Length)
            {
                Line line = this.ProjectEditorComponent.Assembler.Lines[lineno];

                if (line == null)
                {
                    ret.BackColor = Color.Red;
                    ret.ForeColor = Color.White;
                    return(ret);
                }

                ret.Text =
                    linenostr + " " +
                    (line.Org + Config.FileStartAddress).ToString("X5") +
                    ":" +
                    line.PC.ToString("X4");
                ret.ForeColor = Color.Blue;

                if (line.ThrownException != null)
                {
                    ret.BackColor = Color.Red;
                    ret.ForeColor = Color.White;
                }
            }

            return(ret);
        }
Ejemplo n.º 2
0
        RichTextBoxWithLineNumbers.LineDrawArgs setHexStringFromLineNo(int lineno)
        {
            LineDrawArgs ret = new LineDrawArgs()
            {
                Text = "-"
            };

            if (this.ProjectEditorComponent == null)
            {
                return(ret);
            }
            if (this.ProjectEditorComponent.Assembler == null)
            {
                return(ret);
            }
            if (this.ProjectEditorComponent.Assembler.Lines == null)
            {
                return(ret);
            }

            lineno--;

            if (lineno < this.ProjectEditorComponent.Assembler.Lines.Length)
            {
                Line line = this.ProjectEditorComponent.Assembler.Lines[lineno];

                if (line == null || line.ComputedBytes == null)
                {
                    return(ret);
                }

                ret.Text = string.Join(" ", (from b in line.ComputedBytes select b.ToString("X2")).ToArray());
            }

            return(ret);
        }