fix latch
This commit is contained in:
@@ -203,8 +203,8 @@ namespace PIC_Simulator
|
||||
lvSpecial.Items[3].SubItems[1].Text = string.Format("0b{0}", Convert.ToString(programm.GetRegisterOhneBank(PICProgramm.ADDR_OPTION), 2).PadLeft(8, '0'));
|
||||
lvSpecial.Items[4].SubItems[1].Text = string.Format("0b{0}", Convert.ToString(programm.GetRegisterOhneBank(PICProgramm.ADDR_INTCON), 2).PadLeft(8, '0'));
|
||||
lvSpecial.Items[5].SubItems[1].Text = string.Format("{0}ms", programm.Stepcount * int.Parse(insertTime.Text));
|
||||
lvSpecial.Items[6].SubItems[1].Text = "0b" + Convert.ToString(programm.Register[PICProgramm.ADDR_PORT_A], 2).PadLeft(8, '0');
|
||||
lvSpecial.Items[7].SubItems[1].Text = "0b" + Convert.ToString(programm.Register[PICProgramm.ADDR_PORT_B], 2).PadLeft(8, '0');
|
||||
lvSpecial.Items[6].SubItems[1].Text = "0b" + Convert.ToString(programm.Latch_RA, 2).PadLeft(8, '0');
|
||||
lvSpecial.Items[7].SubItems[1].Text = "0b" + Convert.ToString(programm.Latch_RB, 2).PadLeft(8, '0');
|
||||
lvSpecial.Items[8].SubItems[1].Text = programm.GetRegisterOhneBank(PICProgramm.ADDR_STATUS, PICProgramm.STATUS_BIT_C) ? "1" : "0";
|
||||
lvSpecial.Items[9].SubItems[1].Text = programm.GetRegisterOhneBank(PICProgramm.ADDR_STATUS, PICProgramm.STATUS_BIT_DC) ? "1" : "0";
|
||||
lvSpecial.Items[10].SubItems[1].Text = programm.GetRegisterOhneBank(PICProgramm.ADDR_STATUS, PICProgramm.STATUS_BIT_Z) ? "1" : "0";
|
||||
|
@@ -858,29 +858,53 @@ namespace PIC_Simulator.PIC
|
||||
Zaehler.Reset();
|
||||
}
|
||||
|
||||
Register[index] = (byte)(wert & 0xFF);
|
||||
|
||||
if (index == ADDR_PORT_A || index == ADDR_TRIS_A)
|
||||
if (index == ADDR_PORT_A)
|
||||
{
|
||||
var ra = Register[ADDR_PORT_A];
|
||||
var ta = Register[ADDR_TRIS_A];
|
||||
|
||||
Latch_RA = (byte)(wert & 0xFF);
|
||||
|
||||
for (uint i = 0; i < 8; i++)
|
||||
{
|
||||
if (!GetBit(ta, i)) Latch_RA = (byte)SetBit(Latch_RA, i, GetBit(ra, i));
|
||||
if (!GetBit(ta, i)) Register[ADDR_PORT_A] = SetBit(Register[ADDR_PORT_A], i, GetBit(Latch_RA, i));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (index == ADDR_PORT_B || index == ADDR_TRIS_B)
|
||||
if (index == ADDR_PORT_B)
|
||||
{
|
||||
var rb = Register[ADDR_PORT_B];
|
||||
var tb = Register[ADDR_TRIS_B];
|
||||
|
||||
Latch_RB = (byte)(wert & 0xFF);
|
||||
|
||||
for (uint i = 0; i < 8; i++)
|
||||
{
|
||||
if (!GetBit(tb, i)) Latch_RB = (byte)SetBit(Latch_RB, i, GetBit(rb, i));
|
||||
if (!GetBit(tb, i)) Register[ADDR_PORT_B] = SetBit(Register[ADDR_PORT_B], i, GetBit(Latch_RB, i));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (index == ADDR_TRIS_A)
|
||||
{
|
||||
var ta = (byte)(wert & 0xFF);
|
||||
|
||||
for (uint i = 0; i < 8; i++)
|
||||
{
|
||||
if (!GetBit(ta, i)) Register[ADDR_PORT_A] = SetBit(Register[ADDR_PORT_A], i, GetBit(Latch_RA, i));
|
||||
}
|
||||
}
|
||||
|
||||
if (index == ADDR_TRIS_B)
|
||||
{
|
||||
var tb = (byte)(wert & 0xFF);
|
||||
|
||||
for (uint i = 0; i < 8; i++)
|
||||
{
|
||||
if (!GetBit(tb, i)) Register[ADDR_PORT_B] = SetBit(Register[ADDR_PORT_B], i, GetBit(Latch_RB, i));
|
||||
}
|
||||
}
|
||||
|
||||
Register[index] = (byte)(wert & 0xFF);
|
||||
}
|
||||
|
||||
private void Interrupt_RB(byte alt, byte neu)
|
||||
|
Reference in New Issue
Block a user