summaryrefslogtreecommitdiff
path: root/DebugForm.cs
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-01-21 01:13:58 +0000
committerIan C <ianc@noddybox.co.uk>2005-01-21 01:13:58 +0000
commitf0a9af7158f2faf6359beef5602451b6a042a539 (patch)
treef9c0b00d2067777d9c7d8548f0d7b00a76a85e6d /DebugForm.cs
parent88256e4aed5262e7c50f351264d5f163ffe8e7ef (diff)
Initial checkin
Diffstat (limited to 'DebugForm.cs')
-rw-r--r--DebugForm.cs109
1 files changed, 109 insertions, 0 deletions
diff --git a/DebugForm.cs b/DebugForm.cs
new file mode 100644
index 0000000..d778ddc
--- /dev/null
+++ b/DebugForm.cs
@@ -0,0 +1,109 @@
+// SIDFX
+// Copyright (C) 2004 Ian Cowburn
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//
+// $Id$
+//
+using System;
+using System.Windows.Forms;
+using System.Drawing;
+using HardsidInterface;
+
+namespace SIDFX
+{
+ /// <summary>
+ /// Description of DebugForm.
+ /// </summary>
+ public class DebugForm : System.Windows.Forms.Form
+ {
+ private Label[] m_reg;
+
+ public DebugForm()
+ {
+ //
+ // The InitializeComponent() call is required for Windows Forms designer support.
+ //
+ InitializeComponent();
+
+ m_reg=new Label[25];
+
+ Font fnt=new System.Drawing.Font
+ ("Courier New", 9.75F, FontStyle.Regular,
+ GraphicsUnit.Point, ((System.Byte)(0)));
+
+ for(int f=0;f<25;f++)
+ {
+ m_reg[f]=new Label();
+
+ Point p=new Point(((f%5)*60+10),
+ ((f/5)*20+10));
+
+ m_reg[f].Text=LabelText((uint)f,0);
+ m_reg[f].Location=p;
+ m_reg[f].Font=fnt;
+ m_reg[f].AutoSize=true;
+
+ Controls.Add(m_reg[f]);
+ }
+ }
+
+ public void StartDebug()
+ {
+ Hardsid.DebugWrite+=new Hardsid.DebugEvent(Write);
+ Show();
+ }
+
+ public void StopDebug()
+ {
+ Hardsid.DebugWrite-=new Hardsid.DebugEvent(Write);
+ Hide();
+ }
+
+ private void Write(uint dev, uint r, uint v)
+ {
+ m_reg[r].Text=LabelText(r,Hardsid.Read(r));
+ }
+
+ private string LabelText(uint r, uint v)
+ {
+ return (r&0xffu).ToString("X02")+"="+(v&0xffu).ToString("x02");
+ }
+
+
+ #region Windows Forms Designer generated code
+ /// <summary>
+ /// This method is required for Windows Forms designer support.
+ /// Do not change the method contents inside the source code editor. The Forms designer might
+ /// not be able to load this method if it was changed manually.
+ /// </summary>
+ private void InitializeComponent() {
+ //
+ // DebugForm
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(394, 135);
+ this.ControlBox = false;
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "DebugForm";
+ this.ShowInTaskbar = false;
+ this.Text = "SID Registers";
+ this.TopMost = true;
+ }
+ #endregion
+ }
+}