Ejemplo n.º 1
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Event handler. Called by TextArea for margin click events. </summary>
        ///
        /// <remarks> 19/09/2018. </remarks>
        ///
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e">	  Margin click event information. </param>
        /// -------------------------------------------------------------------------------------------------
        private void TextArea_MarginClick(object sender, MarginClickEventArgs e)
        {
            if (!Program.InStepMode)
            {
                return;
            }

            MarginClicked = true;

            //Console.WriteLine("TextArea_MarginClick");



            Scintilla s = (Scintilla)sender;

            if (e.Margin == CODE_MARGIN || e.Margin == BREAKPOINT_MARGIN)
            {
                const uint mask    = (1 << BREAKPOINT_MARKER);
                int        linenum = s.LineFromPosition(e.Position);
                var        line    = s.Lines[linenum];

                TraceFile tf = TraceFile.FindTraceFile((string)s.Tag);

                if ((string)s.Tag == "Dissassembly")
                {
                    tf = DisasmCodeFile;
                }

                //Section sec = FindSection((string)s.Tag);

                if (tf != null && tf.IsLineLegal(linenum))
                {
                    //Console.WriteLine("Line Ok");
                    LineData ld = tf.GetLine(linenum);

                    if ((line.MarkerGet() & mask) > 0)
                    {
                        // Remove existing breakpoint

                        Program.serialport.RemoveBreakpoint(null, ld.nextAddress.GetAddr(), ld.nextAddress.GetBank());
                        MainForm.myBreakpoints.RequestUpdate();
                    }
                    else
                    {
                        // Add breakpoint
                        Program.serialport.SetBreakpoint(null, ld.nextAddress.GetAddr(), ld.nextAddress.GetBank());
                        MainForm.myBreakpoints.RequestUpdate();

                        Console.WriteLine("Add breakpoint " + ld.nextAddress.GetAddr().ToString("X4") + " " + ld.nextAddress.GetBank());
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Event handler. Called by Codewindow for mouse down events. </summary>
        ///
        /// <remarks> 18/09/2018. </remarks>
        ///
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e">	  Mouse event information. </param>
        /// -------------------------------------------------------------------------------------------------
        private void Codewindow_MouseDown(object sender,
                                          System.Windows.Forms.MouseEventArgs e)
        {
            Scintilla s = (Scintilla)sender;

            if (e.Button == MouseButtons.Right)
            {
                ContextMenu cm = new ContextMenu();

                int position = s.CharPositionFromPoint(e.X, e.Y);


                int linenum = s.LineFromPosition(position);
                var line    = s.Lines[linenum];

                TraceFile tf = TraceFile.FindTraceFile((string)s.Tag);
                if (tf != null)
                {
                    LineData ld   = tf.GetLine(linenum);
                    string   word = s.GetWordFromPosition(position);

                    //step mode and on valid line add a set pc option
                    if (tf.IsLineLegal(linenum) && Program.InStepMode)
                    {
                        cm.MenuItems.Add(new CustomMenuItem("Set PC to $" + ld.address.ToString("X4"), new EventHandler(ContextSetPC), (object)ld.address));
                    }

                    if (!string.IsNullOrEmpty(word))
                    {
                        Labels.Label l = Labels.FindLabel(word);
                        if (l != null)
                        {
                            if (!l.function)
                            {
                                cm.MenuItems.Add(new CustomMenuItem("Add Variable " + l.label + " to Watch", new EventHandler(ContextAddToWatch), (object)l));
                            }
                        }
                    }


                    cm.MenuItems.Add("item2");
                    //ContextMenu cm = new ContextMenu();
                    //{
                    //	MenuItem mi = new MenuItem("coming soon2 "+word);//  ,   (s, ea) => this.UndoRedo.Undo());
                    //	cm.MenuItems.Add(mi);
                    //}
                    tf.codefile.codewindow.ContextMenu = cm;
                }
            }

            Console.WriteLine("hello");
        }
Ejemplo n.º 3
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Event handler. Called by Codewindow for mouse down events. </summary>
        ///
        /// <remarks> 18/09/2018. </remarks>
        ///
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e">	  Mouse event information. </param>
        /// -------------------------------------------------------------------------------------------------
        private void Codewindow_MouseDown(object sender,
                                          System.Windows.Forms.MouseEventArgs e)
        {
            Scintilla s = (Scintilla)sender;

            if (e.Button == MouseButtons.Right)
            {
                ContextMenu cm = new ContextMenu();

                int position = s.CharPositionFromPoint(e.X, e.Y);


                int linenum = s.LineFromPosition(position);
                var line    = s.Lines[linenum];

                TraceFile tf = TraceFile.FindTraceFile((string)s.Tag);
                if (tf != null)
                {
                    LineData ld   = tf.GetLine(linenum);
                    string   word = s.GetWordFromPosition(position);

                    //step mode and on valid line add a set pc option
                    if (tf.IsLineLegal(linenum) && Program.InStepMode)
                    {
                        //cm.MenuItems.Add(new CustomMenuItem( "Set PC to $"+ld.address.ToString("X4"),new EventHandler(ContextSetPC),(object)ld.address ) );

                        const uint mask = (1 << BREAKPOINT_MARKER);
                        if ((line.MarkerGet() & mask) > 0)
                        {
                            cm.MenuItems.Add(new CustomMenuItem("Clear breakpoint", new EventHandler(ContextClearBreakpoint), (object)ld.nextAddress.GetLongAddress()));
                        }
                        else
                        {
                            cm.MenuItems.Add(new CustomMenuItem("Set breakpoint", new EventHandler(ContextSetBreakpoint), (object)ld.nextAddress.GetLongAddress()));
                        }
                    }

                    if (!string.IsNullOrEmpty(word))
                    {
                        Labels.Label l = Labels.FindLabel(word);
                        if (l != null)
                        {
                            //if (!l.function)
                            //{
                            cm.MenuItems.Add(new CustomMenuItem("ADD TO WATCH: " + l.label + " " + l.nextAddress.ToString("b") + "", new EventHandler(ContextAddToWatch), (object)l));
                            cm.MenuItems.Add(new CustomMenuItem("JUMP TO: " + l.label + " " + l.nextAddress.ToString("b"), new EventHandler(ContextGotoAddress), (object)l));
                            //}
                        }
                    }


                    //cm.MenuItems.Add("item3");
                    //ContextMenu cm = new ContextMenu();
                    //{
                    //	MenuItem mi = new MenuItem("coming soon2 "+word);//  ,   (s, ea) => this.UndoRedo.Undo());
                    //	cm.MenuItems.Add(mi);
                    //}
                    tf.codefile.codewindow.ContextMenu = cm;
                }
            }
        }
Ejemplo n.º 4
0
            // -------------------------------------------------------------------------------------------------
            // Gets a line
            //
            // \param   line
            // The line.
            //
            // \return  The line.
            // -------------------------------------------------------------------------------------------------
            public LineData GetLine(int line)
            {
                TraceFile s = TraceFile.FindTraceFile(TraceFileName);

                return(s.GetLine(line));
            }
Ejemplo n.º 5
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Event handler. Called by TextArea for margin click events. </summary>
        ///
        /// <remarks> 19/09/2018. </remarks>
        ///
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e">	  Margin click event information. </param>
        /// -------------------------------------------------------------------------------------------------
        private void TextArea_MarginClick(object sender, MarginClickEventArgs e)
        {
            if (!Program.InStepMode)
            {
                return;
            }

            MarginClicked = true;

            //Console.WriteLine("TextArea_MarginClick");



            Scintilla s = (Scintilla)sender;

            if (e.Margin == CODE_MARGIN || e.Margin == BREAKPOINT_MARGIN)
            {
                const uint mask    = (1 << BREAKPOINT_MARKER);
                int        linenum = s.LineFromPosition(e.Position);
                var        line    = s.Lines[linenum];

                TraceFile tf = TraceFile.FindTraceFile((string)s.Tag);
                //Section sec = FindSection((string)s.Tag);

                if (tf != null && tf.IsLineLegal(linenum))
                {
                    //Console.WriteLine("Line Ok");
                    LineData ld = tf.GetLine(linenum);

                    //Form1.commsthread.AddCommand(Command.disassmblememory, 50, " " + ld.Addess.ToString("X4") + "H 256");


                    //now request memory and display is asm window


                    if ((line.MarkerGet() & mask) > 0)
                    {
                        // Remove existing breakpoint
                        //line.MarkerDelete(BOOKMARK_MARKER);
                        //line.MarkerDelete(BREAKPOINT_MARKER);
                        if (Breakpoint.RemoveBreakPointAtAddress(ld.address))
                        {
                        }


                        //Form1.commsthread.AddCommand(Command.direct, 76, "disable-breakpoint 1");
                    }
                    else
                    {
                        // Add breakpoint
                        if (Breakpoint.SetBreakPoint(ld.address, Breakpoint.BreakpointType.PC,
                                                     "PC=" + ld.address.ToString("X4") + "H", tf.filename, linenum))
                        {
                        }
                        //
                        //
                        //
                        //if (Program.AddBreakpoint(ld.address))
                        //{
                        //	line.MarkerAdd(BREAKPOINT_MARKER);

                        //}
                        //
                        //line.MarkerAdd(BOOKMARK_MARKER);

                        //LineData ld = cf.GetLine(linenum);

                        //Form1.commsthread.AddCommand(Command.setbreakpointaction, 76, " 1 break");
                        //Form1.commsthread.AddCommand(Command.setbreakpoint, 75, " 1 PC="+ld.Addess.ToString("x4")+"H");
                        //Form1.commsthread.AddCommand(Command.direct, 74, "enable-breakpoint 1");
                    }
                }
            }


/*			if (e.Margin == BOOKMARK_MARGIN)
 *                      {
 *
 *                              CodeFile cf = GetCodeFileFromSection((string)s.Tag);
 *
 *
 *
 *                              // Do we have a marker for this line?
 *                              const uint mask = (1 << BOOKMARK_MARKER);
 *                              int linenum = s.LineFromPosition(e.Position);
 *                              var line = s.Lines[linenum];
 *
 *
 *                              if (cf.IsLineLegal(linenum))
 *                              {
 *                                      if ((line.MarkerGet() & mask) > 0)
 *                                      {
 *                                              // Remove existing breakpoint
 *                                              line.MarkerDelete(BOOKMARK_MARKER);
 *                                              line.MarkerDelete(BREAKPOINT_MARKER);
 *
 *
 *                                              //Form1.commsthread.AddCommand(Command.direct, 76, "disable-breakpoint 1");
 *
 *
 *                                      }
 *                                      else
 *                                      {
 *                                              // Add breakpoint
 *                                              line.MarkerAdd(BOOKMARK_MARKER);
 *                                              line.MarkerAdd(BREAKPOINT_MARKER);
 *
 *                                              LineData ld = cf.GetLine(linenum);
 *
 *                                              //Form1.commsthread.AddCommand(Command.setbreakpointaction, 76, " 1 break");
 *                                              Form1.commsthread.AddCommand(Command.setbreakpoint, 75, " 1 PC="+ld.Addess.ToString("x4")+"H");
 *                                              //Form1.commsthread.AddCommand(Command.direct, 74, "enable-breakpoint 1");
 *
 *                                      }
 *
 *                              }
 *
 *
 *
 *                      }*/
        }