Example #1
0
        public static void BTFSS(Data.Command com)
        {
            int  b1 = (com.GetHighByte() & 3) << 1;
            int  b  = b1 + (((com.GetLowByte() & 128) == 128) ? 1 : 0);
            byte f  = (byte)(com.GetLowByte() & 127);

            if (Data.GetRegisterBit(Data.AddressResolution(f), b) == true)
            {
                Data.IncPC();
                SkipCycle();
            }
        }
Example #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);
            }
        }
Example #3
0
        public static void INCFSZ(Data.Command com)
        {
            byte d = (byte)(com.GetLowByte() & 128);
            byte f = (byte)(com.GetLowByte() & 127);

            byte result = (byte)(Data.GetRegister(Data.AddressResolution(f)) + 1);

            if (result == 0)
            {
                Data.IncPC();
                SkipCycle();
            }

            DirectionalWrite(d, f, result);
        }
Example #4
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();
     }
 }