The program counter keeps track of which instruction is next to be executed. See the PIC 16F877 data sheet, section 2.3 for a detailed description of PCL and PCLATH.
Basically, when your program runs, the next instruction's memory locaton is automatically loaded while the current instruction is being executed. Assume the program has been run up until instruction number 0049. At this point, the PC contains 0050. This lets the microcontroller know where the next instruction is that it fetches from memory to execute. So 0049 is done. The PIC asks "Where is the next instruction?" It looks at the PC, sees the value 0050, and loads whatever command is there, in this case:
That instruction is Bit Test F Skip if Clear. If the specified bit is clear (0), it will skip over the next instruction, and take two cycles to execute, since it will have to load a new memory location to skip to. If the bit is set (1), the next memory location was already automatically set, so it continues normally and only takes single cycle to execute, just like every other command.
So we will make two run throughs of the code. In the first case the bit is set (1), so things will flow normally. In the second case, the bit is clear (0), which will change things:
Code:
Case 1, bit is set (1):
00xx Previous executes. Time unknown. PC = 0050
0050 BTFSC executes. Time = 1 cycle. PC = 0051
0051 ADDLW executes. Time = 1 cycle. PC = 0052
0052 SUBLW executes. Time = 1 cycle. PC = 0053
Case 2, bit is clear (0):
00xx Previous executes. Time unknown. PC = 0050
0050 BTFSC executes. Time = 2 cycle. PC = 0052 (1 to execute, 1 to change PC)
0052 SUBLW executes. Time = 1 cycle. PC = 0053
Does this answer your question?