SLEEP command

This commit is contained in:
Mike Schwörer 2017-05-11 11:13:09 +02:00
parent 7cb924f580
commit 23ecfdd906
2 changed files with 14 additions and 1 deletions

View File

@ -114,6 +114,7 @@ namespace PIC_Simulator.PIC
public uint Register_W = 0; public uint Register_W = 0;
public uint[] Register = new uint[0x100]; public uint[] Register = new uint[0x100];
public Stack<uint> Stack = new Stack<uint>(); public Stack<uint> Stack = new Stack<uint>();
public bool IsSleeping = false;
public List<int> Breakpoints = new List<int>(); public List<int> Breakpoints = new List<int>();
@ -203,6 +204,8 @@ namespace PIC_Simulator.PIC
PICBefehl aktueller_befehl = befehle[PCCounter]; PICBefehl aktueller_befehl = befehle[PCCounter];
if (IsSleeping) return false;
if (aktueller_befehl.befehl == ADDWF) if (aktueller_befehl.befehl == ADDWF)
{ {
// Add the contents of the W register with // Add the contents of the W register with
@ -697,7 +700,17 @@ namespace PIC_Simulator.PIC
// mode with the oscillator stopped. See // mode with the oscillator stopped. See
// Section 14.8 for more details. // Section 14.8 for more details.
//TODO if (GetRegisterOhneBank(ADDR_OPTION, OPTION_BIT_PSA))
{
SetRegisterOhneBank(ADDR_OPTION, OPTION_BIT_PS0, false);
SetRegisterOhneBank(ADDR_OPTION, OPTION_BIT_PS1, false);
SetRegisterOhneBank(ADDR_OPTION, OPTION_BIT_PS2, false);
}
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_TO, true);
SetRegisterOhneBank(ADDR_STATUS, STATUS_BIT_PD, false);
IsSleeping = true;
} }
else if (aktueller_befehl.befehl == SUBLW) else if (aktueller_befehl.befehl == SUBLW)
{ {

Binary file not shown.