Whilst having lunch. (the 3 bite decrementing sandwich), and pondering what in the world was I thinking when I reversed the byte (bite) order for the 24 bit decrement code I posted yesterday... here is the third bite.. ; ; The starting point. 16 bit decrement ; 4 cycles doesn't use W and is isochronous ; thanks to Chip Weller for pointing out the TSTF macro ; which just does MOVF XXX,F, thus preserving W ; TSTF LB16 SKPNZ DECF HB16,F DECF LB16,F Now how can this be extended to 24 bits cleanly? ; ; The straight forward extension to 24 bits would be ; something like this.. 5 cycles when LOW is non zero ; and 8 cycles when LOW is zero, and doesn't use W ; TSTF LOW BNZ lbnz TSTF MID SKPNZ DECF HIGH,F DECF MID,F lbnz DECF LOW,F If you were just counting stuff, then 255 times out of 256 it will take just 5 cycles. So I claim an average execution time of (5*255+8)/256 = 5.0117 cycles.... (just kidding) Testing, the above code decrements monotonically for all the case I have checked, however comments and bug reports are always welcome. And yes, I too think Dmitry's solution is the best! Ray Gardiner ray@hdc.com.a