Breakpoints

This commit is contained in:
Mike Schwörer 2017-05-11 10:08:48 +02:00
parent 8754fd7bd6
commit e3985dc887
4 changed files with 125 additions and 53 deletions

View File

@ -44,6 +44,7 @@
this.cmdOpenDoc = new System.Windows.Forms.ToolStripMenuItem(); this.cmdOpenDoc = new System.Windows.Forms.ToolStripMenuItem();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.lvMemory = new System.Windows.Forms.ListView(); this.lvMemory = new System.Windows.Forms.ListView();
this.Index = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -52,13 +53,6 @@
this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.cmd_Stop = new System.Windows.Forms.Button();
this.lbl_Timer = new System.Windows.Forms.Label();
this.insertTime = new System.Windows.Forms.TextBox();
this.lvSpecial = new System.Windows.Forms.ListView();
this.c1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.c2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lbStack = new System.Windows.Forms.ListBox();
this.columnHeader9 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader9 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader10 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader10 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader11 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader11 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -67,7 +61,13 @@
this.columnHeader14 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader14 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader15 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader15 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader16 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader16 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.Index = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.cmd_Stop = new System.Windows.Forms.Button();
this.lbl_Timer = new System.Windows.Forms.Label();
this.insertTime = new System.Windows.Forms.TextBox();
this.lvSpecial = new System.Windows.Forms.ListView();
this.c1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.c2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lbStack = new System.Windows.Forms.ListBox();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -91,6 +91,7 @@
this.box_CodeView.TabIndex = 3; this.box_CodeView.TabIndex = 3;
this.box_CodeView.Text = ""; this.box_CodeView.Text = "";
this.box_CodeView.WordWrap = false; this.box_CodeView.WordWrap = false;
this.box_CodeView.DoubleClick += new System.EventHandler(this.box_CodeView_DoubleClick);
// //
// lbl_path // lbl_path
// //
@ -237,6 +238,11 @@
this.lvMemory.UseCompatibleStateImageBehavior = false; this.lvMemory.UseCompatibleStateImageBehavior = false;
this.lvMemory.View = System.Windows.Forms.View.Details; this.lvMemory.View = System.Windows.Forms.View.Details;
// //
// Index
//
this.Index.Text = " ";
this.Index.Width = 48;
//
// columnHeader1 // columnHeader1
// //
this.columnHeader1.Text = "0"; this.columnHeader1.Text = "0";
@ -279,6 +285,46 @@
this.columnHeader8.Text = "7"; this.columnHeader8.Text = "7";
this.columnHeader8.Width = 32; this.columnHeader8.Width = 32;
// //
// columnHeader9
//
this.columnHeader9.Text = "8";
this.columnHeader9.Width = 32;
//
// columnHeader10
//
this.columnHeader10.Text = "9";
this.columnHeader10.Width = 32;
//
// columnHeader11
//
this.columnHeader11.Text = "A";
this.columnHeader11.Width = 32;
//
// columnHeader12
//
this.columnHeader12.Text = "B";
this.columnHeader12.Width = 32;
//
// columnHeader13
//
this.columnHeader13.Text = "C";
this.columnHeader13.Width = 32;
//
// columnHeader14
//
this.columnHeader14.Text = "D";
this.columnHeader14.Width = 32;
//
// columnHeader15
//
this.columnHeader15.Text = "E";
this.columnHeader15.Width = 32;
//
// columnHeader16
//
this.columnHeader16.Text = "F";
this.columnHeader16.Width = 32;
//
// cmd_Stop // cmd_Stop
// //
this.cmd_Stop.Location = new System.Drawing.Point(64, 30); this.cmd_Stop.Location = new System.Drawing.Point(64, 30);
@ -340,51 +386,6 @@
this.lbStack.Size = new System.Drawing.Size(66, 355); this.lbStack.Size = new System.Drawing.Size(66, 355);
this.lbStack.TabIndex = 19; this.lbStack.TabIndex = 19;
// //
// columnHeader9
//
this.columnHeader9.Text = "8";
this.columnHeader9.Width = 32;
//
// columnHeader10
//
this.columnHeader10.Text = "9";
this.columnHeader10.Width = 32;
//
// columnHeader11
//
this.columnHeader11.Text = "A";
this.columnHeader11.Width = 32;
//
// columnHeader12
//
this.columnHeader12.Text = "B";
this.columnHeader12.Width = 32;
//
// columnHeader13
//
this.columnHeader13.Text = "C";
this.columnHeader13.Width = 32;
//
// columnHeader14
//
this.columnHeader14.Text = "D";
this.columnHeader14.Width = 32;
//
// columnHeader15
//
this.columnHeader15.Text = "E";
this.columnHeader15.Width = 32;
//
// columnHeader16
//
this.columnHeader16.Text = "F";
this.columnHeader16.Width = 32;
//
// Index
//
this.Index.Text = " ";
this.Index.Width = 48;
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@ -100,6 +100,15 @@ namespace PIC_Simulator
box_CodeView.SelectionBackColor = Color.SteelBlue; box_CodeView.SelectionBackColor = Color.SteelBlue;
} }
} }
void HighlightBreakpoint(int line)
{
int i1 = box_CodeView.GetFirstCharIndexFromLine(line);
int i2 = box_CodeView.GetFirstCharIndexFromLine(line) + 4;
box_CodeView.SelectionStart = i1;
box_CodeView.SelectionLength = i2 - i1;
box_CodeView.SelectionBackColor = Color.Red;
}
private void cmd_reset_Click(object sender, EventArgs e) private void cmd_reset_Click(object sender, EventArgs e)
{ {
@ -132,6 +141,8 @@ namespace PIC_Simulator
if (finished) { quartztimer.Stop(); MessageBox.Show("Finished"); return; } if (finished) { quartztimer.Stop(); MessageBox.Show("Finished"); return; }
if (programm.Breakpoints.Contains(programm.befehle[programm.PCCounter].labelnummer)) quartztimer.Stop();
OberflaecheAktualisieren(); OberflaecheAktualisieren();
} }
@ -144,6 +155,18 @@ namespace PIC_Simulator
Highlight(programm.befehle[programm.PCCounter].zeilennummer); Highlight(programm.befehle[programm.PCCounter].zeilennummer);
} }
foreach (var bp in programm.Breakpoints)
{
PICBefehl b = programm.befehle.FirstOrDefault(i => i.labelnummer == bp);
if (b != null)
{
HighlightBreakpoint(b.zeilennummer);
}
}
box_CodeView.SelectionStart = 0;
box_CodeView.SelectionLength = 0;
// Memory aktualisieren // Memory aktualisieren
for (int y = 0; y < 16; y++) for (int y = 0; y < 16; y++)
@ -165,6 +188,23 @@ namespace PIC_Simulator
lbStack.Items.Clear(); lbStack.Items.Clear();
foreach (var u in programm.Stack) lbStack.Items.Add(u.ToString()); foreach (var u in programm.Stack) lbStack.Items.Add(u.ToString());
} }
private void box_CodeView_DoubleClick(object sender, EventArgs e)
{
int line = box_CodeView.GetLineFromCharIndex(box_CodeView.SelectionStart);
PICBefehl b = programm.befehle.FirstOrDefault(i => i.zeilennummer == line);
if (b != null)
{
if (programm.Breakpoints.Contains(b.labelnummer))
programm.Breakpoints.Remove(b.labelnummer);
else
programm.Breakpoints.Add(b.labelnummer);
OberflaecheAktualisieren();
}
}
} }
} }

