I just happened to be looking through some of the code the other day and noticed a small performance related bug to do with moving the player missile graphics up and down. It’s a shame I didn’t notice it before really – it’s not like I’ve been poring over the code intently since releasing the game…
Anyway, it’s a tiny performance difference – about 40 machine cycles more than it should be every Vertical Blank, when the man is moving up. (To put it in perspective, there are over 35000 cycles between Vertical Blanks).
The code was clearing more data than it ought, by dropping through to do some unnecessary clearing instead of branching past it. By not having a branch always instruction (no, JMP doesn’t count – it’s a whole 3 bytes and not relocatable!), the 6502 lends itself particularly well to making that kind of mistake – leaving the programmer free to pick the wrong conditional branch after a “then” in ”if…then…else” situations.
Not that you’ll notice any difference, and purely because I was just irritated at finding it, I have put a fixed version in the downloads. I won’t be doing much browsing back through the code again any time soon…
Recent Comments