diff --git a/PIC_Simulator/Form1.Designer.cs b/PIC_Simulator/Form1.Designer.cs index 3f0e82e..b63d51a 100644 --- a/PIC_Simulator/Form1.Designer.cs +++ b/PIC_Simulator/Form1.Designer.cs @@ -44,6 +44,7 @@ this.cmdOpenDoc = new System.Windows.Forms.ToolStripMenuItem(); this.label4 = new System.Windows.Forms.Label(); 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.columnHeader2 = ((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.columnHeader7 = ((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.columnHeader10 = ((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.columnHeader15 = ((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.SuspendLayout(); // @@ -91,6 +91,7 @@ this.box_CodeView.TabIndex = 3; this.box_CodeView.Text = ""; this.box_CodeView.WordWrap = false; + this.box_CodeView.DoubleClick += new System.EventHandler(this.box_CodeView_DoubleClick); // // lbl_path // @@ -237,6 +238,11 @@ this.lvMemory.UseCompatibleStateImageBehavior = false; this.lvMemory.View = System.Windows.Forms.View.Details; // + // Index + // + this.Index.Text = " "; + this.Index.Width = 48; + // // columnHeader1 // this.columnHeader1.Text = "0"; @@ -279,6 +285,46 @@ this.columnHeader8.Text = "7"; 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 // 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.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 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/PIC_Simulator/Form1.cs b/PIC_Simulator/Form1.cs index d6acc78..4889c54 100644 --- a/PIC_Simulator/Form1.cs +++ b/PIC_Simulator/Form1.cs @@ -100,6 +100,15 @@ namespace PIC_Simulator 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) { @@ -132,6 +141,8 @@ namespace PIC_Simulator if (finished) { quartztimer.Stop(); MessageBox.Show("Finished"); return; } + if (programm.Breakpoints.Contains(programm.befehle[programm.PCCounter].labelnummer)) quartztimer.Stop(); + OberflaecheAktualisieren(); } @@ -144,6 +155,18 @@ namespace PIC_Simulator 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 for (int y = 0; y < 16; y++) @@ -165,6 +188,23 @@ namespace PIC_Simulator lbStack.Items.Clear(); 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(); + } + } } } diff --git a/PIC_Simulator/PIC/PICProgramm.cs b/PIC_Simulator/PIC/PICProgramm.cs index 0c4c0e4..b73087c 100644 --- a/PIC_Simulator/PIC/PICProgramm.cs +++ b/PIC_Simulator/PIC/PICProgramm.cs @@ -115,6 +115,8 @@ namespace PIC_Simulator.PIC public uint[] Register = new uint[0x100]; public Stack Stack = new Stack(); + public List Breakpoints = new List(); + public PICProgramm() { diff --git a/Projektinformationen/Tabelle.txt b/Projektinformationen/Tabelle.txt new file mode 100644 index 0000000..97c127b --- /dev/null +++ b/Projektinformationen/Tabelle.txt @@ -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 \ No newline at end of file