Re: (fwd) Re: [stella] GunFight 2600: One Limit Reached!

Subject: Re: (fwd) Re: [stella] GunFight 2600: One Limit Reached!
From: Erik Mooney <emooney@xxxxxxxxxxxxxxxx>
Date: Fri, 16 Feb 2001 11:27:56 -0500
> >I found something very interesting regarding quick/clever missile
> >enabling/disabling in the archive:
> >http://www.biglist.com/lists/stella/archives/199704/msg00056.html
> >
> >I goes like this:
> >
> >Do this before the display loop:
> >LDX #$1E        ;for ENAM1 - could also be used for ENABL or ENAM0
> >TXS
> >
> >And in the loop:
> >LDA MissileY
> >SEC
> >SBC Scanline    ;A has (MissileY - Scanline).  If it is >=0 but <4,
> >                ;we want the carry clear.
> >CLC
> >ADC #252        ;If 0 <= A <= 3, the carry will now be clear.
> >LDA #00
> >ADC #00         ;If the carry was clear, A now = 0, so Z is set.
> >PHP             ;Plug it into ENABL.
> >
> >I think it can be optimised here & there. Besides the carry especially
> >the last part. Wouldn't...
> >ROL
> >ROL
> >PHP
> >...do the the trick way shorter & quicker than
> >LDA #00
> >ADC #00         ;If the carry was clear, A now = 0, so Z is set.
> >PHP             ;Plug it into ENABL.
> >????

Your way is faster by only 2 cycles (because you can remove the CLC.)
However, this version was posted to the list some time after that archived
message.  After the subtraction, do
AND #$FC
PHP

which is exceedingly clever and short.  That does exactly what we want -
if A is between 0 and 3 before the AND, the zero flag will be set, and so
ENAMx will be enabled.  This only works if your missile height is a power
of two, though.

> >But still... wouldn't it be best to make the missile yellow like the
> >background, where there is no gun? The only other object actually
> >crossing that *invisible* missile would be the ball. Can't the ball just
> >have a higher priority than the misslie?

Unfortunately, no.  You can only give the ball a higher priority than the
players, if you don't mind the playfield also having a higher priority.


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

Current Thread