I'm looking at this myself now. For me there was never any question of having some amount of subpixel precision since whole pixel speeds are always awkward. But the question is, how much? Right now I use 2 bits just for testing purposes which is sufficient in terms of speed, but other methods listed here make a lot of sense.
I like the way tepples laid out the 4 bit method, it seems quite enough to store a standard sized map and is metatile friendly. But I also like Celius's 8 bit precision, 24 bit coords, for the simpler screen operations and ultimate speed control.
However, 24 bit adds and subtractions get really bad, especially since you need to use 16 bit velocities for pixel movement greater than 1.
Code:
clc ;16 bit add
lda y_coord
adc y_veloc
sta y_coord
lda y_coord+1
adc #0
sta y_coord+1
clc ;24 bit add
lda y_coord
adc y_veloc
sta y_coord
lda y_coord+1
adc y_veloc+1
sta y_coord+1
lda y_coord+2
adc #0
sta y_coord+2
But then again, assuming I'm not missing something simple, your code to pull out the screen position in 16 bit is always annoying:
Code:
lsr y_coord+1 ;Discard subpixel precision...
ror y_coord
lsr y_coord+1
ror y_coord
lsr y_coord+1
ror y_coord
lsr y_coord+1
ror y_coord
lda y_coord ;24 bit skips to this step :)
And then there's the fact that every moving object in 24 bit obviously takes up an extra byte, unless a method can be used to treat enemies and such with less precision and remain compatible with the player object.
Any other thoughts on the subject? Any other methods that might work better, intermediate or counter-based?