View File

@ -115,6 +115,8 @@ namespace PIC_Simulator.PIC
public uint[] Register = new uint[0x100]; public uint[] Register = new uint[0x100];
public Stack<uint> Stack = new Stack<uint>(); public Stack<uint> Stack = new Stack<uint>();
public List<int> Breakpoints = new List<int>();
public PICProgramm() public PICProgramm()
{ {

View File

@ -0,0 +1,29 @@
[ ] Inhaltsverz./Quellverz./Ä ußeres Ers.
[ ] Darstellung /Prog.- struktur/all.Diagr.
[ ] Befehlsbeschreibung + Diagramme
[X] PDF-Hilfedatei aus Prog. aufrufen
[ ] Bedienkomfort
[ ] Kommentare sinnvoll und ausreich
[ ] Funkt., Meth., Klassen Befehlsnachbild.
[ ] Variablenbezeichner / Variablennamen
[?] INIT-Werte bei RESET
[X] Laufzeitzähler
[ ] Latchfunktion der IO-Register
[X] frei wählbare Quarzfrequenz
[ ] Breakpoints
[ ] Hardwareansteuerung
[X] Testprogramm 1 (Literalbefehle)
[ ] Testprogramm 2 (CALL, GOTO etc)
[ ] Testprogramm 3 (Byte Befehle ohne 4).
[ ] Testprogramm 4 (DECFSZ, RLF, RRF...
[ ] Testprogramm 5 (Bitbefehle)
[ ] Testprogramm 6 (indirekte Adressierung)
[ ] Testprogramm 7 (Timer 0 )
[ ] Ext. Taktgeber an RA4 + IO-Pin
[ ] Testprogramm 7 (Interrupts)
[ ] Testprogramm 9 (Sleep-Befehl)
[ ] Tetstprogramm 10 (PCL und PCLATH)
[ ] Testprogramm 11 (Watchdog, Vorteiler)
[ ] Testprogramm 12 (EEPROM)
[ ] Zusätzliche eignene Features
[ ] Vorzeitige Abgabe