Re: [stella] I did it!(SFCaves 2600)

Subject: Re: [stella] I did it!(SFCaves 2600)
From: "Thomas Jentzsch" <tjentzsch@xxxxxx>
Date: Mon, 2 Oct 2000 10:13:23 +0200
Mark De Smet wrote: 
> Well, after much talk about it not being possible, I
> think I've gotten
> past the hardest part.  Well, mostly ;-)
[snip]
> -I use 2 lines to do the computations for the cave
> top, then the next two
> lines to do the computations for the bottom of the
> caves.  This way I
> don't have to deal with a complex line where on the
> same line is the top
> of the cave and the bottom of the cave(which would
> happen when the cave
> goes down or up sharply.).
[snip]
> So, what do people think?

I think you are wasting far to many cycles with this. Try to avoid those complex lines, or find a solution where you can handle them in one line. You'll need much more free cycles for the player object, than you might expect now. ;-)

Some other hints:
- Store the contents of X in memory and use the X and Y registers for indexing at the left and right border together. This could look like that:

loopcave1:
    STA WSYNC           ;3

    STA PF0             ;3
    STA PF1             ;3
    STA PF2             ;3

    ...                 ;        ~30 cycles free time here

    LDX line            ;3

    LDA currleftcol     ;3      ;load the column from last line.
    CLC                 ;2      ;???
    ADC leftcave,X      ;4      ;add on the shift.
    STA currleftcol     ;3      ;save the result for next line.
    TAY                 ;2      ;put result into Y for indexing

    LDA currrightcol    ;3      ;load the column from last line.
    SEC                 ;2      ;???
    SBC rightcave,X     ;4      ;add on the shift.
    TAX

    LDA cavedata1a,Y    ;4      ;load the first byte.
    AND cavedata2a,X    ;4      ;and the halves together, and load!

    STA WSYNC           ;3

    STA PF0             ;3| 3
    LDA cavedata1b,Y    ;4      ;load the second byte.
    AND cavedata2b,X    ;4      ;and the halves together, and load!
    STA PF1             ;3|14
    LDA cavedata1c,Y    ;4      ;load the third byte.
    AND cavedata2c,X    ;4      ;and the halves together, and load!
    STA PF2             ;3|25

    LDA cavedata1d,Y    ;4      ;load the first byte.
    AND cavedata2d,X    ;4      ;and the halves together, and load!
    STA PF0             ;3|36
    LDA cavedata1e,Y    ;4      ;load second byte.
    AND cavedata2e,X    ;4      ;and the halves together, and load!
    STA PF1             ;3|47
    LDA cavedata1f,Y    ;4      ;load third byte.
    AND cavedata2f,X    ;4      ;and the halves together, and load!
    STA PF2             ;3|58

    LDA line            ;3
    ADC height          ;3
    TAY                 ;2

    LDA #00             ;2
    SEC                 ;2|70   ;???
    ...                 ;       ;6 cycles free time here

    ...

    DEC LINE            ;5      ;3 extra clycles here
    BEQ noloopcave1     ;23     ;check if done, otherwise, loop.
    JMP loopcave1       ;3      ;always 3 cycles!
noloopcave1:

- If you have the chance to determine (from the contents of X and Y), if the left/right half of the line is full/empty you could gain some extra time (i did this in Thrust)
- Make sure that the indexes and branches never cross a bank (align your code and data). Then you have the chance to get the 3 extra cycles from WSYNC.
- Get rid of as many CLC/SEC as possible!

BTW: I don't know how your tables look like, but why do you use AND in the first and ORA in he second half? Always using ORA might help to solve the complex line problems.

Go on...

Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |
_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName@xxxxxx, 8MB Speicher, Verschluesselung - http://freemail.web.de



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

Current Thread