0:00 / 0:00
What is a stack and how does it work? — 6502 part 5
Ben Eater
1.4M subscribers • 28 videos on Hallway
- Recommended by 2 people: 1 on Lobsters and 1 in engineering communities.
- Presented by Ben Eater
Intermediate. Assumes working knowledge.
825K views6 years ago2 recommendations
HardwareSystems programmingCPUs and computer architectureRetro computing
Ben Eater explains how the stack and stack pointer work at the hardware level using the 6502 microprocessor.
Schematics, datasheets, kits, and more at eater.net/6502 Part 1: youtube.com/watch?v=LnzuMJLZRdU Part 2: youtube.com/watch?v=yl8vPW5hydQ Part 3: youtube.com/watch?v=oO8_2JJV0B4 Part 4: youtube.com/watch?v=FY3zTUaykVo Part 5: This video! Part 6: youtube.com/watch?v=i_wrxBdXTgM Part 7: youtube.com/watch?v=omI0MrTWiMU Support these videos on Patreon: patreon.com/beneater or eater.net/support for other ways to support. ------------------ Social media: Website: eater.net Twitter: x.com/beneater Patreon: patreon.com/beneater Reddit: reddit.com/r/beneater Special thanks to these supporters for making this video possible: Adam Lininger, Adrien Friggeri, Alex Catchpole, Andrew R. Whalley, Anthony Cuccia, Armin Brauns, Austin Grant, BakerStaunch, Beau-James Erion, Ben Dyson, Ben Kamen, Ben Williams, Bradley Pirtle, Bryan Brickman, Carlos Ambrozak, Christopher Blackmon, Clayton Parker Coleman, Daniel Tang, Dave Walter, David Boardman, David H. Friedman, David House, David Turner, Dean Winger, Debilu Krastas, Dmitry Guyvoronsky, Dušan Dželebdžić, Dzevad Trumic, Eric Brummer, Eric Busalacchi, Eric Dynowski, Eric Twilegar, Erik Broeders, Eugene Bulkin, Foaly, fxshlein, HaykH, Ian Tait, Ingo Eble, Ivan Sorokin, Jason DeStefano, JavaXP, Jay Binks, Jayne Gabriele, Jeremy A., Jeremy Wise, Jimmy Campbell, Joel Jakobsson, Joel Messerli, Joel Miller, Joern Heidenreich, Jon Dugan, Jordan Scales, Joshua King, Justin Duch, Kefen, Kent Collins, Lambda GPU Workstations, Lucas Nestor, Maksym Zavershynskyi, Manne Moquist, Marcus Classon, Mats Fredriksson, Matt Alexander, Matthäus Pawelczyk, Michael, Michael Burke, Michael Garland, Michael Tedder, Miguel Ríos, Nathan Wachholz, Nicholas Counts, Nicholas Moresco, Örn Arnarson, Paul Pluzhnikov, Paul Randal, Philip Hofstetter, Randy True, Ric King, Richard Wells, Rob Bruno, Robert Blackshaw, Robert Butler, Ross, Sachin Chitale, Sam Rose, Samuel E Joseph, Scott, Sergey Ten, Sever Banesiu, SonOfSofaman, Stefan Nesinger, Stefanus Du Toit, Stephen Riley, Stephen Smithstone, Steve Jones, Steve Gorman, Steven Pequeno, Thomas Ballinger, Tom Burns, Vladimir Kanazir, Warren Miller, xisente, Ziggy LWhy it's here
2 people recommend thisWhat people say. Recommended for understanding how function calls and stacks work under the hood at the hardware level.
u/rzksobhy27in r/C_Programming • Recommends
On “Dynamic memory allocation ** in stack**?”
then what it is ?
this is where I got my idea on how functions work
link to this video
u/skeetoin r/C_Programming • Mentions
On “Stacks are used to store functions during recursive calls in C. But are these stacks implemented using arrays or linked lists?”
The C standard doesn't specify either. In fact, the word "stack" doesn't
even appear in the standard. In practice it's most like an array, with
the end of the array being tracked in a special *stack pointer* register
in the CPU.
On certain architectures or build configurations, it actually resembles
both at the same time via *base pointers*. A base pointer holds the
address of the current stack frame, and from there you can find the base
pointer to the next stack frame, and so on. This allows debuggers to
parse stack frames at run time.
See also: What is a stack and how does it work?