I'm not familiar with the asm enough, but can't you adjust the sp in the asm so that in user code it always has to be the lowest position?
So how would you modify them to support both upward and downward stack? preprocessor branch? runtime check?
My prevoius question stays unanswered, so let me repeat here:what does "beginning of the stack" really means?
Suppose we have a stack of size 3, starting at [s]:
[s-1][s][s+1][s+2][s+3]
Why the beginning of a downward stack is [s+3], not [s+2]?
If it's a upward stack, is beginning [s] or [s-1]?