RE: [stella] skipDraw explained (I hope) (was: bipolar joustpong)

Subject: RE: [stella] skipDraw explained (I hope) (was: bipolar joustpong)
From: "Dennis Debro" <ddebro@xxxxxxxxxxxxx>
Date: Fri, 5 Sep 2003 23:22:28 -0400
Hi Kirk,

> Is SpriteEnd equal to which scanline the sprite should start
> to be drawn on? And is that counting down from like 192 or
> up from 0?

Let's map it out together.

Let's say the sprite is 8 scan lines high. Trying to think like Thomas
:) he would store his sprites in ROM upside down. So that would mean
that scanLine would start with the number of scan lines for the kernel.
Let's just use 192 for now.

So before starting the kernel we would do...

   lda #192             ; maximum scan lines for the kernel
   sta scanLine         ; keeps track of scan line

Now let's position spriteEnd at location 96 to see what it represents.
 
As we do the kernel processing scanLine is decremented each scan line.
Then when we reach scan line 96...

   lda scanLine
   sec                     ; well for this example I don't know the
state
                           ; of the carry bit :)
   sbc spriteEnd           ; so that's 96 - 96 = 0
   adc #SPRITEHEIGHT       ; remember the sprite is 8 lines high
   bcc .skipDraw           ; out of range???
   tay
   lda (spriteGraphic),y   ; use indirect loading here
   sta GRP0
   
Now lets say that scanLine = 88

   lda scanLine            ; a = 88
   sec
   sbc spriteEnd           ; 88 - 96 = -8 or #$F8 (C = 0)
   adc #SPRITEHEIGHT       ; -8 + 8 = 0 (ADC: A = A + M + C)
   bcc .skipDraw

So spriteEnd would be the low bound of the sprite.

BTW, I looked at RobotCity for an example and it's there too. Thomas
will have to explain how he does this without moving the accumulator to
y.

.contDrawPlayer: 
    dey
    tya
    sbc yPosP0
    adc #H_TANK
    bcs.doDrawP0
    lda #0
    NOP_W
.doDrawP0:
    lda (ptrP0),y
    sta.w GRP0

I guess we might have to wait for Thomas to get back from vacation to
proof read this ;)

Take care,
Dennis


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


Current Thread