|
Subject: [stella] It's all coming back... From: "Andrew Davie" <adavie@xxxxxxxxxxxxxxxxx> Date: Wed, 6 May 1998 23:55:19 +1000 |
Hi guys.
Enjoying my time playing with this thing, I can see the attraction of going
back to the the minimal environment. It takes me back to the (good?) old
days when cycles and space were everything. I've not dug through the entire
archives, but did spot a note by Piero Cavina from last year detailing the
use of the indirect jump to effect case statements.
ie:
lda value
asl a
tax
lda jumptable,x
sta temp
lda jumptable+1,x
sta temp+1
jmp (temp)
This is a fine way to go, 16 bytes and 26 cycles - but I thought I'd mention
one of the other tricks we used way back when, when space was also tight...
lda value
asl a
tax
lda jumptable,x
pha
lda jumptable+1,x
pha
rts
This is 13 bytes and 27 cycles - saves 3 bytes on the earlier
implementation, at the cost of a single cycle. It works by pushing the jump
address onto the stack as a return address (as if from a subroutine)... and
then returning. If I were really cutting corners, I'd make sure that the
value variable already was a multiple of two, and then it would be...
ldx value
lda jumptable,x
pha
lda jumptable+1,x
pha
rts
11 bytes, 23 cycles. One proviso - memory fails me as to if the high byte
or low byte should be pushed onto the stack first - so beware! Its been a
long long time - please excuse any errors!
Hope this is helpful to some of you folks...
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 -> |
|---|---|---|
| [stella] Mac Atari PowerPC Page's N, Ruffin Bailey | Thread | [stella] Re: It's all coming back.., Andrew Davie |
| RE: [stella] Formats (64K Flat Mode, A.K.A. TheWiz | Date | [stella] Re: It's all coming back.., Andrew Davie |
| Month |