mirror of
https://github.com/SourMesen/Mesen.git
synced 2025-04-02 10:52:48 -04:00
Debugger: Added more information to opcode tooltip
This commit is contained in:
parent
3a4bab270e
commit
d84c83e1e6
6 changed files with 303 additions and 87 deletions
|
@ -116,7 +116,7 @@ namespace Mesen.GUI.Config
|
|||
public int PpuDisplayScanline = 241;
|
||||
|
||||
public bool ShowCodePreview = true;
|
||||
public bool ShowOpCodeTooltips = false;
|
||||
public bool ShowOpCodeTooltips = true;
|
||||
|
||||
public bool ShowCpuMemoryMapping = true;
|
||||
public bool ShowPpuMemoryMapping = true;
|
||||
|
|
|
@ -382,17 +382,18 @@ namespace Mesen.GUI.Debugger
|
|||
private Point _previousLocation;
|
||||
private bool _preventCloseTooltip = false;
|
||||
private string _hoverLastWord = "";
|
||||
private int _hoverLastLineAddress = -1;
|
||||
|
||||
private void ShowTooltip(string word, Dictionary<string, string> values, int address)
|
||||
private void ShowTooltip(string word, Dictionary<string, string> values, int address, int lineAddress)
|
||||
{
|
||||
if(_hoverLastWord != word || _codeTooltip == null) {
|
||||
if(_hoverLastWord != word || _hoverLastLineAddress != lineAddress || _codeTooltip == null) {
|
||||
if(!_preventCloseTooltip && _codeTooltip != null) {
|
||||
_codeTooltip.Close();
|
||||
_codeTooltip = null;
|
||||
}
|
||||
|
||||
if(ConfigManager.Config.DebugInfo.ShowOpCodeTooltips && frmOpCodeTooltip.IsOpCode(word)) {
|
||||
_codeTooltip = new frmOpCodeTooltip(word);
|
||||
_codeTooltip = new frmOpCodeTooltip(word, lineAddress);
|
||||
} else {
|
||||
bool isPrgRom = false;
|
||||
if(address >= 0 && ConfigManager.Config.DebugInfo.ShowCodePreview) {
|
||||
|
@ -412,6 +413,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
_preventCloseTooltip = true;
|
||||
_hoverLastWord = word;
|
||||
_hoverLastLineAddress = lineAddress;
|
||||
}
|
||||
|
||||
private void ctrlCodeViewer_MouseLeave(object sender, EventArgs e)
|
||||
|
@ -465,7 +467,7 @@ namespace Mesen.GUI.Debugger
|
|||
if(label != null) {
|
||||
DisplayLabelTooltip(word, label);
|
||||
} else if(ConfigManager.Config.DebugInfo.ShowOpCodeTooltips && frmOpCodeTooltip.IsOpCode(word)) {
|
||||
ShowTooltip(word, null, -1);
|
||||
ShowTooltip(word, null, -1, ctrlCodeViewer.GetLineNumberAtPosition(e.Y));
|
||||
}
|
||||
}
|
||||
_previousLocation = e.Location;
|
||||
|
@ -482,7 +484,7 @@ namespace Mesen.GUI.Debugger
|
|||
{ "Value", $"${byteValue.ToString("X2")} (byte){Environment.NewLine}${wordValue.ToString("X4")} (word)" }
|
||||
};
|
||||
|
||||
ShowTooltip(word, values, (int)address);
|
||||
ShowTooltip(word, values, (int)address, -1);
|
||||
}
|
||||
|
||||
private void DisplayLabelTooltip(string word, CodeLabel label)
|
||||
|
@ -501,7 +503,7 @@ namespace Mesen.GUI.Debugger
|
|||
values["Comment"] = label.Comment;
|
||||
}
|
||||
|
||||
ShowTooltip(word, values, address);
|
||||
ShowTooltip(word, values, address, -1);
|
||||
}
|
||||
|
||||
private bool UpdateContextMenu(Point mouseLocation)
|
||||
|
|
|
@ -144,7 +144,8 @@ namespace Mesen.GUI.Debugger
|
|||
}
|
||||
}
|
||||
|
||||
if(int.TryParse(txtAddress.Text, NumberStyles.HexNumber, null, out int address)) {
|
||||
int address;
|
||||
if(int.TryParse(txtAddress.Text, NumberStyles.HexNumber, null, out address)) {
|
||||
if(address > maxValue) {
|
||||
return false;
|
||||
}
|
||||
|
|
248
GUI.NET/Debugger/frmOpCodeTooltip.Designer.cs
generated
248
GUI.NET/Debugger/frmOpCodeTooltip.Designer.cs
generated
|
@ -29,17 +29,25 @@
|
|||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.tlpMain = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.lblAffectedStatusFlags = new System.Windows.Forms.Label();
|
||||
this.lblName = new System.Windows.Forms.Label();
|
||||
this.lblOpCodeDescription = new System.Windows.Forms.Label();
|
||||
this.lblByteCode = new System.Windows.Forms.Label();
|
||||
this.lblAddressingMode = new System.Windows.Forms.Label();
|
||||
this.lblCycleCount = new System.Windows.Forms.Label();
|
||||
this.ctrlFlagNegative = new Mesen.GUI.Debugger.Controls.ctrlFlagStatus();
|
||||
this.ctrlFlagOverflow = new Mesen.GUI.Debugger.Controls.ctrlFlagStatus();
|
||||
this.ctrlFlagDecimal = new Mesen.GUI.Debugger.Controls.ctrlFlagStatus();
|
||||
this.ctrlFlagInterrupt = new Mesen.GUI.Debugger.Controls.ctrlFlagStatus();
|
||||
this.ctrlFlagZero = new Mesen.GUI.Debugger.Controls.ctrlFlagStatus();
|
||||
this.ctrlFlagCarry = new Mesen.GUI.Debugger.Controls.ctrlFlagStatus();
|
||||
this.lblName = new System.Windows.Forms.Label();
|
||||
this.lblOpCodeDescription = new System.Windows.Forms.Label();
|
||||
this.lblAffectedStatusFlags = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.tlpOpCodeInfo = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.panel1.SuspendLayout();
|
||||
this.tlpMain.SuspendLayout();
|
||||
this.tlpOpCodeInfo.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
|
@ -51,7 +59,7 @@
|
|||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(305, 96);
|
||||
this.panel1.Size = new System.Drawing.Size(305, 357);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// tlpMain
|
||||
|
@ -66,79 +74,43 @@
|
|||
this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 35F));
|
||||
this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 35F));
|
||||
this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tlpMain.Controls.Add(this.lblAffectedStatusFlags, 0, 2);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagNegative, 6, 3);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagOverflow, 5, 3);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagDecimal, 4, 3);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagInterrupt, 3, 3);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagZero, 2, 3);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagCarry, 1, 3);
|
||||
this.tlpMain.Controls.Add(this.lblAffectedStatusFlags, 0, 3);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagNegative, 6, 4);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagOverflow, 5, 4);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagDecimal, 4, 4);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagInterrupt, 3, 4);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagZero, 2, 4);
|
||||
this.tlpMain.Controls.Add(this.ctrlFlagCarry, 1, 4);
|
||||
this.tlpMain.Controls.Add(this.lblName, 0, 0);
|
||||
this.tlpMain.Controls.Add(this.lblOpCodeDescription, 0, 1);
|
||||
this.tlpMain.Controls.Add(this.tlpOpCodeInfo, 0, 2);
|
||||
this.tlpMain.Location = new System.Drawing.Point(0, 0);
|
||||
this.tlpMain.MaximumSize = new System.Drawing.Size(295, 0);
|
||||
this.tlpMain.MinimumSize = new System.Drawing.Size(295, 0);
|
||||
this.tlpMain.Name = "tlpMain";
|
||||
this.tlpMain.RowCount = 5;
|
||||
this.tlpMain.RowCount = 6;
|
||||
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
|
||||
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tlpMain.Size = new System.Drawing.Size(295, 92);
|
||||
this.tlpMain.Size = new System.Drawing.Size(295, 159);
|
||||
this.tlpMain.TabIndex = 0;
|
||||
//
|
||||
// ctrlFlagNegative
|
||||
// lblAffectedStatusFlags
|
||||
//
|
||||
this.ctrlFlagNegative.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagNegative.Location = new System.Drawing.Point(224, 69);
|
||||
this.ctrlFlagNegative.Name = "ctrlFlagNegative";
|
||||
this.ctrlFlagNegative.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagNegative.TabIndex = 6;
|
||||
//
|
||||
// ctrlFlagOverflow
|
||||
//
|
||||
this.ctrlFlagOverflow.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagOverflow.Location = new System.Drawing.Point(189, 69);
|
||||
this.ctrlFlagOverflow.Name = "ctrlFlagOverflow";
|
||||
this.ctrlFlagOverflow.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagOverflow.TabIndex = 5;
|
||||
//
|
||||
// ctrlFlagDecimal
|
||||
//
|
||||
this.ctrlFlagDecimal.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagDecimal.Location = new System.Drawing.Point(154, 69);
|
||||
this.ctrlFlagDecimal.Name = "ctrlFlagDecimal";
|
||||
this.ctrlFlagDecimal.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagDecimal.TabIndex = 4;
|
||||
//
|
||||
// ctrlFlagInterrupt
|
||||
//
|
||||
this.ctrlFlagInterrupt.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagInterrupt.Location = new System.Drawing.Point(119, 69);
|
||||
this.ctrlFlagInterrupt.Name = "ctrlFlagInterrupt";
|
||||
this.ctrlFlagInterrupt.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagInterrupt.TabIndex = 3;
|
||||
//
|
||||
// ctrlFlagZero
|
||||
//
|
||||
this.ctrlFlagZero.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagZero.Location = new System.Drawing.Point(84, 69);
|
||||
this.ctrlFlagZero.Name = "ctrlFlagZero";
|
||||
this.ctrlFlagZero.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagZero.TabIndex = 2;
|
||||
//
|
||||
// ctrlFlagCarry
|
||||
//
|
||||
this.ctrlFlagCarry.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagCarry.Location = new System.Drawing.Point(49, 69);
|
||||
this.ctrlFlagCarry.Name = "ctrlFlagCarry";
|
||||
this.ctrlFlagCarry.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagCarry.TabIndex = 1;
|
||||
this.lblAffectedStatusFlags.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblAffectedStatusFlags.AutoSize = true;
|
||||
this.tlpMain.SetColumnSpan(this.lblAffectedStatusFlags, 8);
|
||||
this.lblAffectedStatusFlags.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.lblAffectedStatusFlags.Location = new System.Drawing.Point(0, 104);
|
||||
this.lblAffectedStatusFlags.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.lblAffectedStatusFlags.Name = "lblAffectedStatusFlags";
|
||||
this.lblAffectedStatusFlags.Size = new System.Drawing.Size(108, 13);
|
||||
this.lblAffectedStatusFlags.TabIndex = 24;
|
||||
this.lblAffectedStatusFlags.Text = "Affected Status Flags";
|
||||
//
|
||||
// lblName
|
||||
//
|
||||
|
@ -165,25 +137,144 @@
|
|||
this.lblOpCodeDescription.TabIndex = 0;
|
||||
this.lblOpCodeDescription.Text = "Desc";
|
||||
//
|
||||
// lblAffectedStatusFlags
|
||||
// lblByteCode
|
||||
//
|
||||
this.lblAffectedStatusFlags.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblAffectedStatusFlags.AutoSize = true;
|
||||
this.tlpMain.SetColumnSpan(this.lblAffectedStatusFlags, 8);
|
||||
this.lblAffectedStatusFlags.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.lblAffectedStatusFlags.Location = new System.Drawing.Point(0, 53);
|
||||
this.lblAffectedStatusFlags.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||
this.lblAffectedStatusFlags.Name = "lblAffectedStatusFlags";
|
||||
this.lblAffectedStatusFlags.Size = new System.Drawing.Size(108, 13);
|
||||
this.lblAffectedStatusFlags.TabIndex = 24;
|
||||
this.lblAffectedStatusFlags.Text = "Affected Status Flags";
|
||||
this.lblByteCode.AutoSize = true;
|
||||
this.lblByteCode.Location = new System.Drawing.Point(101, 0);
|
||||
this.lblByteCode.Name = "lblByteCode";
|
||||
this.lblByteCode.Size = new System.Drawing.Size(56, 13);
|
||||
this.lblByteCode.TabIndex = 25;
|
||||
this.lblByteCode.Text = "Byte Code";
|
||||
//
|
||||
// lblAddressingMode
|
||||
//
|
||||
this.lblAddressingMode.AutoSize = true;
|
||||
this.lblAddressingMode.Location = new System.Drawing.Point(101, 13);
|
||||
this.lblAddressingMode.Name = "lblAddressingMode";
|
||||
this.lblAddressingMode.Size = new System.Drawing.Size(89, 13);
|
||||
this.lblAddressingMode.TabIndex = 26;
|
||||
this.lblAddressingMode.Text = "Addressing Mode";
|
||||
//
|
||||
// lblCycleCount
|
||||
//
|
||||
this.lblCycleCount.AutoSize = true;
|
||||
this.lblCycleCount.Location = new System.Drawing.Point(101, 26);
|
||||
this.lblCycleCount.Name = "lblCycleCount";
|
||||
this.lblCycleCount.Size = new System.Drawing.Size(64, 13);
|
||||
this.lblCycleCount.TabIndex = 27;
|
||||
this.lblCycleCount.Text = "Cycle Count";
|
||||
//
|
||||
// ctrlFlagNegative
|
||||
//
|
||||
this.ctrlFlagNegative.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagNegative.Location = new System.Drawing.Point(224, 120);
|
||||
this.ctrlFlagNegative.Name = "ctrlFlagNegative";
|
||||
this.ctrlFlagNegative.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagNegative.TabIndex = 6;
|
||||
//
|
||||
// ctrlFlagOverflow
|
||||
//
|
||||
this.ctrlFlagOverflow.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagOverflow.Location = new System.Drawing.Point(189, 120);
|
||||
this.ctrlFlagOverflow.Name = "ctrlFlagOverflow";
|
||||
this.ctrlFlagOverflow.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagOverflow.TabIndex = 5;
|
||||
//
|
||||
// ctrlFlagDecimal
|
||||
//
|
||||
this.ctrlFlagDecimal.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagDecimal.Location = new System.Drawing.Point(154, 120);
|
||||
this.ctrlFlagDecimal.Name = "ctrlFlagDecimal";
|
||||
this.ctrlFlagDecimal.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagDecimal.TabIndex = 4;
|
||||
//
|
||||
// ctrlFlagInterrupt
|
||||
//
|
||||
this.ctrlFlagInterrupt.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagInterrupt.Location = new System.Drawing.Point(119, 120);
|
||||
this.ctrlFlagInterrupt.Name = "ctrlFlagInterrupt";
|
||||
this.ctrlFlagInterrupt.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagInterrupt.TabIndex = 3;
|
||||
//
|
||||
// ctrlFlagZero
|
||||
//
|
||||
this.ctrlFlagZero.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagZero.Location = new System.Drawing.Point(84, 120);
|
||||
this.ctrlFlagZero.Name = "ctrlFlagZero";
|
||||
this.ctrlFlagZero.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagZero.TabIndex = 2;
|
||||
//
|
||||
// ctrlFlagCarry
|
||||
//
|
||||
this.ctrlFlagCarry.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.ctrlFlagCarry.Location = new System.Drawing.Point(49, 120);
|
||||
this.ctrlFlagCarry.Name = "ctrlFlagCarry";
|
||||
this.ctrlFlagCarry.Size = new System.Drawing.Size(20, 20);
|
||||
this.ctrlFlagCarry.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.label1.Location = new System.Drawing.Point(3, 0);
|
||||
this.label1.MaximumSize = new System.Drawing.Size(280, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(59, 13);
|
||||
this.label1.TabIndex = 28;
|
||||
this.label1.Text = "Byte Code:";
|
||||
//
|
||||
// tlpOpCodeInfo
|
||||
//
|
||||
this.tlpOpCodeInfo.ColumnCount = 2;
|
||||
this.tlpMain.SetColumnSpan(this.tlpOpCodeInfo, 8);
|
||||
this.tlpOpCodeInfo.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tlpOpCodeInfo.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tlpOpCodeInfo.Controls.Add(this.label2, 0, 1);
|
||||
this.tlpOpCodeInfo.Controls.Add(this.lblByteCode, 1, 0);
|
||||
this.tlpOpCodeInfo.Controls.Add(this.label1, 0, 0);
|
||||
this.tlpOpCodeInfo.Controls.Add(this.lblAddressingMode, 1, 1);
|
||||
this.tlpOpCodeInfo.Controls.Add(this.lblCycleCount, 1, 2);
|
||||
this.tlpOpCodeInfo.Controls.Add(this.label3, 0, 2);
|
||||
this.tlpOpCodeInfo.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tlpOpCodeInfo.Location = new System.Drawing.Point(0, 51);
|
||||
this.tlpOpCodeInfo.Margin = new System.Windows.Forms.Padding(0, 10, 0, 0);
|
||||
this.tlpOpCodeInfo.Name = "tlpOpCodeInfo";
|
||||
this.tlpOpCodeInfo.RowCount = 4;
|
||||
this.tlpOpCodeInfo.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tlpOpCodeInfo.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tlpOpCodeInfo.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tlpOpCodeInfo.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tlpOpCodeInfo.Size = new System.Drawing.Size(295, 41);
|
||||
this.tlpOpCodeInfo.TabIndex = 29;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.label2.Location = new System.Drawing.Point(3, 13);
|
||||
this.label2.MaximumSize = new System.Drawing.Size(280, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(92, 13);
|
||||
this.label2.TabIndex = 29;
|
||||
this.label2.Text = "Addressing Mode:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.label3.Location = new System.Drawing.Point(3, 26);
|
||||
this.label3.MaximumSize = new System.Drawing.Size(280, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(67, 13);
|
||||
this.label3.TabIndex = 30;
|
||||
this.label3.Text = "Cycle Count:";
|
||||
//
|
||||
// frmOpCodeTooltip
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.ClientSize = new System.Drawing.Size(305, 96);
|
||||
this.ClientSize = new System.Drawing.Size(305, 357);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
|
@ -199,6 +290,8 @@
|
|||
this.panel1.PerformLayout();
|
||||
this.tlpMain.ResumeLayout(false);
|
||||
this.tlpMain.PerformLayout();
|
||||
this.tlpOpCodeInfo.ResumeLayout(false);
|
||||
this.tlpOpCodeInfo.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -217,5 +310,12 @@
|
|||
private Controls.ctrlFlagStatus ctrlFlagCarry;
|
||||
private System.Windows.Forms.Label lblName;
|
||||
private System.Windows.Forms.Label lblAffectedStatusFlags;
|
||||
private System.Windows.Forms.Label lblByteCode;
|
||||
private System.Windows.Forms.Label lblAddressingMode;
|
||||
private System.Windows.Forms.Label lblCycleCount;
|
||||
private System.Windows.Forms.TableLayoutPanel tlpOpCodeInfo;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||
using System.Windows.Forms;
|
||||
using Mesen.GUI.Controls;
|
||||
using Mesen.GUI.Config;
|
||||
using Mesen.GUI.Forms;
|
||||
|
||||
namespace Mesen.GUI.Debugger
|
||||
{
|
||||
|
@ -102,12 +103,42 @@ namespace Mesen.GUI.Debugger
|
|||
return _descriptions.TryGetValue(text.ToLowerInvariant(), out desc);
|
||||
}
|
||||
|
||||
public frmOpCodeTooltip(string opcode)
|
||||
public frmOpCodeTooltip(string opcode, int relativeAddress)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
OpCodeDesc desc = _descriptions[opcode.ToLowerInvariant()];
|
||||
|
||||
if(relativeAddress >= 0) {
|
||||
byte opCode = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, (UInt32)relativeAddress);
|
||||
|
||||
int opSize = 1;
|
||||
switch(AddressingModes[opCode]) {
|
||||
case AddrMode.Abs: case AddrMode.AbsX: case AddrMode.AbsXW: case AddrMode.AbsY: case AddrMode.AbsYW: case AddrMode.Ind:
|
||||
opSize = 3;
|
||||
break;
|
||||
|
||||
case AddrMode.Imm: case AddrMode.IndX: case AddrMode.IndY: case AddrMode.IndYW: case AddrMode.Rel: case AddrMode.Zero: case AddrMode.ZeroX: case AddrMode.ZeroY:
|
||||
opSize = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
string byteCode = "";
|
||||
for(int i = 0; i < opSize; i++) {
|
||||
byte value = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, (UInt32)(relativeAddress + i));
|
||||
byteCode += "$" + value.ToString("X2") + " ";
|
||||
}
|
||||
|
||||
lblByteCode.Text = byteCode;
|
||||
lblAddressingMode.Text = ResourceHelper.GetEnumText(AddressingModes[opCode]);
|
||||
lblCycleCount.Text = OpCycles[opCode].ToString();
|
||||
if(OpCycles[opCode] != OpCyclesCrossed[opCode]) {
|
||||
lblCycleCount.Text += $" ({OpCyclesCrossed[opCode]} if page crossed)";
|
||||
}
|
||||
} else {
|
||||
tlpOpCodeInfo.Visible = false;
|
||||
}
|
||||
|
||||
ctrlFlagCarry.Letter = "C";
|
||||
ctrlFlagDecimal.Letter = "D";
|
||||
ctrlFlagInterrupt.Letter = "I";
|
||||
|
@ -131,11 +162,11 @@ namespace Mesen.GUI.Debugger
|
|||
base.OnShown(e);
|
||||
|
||||
this.Width = this.tlpMain.Width;
|
||||
this.Height = this.tlpMain.Height;
|
||||
this.Height = this.tlpMain.Height;
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum CpuFlag { None = 0, Carry = 1, Decimal = 2, Interrupt = 4, Negative = 8, Overflow = 16, Zero = 32}
|
||||
enum CpuFlag { None = 0, Carry = 1, Decimal = 2, Interrupt = 4, Negative = 8, Overflow = 16, Zero = 32 }
|
||||
|
||||
class OpCodeDesc
|
||||
{
|
||||
|
@ -150,7 +181,70 @@ namespace Mesen.GUI.Debugger
|
|||
Flags = flags;
|
||||
}
|
||||
}
|
||||
|
||||
enum AddrMode
|
||||
{
|
||||
None, Acc, Imp, Imm, Rel,
|
||||
Zero, Abs, ZeroX, ZeroY,
|
||||
Ind, IndX, IndY, IndYW,
|
||||
AbsX, AbsXW, AbsY, AbsYW
|
||||
}
|
||||
|
||||
private AddrMode[] AddressingModes = new AddrMode[256] {
|
||||
AddrMode.Imp, AddrMode.IndX, AddrMode.None, AddrMode.IndX, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Imp, AddrMode.Imm, AddrMode.Acc, AddrMode.Imm, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs,
|
||||
AddrMode.Rel, AddrMode.IndY, AddrMode.None, AddrMode.IndYW, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.Imp, AddrMode.AbsY, AddrMode.Imp, AddrMode.AbsYW,AddrMode.AbsX, AddrMode.AbsX, AddrMode.AbsXW,AddrMode.AbsXW,
|
||||
AddrMode.Abs, AddrMode.IndX, AddrMode.None, AddrMode.IndX, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Imp, AddrMode.Imm, AddrMode.Acc, AddrMode.Imm, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs,
|
||||
AddrMode.Rel, AddrMode.IndY, AddrMode.None, AddrMode.IndYW, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.Imp, AddrMode.AbsY, AddrMode.Imp, AddrMode.AbsYW,AddrMode.AbsX, AddrMode.AbsX, AddrMode.AbsXW,AddrMode.AbsXW,
|
||||
AddrMode.Imp, AddrMode.IndX, AddrMode.None, AddrMode.IndX, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Imp, AddrMode.Imm, AddrMode.Acc, AddrMode.Imm, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs,
|
||||
AddrMode.Rel, AddrMode.IndY, AddrMode.None, AddrMode.IndYW, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.Imp, AddrMode.AbsY, AddrMode.Imp, AddrMode.AbsYW,AddrMode.AbsX, AddrMode.AbsX, AddrMode.AbsXW,AddrMode.AbsXW,
|
||||
AddrMode.Imp, AddrMode.IndX, AddrMode.None, AddrMode.IndX, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Imp, AddrMode.Imm, AddrMode.Acc, AddrMode.Imm, AddrMode.Ind, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs,
|
||||
AddrMode.Rel, AddrMode.IndY, AddrMode.None, AddrMode.IndYW, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.Imp, AddrMode.AbsY, AddrMode.Imp, AddrMode.AbsYW,AddrMode.AbsX, AddrMode.AbsX, AddrMode.AbsXW,AddrMode.AbsXW,
|
||||
AddrMode.Imm, AddrMode.IndX, AddrMode.Imm, AddrMode.IndX, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Imp, AddrMode.Imm, AddrMode.Imp, AddrMode.Imm, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs,
|
||||
AddrMode.Rel, AddrMode.IndYW, AddrMode.None, AddrMode.IndYW, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroY, AddrMode.ZeroY, AddrMode.Imp, AddrMode.AbsYW,AddrMode.Imp, AddrMode.AbsYW,AddrMode.AbsXW,AddrMode.AbsXW,AddrMode.AbsYW,AddrMode.AbsYW,
|
||||
AddrMode.Imm, AddrMode.IndX, AddrMode.Imm, AddrMode.IndX, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Imp, AddrMode.Imm, AddrMode.Imp, AddrMode.Imm, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs,
|
||||
AddrMode.Rel, AddrMode.IndY, AddrMode.None, AddrMode.IndY, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroY, AddrMode.ZeroY, AddrMode.Imp, AddrMode.AbsY, AddrMode.Imp, AddrMode.AbsY, AddrMode.AbsX, AddrMode.AbsX, AddrMode.AbsY, AddrMode.AbsY,
|
||||
AddrMode.Imm, AddrMode.IndX, AddrMode.Imm, AddrMode.IndX, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Imp, AddrMode.Imm, AddrMode.Imp, AddrMode.Imm, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs,
|
||||
AddrMode.Rel, AddrMode.IndY, AddrMode.None, AddrMode.IndYW, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.Imp, AddrMode.AbsY, AddrMode.Imp, AddrMode.AbsYW,AddrMode.AbsX, AddrMode.AbsX, AddrMode.AbsXW,AddrMode.AbsXW,
|
||||
AddrMode.Imm, AddrMode.IndX, AddrMode.Imm, AddrMode.IndX, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Zero, AddrMode.Imp, AddrMode.Imm, AddrMode.Imp, AddrMode.Imm, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs, AddrMode.Abs,
|
||||
AddrMode.Rel, AddrMode.IndY, AddrMode.None, AddrMode.IndYW, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.ZeroX, AddrMode.Imp, AddrMode.AbsY, AddrMode.Imp, AddrMode.AbsYW,AddrMode.AbsX, AddrMode.AbsX, AddrMode.AbsXW,AddrMode.AbsXW,
|
||||
};
|
||||
|
||||
private int[] OpCycles = new int[256] {
|
||||
7, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 4, 4, 6, 6,
|
||||
2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7,
|
||||
6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 4, 4, 6, 6,
|
||||
2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7,
|
||||
6, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 3, 4, 6, 6,
|
||||
2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7,
|
||||
6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 5, 4, 6, 6,
|
||||
2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7,
|
||||
2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4,
|
||||
2, 6, 2, 6, 4, 4, 4, 4, 2, 5, 2, 5, 5, 5, 5, 5,
|
||||
2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4,
|
||||
2, 5, 2, 5, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 4,
|
||||
2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6,
|
||||
2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7,
|
||||
2, 6, 3, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6,
|
||||
2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 7
|
||||
};
|
||||
|
||||
private int[] OpCyclesCrossed = new int[256] {
|
||||
7, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 4, 4, 6, 6,
|
||||
3, 6, 2, 8, 4, 4, 6, 6, 2, 5, 2, 7, 5, 5, 7, 7,
|
||||
6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 4, 4, 6, 6,
|
||||
3, 6, 2, 8, 4, 4, 6, 6, 2, 5, 2, 7, 5, 5, 7, 7,
|
||||
6, 6, 2, 8, 3, 3, 5, 5, 3, 2, 2, 2, 3, 4, 6, 6,
|
||||
3, 6, 2, 8, 4, 4, 6, 6, 2, 5, 2, 7, 5, 5, 7, 7,
|
||||
6, 6, 2, 8, 3, 3, 5, 5, 4, 2, 2, 2, 5, 4, 6, 6,
|
||||
3, 6, 2, 8, 4, 4, 6, 6, 2, 5, 2, 7, 5, 5, 7, 7,
|
||||
2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4,
|
||||
3, 6, 2, 6, 4, 4, 4, 4, 2, 5, 2, 5, 5, 5, 5, 5,
|
||||
2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4,
|
||||
3, 6, 2, 5, 4, 4, 4, 4, 2, 5, 2, 5, 5, 5, 5, 5,
|
||||
2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6,
|
||||
3, 6, 2, 8, 4, 4, 6, 6, 2, 5, 2, 7, 5, 5, 7, 7,
|
||||
2, 6, 3, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6,
|
||||
3, 6, 2, 8, 4, 4, 6, 6, 2, 5, 2, 7, 5, 5, 7, 7,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -319,6 +319,25 @@
|
|||
<Value ID="SaveRam">Save RAM</Value>
|
||||
<Value ID="InternalRam">Built-in NES RAM</Value>
|
||||
</Enum>
|
||||
<Enum ID="AddrMode">
|
||||
<Value ID="None">None</Value>
|
||||
<Value ID="Acc">Accumulator</Value>
|
||||
<Value ID="Imp">Implicit</Value>
|
||||
<Value ID="Imm">Immediate</Value>
|
||||
<Value ID="Rel">Relative</Value>
|
||||
<Value ID="Zero">Zero Page</Value>
|
||||
<Value ID="Abs">Absolute</Value>
|
||||
<Value ID="ZeroX">Zero Page, X</Value>
|
||||
<Value ID="ZeroY">Zero Page, Y</Value>
|
||||
<Value ID="Ind">Indirect</Value>
|
||||
<Value ID="IndX">Indexed Indirect</Value>
|
||||
<Value ID="IndY">Indirect Indexed</Value>
|
||||
<Value ID="IndYW">Indirect Indexed</Value>
|
||||
<Value ID="AbsX">Absolute, X</Value>
|
||||
<Value ID="AbsXW">Absolute, X</Value>
|
||||
<Value ID="AbsY">Absolute, Y</Value>
|
||||
<Value ID="AbsYW">Absolute, Y</Value>
|
||||
</Enum>
|
||||
<Enum ID="StatusFlagFormat">
|
||||
<Value ID="Hexadecimal">Hexadecimal</Value>
|
||||
<Value ID="Text">Text</Value>
|
||||
|
|
Loading…
Add table
Reference in a new issue