private void assemblyPanel_MouseMove(object sender, MouseEventArgs e) { uint line; uint mem; if (!(Chip.GetCog(HostID) is NativeCog)) { return; } NativeCog host = (NativeCog)Chip.GetCog(HostID); line = (uint)positionScroll.Value + (uint)(e.Y / MonoFont.Height); if (line > 0x1FF) { return; } //Update tooltip only if line has change to prevent flickering if (line != LastLine) { mem = host.ReadLong(line); toolTip1.SetToolTip(assemblyPanel, String.Format("${0:x3}= ${1:x8}, {1}\n${2:x3}= ${3:x8}, {3}", mem >> 9 & 0x1ff, host.ReadLong(mem >> 9 & 0x1ff), mem & 0x1ff, host.ReadLong(mem & 0x1ff)) ); LastLine = line; } }
public void VideoBreak_Click(object sender, EventArgs e) { if (sender == breakNone) { breakNone.Checked = true; breakMiss.Checked = false; breakAll.Checked = false; breakVideo = FrameState.frameMiss; } if (sender == breakMiss) { breakNone.Checked = false; breakMiss.Checked = true; breakAll.Checked = false; breakVideo = FrameState.frameMiss; } if (sender == breakAll) { breakNone.Checked = true; breakMiss.Checked = false; breakAll.Checked = false; breakVideo = FrameState.frameNone; } Cog cog = Chip.GetCog(HostID); cog.VideoBreak = breakVideo; }
private void AssemblyView_Paint(object sender, PaintEventArgs e) { Cog host = Chip?.GetCog(HostID); if (host is NativeCog) { PaintNative(e.Graphics, (NativeCog)host); } else if (host is InterpretedCog) { PaintInterpreted(e.Graphics, (InterpretedCog)host); } }
private void assemblyPanel_MouseDown(object sender, MouseEventArgs e) { int bp = 0; if ((e.Button & MouseButtons.Left) == MouseButtons.Left) { //Make sure it's a valid breakpoint environment if (Chip == null) { return; } Cog Host = Chip.GetCog(HostID); if (Host == null) { return; } //Find the line that was clicked on bp = (assemblyPanel.PointToClient(MousePosition).Y / MonoFont.Height); //What type of cog? if (Host is NativeCog) { bp += positionScroll.Value; } else if (Host is InterpretedCog) { bp = (int)InterpAddress[bp + 1]; } //Toggle/move the breakpoint if (bp == Host.BreakPoint) { Host.BreakPoint = -1; } else { Host.BreakPoint = bp; } //Show the user what happened Repaint(false); } }
public Cog GetViewCog() { return(Chip.GetCog(HostID)); }
/// @brief Repaint the Cog state and data. /// @param force public override void Repaint(bool force) { if (Chip == null) { return; } Cog Host = Chip.GetCog(HostID); if (Host == null) { processorStateLabel.Text = "CPU State: Cog is stopped."; programCounterLabel.Text = ""; zeroFlagLabel.Text = ""; carryFlagLabel.Text = ""; return; } positionScroll.Minimum = 0; if (Host is InterpretedCog) { positionScroll.Maximum = 0xFFFF; } else if (Host is NativeCog) { positionScroll.Maximum = 0x200; } positionScroll.LargeChange = 10; positionScroll.SmallChange = 1; if (positionScroll.Maximum < positionScroll.Value) { positionScroll.Value = positionScroll.Maximum; } if (followPCButton.Checked) { uint topLine, bottomLine; topLine = 5; bottomLine = (uint)((ClientRectangle.Height / MonoFont.Height) - 5); if (Host is NativeCog) { if (Host.ProgramCursor < topLine) { positionScroll.Value = 0; } else if (Host.ProgramCursor - positionScroll.Value >= bottomLine - 1) { positionScroll.Value = (int)Host.ProgramCursor - (int)topLine; } else if (Host.ProgramCursor - positionScroll.Value < topLine) { positionScroll.Value = (int)Host.ProgramCursor - (int)topLine; } } else { positionScroll.Value = (int)Host.ProgramCursor; } } if (Host is NativeCog) { Repaint(force, (NativeCog)Host); } else if (Host is InterpretedCog) { Repaint(force, (InterpretedCog)Host); } programCounterLabel.Text = "PC: " + String.Format("{0:X8}", Host.ProgramCursor); processorStateLabel.Text = "CPU State: " + Host.CogState; assemblyPanel.CreateGraphics().DrawImageUnscaled(BackBuffer, 0, 0); }
/// @brief Repaint the Cog state and data. /// @param force public override void UpdateGui() { assemblyPanel.Invalidate(); Cog host = Chip?.GetCog(HostID); if (host == null) { processorStateLabel.Text = "CPU State: Cog is stopped."; programCounterLabel.Text = ""; zeroFlagLabel.Text = ""; carryFlagLabel.Text = ""; return; } positionScroll.Minimum = 0; if (host is InterpretedCog) { positionScroll.Maximum = PropellerCPU.TOTAL_MEMORY - 1; } else if (host is NativeCog) { positionScroll.Maximum = 0x200; } positionScroll.LargeChange = 10; positionScroll.SmallChange = 1; if (positionScroll.Maximum < positionScroll.Value) { positionScroll.Value = positionScroll.Maximum; } if (followPCButton.Checked) { uint topLine, bottomLine; topLine = 5; bottomLine = (uint)((ClientRectangle.Height / MonoFont.Height) - 5); if (host is NativeCog) { if (host.ProgramCursor < topLine) { positionScroll.Value = 0; } else if (host.ProgramCursor - positionScroll.Value >= bottomLine - 1) { positionScroll.Value = (int)host.ProgramCursor - (int)topLine; } else if (host.ProgramCursor - positionScroll.Value < topLine) { positionScroll.Value = (int)host.ProgramCursor - (int)topLine; } } else { positionScroll.Value = (int)host.ProgramCursor; } } if (host is NativeCog) { NativeCog nativeHost = (NativeCog)host; OpcodeSize.Visible = false; DisplayUnits.Visible = false; zeroFlagLabel.Text = "Zero: " + (nativeHost.ZeroFlag ? "True" : "False"); carryFlagLabel.Text = "Carry: " + (nativeHost.CarryFlag ? "True" : "False"); } else if (host is InterpretedCog) { zeroFlagLabel.Text = ""; carryFlagLabel.Text = ""; OpcodeSize.Visible = true; DisplayUnits.Visible = true; } programCounterLabel.Text = "PC: " + String.Format("{0:X8}", host.ProgramCursor); processorStateLabel.Text = "CPU State: " + host.CogState; }