Optimizing an Imaginary Sprite Part 7

<< Previous | Next >>

Version 6c – Mind. Blown.

Will the madness ever stop? In this version Simon is able to make use of masking and OR’ing sprite and background data. We are down to 17 instructions.


Version 6c (new) on left, version 5p (old) on right. Sorry I had to switch the sides on you.

This time we see that by using some clever bit tests and masking, we are able to decide if we need to keep the background nibbles, or mask them off. By doing that, you can then just do a logical or on A which is the background, with the sprite byte. Lines 13 & 17 do the background masking. Line 19 does the logical or ORA -1,x which is to say, or the masked value of the background with the sprite byte. After the logical or, A will contain appropriate value to store into the mixbuf.

Mind. Blown.

Thanks for listening. Feel free to leave a comment if you see any problems, like it, or hate it. All comments get moderated to avoid spam.

Next, Resources