A little more speed from the 6502 ...

Here you can ask questions or provide insights about how to use efficiently 6502 assembly code on the Oric.
User avatar
ibisum
Wing Commander
Posts: 1535
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

A little more speed from the 6502 ...

Post 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?
User avatar
Dbug
Site Admin
Posts: 4082
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

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

Post 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 :)
Post Reply