RE: [stella] Stack pointer. Some questions

Subject: RE: [stella] Stack pointer. Some questions
From: "Paul Slocum" <paul-stella@xxxxxxxxxxxxxx>
Date: Mon, 10 May 2004 15:17:35 -0500

Really? Can you give a practical example?

Mainly places where you're using X for some index, but you need to temporarily use it for a different index. I use it in the RPG in the routine that decompresses the map, and I think I used it in the Marble Craze kernel.

Unless your swapping out of X is really timing critical but you can spare the cycles required to save/restore the stack. Or you've got a stack free program. Or you have no scratch RAM available.

Yeah, saving two cycles in a kernel or a long loop can make a big difference. And the overhead to save/restore the stack before/after the kernel or loop is insignificant.

Even if you don't have a stack-free program, if you use the trick in a top-level routine you don't need to save the stack. Just set it back to $ff when finished.


Archives (includes files) at
Unsub & more at

Current Thread