What are stacks and pointers, please explain them vividly and simply

Updated on technology 2024-03-18
15 answers
  1. Anonymous users2024-02-06

    The stack pointer is an 8-bit register that holds the address at the top of the stack, and one end of the stack is fixed, called the bottom of the stack; One end is floating, called the top of the stack. If the stack extends from a low address to a high address, the bottom of the stack is the lowest address, and at the beginning, the top of the stack coincides with the bottom of the stack, and the stack pointer points to this address.

  2. Anonymous users2024-02-05

    It is suggested that you should look at the data structure.

  3. Anonymous users2024-02-04

    A stack segment pointer (register ss) is a register used to determine the starting position of the stack in memory; The function of the stack segment register is the same as that of other segment registers (CS, DS, ES), all of which are designed to divide the area in the memory of a whole segment: since the memory is a whole segment storage unit, the starting position of the ** segment is stored in the CS (** segment register), the starting position of the data segment is stored in the DS (data segment register), the start position of the stack segment is stored in the SS (stack segment register), and the starting position of the additional segment is stored in the ES (additional segment register).

    In the memory of the operating system architecture, the stack is at the top of the memory used by the program, expanding towards the low address of the memory, and the DS register is the address with the lowest stack. The stack itself is a part of the memory, but the difference between the normal memory segment (DS) and the ordinary memory segment (DS) is that the ordinary memory segment (DS) is generally used to store long-term data without a special storage order; Stack memory segments (SS) are generally used to store temporary data (such as the argument of the calling function), which can be pressed to the top of the stack using push and pop commands to eject data.

    In addition, if the value in the SP (top of the stack register) is less than the DS register (the push command has been executed many times) an error will be thrown: the system will display stack overflow (because the memory address below the SS segment belongs to the data segment). If the value in the sp is greater than a certain amount (determined by the size of the program's stack segments) (pop instruction execution is too much), an error will also be thrown:

    The system displays an access violation reading address for such and such a program (because there is other data on the top of the program's memory).

    It should be noted that when assembling a program under the platform under a newer operating system, the programmer will not be able to modify the values in the segment registers (the modification will cause an error), and they are managed by the operating system itself (which can be understood as managed by the operating system writer), for security reasons.

  4. Anonymous users2024-02-03

    Just like a warehouse, it is used to store data, but it is a piece of storage space organized according to the first-in, last-out principle.

  5. Anonymous users2024-02-02

    A stack is used to store data, such as a value or address in a register.

    A stack can be thought of as a warehouse with many compartments, each compartment containing a thing, and each compartment having a number. Suppose there are 10 cells in the stack, and the numbers are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, if the stack pointer is 5, then it corresponds to the content (data or address) in the 5th box

  6. Anonymous users2024-02-01

    Stack pointer, which is used for stack operations.

    Both inbound and outbound pointers are added or subtracted to ensure the entry and exit of data.

  7. Anonymous users2024-01-31

    The SS register of the stack segment under the 16-bit assembly is the base address of a stack, and the actual address is (ss)*16+(sp)=physical address, which is the actual address pointed to by the current battle pointer.

  8. Anonymous users2024-01-30

    Stack segments are where data is stored.

    ESP is an address indicator.

    When pushing EAX, ESP-4

    pop eax, esp +4

    Of course, you can also perform stack in and out of stack operations, save register state, etc., and even use it as a data segment, save temporary variables, etc.

  9. Anonymous users2024-01-29

    Used to point to the top of the stack for easy stack management.

  10. Anonymous users2024-01-28

    After the 8051 single-chip microcomputer is reset, the bottom of the stack is at 07h, and when the stack is pressed, it will grow in the direction of 08h.

    If you need to change the default value, you can use the following command in the initialization phase: mov sp, 6fh, to set the bottom of the stack to 6fh.

    The function of the stack pointer is to point to the top element of the stack, and it can also perform an out-of-stack operation on the top element of the stack. When an element in the stack is removed or put in the stack, the top element of the stack changes, and the stack pointer sp needs to be reassigned to point to the new top element.

  11. Anonymous users2024-01-27

    Summary. A stack is a special type of linear table, which is a type of linear table that allows inserts or deletions to be made at only one end of the table. The end of the table that allows inserts and deletions is called the top of the stack.

    The other end of the table is called the bottom of the stack. The current position of the top of the stack is dynamic, and the marker of the current position at the top of the stack is called the top of the stack pointer. When there are no data elements in the stack, it is called an empty stack.

    The insertion of a stack is often referred to as entering or entering a stack, and the deletion of a stack is often referred to as a withdrawal or egress.

    What is a stack pointer? What is its address? What is his content when the power on reset? The stack follows principles.

    Can you hurry up? I'm taking an exam.

    Hello, the answer to your question What is a stack pointer: The stack pointer is a special stack pointer (habitually called top) in the process of lead ant stack operation, pointing out the location of the top element of the stack.

    The stack pointer always points to the top element of the stack.

    Generally, the bottom of the stack cannot be moved, so before the data enters the stack, it is necessary to modify the pointer of the stack to point to the free space of Xinwu macro and then store the data, and the opposite is true when leaving the stack.

    Stack pointers, track the top of the stack address at any time, and access data according to the principle of "first-in, last-out".

    A stack is a special type of linear table, which is a type of linear table that allows inserts or deletions to be made at only one end of the table. The end of the table that allows inserts and deletions is called the top of the stack. The other end of the table is called the bottom of the stack.

    The current position of the top of the stack is dynamic, and the marker of the current position at the top of the stack is called the top of the stack pointer. When there is no reed limb mass in the stack, it is called an empty stack. The insertion operation of the stack is usually referred to as the entry or entry of the stack, and the deletion of the stack is usually referred to as the withdrawal or exit of the stack.

  12. Anonymous users2024-01-26

    Answer]: The principle of stack access is list in first out (lifo), that is, the data stored in the stack will be retrieved first.

    When there is no evidence in the stack, the position specified by the SP is quietly called the bottom, and the address at the bottom of the stack is the initial value of the SP. When there is data on the stack, the SP will always point to the top of the stack, and the data at the top of the stack is the last data to be pushed into the stack.

  13. Anonymous users2024-01-25

    First of all, you have to understand what a concept, a pointer, does. The answer is, a pointer, which points to an address.

    The program pointer, the space it points to, is physically flash, and logically, it is the **space. For example, the PC pointer of the 51 microcontroller points to Flash, that is, the address of the instruction to be executed next by the program.

    The data pointer, the space pointed to, there is flash and RAM in physics, and logically it is the constant space and data space in flash, note that for single-chip microcomputer, for our computer, the constant space is not on flash.

    For example, the DPTR of 51 MCU, if you use MOVC A, @a+DPTR, at this time, it is pointing to the constant space, if you use.

    movx a, @a+dptr is the data space that points to.

    The stack pointer points to the space that is physically ram, logically the data space, which is a specific data space, and the stack is the memory space that is divided separately in the data space and used to host intermediate results.

    There are two main differences between data pointers and stack pointers:

    First, the data pointer can point to the flash, that is, it can point to a constant, for example, if we define an array unsigned char code table[99], in this case, the dptr can point to the constant space. Stack pointers are not allowed, they can only point to RAM.

    The second difference is that the stack pointer points to a specific data space, and this specific data space is divided from the entire data space, which is specially used for stacking, once the stack interval is divided, the stack pointer can only be active in this range in the rules, and if it is out of this range, it may lead to the collapse of the whole program. The data pointer can point to the entire data space in the rule, however, the stack space can be read, and it should not be modified, otherwise it may also cause the program to crash.

  14. Anonymous users2024-01-24

    The program pointer pc is the address that points to the program running track.

    The data pointer dptr is the address that points to the RAM or ROM space where data or programs are stored.

    The stack pointer sp is an address that points to an internal register (usually 08h ffh) that relies on push or pop to access data.

  15. Anonymous users2024-01-23

    Program pointer: Used to access the code** area.

    Data pointer: used to access the data memory area.

    Stack pointer: used to access the stack in the data memory area.

Related questions
5 answers2024-03-18

Owner's equity refers to the residual equity enjoyed by the owner after deducting liabilities from the assets of the enterprise. This includes paid-up capital (or share capital), capital reserves, surplus reserves, and undistributed profits. In joint-stock enterprises, it is also called shareholders' equity. >>>More

7 answers2024-03-18

"Chinese Culture Education" is a book by Zhang Cheng. Generally speaking, Chinese language studies mainly refers to an academic system that uses classical Chinese books as a carrier to express the traditional social values and morals and ethics of the Chinese nation. >>>More

16 answers2024-03-18

There are many kinds of hard qigong that require breath holding, such as Vajra Qigong and Thirteen Taibao Hard Qigong. Holding your breath is to inhale through your nose or mouth, inhale full of air to press the qi into the dantian, and then tighten your throat, just like swallowing hard food. Long-term exercise can improve the impact resistance of the viscera, improve the tension of the muscles, and increase the reserve of the dantian. >>>More

20 answers2024-03-18

The address assigned to the parameter and the parameter is different. >>>More

5 answers2024-03-18

Information on beneficial birds and insects.

The gray magpie, also known as the mountain magpie, is an expert in preying on pine caterpillars, known as the "forest guardian", it is said that a gray magpie can eat more than 15,000 pine caterpillars and other pests a year. >>>More