Re: [stella] My code is broked!

Subject: Re: [stella] My code is broked!
From: Christopher Tumber <christophertumber@xxxxxxxxxx>
Date: Wed, 08 Oct 2003 01:31:15 -0400
>I know this loop does not replace the first byte in either location, but it should "swap" the others... However
>my results are not very good :-) What am I doing wrong?

As Jason said, pointers are two bytes and you're only initialising the lower byte.

But, am I missing something here, you're just swapping two 7 byte long buffers, right? These buffers are permanently anchored in RAM, right? So why are you using indirection? (just for the sake of using indirect addressing?) You don't need the flexibility of being able to select between several buffers or allocate buffers dynamically, do you?

Why not just do something like:

 ldx #7
next_switch:
 ldy PlayerHand,x
 lda Player3,x
 sta PlayerHand,x
 sty Player3,x
 dex
 bpl next_switch

Unless you've only got one X/Y register avalable, in which case you can just sub in a temporary variable:

 ldx #7
next_switch:
 lda PlayerHand,x
 sta Temp
 lda Player3,x
 sta PlayerHand,x
 lda Temp
 sta Player3,x
 dex
 bpl next_switch


Chris...

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


Current Thread