Re: [stella] Euchre: a tight fit

Subject: Re: [stella] Euchre: a tight fit
From: "Erik J. Eid" <eeid@xxxxxxxxx>
Date: Mon, 17 Sep 2001 21:41:23 -0400
I had asked for help in optimizing my Euchre game, which had gone beyond its 4 KB limits. Here was one of the suggestions:

At 10:12 AM 9/4/01 +1000, Andrew Davie wrote:
You can save a fair bit by junking the LetterImageTable and calculating the
address instead of looking it up.  This requires the letters to be defined
in a set order, but that's not a big limitation.  Replace...

    lda LetterImageTable,x
    sta $00,y
    lda LetterImageTable+1,x
    sta $01,y


    adc #<LetterImageSpace
    sta 0,y
    lda #>LetterImageSpace
    adc #0                                            ; can be omitted if
LetterImage stuff doesn't cross a page
    sta 1,y

This loses 1 byte in the routine, but junks the LetterImageTable, saving a
total of 65 bytes or so.

Seeing as the messages are formed of six "letters" each, which are indexes into the table, the letters are already in a known order, so this should work well.

I would like to understand this revised routine a little better, so I have a couple of questions (particularly directed at Andrew, but open as always to the list):

- Why is it not necessary to include a clc before each adc statement? I got into trouble with a very early version of the program by not doing this.
- What is the purpose of the adc #0 statement?

. . \_ +\_ + o_-/ . O
. \-_o -=/- . .
. . \=// .
---------\_______ ||O ___.______
/* Erik Eid */ \____||L/\_____/
/* eeid@xxxxxxxxx */_______________________

- Archives (includes files) at Unsub & more at

Current Thread