예제 #1
0
 /// <summary>
 /// Executes one program step. Stops running timer if 1. out of program bounds AND warning message has not yet been shown 2. a breakpoint is hit
 /// </summary>
 private void ProgramStep()
 {
     try
     {
         InstructionProcessor.PCStep();
     }
     catch (IndexOutOfRangeException)
     {
         Stop();
         UpdateUI();
         Dispatcher.Invoke(() =>
         {
             MessageBox.Show("Tried to get/set an out of range register!\nCheck your code!", "Index out of range");
         });
         return;
     }
     if (IsPCOutOfRange())
     {
         if (!OutOfBoundsMessageShown)
         {
             StopAndUpdateUI();
         }
     }
     else if (IsBreakpointHit())
     {
         StopAndUpdateUI();
     }
 }
예제 #2
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();
     }
 }