RA RB Latch (?)
This commit is contained in:
parent
62bec2f317
commit
7ebfa04f5d
@ -34,6 +34,8 @@ namespace PIC_Simulator
|
||||
lvSpecial.Items.Add(new ListViewItem(new[] { "PC", "0x00" }));
|
||||
lvSpecial.Items.Add(new ListViewItem(new[] { "Status", "0b00000000" }));
|
||||
lvSpecial.Items.Add(new ListViewItem(new[] { "Time", "0ms" }));
|
||||
lvSpecial.Items.Add(new ListViewItem(new[] { "RA (Backing)", "0b00000000" }));
|
||||
lvSpecial.Items.Add(new ListViewItem(new[] { "RB (Backing)", "0b00000000" }));
|
||||
|
||||
lvSpecial.Items.Add(new ListViewItem(new[] { "Status[DC]", "0" }));
|
||||
lvSpecial.Items.Add(new ListViewItem(new[] { "Status[C]", "0" }));
|
||||
@ -195,9 +197,11 @@ namespace PIC_Simulator
|
||||
lvSpecial.Items[1].SubItems[1].Text = string.Format("{0,4}", programm.PCCounter);
|
||||
lvSpecial.Items[2].SubItems[1].Text = string.Format("0b{0}", Convert.ToString(programm.GetRegisterOhneBank(PICProgramm.ADDR_STATUS), 2).PadLeft(8, '0'));
|
||||
lvSpecial.Items[3].SubItems[1].Text = string.Format("{0}ms", programm.Stepcount * int.Parse(insertTime.Text));
|
||||
lvSpecial.Items[4].SubItems[1].Text = programm.GetRegisterOhneBank(PICProgramm.ADDR_STATUS, PICProgramm.STATUS_BIT_C) ? "1" : "0";
|
||||
lvSpecial.Items[5].SubItems[1].Text = programm.GetRegisterOhneBank(PICProgramm.ADDR_STATUS, PICProgramm.STATUS_BIT_DC) ? "1" : "0";
|
||||
lvSpecial.Items[6].SubItems[1].Text = programm.GetRegisterOhneBank(PICProgramm.ADDR_STATUS, PICProgramm.STATUS_BIT_Z) ? "1" : "0";
|
||||
lvSpecial.Items[4].SubItems[1].Text = "0b" + Convert.ToString(programm.Register[PICProgramm.ADDR_PORT_A], 2).PadLeft(8, '0');
|
||||
lvSpecial.Items[5].SubItems[1].Text = "0b" + Convert.ToString(programm.Register[PICProgramm.ADDR_PORT_B], 2).PadLeft(8, '0');
|
||||
lvSpecial.Items[6].SubItems[1].Text = programm.GetRegisterOhneBank(PICProgramm.ADDR_STATUS, PICProgramm.STATUS_BIT_C) ? "1" : "0";
|
||||
lvSpecial.Items[7].SubItems[1].Text = programm.GetRegisterOhneBank(PICProgramm.ADDR_STATUS, PICProgramm.STATUS_BIT_DC) ? "1" : "0";
|
||||
lvSpecial.Items[8].SubItems[1].Text = programm.GetRegisterOhneBank(PICProgramm.ADDR_STATUS, PICProgramm.STATUS_BIT_Z) ? "1" : "0";
|
||||
|
||||
lbStack.Items.Clear();
|
||||
foreach (var u in programm.Stack) lbStack.Items.Add(u.ToString());
|
||||
|
@ -116,6 +116,9 @@ namespace PIC_Simulator.PIC
|
||||
public Stack<uint> Stack = new Stack<uint>();
|
||||
public bool IsSleeping = false;
|
||||
|
||||
public byte Latch_RA = 0;
|
||||
public byte Latch_RB = 0;
|
||||
|
||||
public List<int> Breakpoints = new List<int>();
|
||||
|
||||
public int TaktgeberFrequenz = 100000;
|
||||
@ -816,6 +819,28 @@ namespace PIC_Simulator.PIC
|
||||
}
|
||||
|
||||
Register[index] = (byte)(wert & 0xFF);
|
||||
|
||||
if (index == ADDR_PORT_A || index == ADDR_TRIS_A)
|
||||
{
|
||||
var ra = Register[ADDR_PORT_A];
|
||||
var ta = Register[ADDR_TRIS_A];
|
||||
|
||||
for (uint i = 0; i < 8; i++)
|
||||
{
|
||||
if (!GetBit(ta, i)) Latch_RA = (byte)SetBit(Latch_RA, i, GetBit(ra, i));
|
||||
}
|
||||
}
|
||||
|
||||
if (index == ADDR_PORT_B || index == ADDR_TRIS_B)
|
||||
{
|
||||
var rb = Register[ADDR_PORT_B];
|
||||
var tb = Register[ADDR_TRIS_B];
|
||||
|
||||
for (uint i = 0; i < 8; i++)
|
||||
{
|
||||
if (!GetBit(tb, i)) Latch_RB = (byte)SetBit(Latch_RB, i, GetBit(rb, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public byte GetRegisterOhneBank(uint index)
|
||||
@ -841,6 +866,9 @@ namespace PIC_Simulator.PIC
|
||||
return Register[Register[ADDR_FSR]];
|
||||
}
|
||||
|
||||
if (index == ADDR_PORT_A) return Latch_RA;
|
||||
if (index == ADDR_PORT_A) return Latch_RB;
|
||||
|
||||
return Register[index];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user