Re: [stella] My very first

Subject: Re: [stella] My very first
From: "Chris Larkin" <clarkin@xxxxxxxxxxxxx>
Date: Wed, 1 Jan 2003 19:53:41 -0800
I'm not an expert programmer for the 2600 by any means... but I'll help you
with some simple optimizations I noticed on a quick skim through.

Consider this early in your code.. it'll save a tiny bit of ROM space, but
every bit is sacred :-)
Silence
        ldx #$00        ; blessed silence
        stx AUDV0
        stx AUDV1

Colors
        stx NUSIZ0
        stx COLUBK

Because you already LDX to #$00 in Silence there is no reason to LDX again
with the same value only a few lines later... just keep using it :-) In-Fact
after your memory clear loop is finished, the accumulator has been
decremented to #00, so you can even just load these values there if you
want.  However if you plan on changing these values later in the game :-)
This makes sense.

You also have quite a bit of room in HBlank left... if you load the graphics
data for that scan line into RAM (If you think you will have room) you will
save cycles when you load it into it's appropriate graphics register.

You can also store your maze data, it ROM area's for each PF register...
Example

MazePF0-1 --- Put your maze PF0 data here for each scan line (First half of
PF)
MazePF1-1 --- Put your maze PF1 data here for each scan line
MazePF2-1 ""
MazePF0-2 --- maze PFO data here for second half of PF.

So MazePF0-1,0 is the first scan line of data.

This way you only have to increment Y once per scan line, preferably during
HBlank... this will give much more room in the kernel.

        iny
        lda MazePF0-1,Y         ; cycles 4
        sta PF0            ; cycles 3
        lda MazePF1-1,Y         ; cycles 4
        sta PF1            ; cycles 3
        lda MazePF2-1,Y         ; cycles 4
        sta PF2            ; cycles 3 == 25

        ldx MazePF0-2,Y         ; cycles 4
        stx PF0            ; cycles 3
        ldx MazePF1-2,Y         ; cycles 4
        stx PF1            ; cycles 3
        ldx MazePF2-2,Y         ; cycles 4
        stx PF2            ; cycles 3 == 27

Saves you 14 cycles in your Kernel :-) Woo Hoo!! :-)  And if you load some
of that data into RAM during HBlank, you will have even more room when the
line is visible!.

I hope this helps.. I was only able to skim through it... :-) Good job so
far!!

--Chris Larkin



----- Original Message -----
From: "Adam Wozniak" <adam@xxxxxxxxxxxxxxxx>
To: <stella@xxxxxxxxxxx>
Sent: Wednesday, January 01, 2003 7:11 PM
Subject: [stella] My very first


> My very first attempt at a 2600 game.
>
> It's Sokoban, a classic "push blocks around a maze" puzzle game.
>
> Nothing really there yet to speak of, but it does run.
>
> Can anybody spot any cheap ways to gain some cycles?
>
> I'm using an asymmetric playfield, and I'm afraid my
> kernel doesn't have enough time left to draw sprites!
>
> --
> Will code for food.       http://cuddlepuddle.org/~adam/resume.html
>
> adam@xxxxxxxxxxxxxxxx        http://cuddlepuddle.org/~adam/pgp.html
>

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


Current Thread