I think it's even weirder than you might expect. Certainly on the
STM8S103F3 SP seems to be a full 16bit register, can be loaded with any
value, and then behaves as you might expect. BUT... there seems to be a
single bit comparator, active for push/pop, that triggers the wrap at
0x3ff and 0x1ff in order to constrain the stack to be in the officially
allocated RAM area. Start within the 0x3ff..0x1ff region and the stack
wraps around. Start outside that and... well... you can have... fun...?
I _think_ the non-rollover parts just let you do your own thing (maybe
there's still a comparator that triggers an overflow event though?)

Mike

On 21/04/2022 14:01, Daniel Drotos wrote:
> On Thu, 21 Apr 2022, Basil Hussain wrote:
>
>>> All have a stack limit, but some of them may not have the roll-over.
>>
>> So, in those cases the stack pointer just stops decrementing at the
>> limit when there is no roll-over?
>
> I don't know, but I don't think so. According to page 32 of RM0016, I
> think RAM size can be the limit only. Unfortunately datasheets do not
> say about it at all. Experiments would be usefull.
>
> Daniel
>
>
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to