I am a bit stuborn on having (some) of my programs behave as a built in function related to stack and lastx register.
What I have done so fare is to write a subroutine that saves the stack in the indirect registers (will not use the valuable A-H,K-Z for such stuff).
Then I found this
thread
that offers an elegant second option by Valentin Albillo when you can do it all in an equation.
In the great danger of saying something well known; the x<> operation do come to the rescue if one need to resort to storing the stack in indirect registers.