Re: Multplexing sprites
- From: "White Flame \(aka David Holz\)" <whiteflame52@xxxxxxxxxxxxx>
- Date: Thu, 6 Oct 2005 09:04:14 -0700
"Stu Carter" <stu@xxxxxxxxxxxxxxxxxxx> wrote in message
news:Pine.LNX.4.60.0510061446370.24483@xxxxxxxxxxxxxxxxxxxxxxx
> 1) When can I move a sprite that's in use? Do I have to wait until the
> line after its last 'active' line?
If you change the Y-coord after the sprite has started drawing, the entire
sprite will finish drawing where it is, then restart at the new Y-coord. If
the new position is immediately below the old one, they can match up without
blank lines inbetween. If the new start position is inside where the old
one was drawing, it won't redraw, because sprites are only in a "drawing" or
"not drawing mode", triggered on the first line of the sprite matching the
Y-coord.
Changing X-coords, color, frame, etc, should take effect the same or next
line, and can be used to "split" sprites in many different ways.
> I've found some guides on the net but nothing that clearly sets out the
> rules in one place. I guess - implied by super hi-res mode, or whatever
> it's called - that a sprite can be reused directly below itself as long as
> your timing is accurate.
Yes. The easiest is to just change the y coordinate and nothing else. You
can do this change anytime while the previous sprite is drawing. The
problematic timing is getting the color and frame to happen exactly between
those 2 raster lines of display. You can play tricks with having
tops/bottoms of adjacent sprites be similar, not using changing colors in
those few lines of the sprites, etc, to get around timing requirements, of
course at the expense of some graphical flexibility.
> Incidentally, I'm looping in the following manner... is this stupid or
> acceptable?
>
>
> lda #0
> sta var_i
> loop:
>
> ; CODE HERE
> lda #8
> sec
> inc var_i
> sbc var_i
> bne loop
If you're not using the value of var_i, and are just using it to count 8
iterations, it's always faster to count down instead of up, since checking
for zero comes free.
lda #8
sta var_i
loop:
;blahblah
dec var_i
bne loop
If you have .X or .Y free, you can use those, too:
ldx #8
sta var_i
loop;
;l33t c0de
dex
bne loop
If you do need to specifically count up, see Cameron's examples. Also, make
sure that var_i is in zero page (you should basically treat zero page as 256
pseudo-registers), because instructions are shorter and faster in zp.
--
White Flame (aka David Holz)
http://www.white-flame.com/
(spamblock in effect)
.
- Follow-Ups:
- Re: Multplexing sprites
- From: Six/Style
- Re: Multplexing sprites
- From: White Flame \(aka David Holz\)
- Re: Multplexing sprites
- References:
- Multplexing sprites
- From: Stu Carter
- Multplexing sprites
- Prev by Date: c64dieHards & 8-Bit Designs - Update
- Next by Date: Re: Multplexing sprites
- Previous by thread: Re: Multplexing sprites
- Next by thread: Re: Multplexing sprites
- Index(es):
Relevant Pages
|
Loading