What happens, when the stack over / underflows?
Christof Eb.
Posts: 1,195
in Propeller 2
Hi,
question about the hardware stack:
What happens, when the P2 hardware stack over / underflows?
Is this a circular stack?
Thank you very much!
Christof
Comments
When it overflows, the oldest level is lost (i.e. it is totally valid to just break out of a nested call without cleaning the stack). Not sure what happens on underflow, but I assume that either the last value (shift register implementation) or the last 8 values (ring buffer implementation) repeat indefinitely.
HW stack is a shift register. Reply from last year: https://forums.parallax.com/discussion/comment/1529391/#Comment_1529391
Thank you both!
Christof
Each time the stack is popped from either a POP or RET, the bottom (deepest) register is copied to the next-to-bottom register.