Exemple #1
0
 public static void SkipCycle()
 {
     if (!Data.IsSleeping())
     {
         Data.ProcessTMR0();
     }
     Data.ProcessWDT();
     Data.ProcessRBInterrupts();
     Data.IncreaseRuntime();
     if (Data.CheckInterrupts())
     {
         CallInterrupt();
     }
 }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
 /// <summary>
 /// Step function. Executes current command of loaded program and increases PC
 /// </summary>
 /// <returns>false if within program bounds, true if PC left program bounds</returns>
 public static void PCStep()
 {
     if (Data.IsProgramInitialized())
     {
         if (!Data.IsSleeping())
         {
             if (Data.GetPC() < Data.GetProgram().Count)
             {
                 Data.Command com = Data.GetProgram()[Data.GetPC()];
                 Data.IncPC();
                 InstructionProcessor.Execute(Data.InstructionLookup(com), com);
             }
             else //PC has left program area
             {
                 Data.IncPC();
             }
         }
         SkipCycle();
     }
 }