Mem display

This commit is contained in:
2017-05-10 19:41:39 +02:00
parent b9dcf70dfe
commit 8754fd7bd6
3 changed files with 114 additions and 23 deletions

View File

@@ -747,6 +747,13 @@ namespace PIC_Simulator.PIC
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)
{
return Register[0x80 + index];
@@ -759,6 +766,13 @@ namespace PIC_Simulator.PIC
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)
{
Register[0x80 + index] = wert;
@@ -771,14 +785,7 @@ namespace PIC_Simulator.PIC
private void SetRegister(uint index, uint bit, bool wert)
{
if ((Register[ADDR_STATUS] & STATUS_BIT_RP0) == STATUS_BIT_RP0)
{
Register[0x80 + index] = SetBit(Register[index], bit, wert);
}
else
{
Register[index] = SetBit(Register[index], bit, wert);
}
SetRegister(index, SetBit(GetRegister(index), bit, wert));
}
private void SetRegisterOhneBank(uint index, uint bit, bool wert)
@@ -793,6 +800,16 @@ namespace PIC_Simulator.PIC
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];
}