>> FAST ASM, C VERSION, SMALL ASM >> 1603 cycles, 1889 cycles, 3016 cycles >> 132 instructions, 146 instructions, 89 instructions > > Wouter van Ooijen Sorry for the (very) late reply. Just saw this message laying in my inbox. FAST ASM - Probably close to a day including several improvements to the=20 version reported above. It now runs in 1442 cycles and takes 125=20 instructions on a dsPIC30/dsPIC33 (not including the dsPIC33EXXXX, which=20 takes more cycles, but allows for a much faster clock). Three of the=20 speedups: (A) using the dsPIC "DO" instruction, (B) removing a couple stall= s=20 because of read-after-write hazards, and (C) using the mul.uu reg,#0,reg=20 instruction to clear a double register in one cycle/one instruction. SMALL ASM - About an hour, basing it on the code in FAST ASM. Now down to 8= 3=20 instructions and a little faster at 2925 cycles. C VERSION - Maybe 20 minutes. So, was it worth it to write the FAST ASM version? While the performance is= =20 all that much better than the C implementation it was a pleasant challenge.= =20 Also, I implemented the C version last, just for laughs, and was very(!)=20 surprised at the job done by the optimizer. In fact, I stole the "mul.uu=20 reg,#0,reg" trick from the C compiler's output. -- Bob Ammerman RAm Systems --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .