1 points · by SairajK19 · 2y ago · 9 comments
Thankyou!
See it as a digital display with two hex digits and the value “0x01” painted in front of it:
0x0142
^^ two hex digits: the value in the register
^^^^ painted on the front plate of the display
The cpu, similarly, hard-wires those 8 bits (seven zeros and a single one) in front of the register value when accessing the stack.So for example if the current top of the stack is 0x01FF then then SP will store FF, which being upper 8 bits of 0x01FF and the data will be at 01 which being lower 8bits of 0x01FF ?
It is also why the stack is always in page 1, and can not be moved to any other page.
The stack pointer is used to drive the lower eight bits of the address bus during a stack read or write. The upper eight bits are always 0x01.
Many thanks!