|
Subject: Re: [stella] some more optimization tips From: "Andrew Davie" <adavie@xxxxxxxxxxxxxxxxx> Date: Sat, 9 May 1998 21:38:23 +1000 |
Mmmh.. well I've actually started writing my game, now its (ahem) designed.
Just thought I'd share the very first stages of the program.. here's an
efficient memory clear for you...
; CLEARS ALL VARIABLES, STACK
; INIT STACK POINTER
; ALSO CLEARS TIA REGISTERS
; DOES THIS BY "WRAPPING" THE STACK - UNUSUAL
LDX #0
TXS
PHA ; BEST WAY TO GET SP=$FF, X=0
TXA
CLEAR PHA
DEX
BNE CLEAR
; 9 BYTES TOTAL FOR CLEARING STACK, MEMORY
; STACK POINTER NOW $FF, A=X==0
Of course, this is untested so here's hoping I won't be red-faced.
I would note that Nick Bensema's excellent "How To Draw a Playfield"
(thanks, Nick) does it this way...
LDX #$FF
TXS ; Set stack to beginning.
LDA #0
B1 STA 0,X
DEX
BNE B1
This is fine - a byte longer - but it fails to clear location 0. It really
needs an INX or a TAX just before the loop starts - making it 2 bytes
longer. His code is, however, much more readable than mine, which is why I
like mine better :)
Maybe I should stop - am I flooding?
A
--
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/stella.html
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [stella] some more optimization, Andrew Davie | Thread | Re: [stella] some more optimization, Retroware |
| Re: [stella] some more optimization, Andrew Davie | Date | Re: [stella] some more optimization, Retroware |
| Month |