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(); } }
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); } }
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); }
/// <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(); } }