basic ui display

This commit is contained in:
2017-05-10 16:30:58 +02:00
parent 65864ecd4e
commit 7b4a5ed4fe
4 changed files with 137 additions and 48 deletions

View File

@@ -14,6 +14,8 @@ namespace PIC_Simulator.PIC
public uint parameter_k;
public uint parameter_b;
public int labelnummer;
public int zeilennummer;
}
@@ -108,6 +110,7 @@ namespace PIC_Simulator.PIC
public List<PICBefehl> befehle;
public int PCCounter = 0; // -> nächster befehl
public int Stepcount = 0;
public uint Register_W = 0;
public uint[] Register = new uint[0x100];
@@ -121,7 +124,7 @@ namespace PIC_Simulator.PIC
{
befehle = new List<PICBefehl>();
int zn = 0;
int zn = -1;
foreach (var zeile in Regex.Split(code, @"\r?\n"))
{
zn++;
@@ -177,6 +180,7 @@ namespace PIC_Simulator.PIC
b.parameter_x = p_x;
b.parameter_b = p_b;
b.zeilennummer = zeilennummer;
b.labelnummer = Convert.ToInt32(zeile.Substring(0, 4), 16);
return b;
}
}
@@ -496,7 +500,7 @@ namespace PIC_Simulator.PIC
}
else if (aktueller_befehl.befehl == GOTO)
{
//TODO
PCCounter = befehle.FindIndex(b => b.labelnummer == aktueller_befehl.parameter_k) - 1;
}
else if (aktueller_befehl.befehl == IORLW)
{
@@ -559,6 +563,10 @@ namespace PIC_Simulator.PIC
Register_W = Result; ;
}
PCCounter++;
Stepcount++;
return PCCounter >= befehle.Count;
}
private uint GetRegister(uint index)
@@ -602,11 +610,16 @@ namespace PIC_Simulator.PIC
Register[index] = SetBit(Register[index], bit, wert);
}
private bool GetRegisterOhneBank(uint index, uint bit)
public bool GetRegisterOhneBank(uint index, uint bit)
{
return GetBit(Register[index], bit);
}
public uint GetRegisterOhneBank(uint index)
{
return Register[index];
}
public static bool AdditionDigitCarry(uint a, uint b)
{
a &= 0x0F;