Subject: Re: [stella] Player Animation Basics Take 1 From: Ruffin Bailey <rufbo1@xxxxxxxxxxx> Date: Mon, 15 Jul 2002 23:52:38 -0400 |
You begged for it. ;-)
A minimal improvement would be (saves 2 bytes): lda SWCHA cmp #%11110000 ; we don't care for the lower bits bcs dontIncreaseFrame ; CF=1, if all 4 upper bits are set
That code has a bug: lda p0FrameCount adc #%00001000 ; ... increase the frame count "by one frame" (16 dec, $10) and #%00111000 ; but don't let it get over "three frames" (48 dec, $30) sta p0FrameCount ; put back into p0FrameCount
Instead of 4 frames, you get 8 frames here (%00001000 = $08, %00111000 = $38).
adc #%00000100 and #%00111100 sta p0FrameCount
But you don't need to do that complicated stuff with p0FrameCount: dec p0FrameCount bpl .skipReset lda #NUM_FRAMES-1 ; = 3 sta p0FrameCount .skipReset
This doesn't save space, but IMO is better readable.
And instead of using a magic number ($08) for the offset you better should write: clc ; not necessary, CF = 0 already adc #<player0data ;
That makes the code more readable and maintainable.
Ruffin Bailey http://myfreakinname.blogspot.com
---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] Player Animation Basic, Thomas Jentzsch | Thread | Re: [stella] Player Animation Basic, Jeff Johnston |
[stella] Playfield Generator, wbrown | Date | Re: [stella] Player Animation Basic, Jeff Johnston |
Month |