After that, whenever I want to apply momentum, I take the speed value, add that reversed counter value to it, and then shift left 8. The result of that is then added to the coordinate as usual:
Code: Select all
; d0 = Position
; d1 = Speed
; d2 = Counter (zero extended)
add.w d2, d1 ; speed += subpixel
asr.w #8, d1 ; speed >>= 8
add.w d1, d0 ; position += speed
This same method should be easily doable on the SNES, and I'd assume on the NES as well, even. Here's an example of how well it works. Note that if you want to cheap out, you can get away with less bits, e.g. you could just take four bits from the counter and leave the rest cleared (this gives you steps of 1/16th pixels, which most of the time is more than enough), just make sure that the bits are at the top of the byte and not the bottom.
The two biggest advantages are that it means you need less memory and that everything is measured in pixels (which can help reduce errors). The downside is the sightly added complexity (although for many things you don't even need subpixel momentum anyway, so remember that).
EDIT: added comments.
EDIT 2: coming to think on it, yeah it's pretty much what tepples said, except that instead of being a pseudorandom value it's the most perfect pattern that gets the job done instead (and the addition of 1 comes as a side effect of the calculation, rather than being an explicit branch).