Re: [stella] Qb: Latest version v0.01

Subject: Re: [stella] Qb: Latest version v0.01
From: "Andrew Davie" <adavie@xxxxxxxxxxxxx>
Date: Wed, 14 Feb 2001 02:58:10 +1100
I've had a look at some of Manuel's optimisations.
Some are good, some are bad, and some are ugly :)))

> --- bgcol1 & pfcol1 would do as well as equates, saving you one byte
> immediately and one byte where ever you access 'em.

Yes agreed, just old old code which hasn't been optimised yet :)

> --- InitCubes
> Replace:
>         lda #0
>         sta TargetDisplay+8
>         sta TargetDisplay+9  ; SLIDING TARGET AREA
>
>         sta Grid
>         sta Grid+1
>         sta Grid+2
>         sta Grid+3
> with:
>         lda #0
> ldx #$5
> ClearTG sta TargetDisplay+8,x
> dex
> bpl ClearTG

No.  This creates a dependency between the physical location of the
variables.  I do not like this at all;  they are distinct units, and tying
them together like this is just asking for trouble and heartache.  If I got
really really desperate I might consider something like this!  You'd have to
be VERY thourough with your commenting if you were to do something like
this.

> --- CreateTableaux
> Replace:
> CTab    jsr Random
[snip/snip]
> with:
> CTab    jsr Random
>         and #3
>         tax
> jsr Random
>         and #3
>         tay

Agreed.  Not sure what I was thinking.  I think at the time I did it, I was
looking for speed, and this was a LOT quicker, at the cost of an extra byte.

> --- CreateTableaux
> Replace:
> CheckGrid
[snip/snip]
> with:
> CheckGrid
>
>         lda Grid,x
>         and TargetBit,y
>         beq EnterPosition
> bne CTab


No.  It is unlikely, but possible, that the random number routine will NEVER
select a vacant grid position.  And here the program will lock up looking
for one (using your code).  The original code selected a random position,
then stepped along the row/column until it DID find a blank spot.
Guaranteed termination.  It is much safer left as it is (though less
elegant).  ESPECIALLY when using a dodgy random number routine which isn't
really nearly random at all.

>
> --- InitCubes
> Replace:
[snip/snip]
> with:
> ldx #$01
> PCube   lda PlayerCube,x
>         and #%11111000
>         ora IC_FedCubeIndex
>         sta PlayerCube,x
>         jsr TieToCube
> dex
> bpl PCube

Agreed!  Good.

Thanks for those :)

Cheers
A
--
 _  _  _| _ _        _| _    * _                               _  ,
(_|| )(_|( (/_\/\/  (_|(_|\/(_(/_                           ,~' L_|\
                                                         ,-'        \
see my Museum of Soviet Calculators at                  (            \
http://www.taswegian.com/MOSCOW/soviet.html              \    __     /
                                                          L,~'  "\__/
                                                              @--> v



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

Current Thread