Re: [stella] Death Derby, new build

Subject: Re: [stella] Death Derby, new build
From: Thomas Jentzsch <tjentzsch@xxxxxx>
Date: Sun, 7 Oct 2001 10:52:19 +0100
Glenn Saunders wrote:
> In this build a lot of the stuff is laid out in memory, the sprites et. al.

Your demo is showing a lot of flickering crap at the top. I guess that
is intentional for now. When I tried to adjust this with Page-Up/Down in
z26, the flickering crap seems to move(!) further down. Can't explain
this, there seems something to be completely broken in your code.

> I actually have a car showing up, but I don't like the routines that handle 
> the logic.  Too much RAM and cycles.

I agree, but here optimizations will make the explanations quite

I'm giving you the same suggestions, that I gave to Manuel (s. Gunfight
2600, Feb, 13. 2001).

The first step, you should try, is to use Y as THE universal rowcounter.
Try not to use Y for anything else, and do all loading of the graphics
(cars, later the pedestrians) with this rowcounter. That way you save a
lot of cycles during the kernel and some RAM space. You have a two-line
kernel, so let Y countdown every 2nd row.

The kernel code for the car could look like this:
       SBC SpriteStart         ; contains the line where the car starts+1
       ADC #SPRITEHEIGHT       ; assuming the height is constant (i.E. 8)
       BCC .skipDraw
       LDA (P0_CurrentFramePtr),Y
       STA GRP0

This requires, that you must do some a bit more complicated setup
calculations for the pointers (i.E. P0_CurrentFramePtr).

Currently this pointer is directly pointing to CarRotation0..4. For the
code above, we must subtract the y-position, or: the value of the
rowcounter Y when the car is drawn (i.E. 50).

        LDA #<CarRotation0
        SBC #50
        STA P0_CurrentFramePtr
        LDA #>CarRotation0
        SBC #0
        STA P0_CurrentFramePtr+1
        LDA #51
        STA SpriteStart

And you have to arrange your data very carefully, if you want to avoid
additional cycles for crossing a page. If your kernel is 180 lines tall,
you countdown Y every 2nd line and the car can be displayed in every
row, then your data must be inside 256*n+180/2 and 256*(n+1)-1.

I hope, this makes sense to you. But my english is limited and here the
kernel is starting to get complex. Maybe Manuel can explain this better.

> I tried to use indirect addressing to set up pointers to the start of car 
> sprite ROM in order to handle the rotations but I don't think I understand 
> how to do this properly.  I had to go back to hardcoding it to one car shape.

> Please assist :)

That's easier :)
    LDX P0_CurrentRowCounter
    LDA (P0_CurrentFramePtr,X)    ; indexed, indirect
    LDY P0_CurrentRowCounter
    LDA (P0_CurrentFramePtr),Y    ; indirect, indexed

Another tip:
    BPL InitializeTombstones  ; replaces BNE
; remove the next 8 instructions

Have fun!
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |

Archives (includes files) at
Unsub & more at

Current Thread