diff --git a/BizHawk.Client.EmuHawk/tools/Atari2600/Atari2600Debugger.Designer.cs b/BizHawk.Client.EmuHawk/tools/Atari2600/Atari2600Debugger.Designer.cs index d715b6197d..596c56fe74 100644 --- a/BizHawk.Client.EmuHawk/tools/Atari2600/Atari2600Debugger.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Atari2600/Atari2600Debugger.Designer.cs @@ -78,6 +78,8 @@ this.FrameCountBox = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.TracerBox = new System.Windows.Forms.GroupBox(); + this.StepOverButton = new System.Windows.Forms.Button(); + this.StepOutButton = new System.Windows.Forms.Button(); this.TraceView = new BizHawk.Client.EmuHawk.VirtualListView(); this.Script = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.DebuggerMenu.SuspendLayout(); @@ -174,14 +176,14 @@ this.StepBtn.Name = "StepBtn"; this.StepBtn.Size = new System.Drawing.Size(75, 23); this.StepBtn.TabIndex = 1; - this.StepBtn.Text = "&Step"; + this.StepBtn.Text = "Step &Into"; this.StepBtn.UseVisualStyleBackColor = true; this.StepBtn.Click += new System.EventHandler(this.StepBtn_Click); // // ScanlineAdvanceBtn // this.ScanlineAdvanceBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.ScanlineAdvanceBtn.Location = new System.Drawing.Point(645, 56); + this.ScanlineAdvanceBtn.Location = new System.Drawing.Point(645, 117); this.ScanlineAdvanceBtn.Name = "ScanlineAdvanceBtn"; this.ScanlineAdvanceBtn.Size = new System.Drawing.Size(75, 23); this.ScanlineAdvanceBtn.TabIndex = 2; @@ -192,7 +194,7 @@ // FrameAdvButton // this.FrameAdvButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.FrameAdvButton.Location = new System.Drawing.Point(645, 85); + this.FrameAdvButton.Location = new System.Drawing.Point(645, 144); this.FrameAdvButton.Name = "FrameAdvButton"; this.FrameAdvButton.Size = new System.Drawing.Size(75, 23); this.FrameAdvButton.TabIndex = 3; @@ -527,7 +529,6 @@ this.ScanlineBox.ReadOnly = true; this.ScanlineBox.Size = new System.Drawing.Size(74, 20); this.ScanlineBox.TabIndex = 3; - this.ScanlineBox.Text = "Todo"; // // label8 // @@ -568,6 +569,26 @@ this.TracerBox.TabStop = false; this.TracerBox.Text = "Trace log"; // + // StepOverButton + // + this.StepOverButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.StepOverButton.Location = new System.Drawing.Point(645, 56); + this.StepOverButton.Name = "StepOverButton"; + this.StepOverButton.Size = new System.Drawing.Size(75, 23); + this.StepOverButton.TabIndex = 7; + this.StepOverButton.Text = "Step &Over"; + this.StepOverButton.UseVisualStyleBackColor = true; + // + // StepOutButton + // + this.StepOutButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.StepOutButton.Location = new System.Drawing.Point(645, 82); + this.StepOutButton.Name = "StepOutButton"; + this.StepOutButton.Size = new System.Drawing.Size(75, 23); + this.StepOutButton.TabIndex = 8; + this.StepOutButton.Text = "Step O&ut"; + this.StepOutButton.UseVisualStyleBackColor = true; + // // TraceView // this.TraceView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -602,6 +623,8 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(732, 702); + this.Controls.Add(this.StepOutButton); + this.Controls.Add(this.StepOverButton); this.Controls.Add(this.TracerBox); this.Controls.Add(this.CoreInfoBox); this.Controls.Add(this.RegistersBox); @@ -680,5 +703,7 @@ private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem RestoreDefaultsMenuItem; + private System.Windows.Forms.Button StepOverButton; + private System.Windows.Forms.Button StepOutButton; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/Atari2600/Atari2600Debugger.cs b/BizHawk.Client.EmuHawk/tools/Atari2600/Atari2600Debugger.cs index 9ffbcbf50f..dccb8d08f1 100644 --- a/BizHawk.Client.EmuHawk/tools/Atari2600/Atari2600Debugger.cs +++ b/BizHawk.Client.EmuHawk/tools/Atari2600/Atari2600Debugger.cs @@ -14,12 +14,75 @@ namespace BizHawk.Client.EmuHawk { public partial class Atari2600Debugger : Form, IToolForm { + // TODO: + // Take control of mainform + // Consider how to handle trace logger (the two will compete with each other with the TakeContents() method) + // Step Into + // Step Out + // Step + // Advance 1 scanline? + // Settable registers, also implement in lua + // Breakpoints private Atari2600 _core = Global.Emulator as Atari2600; private readonly List _instructions = new List(); private int _defaultWidth; private int _defaultHeight; + //the opsize table is used to quickly grab the instruction sizes (in bytes) + private readonly byte[] opsize = new byte[] + { + /*0x00*/ 1,2,0,0,0,2,2,0,1,2,1,0,0,3,3,0, + /*0x10*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0, + /*0x20*/ 3,2,0,0,2,2,2,0,1,2,1,0,3,3,3,0, + /*0x30*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0, + /*0x40*/ 1,2,0,0,0,2,2,0,1,2,1,0,3,3,3,0, + /*0x50*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0, + /*0x60*/ 1,2,0,0,0,2,2,0,1,2,1,0,3,3,3,0, + /*0x70*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0, + /*0x80*/ 0,2,0,0,2,2,2,0,1,0,1,0,3,3,3,0, + /*0x90*/ 2,2,0,0,2,2,2,0,1,3,1,0,0,3,0,0, + /*0xA0*/ 2,2,2,0,2,2,2,0,1,2,1,0,3,3,3,0, + /*0xB0*/ 2,2,0,0,2,2,2,0,1,3,1,0,3,3,3,0, + /*0xC0*/ 2,2,0,0,2,2,2,0,1,2,1,0,3,3,3,0, + /*0xD0*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0, + /*0xE0*/ 2,2,0,0,2,2,2,0,1,2,1,0,3,3,3,0, + /*0xF0*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0 + }; + + + /*the optype table is a quick way to grab the addressing mode for any 6502 opcode + // + // 0 = Implied\Accumulator\Immediate\Branch\NULL + // 1 = (Indirect,X) + // 2 = Zero Page + // 3 = Absolute + // 4 = (Indirect),Y + // 5 = Zero Page,X + // 6 = Absolute,Y + // 7 = Absolute,X + // 8 = Zero Page,Y + */ + private readonly byte[] optype = new byte[] + { + /*0x00*/ 0,1,0,0,0,2,2,0,0,0,0,0,0,3,3,0, + /*0x10*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0, + /*0x20*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0, + /*0x30*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0, + /*0x40*/ 0,1,0,0,0,2,2,0,0,0,0,0,0,3,3,0, + /*0x50*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0, + /*0x60*/ 0,1,0,0,0,2,2,0,0,0,0,0,3,3,3,0, + /*0x70*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0, + /*0x80*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0, + /*0x90*/ 0,4,0,0,5,5,8,0,0,6,0,0,0,7,0,0, + /*0xA0*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0, + /*0xB0*/ 0,4,0,0,5,5,8,0,0,6,0,0,7,7,6,0, + /*0xC0*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0, + /*0xD0*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0, + /*0xE0*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0, + /*0xF0*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0 + }; + public Atari2600Debugger() { InitializeComponent();