From 839a22481d8050ac7d0998ad766c76b64be2bcab Mon Sep 17 00:00:00 2001 From: yatesal Date: Mon, 21 May 2018 20:02:54 -0700 Subject: [PATCH] Updated diagram explaining the stack data structure. --- Basic-Assembly-tutorial.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Basic-Assembly-tutorial.md b/Basic-Assembly-tutorial.md index b3cf723..0cf3172 100644 --- a/Basic-Assembly-tutorial.md +++ b/Basic-Assembly-tutorial.md @@ -441,6 +441,7 @@ To understand this example, we must first understand what is the **stack**. The We use the term *push* when we add a piece of data on top of the stack and *pop* when we remove a piece of data from the stack. Visual representation of the stack: -![Visual representation of the stack](https://user-images.githubusercontent.com/25143248/40293017-a0faff04-5c83-11e8-8a84-75ea058b8655.png) + +![Visual representation of the stack](https://user-images.githubusercontent.com/25143248/40339650-38288bb0-5d30-11e8-826f-d0b924b01192.png) We can notice that this implementation of the stack is actually upside-down compared to a real-world stack of items: the stack grows downwards in memory, towards lower addresses. The important thing to remember is that the bottom of the stack is at a fixed address and that the top of the stack changes when an item is *pushed* on the stack or *popped* out. In the game's CPU, the **stack pointer** (SP) register always points to the top of the stack and the **base pointer** always points to the base of the current **stack frame**. \ No newline at end of file