
Originally Posted by
Bruce
Code:
I VAR BYTE SYSTEM
LOOP1: ; 150 cycles. Not very fast
For I=10 TO 1 STEP -1
NEXT I
LOOP2: ; 90 cycles. A lot better
I = 10
REPEAT
I=I-1
UNTIL I=0
ASM ; 31 cycles. Pretty fast
LOOP3
MOVLW 0xA
MOVWF I ; I=10
INNER
DECFSZ I,F ; I=I-1. IF I=0 skip next instruction
GOTO INNER ; Loop until I=0
ENDASM
FINISH:
GOTO FINISH
...and, there is also the expert approach!
You know, we kiss the hand of the experts here.
------------------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks