[stella] Re: 2600Cookbook - exact horizontal positioning

Subject: [stella] Re: 2600Cookbook - exact horizontal positioning
From: "Eric Ball" <ericball@xxxxxxxxxxxx>
Date: Wed, 14 Apr 2004 20:58:24 -0400
There are three important concepts in the "Battlezone" horizontal
positioning technique:

First, is uses a SBC #15 / BCS loop for "coarse" positioning instead of
other techniques which calculate XPOS/15 (via complex code or lookup table)
then use a DEX / BNE loop.

Second, the value contained in the A register after the coarse positioning
loop can be transformed using code or a lookup table into the fine
positioning value stored in HMPn.

Finally, both sprites can be positioned back-to-back simultaneously by
performing a STA RESP0 immediately after STA RESP1 and shifting P1 left one
additional pixel by subtracting $10 from the value used for HMP0 to obtain
the value for HMP1.  (This can then be used for 16 bit or even 48bit
sprites.)

Obviously the first two ideas are linked, although there are multiple
variations on how to obtain the fine positioning value with size, speed and
complexity tradeoffs.  It is also possible to design and tweak this routine
to adapt to the different constraints and requirements; like where the
sprites need to be positioned on (or off) screen and where XPOS=0 lands.

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


Current Thread