Bob Ammerman [RAMMERMAN at PRODIGY.NET] says:
I prefix my N*3 delay routine with a few instructions and branch to the right one for the desired delay.DELAY macro count local next local n n = (count) if n < D'1' error "Delay count less than 1" exitm endif if n < D'4' if (n & 1) nop endif if (n & 2) goto next next endif exitm endif if n <= D'7' call delay4-(n-4) exitm endif movlw (n-D'5')/D'3' call delay_3W_p4-((n+1) % 3) endm DELAY2 macro first,last DELAY last-first+1 endm ; Delay Routine delay_3W_p6: ;3N+6 from here down (includes call and return) movwf temp0 ;{1} delay_3W_p5: ;3N+5 from here down (includes call and return) movwf temp0 ;{1} delay_3W_p4: ;3N+4 from here down (includes call and return) movwf temp0 ;{1} delay_loop: ;3N+1 from here down (includes return) decfsz temp0,F ;{N+1} loop eats 3N-1 goto delay_loop ;{2N-2} return ;{2} delay7: nop delay6: nop delay5: nop delay4: return end