Sometimes to make something faster, making it smaller isn’t the answer. We saw that in the last section, and we get to see it here as well. This time however, it is more obvious. This was my only contribution to all the optimizations. Basically I test to see if the entire byte (both nibbles) are 0, and if so, we can just skip right to copying the background byte.
Version 5p (new) on left, version 5 (old) on right. Sorry I had to switch the sides on you.
What’s happened here is that at line 9 I introduced a check to see if A, the sprite byte, is zero, meaning both nibbles are also zero. This means we can just skip the entire block of code that works on nibbles and just dump B, the background right into
mixbuf. This saves us from executing 11 instructions, and saving about 59 cycles.
Copyright © 2019, Lee Patterson