Page 1 of 1

LD SP,????

Posted: Wed Sep 29, 2021 10:02 am
by mz-80a
Hi,

Just wondered, when you're writing your assembly programs, is it acceptable to use LD SP,$10F0 ? i.e. use the Monitor's work area as a stack? Or should this be avoided?

Re: LD SP,????

Posted: Wed Sep 29, 2021 7:50 pm
by hlide
That's a valid setting because there are some room before $10F0 for a small stack. Obviously, if you are programming a recursive code or need larger stack, you'll need to point SP somewhere else.

Re: LD SP,????

Posted: Wed Sep 29, 2021 7:54 pm
by hlide
At least, when just calling monitor routines in your code and using static variables, it should be enough. But for more elaborate, I will set SP somewhere else.

Re: LD SP,????

Posted: Thu Sep 30, 2021 1:38 pm
by mz-80a
Thanks. That's what I thought anyway. I didn't want to find myself overwriting anything that the Monitor would use the stack for. But I guess if you are resetting the SP to $10F0 like this then the Monitor routines won't change it at all and it'll all just be used correctly.
hlide wrote: Wed Sep 29, 2021 7:54 pm At least, when just calling monitor routines in your code and using static variables, it should be enough. But for more elaborate, I will set SP somewhere else.