> >For small projects, there is probably no compiler that can do as well as a >good programmer at squeezing out every last byte of RAM, instruction, or >CPU cycle; this is true especially of the last point because compilers have >no way of knowing what parts of the code are time-critical (no wasted cycles >at all allowed), what parts need to run quickly (but need not be hyper- >optimized) and what parts could run 10 times slower than optimal with no >consequence to the end user. > [snip] >If you like assembly, tell me how you would possibly code something that >reads as well as the following: [a paraphrase and simplification of my real >code] > [snip] > >About 25 lines of C code, presupposing the existence of fmult and recip. >Even assuming the existence of any reasonable set of library routines, I >challenge you to write the above in less than 100 lines of assembly and >to have it make any sense whatsoever to the poor soul who might have to >read it. > I just want to make a quick comment about this assembler / C debate. I think I saw an article in Circuit Cellar that solves the problem of using C as opposed to assembler for writting easily readable and maintainable code. The technique involves writing the code in assembler and then placing the C code that equates to the assembler in the comments to the right of the assembler code. This gives some(!) of the benefits of both languages at the same time. Many times I see comments embedded in assembler code that look like this: movlw 8 movwf Cnt ; Loop 8 times loop movf Reg1, w ; Move value to w movwf Reg2 ; Move w to Reg2 . . . decfsz Cnt, f ; Decrement Counter goto loop ; Is it zero yet? . . . Gee!! Thanks a lot. (Duh) I much prefer to see this: movlw 8 ; for (Cnt=8; Cnt>0; Cnt--) movwf Cnt ; { loop movf Reg1, w ; Reg2 = Reg1; movwf Reg2 . . . decfsz Cnt, f goto loop ; } . . . Now you have the speed and compactness of assembler AND the readability of C. Using this technique, the programmer acts as the C compiler which allows for the greatest degree of optimization possible. Neat huh? Just my two cents worth. If you agree, use it - if not, trash it. ps - I love this list!! I learn something most every day.