Often times in project coding development, the programmer need to generate some sort of delay. It is hard and tedious to calculate by hand, an alternative way is to use the Pic Delay Code Generator for ASM Programmers made by N Golovchenko.
This is a very useful software for Pic Programming in Assembly Language in ways that it saves both time and energy for delay calculation.
For long delays (> 10 cycles) the code is based on nested loops using 'decfsz' and 'goto' instructions. Small delays are built using 'goto $ + 1' (2 cycles delay) and 'nop' (one cycle delay).
To calculate nested loop counter values the code generator uses an optimum search algorithm. The algorithm finds such values for counters that achieve good approximation to the specified delay.
Even if there is an error in the first block of nested loops, the rest of the code fixes that. As a result, one cycle resolution is achieved.