Standard comment upon any mention of Bresenham:
- for "90â€“150 cycles" (i.e. I just Googled it) you can perform an 8x8 divide with remainder;
- if you do that then you can use the Bresenham run-slice version.
i.e. if you need to draw a line that is a pixels across and b pixels down, a > b, then you need to draw b instances of a horizontal line that is either floor(a/b) or floor(a/b)+1 pixels long.
You get floor(a/b) from the divide and you have the remainder, a mod b, which is the error term (i.e. accumulate that per slice until it overflows, for that run draw at +1 length; seed your error term with half the modulus to get normal rounding).
The advantage then being that the decisionÂ step is peformed much less frequently and most of your pixel plots are parts of long runs. So you can save quite a bit if you're on a 1bpp or 2bpp graphics mode, where plotting a pixel is an involved read-modify-write process.
As the savings don't cut in until lines are sufficiently long and sufficiently flat, an ideal implementation would switch between classic Bresenham and run slice probably based on the major axis beyond a certain length and the minor then below a certain other length. Though with Tempest you've got a bunch of lines that don't change in length or position much so you could probably preassign and still do fairly well. Admittedly I'm imagining Tempest 2000 in which the camera bobs around quite a lot; I've not played it a lot but I think it's fairly static in the original? Which might even mean that all you're actually drawing for each frame is the enemies and player?
EDIT: has anybody ever put together a profiling sandbox? I'm imagining you chuck it a blob of 6502 code and a load location plus a list of tests; each test is a description of initial state plus a termination condition and a weighting; it runs through them all and gives you the weighted total cycle count. Turn it into a full unit tester if you want by adding a state test post termination, but then the scripting probably gets somewhat more complicated. But it would allow you more rapidly to get towards the optimal solution for leaf functionality like drawing a line.