Page 1 of 1

A little more speed from the 6502 ...

Posted: Sun Jun 26, 2022 10:54 am
by ibisum
I saw this on HN today and thought my fellow Oric'ians would appreciate reading it too:

https://imapenguin.com/a-little-more-sp ... -the-6502/

The top comments from the HN thread have already found some optimisations, which I though was particularly revealing, especially the idea to use the X register instead of A because of the INCX instruction - which I'm sure you guru's already know about, but I found it interesting as a dilettante/hobbyist:

https://news.ycombinator.com/item?id=31859892

Maybe you guys have some other well-worn tips too?

Re: A little more speed from the 6502 ...

Posted: Sun Jun 26, 2022 11:49 am
by Dbug
Well, the suggested optimizations are more of the absurd type, they assume that the code already knows perfectly what the final values are, and it's optimized code that basically does not "copy" data from a "source" to a "destination" (which the original program did), it become a specialized "paint by number" program that writes all the zeroes, then all the ones, etc...

These things are called "generated code", and it's what has been used for world records like "most 16x16 sprites on an Atari ST", etc... where basically the optimal code path if generated by some PC code that crunches all the combinations of possible positions to generate optimal code that uses all the allowed memory.

It's an interesting topic by itself, but it's not a real-world usable way of programming stuff, and yes, very much was demo making is all about :)