Subject: Re: [stella] he got game From: "Andrew Davie" <atari2600@xxxxxxxxxxxxx> Date: Tue, 2 Sep 2003 13:46:44 +1000 |
> Hrm, maybe I do need to look into fractional speeds, round down > to the nearest integer for what's actually added to the relevant > position each frame. (Since after all, even "4/5 rounding" is > truncation but with a different window) Eww, pos/neg is going to > need some careful work no. NO!! The positions have fractional bytes, too. The fractions (8 bits) represent fractions of a pixel. You use the whole number for position display, the fractions give you your beautiful slow movement. No rounding necessary, no "truncation". Just think of it as increasing your movement resolution by 256x but actually displaying on pixel boundaries. Code: clc lda position adc speed sta position ; fractional bytes now done lda position+1 adc speed+1 sta position+1 ; whole pixels (we display the object at 'position+1' There's absolutely no change needed for positive/negative calculations. We're just adding a 16-bit signed number to another, and taking the high byte of the result to mean "whole pixels". The low byte is fractions of a pixel. Both speed and position variables are essentially 8 bit whole number, 8 bit fractional, or in other words 8.8 format. Cheers A ---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] he got game, KirkIsrael | Thread | RE: [stella] he got game, KirkIsrael |
RE: [stella] he got game, KirkIsrael | Date | Re: [stella] he got game, Andrew Davie |
Month |