RA RB Latch (?)
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user