Re: [stella] Horizontal Positioning and Movement

Subject: Re: [stella] Horizontal Positioning and Movement
From: emooney@xxxxxxxxxxxxxxxx (Erik Mooney)
Date: Tue, 02 Sep 1997 23:14:04 GMT
>Could someone please give me some assistance with horizontal moveable
>object positioning and horizontal movement.
>
>I could really use a simple example of how it's done. Or at least a plain
>english explanation of the process. I can't make heads or tails out of what
>the Stella Programmer's guide is telling me and my experiments in such
>matters are not meeting with great success.

Ok... Each object: the two players, the two missiles, and the ball has
a horizontal-position coordinate.  The coordinate is set by writing to
the appropriate register (RESP0, RESP1, RESM0, RESM1, or RESBL).  The
value written to these registers does not matter; the object gets
placed at the horizontal position from WSYNC at which the RESxx
finished, plus six pixels.  Say you want an object 22 pixels from the
left edge of the screen.  That's 90 pixels from WSYNC.  So, because of
the six-pixel delay, your RESP0 must end at pixel 84.  Each CPU cycle
counts off three pixels on the screen, so your STA RESP0 must end on
cycle 84/3=28.  Since STA RESP0 takes three cycles, the instruction
must begin on cycle 26.  Note: the object will not be displayed until
the line *after* you do the STA RESP0, and then only if GRP0 and
COLUP0 are nonzero and VBLANK is zero.  The common method of
displaying players (think Combat) is to calculate and perform the
RESP0 during vertical blank, and then leave GRP0 zero until the
appropriate time during screen-drawing.  Once a RESP0 is done, the
object remains at that horizontal position until further notice.

That allows you to put an object at any 3-pixel interval.  But what if
you want your object at pixel 89?  The STA RESP0 has to end on cycle
25 2/3... that can't be done.  For single-pixel resolution, you must
use the fine motion registers, aka the horizontal motion registers.
These are HMP0, HMP1, HMM0, HMM1, and HMBL.  These registers accept
values of -8 to 7, with positive values meaning leftward movement and
negative values indicating rightward movement.  These values must also
be in the top four bits of the byte.  Once you write a value to HMxx,
it doesn't take effect until you write to HMOVE, which must be done
immediately after a WSYNC.

>Damn it! Why couldn't they handle horizontal movement the same way the
>C-64 did. You divide the screen into 256 horizontal locations, you stick
>a number between 0 and 255 into the sprite's X register and that's where
>it ends up on the screen. Arrrrgggg!!!! Would that have been too much to
>ask for?

Apparently so :)

--
Archives updated once/day at http://www.biglist.com/lists/stella/archives/
Unsubscribing and other info at http://www.biglist.com/lists/stella/stella.html

Current Thread