Ep 081: Introduction to the Stack Pointer

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024
  • For proper operation, applications require memory beyond that defined by the variables. This temporary memory, called the stack, is "pointed" to by a register called the stack pointer. This video presents some of the basics of stack pointer operation.
    Take aways: At the completion of this lesson, each student should be able to:
    • describe the operation of the stack and the stack pointer,
    • describe how the assembly language instructions PUSH and POP are used, and
    • explain the importance of maintaining the integrity of the stack pointer.
    #stackpointer #stack #push #pop

ความคิดเห็น • 26

  • @chunsikkthepotato
    @chunsikkthepotato 3 ปีที่แล้ว +53

    This is literally THE BEST explaination for stack pointer. Cant believe that this qualified lecture's free.

  • @TheLeontheking
    @TheLeontheking 3 ปีที่แล้ว +12

    Well, having Bruce Willis explain assembly language for sure is something not to miss!

  • @miguelalbuquerque9961
    @miguelalbuquerque9961 3 ปีที่แล้ว +20

    Incredibly well explained.
    Was having a hard time finding a good explanation of this.
    Thank you

  • @halawallah95
    @halawallah95 3 ปีที่แล้ว +1

    I haven't finished the video but I'm already loving it! Thank you!

  • @leander11
    @leander11 3 ปีที่แล้ว +2

    Thank you! Lively explanation and very understandable!

  • @xrafter
    @xrafter 3 ปีที่แล้ว +3

    When you use this stack pointer in function be sure pop everything from the stack before returning , cause the return instruction expect the return address to be in the top of the stack .

  • @eventidewatcher
    @eventidewatcher 3 ปีที่แล้ว +2

    Excellent video - really beyond what I expected for a YT video. Thanks very much, saved me on my final! Also...is this dude writing backwards for the camera??

  • @goutamsingh5906
    @goutamsingh5906 3 ปีที่แล้ว +3

    i loved the way you explained it

    • @Intermation
      @Intermation  3 ปีที่แล้ว +2

      Thank you so much for your kind words!

  • @ybbetter2990
    @ybbetter2990 3 ปีที่แล้ว +3

    Amazing video very helpful! Thanks for this

    • @Intermation
      @Intermation  3 ปีที่แล้ว +2

      Glad it was helpful!

  • @steve9125
    @steve9125 3 ปีที่แล้ว

    I found assembly very complex and that makes it interesting to me.

  • @anirudhmadri2628
    @anirudhmadri2628 3 ปีที่แล้ว +1

    good vid sir, ,so basically stack is a certain set of memory locations right... and it may or maynot have values in it. so the stack pointer points to the top of the stack...and with that u can store or remove stuff from the stack using push or pop?

    • @Intermation
      @Intermation  3 ปีที่แล้ว +3

      Yes, it's just memory. Of course a number of mechanisms have been added by both hardware and the operating system to make it more secure, but push and pop are basically putting items on and taking items off the stack.

  • @andrewbaum768
    @andrewbaum768 3 ปีที่แล้ว +3

    how are you writeing backwords

    • @Intermation
      @Intermation  3 ปีที่แล้ว +9

      Nope, it's all done by flipping the video in the video editor. Sorry to disappoint!

  • @Sharath429
    @Sharath429 3 ปีที่แล้ว +1

    A Stack pointer is ?: 1. Last element added to the stack or 2. Previous last element added to the stack

  • @bimanroy8865
    @bimanroy8865 3 ปีที่แล้ว

    How will I get the operand of POP ? You said "POP r1". But will stack remember the position of r1?

    • @Intermation
      @Intermation  3 ปีที่แล้ว +3

      That's the key. The elements of the stack have no identification of where they came from. Your (assembly language) code is responsible for maintaining the correct order of pushes and pops.

  • @sayan3032
    @sayan3032 3 ปีที่แล้ว +2

    he is really a good teacher.

  • @Bob-em6kn
    @Bob-em6kn 3 ปีที่แล้ว +1

    great explanation. easy to understand

  • @TheLeontheking
    @TheLeontheking 3 ปีที่แล้ว

    Is the memory that the stack uses manually addressable? That is could I do sth. like `orr r4, sp` and then `str r5, [r4]`?
    Is the stack-memory a system-defined thing completely separate from any heap-address-space, or can there be overlap?
    Also, is the stack-pointer automatically initialized to sth. legit, or does the programmer have to care for this?

  • @pyitheinkyaw8673
    @pyitheinkyaw8673 3 ปีที่แล้ว

    Thanks sir,
    I have wrong idea about POP - op code, this make me correct. Btw what class is it. I would love to join.

  • @goutamsingh5906
    @goutamsingh5906 3 ปีที่แล้ว

    so we push the new data from top to bottom ?

    • @Intermation
      @Intermation  3 ปีที่แล้ว +2

      It depends on how the architect designed the stack to operate. (In fact, some processors allow the programmer to decide!) From the programmer's point of view, however, you can push any registers in any order onto the stack. To restore those registers, you simply pop off in the opposite order that you pushed.