关于assembly:8051系列内存映射-堆栈指针用法

8051 Family Memory Map - Stack Pointer Usage

我正在寻找有关8051嵌入式处理器系列(特别是80C32)的良好参考,以解释内部存储器映射以及该系列处理器之间的区别。

我目前正在阅读在复位为07H时如何初始化堆栈指针。但是我在该系列中所有处理器的文档(例如,此处)中看到,内部RAM从地址00H开始,将Bank 0的R7映射到位置07H中的内部寄存器。

我对内部寄存器和堆栈如何映射有什么误解?

enter


在链接到的页面中给出了答案:

Programming Tip: By default, the 8051 initializes the Stack Pointer
(SP) to 07h when the microcontroller is booted. This means that the
stack will start at address 08h and expand upwards. If you will be
using the alternate register banks (banks 1, 2 or 3) you must
initialize the stack pointer to an address above the highest register
bank you will be using, otherwise the stack will overwrite your
alternate register banks. Similarly, if you will be using bit
variables it is usually a good idea to initialize the stack pointer to
some value greater than 2Fh to guarantee that your bit variables are
protected from the stack.