Re:Assembly Language Programming: Still Relevant Today (2015)
by druzyek on Wednesday January 01, 2020 @02:55AM
(#21927151)
This article is specific to the 6502 where the commonly used CC65 C compiler the author references produces much, much worse code speed wise than what you can with pure assembly. In that regard, the article is not simplistic in the least. Coincidentally, I messaged the author just yesterday about the for loop example to point out that it was generated without optimization. Even with optimization enabled, the code is still about 3 times slower than hand written assembly. I know this may not be typical for other architectures like AVR but it certainly is for 6502.
[ Parent
| on HN ]
Re:Assembly Language Programming: Still Relevant Today (2015)
by cardiffspaceman on Wednesday January 01, 2020 @11:09AM
(#21928593)
I used to do my production code exclusively in 6502 assembler, with some tools in P-system Pascal. As I would read in magazines about the C language I would try to imagine what the C compiler would generate for certain constructs, and I couldn't imagine it being efficient compared to other 8-bit processors. Then we decided to experiment (at the company) with C and got a compiler. I was right, the code was awful. It used exactly the idioms I thought I would use if I had to to it. I can picture a really top-notch compiler doing better (because I'm more familiar with optimization in compilers now), but sooner or later some of the quirks (like 8-bit index registers and only page 0 can be used for pointers) will catch you.