Mem display

This commit is contained in:
Mike Schwörer 2017-05-10 19:41:39 +02:00
parent b9dcf70dfe
commit 8754fd7bd6
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
3 changed files with 114 additions and 23 deletions

View File

@ -59,6 +59,15 @@
this.c1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.c1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.c2 = ((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.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()));
this.columnHeader12 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader13 = ((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.columnHeader16 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.Index = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -78,7 +87,7 @@
this.box_CodeView.Margin = new System.Windows.Forms.Padding(2); this.box_CodeView.Margin = new System.Windows.Forms.Padding(2);
this.box_CodeView.Name = "box_CodeView"; this.box_CodeView.Name = "box_CodeView";
this.box_CodeView.ReadOnly = true; this.box_CodeView.ReadOnly = true;
this.box_CodeView.Size = new System.Drawing.Size(626, 476); this.box_CodeView.Size = new System.Drawing.Size(626, 600);
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;
@ -148,7 +157,7 @@
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 2, 0, 2); this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(1048, 24); this.menuStrip1.Size = new System.Drawing.Size(1298, 24);
this.menuStrip1.TabIndex = 9; this.menuStrip1.TabIndex = 9;
this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.Text = "menuStrip1";
// //
@ -203,6 +212,7 @@
// lvMemory // lvMemory
// //
this.lvMemory.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvMemory.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Index,
this.columnHeader1, this.columnHeader1,
this.columnHeader2, this.columnHeader2,
this.columnHeader3, this.columnHeader3,
@ -210,11 +220,19 @@
this.columnHeader5, this.columnHeader5,
this.columnHeader6, this.columnHeader6,
this.columnHeader7, this.columnHeader7,
this.columnHeader8}); this.columnHeader8,
this.lvMemory.Location = new System.Drawing.Point(733, 78); this.columnHeader9,
this.columnHeader10,
this.columnHeader11,
this.columnHeader12,
this.columnHeader13,
this.columnHeader14,
this.columnHeader15,
this.columnHeader16});
this.lvMemory.Location = new System.Drawing.Point(711, 78);
this.lvMemory.Margin = new System.Windows.Forms.Padding(2); this.lvMemory.Margin = new System.Windows.Forms.Padding(2);
this.lvMemory.Name = "lvMemory"; this.lvMemory.Name = "lvMemory";
this.lvMemory.Size = new System.Drawing.Size(304, 297); this.lvMemory.Size = new System.Drawing.Size(576, 354);
this.lvMemory.TabIndex = 14; this.lvMemory.TabIndex = 14;
this.lvMemory.UseCompatibleStateImageBehavior = false; this.lvMemory.UseCompatibleStateImageBehavior = false;
this.lvMemory.View = System.Windows.Forms.View.Details; this.lvMemory.View = System.Windows.Forms.View.Details;
@ -231,11 +249,13 @@
// //
// columnHeader3 // columnHeader3
// //
this.columnHeader3.DisplayIndex = 4;
this.columnHeader3.Text = "2"; this.columnHeader3.Text = "2";
this.columnHeader3.Width = 32; this.columnHeader3.Width = 32;
// //
// columnHeader4 // columnHeader4
// //
this.columnHeader4.DisplayIndex = 3;
this.columnHeader4.Text = "3"; this.columnHeader4.Text = "3";
this.columnHeader4.Width = 32; this.columnHeader4.Width = 32;
// //
@ -294,10 +314,10 @@
this.lvSpecial.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvSpecial.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.c1, this.c1,
this.c2}); this.c2});
this.lvSpecial.Location = new System.Drawing.Point(638, 378); this.lvSpecial.Location = new System.Drawing.Point(640, 438);
this.lvSpecial.Margin = new System.Windows.Forms.Padding(2); this.lvSpecial.Margin = new System.Windows.Forms.Padding(2);
this.lvSpecial.Name = "lvSpecial"; this.lvSpecial.Name = "lvSpecial";
this.lvSpecial.Size = new System.Drawing.Size(399, 175); this.lvSpecial.Size = new System.Drawing.Size(269, 239);
this.lvSpecial.TabIndex = 18; this.lvSpecial.TabIndex = 18;
this.lvSpecial.UseCompatibleStateImageBehavior = false; this.lvSpecial.UseCompatibleStateImageBehavior = false;
this.lvSpecial.View = System.Windows.Forms.View.Details; this.lvSpecial.View = System.Windows.Forms.View.Details;
@ -317,14 +337,59 @@
this.lbStack.FormattingEnabled = true; this.lbStack.FormattingEnabled = true;
this.lbStack.Location = new System.Drawing.Point(640, 78); this.lbStack.Location = new System.Drawing.Point(640, 78);
this.lbStack.Name = "lbStack"; this.lbStack.Name = "lbStack";
this.lbStack.Size = new System.Drawing.Size(88, 290); 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);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1048, 585); this.ClientSize = new System.Drawing.Size(1298, 692);
this.Controls.Add(this.lbStack); this.Controls.Add(this.lbStack);
this.Controls.Add(this.lvSpecial); this.Controls.Add(this.lvSpecial);
this.Controls.Add(this.insertTime); this.Controls.Add(this.insertTime);
@ -385,6 +450,15 @@
private System.Windows.Forms.ColumnHeader c1; private System.Windows.Forms.ColumnHeader c1;
private System.Windows.Forms.ColumnHeader c2; private System.Windows.Forms.ColumnHeader c2;
private System.Windows.Forms.ListBox lbStack; private System.Windows.Forms.ListBox lbStack;
private System.Windows.Forms.ColumnHeader Index;
private System.Windows.Forms.ColumnHeader columnHeader9;
private System.Windows.Forms.ColumnHeader columnHeader10;
private System.Windows.Forms.ColumnHeader columnHeader11;
private System.Windows.Forms.ColumnHeader columnHeader12;
private System.Windows.Forms.ColumnHeader columnHeader13;
private System.Windows.Forms.ColumnHeader columnHeader14;
private System.Windows.Forms.ColumnHeader columnHeader15;
private System.Windows.Forms.ColumnHeader columnHeader16;
} }
} }

