Subject: Re: [stella] Re: the big sprite|
From: Erik Mooney <emooney@xxxxxxxxxxxxxxxx>
Date: Tue, 7 Apr 1998 14:46:54 -0400 (EDT)
> >Alright, playfield is out. The ball is still possible, even without > >branching. Assuming Y is used as the counter during the draw-sprite > >routine, and the stack has been preset to ENABL: > > > >TYA > >SBC BallY > >AND #$F8 ;this is a constant for ball height - must be multiple of2 > >PHP > >PLA ;to reset the stack pointer > > A clever idea, but AND does not affect the carry bit. You certainly > meant ADC #hight, which doesn't have to be a multiple of 2, right? I was correct the first time. THis is the same PHP trick used to do the missiles in Combat (and in INV.) BallY has the line on which we want the ball to *end* (and remember that Y is counting down to zero, so if BallY = 30, the ball will display on the 37th through 30th lines from the *bottom*.) After the SBC, the accumulator has the number of lines until the ball ends. If this is between 7 and 0 inclusive, the AND clears the accumulator (not important) and also sets the zero flag (this is the key)... if the accumulator is not between 7 and 0, we are *not* in the screen range where we want to display the ball, so the zero flag will be not set. Now, the zero flag says whether or not we want to display the ball. Since the zero flag is in bit 1 of the flags register, and ENABL uses bit 1 of its register, all we need to do is store the flags register in ENABL, and the fastest way to do that is set the stack to ENABL ($19 if memory serves me correctly), and do a PHP. It's not *perfect* - I should be doing a CLC before the SBC, but there just aren't the cycles to do it, and as before, one-line inaccuracy in display shuoldn't be critical. -- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/stella.html Don't post pirate BINs to Stellalist. Be a programmer, not a pirate. Write the best game, win framed autographs of famous Atari alumni!!