Re: [stella] Euchre: at the barn door

Subject: Re: [stella] Euchre: at the barn door
From: Thomas Jentzsch <tjentzsch@xxxxxx>
Date: Tue, 13 Aug 2002 18:08:30 +0200
Erik Eid wrote:
> Thanks to Thomas Jentzch for his optimization suggestions!

No problem. :-)

> I implemented his jump table for the stages

You could save the jump to EndCase if you move the tables and the
StageJmp subroutine before 'StartBidding1' (-3 bytes)

I also noticed that you write "Shuffling takes an awfully long time" and
had a look at the code.
1. You seem to use only the lowest 4 bits but you always create 8 new
bits (similar happening at other paces too). IMO that's not necessary.
2. You should use the lower bits, because its faster and mainly because
your random generator code shifts its new bits into the low bits (rol
rand1).
3. Your shuffling routine has some flaws. As I said, you only use the
lowest 4 bits (= 16 values) and try to generate 24 different values from
that. But that doesn't work correct, your code only produces 0, 1, 3, 4,
6, ..23. So all 3*n-1 values are missing. I would suggest, that you use
5 bits and repeat if the result is higher than 23. 

And you should check, if a simplier (smaller and much faster) random
routine (like in River Raid, see NextRandom16) will to the job too. The
current code may be more perfectly random, but IMO that's a not really
necessary here.

Then there is the GetXYImage routine. Here you can easily save one byte
for each entry point by using the opcode for BIT.w ($2c):

GetTrickImage
    ldy #$04
    .byte $2c ; the CPU interprets this as bit $03a0 ($a0 = opcode for ldy imm)
GetScoreImage
    ldy #$03
    .byte $2c ; bit $02a0
GetArrowImage
    ldy #$02
    .byte $2c ; bit $01a0
GetSuitImage
    ldy #$01
    .byte $2c ; bit $00a0
GetRankImage
    ldy #$00

It might make the code slightly slower, but it saves 4 bytes. :-)

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

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


Current Thread