public static void SLEEP(Data.Command com) { CLRWDT(null); Data.SetRegisterBit(Data.Registers.STATUS, Data.Flags.Status.TO, true); Data.SetRegisterBit(Data.Registers.STATUS, Data.Flags.Status.PD, false); Data.SetSleeping(true); Data.SetPC(Data.GetPC() - 1); }
private static void CallInterrupt() { Data.PushStack(); Data.SetPC(0x04); //Fixed interrupt routine address Data.SetRegisterBit(Data.Registers.INTCON, Data.Flags.Intcon.GIE, false); //Disable Global-Interrupt-Bit if (Data.IsSleeping()) { Data.SetRegisterBit(Data.Registers.STATUS, Data.Flags.Status.TO, true); Data.SetRegisterBit(Data.Registers.STATUS, Data.Flags.Status.PD, false); Data.IncPC(); Data.SetSleeping(false); } }