Re: [stella] one last 16 bit compare question

Subject: Re: [stella] one last 16 bit compare question
From: "Eric Ball" <ericball@xxxxxxxxxxxx>
Date: Tue, 9 Mar 2004 23:32:30 -0500
Be careful when comparing only the integer portion of a fixed point number
because the fractional portion is considered unsigned.

int    range
2    2.000 to 2.996
1    1.000 to 1.996
0    0.000 to 0.996
-1    -0.004 to -1.000
-2    -1.004 to -2.000

So if you clip the integer value to +/- 2 your positive range will be higher
than your negative range.

You will also need to update the fractional portion if you are dealing with
small integer values or you will get a weird stutter.  (e.g. clip the
integer portion of +3.004 to 2 and the value is 2.004 instead of 2.996)

Don't feel bad, I just found this out for SpaceWar! 7800.

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread