Popular science. The stack is the storage of java non-intelligent machines

The original poster: 2014000 Views: 106 Replies: 1 Posted in: 2012-06-24 12:13:30
The stack is an area used to store data. There is nothing special about this area itself. It is just a part of the internal RAM. What is special is the way it stores and accesses data, which is the so-called 'first in, last out, last in first out', and the stack has special data transfer instructions, namely 'P USH' and 'POP' have a special unit dedicated to serving them, that is, the stack pointer SP. Whenever a PUSH instruction is executed, SP is automatically reduced by 2 (based on the original value). Whenever a POP instruction is executed, SP is automatically increased by 2 (based on the original value). Since the value in SP can be changed by instructions, as long as the value of SP is changed at the beginning of the program, the stack can be set in the specified memory unit. For example, at the beginning of the program, a MOV SP, #5FH instruction is used to set the stack in the unit starting from memory unit 60H. Generally, there is always an instruction to set the stack pointer at the beginning of the program, because when starting up, the initial value of SP is 07H, which makes the stack start from unit 08H and go back. The area from 08H to 1FH is the second, third, and fourth working register area of ​​8031, which is often used, which will cause data confusion. When different authors write programs, the initialization stack instructions are not exactly the same. This is a matter of the author's habits. When the stack area is set up, it does not mean that the area becomes a special memory. It can still be used like an ordinary memory area, but generally programmers will not use it as ordinary memory.
reply 🤍 0 📤 share collect
Understood, thank you for sharing.
— All replies loaded —

Leave a Reply