Subject: [stella] Very nasty 6502 tricks, don't use them! :-) From: Manuel Polik <manuel.polik@xxxxxxxxxxx> Date: Fri, 05 Jan 2001 15:54:21 +0100 |
And yet another post. I want to describe two very nasty 6502 programming tricks, if you promise to never ever use them and if so, that you don't claim that I told you. Ok, here's one I found by myself, it's utilized a lot in the Alpha demo. Let's say you're in Subroutine1 which would end like this: ... JSR Subroutine2 RTS If you are totally aware what you are doing, you might consider to save a Byte and some Cycles, by just doing: ... JMP Subroutine2 instead. (Remember: Don't ever do this - and I didn't tell you!) Here's the next, which I found in Starmaster: Imagine you're doing a fast loop, where you'd need three variables, not just X and Y. Now you could use a temporary variable or push and pop the third value to the stack. But if you need to be faster, consider doing this to temporarily store the variable away: TXS and get it back with TSX of course. This is way faster than PLA / PHA, BUT KEEP IN MIND THESE RULES: - Don't do this within a subroutine! - Don't do any JSRs or other stack handling between TXS and TSX! - Don't forget to restore the Stack to $FF after the loop! (If you construct your loop in a way, that X ends with $FF, this would cost just an additional TXS after the loop) (And again: Remember: Don't ever do this - and I didn't tell you!) Greetings, Manuel -- 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] New game concept...now, MickeyKnox667 | Thread | [stella] Tetris brainstorming, Rob |
Re: [stella] Merry Xmas, Manuel Polik | Date | Re: [stella] New game concept...now, MickeyKnox667 |
Month |