|
Subject: Re: [stella] some more optimization tips From: "Andrew Davie" <adavie@xxxxxxxxxxxxxxxxx> Date: Sat, 9 May 1998 11:07:03 +1000 |
On the 12 bytes of stack space, my true love said to meee.....
I thought I'd go one step further... the shortest code size I know for a
particular delay... Further, I include my best NON stack options (I've not
had the stack denied to me before, but here goes...) Erik's point noted
about the INC zeropage taking 5 cycles, but these delays are designed to be
NON-destructive of memory. Ie: they have no effect other than delay or the
accumulator and/or flags
Where there are several variations available, I choose the one with fewest
lines of code.
1 i wish!
2cycles@1byte
NOP
3@2
LDA $80
4@2
NOP
NOP
5@2
ASSUMING we can safely write to ROM and have nothing disasterous
STA $8000,X
can't use LDA as we can't guarantee extra cycle for page boundary
6@2
LDA ($80,X) ; assumes possible reads from 0-$7f have no effect
7@2 with stack
PHA
PLA
7@3 without stack
ASSUMING we can safely write to ROM and have nothing disasterous
ROL $8000,X ; ie: do nothing, but take a long time
any comments on the possibility of this option?
8@3
LDA ($80,X) ; assumes possible reads from 0-$7f have no effect
NOP
9@3 with stack
PHA
PLA
NOP
9@4 without stack
LDA ($80,X)
LDA $80
10@4
ROL $80
ROR $80 ; leaves $80 unchanged
11@4 .. a few assumptions here
ASSUMING we can safely write to ROM and have nothing disasterous
STA $8000,X
LDA ($80,X) ; assumes possible reads from 0-$7f have no effect
12@3 with stack
JSR return
... somewhere else
return RTS
12@4 without stack
LDA ($80,X) ; assumes possible reads from 0-$7f have no effect
LDA ($80,X) ; assumes possible reads from 0-$7f have no effect
that'll do. Can anyone better the byte counts?
Any comments on the danger of "writing" to ROM?
Enjoy!
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, Erik Mooney | Thread | Re: [stella] some more optimization, Andrew Davie |
| Re: [stella] some more optimization, Erik Mooney | Date | Re: [stella] some more optimization, Andrew Davie |
| Month |