Date : Fri, 26 Dec 2008 17:26:20 +0000
From : afra@... (Phill Harvey-Smith)
Subject: Using stack page for temp vars
John Kortink wrote:
> On Fri, 26 Dec 2008 12:45:08 +0000, Phill Harvey-Smith wrote:
>> 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).
Technically I suppose that is true, but Acorn does this in their 1770
DFS code, acording to setting watchpoints in mess, also the Advanced
user guide seems to say that this is done also, on page 272, so I guess
Acorn thought it low enough risk to do this.
> If you need memory, allocate it on the stack (lower stack
> pointer, use the claimed bytes, restore stack pointer).
Yeah I am doing this for the OSGBPB control block and storing the low
byte of it's address in the &A8-&AF reigon, but doing this for evey
variable is a right royal pain, with only 3 8 bit regs to play with....
Cheers.
Phill.
--
Phill Harvey-Smith, Programmer, Hardware hacker, and general eccentric !
"You can twist perceptions, but reality won't budge" -- Rush.