Re: [stella] he got game

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.


    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

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.


Archives (includes files) at
Unsub & more at

Current Thread