## [stella] one last 16 bit compare question

 Subject: [stella] one last 16 bit compare question From: KirkIsrael@xxxxxxxxxxxxx Date: 9 Mar 2004 03:23:12 -0000
```
So I'm trying to wrap things up by Wednesday, a self-appointed
deadline that should give Al sufficient enough time to put my
ROMly dream into silicon.

I added in a pretty nifty 3...2...1 countdown to start each
game, as well as randomly launching the ball left or right,
up or down (using the old "timer increments every frame,
AND to get bit D0 and D1" trick)

So except for considering some AI improvements, I have one
more improvement to make... Al pointed out that when the ball
goes flat, it definately doesn't look quite as cool. So I think
along with a maximum vertical speed, I'd like to apply a minimum
vertical speed. Though I'm not sure what the best way of doing that
is.

For the maximum, I punted, and just look at the integer
part of the 16 bit (8 bit int, 8 bit 'fractional'):

BALL_MAX_POS_SPEED = #1
BALL_MAX_NEG_SPEED = #-1

;keep ball speed in range
LDA slowBallYSpeed+1
CMP    #BALL_MAX_POS_SPEED
BMI    BallSpeedLessThanMax
LDA    #BALL_MAX_POS_SPEED
BallSpeedLessThanMax
CMP    #BALL_MAX_NEG_SPEED
BPL    BallSpeedGreaterThanMin
LDA    #BALL_MAX_NEG_SPEED
BallSpeedGreaterThanMin
STA    slowBallYSpeed+1

Is that right, to keep the speed
between 1 255/256 and -1 255/256 ?

What would the code to keep the absolute
value of the ball speed >=  #%00100000 ?

Should I do an AND \$80 to see if it's negative,
and then just do a specific comparison
on the fractional byte?

Thanks, and any last minute suggestions for JoustPong
welcome...

--
KirkIsrael@xxxxxxxxxxxxx    http://kisrael.com
"Sometimes your shallowness is so thorough, it's almost like depth."--Daria

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

```