View File

@ -21,9 +21,9 @@ namespace PIC_Simulator
quartztimer = new Timer(); quartztimer = new Timer();
quartztimer.Tick += timer1_Tick; quartztimer.Tick += timer1_Tick;
for (int i = 0; i < 32; i++) for (int i = 0; i < 16; i++)
{ {
var item = new ListViewItem(new[] {"00", "00", "00", "00", "00", "00", "00", "00"}); var item = new ListViewItem(new[] { string.Format("0x{0:X}0", i), "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00", "00" });
lvMemory.Items.Add(item); lvMemory.Items.Add(item);
} }
@ -146,12 +146,12 @@ namespace PIC_Simulator
// Memory aktualisieren // Memory aktualisieren
for (int y = 0; y < 32; y++) for (int y = 0; y < 16; y++)
{ {
for (int x = 0; x < 8; x++) for (int x = 0; x < 16; x++)
{ {
string nummer = string.Format("{0:X2}", programm.Register[y*8 + x]); string nummer = string.Format("{0:X2}", programm.GetRegisterOhneBank((uint) (y*16 + x)));
if (nummer != lvMemory.Items[y].SubItems[x].Text) lvMemory.Items[y].SubItems[x].Text = nummer; if (nummer != lvMemory.Items[y].SubItems[x + 1].Text) lvMemory.Items[y].SubItems[x+1].Text = nummer;
} }
} }

View File

@ -747,6 +747,13 @@ namespace PIC_Simulator.PIC
private uint GetRegister(uint index) private uint GetRegister(uint index)
{ {
// register die nur einmal auf bank1 + 2 existieren
if (index == ADDR_PCL + 0x80) return Register[ADDR_PCL];
if (index == ADDR_STATUS + 0x80) return Register[ADDR_STATUS];
if (index == ADDR_FSR + 0x80) return Register[ADDR_FSR];
if (index == ADDR_PCLATH + 0x80) return Register[ADDR_PCLATH];
if (index == ADDR_INTCON + 0x80) return Register[ADDR_INTCON];
if ((Register[ADDR_STATUS] & STATUS_BIT_RP0) == STATUS_BIT_RP0) if ((Register[ADDR_STATUS] & STATUS_BIT_RP0) == STATUS_BIT_RP0)
{ {
return Register[0x80 + index]; return Register[0x80 + index];
@ -759,6 +766,13 @@ namespace PIC_Simulator.PIC
private void SetRegister(uint index, uint wert) private void SetRegister(uint index, uint wert)
{ {
// register die nur einmal auf bank1 + 2 existieren
if (index == ADDR_PCL) { Register[ADDR_PCL] = wert; return; }
if (index == ADDR_STATUS) { Register[ADDR_STATUS] = wert; return; }
if (index == ADDR_FSR) { Register[ADDR_FSR] = wert; return; }
if (index == ADDR_PCLATH) { Register[ADDR_PCLATH] = wert; return; }
if (index == ADDR_INTCON) { Register[ADDR_INTCON] = wert; return; }
if ((Register[ADDR_STATUS] & STATUS_BIT_RP0) == STATUS_BIT_RP0) if ((Register[ADDR_STATUS] & STATUS_BIT_RP0) == STATUS_BIT_RP0)
{ {
Register[0x80 + index] = wert; Register[0x80 + index] = wert;
@ -771,14 +785,7 @@ namespace PIC_Simulator.PIC
private void SetRegister(uint index, uint bit, bool wert) private void SetRegister(uint index, uint bit, bool wert)
{ {
if ((Register[ADDR_STATUS] & STATUS_BIT_RP0) == STATUS_BIT_RP0) SetRegister(index, SetBit(GetRegister(index), bit, wert));
{
Register[0x80 + index] = SetBit(Register[index], bit, wert);
}
else
{
Register[index] = SetBit(Register[index], bit, wert);
}
} }
private void SetRegisterOhneBank(uint index, uint bit, bool wert) private void SetRegisterOhneBank(uint index, uint bit, bool wert)
@ -793,6 +800,16 @@ namespace PIC_Simulator.PIC
public uint GetRegisterOhneBank(uint index) public uint GetRegisterOhneBank(uint index)
{ {
if (index == ADDR_UNIMPL_A) return 0;
if (index == ADDR_UNIMPL_B) return 0;
// register die nur einmal auf bank1 + 2 existieren
if (index == ADDR_PCL + 0x80) return Register[ADDR_PCL];
if (index == ADDR_STATUS + 0x80) return Register[ADDR_STATUS];
if (index == ADDR_FSR + 0x80) return Register[ADDR_FSR];
if (index == ADDR_PCLATH + 0x80) return Register[ADDR_PCLATH];
if (index == ADDR_INTCON + 0x80) return Register[ADDR_INTCON];
return Register[index]; return Register[index];
} }