Date : Fri, 26 Dec 2008 14:03:12 +0100
From : kortink@... (John Kortink)
Subject: Using stack page for temp vars
On Fri, 26 Dec 2008 12:45:08 +0000, Phill Harvey-Smith wrote:
>Hi there,
>
>Still developing my sram utils to be romable and replace the Acorn ones,
>without taking up extra ram. I have been using the area from &A8-&AF for
>tempory storage during execution of the commands, however I find that I
>need some more storage, perhaps another 5-10 bytes just for tempory byte
>counts end addresses etc.
>
>I have thought of using the bottom of the stack page starting at &100,
>for such a purpose, as tracing my code in the mess debugger the stack
>pointer always seems to be pretty near the top in the &1Ex area, so as
>long as I don't use too much stack they should never get overwritten.
None of page 1 should be considered free for (ab)use.
All of it is stack space. And potentially in use, even
unexpectedly (e.g. from interrupt routines).
If you need memory, allocate it on the stack (lower stack
pointer, use the claimed bytes, restore stack pointer).
All other locations, except for those who you know for
sure you're using exclusively, can be a hazardous choice.
John Kortink
--
Email : kortink@...
Homepage : http://www.inter.nl.net/users/J.Kortink
GoMMC, the ultimate BBC B/Master/Electron storage system :
http://web.inter.nl.net/users/J.Kortink/home/hardware/gommc