Stacks of Assembly

This morning, before I got to continuing my revision for my upcoming Systems Analysis exam I thought that I would write another quick blog post. This time (again under request), I'm posting about the stack in assembly. I thought that I'd make a short animated gif in order to demonstrate it more clearly, but I under estimate the amount of time that it took to make and ended up working on it all morning...!

Anyway, here's the animated gif that I created. I also uploaded it to youtube if you'd prefer to watch it there instead.

Assembly Stack Demo

I omitted the base pointer in order to simplify the animation. I also omitted many of the setup and cleanup commands, because including them would have taken literally all day, and they would also have made the stack really large and hard to read.

Here's the code that was demonstrated in the animation:

#include <iostream>
using namespace std;

void swap(int& a, int& b)
    int temp = a;
    a = b;
    b = temp;

void main(int, char**) {
    int number1 = 10;
    int number2 = 20;
    cout << "number1=" << number1 << ", number2=" << number2 << endl;

    // The animation starts here...
    swap(number1, number2);
    // ...and ends here.

    cout << "number1=" << number1 << ", b=" << number2 << endl;

If you spot any mistakes, please let me know! I'll fix them as soon as I can.

This animation was made thanks to the following software:

If you're interested, you can find the source files for the animation here (Yes, there's a mistake in frame 5 but it didn't make it through to the final product).

Tag Cloud

3d 3d printing account algorithms android announcement architecture archives arduino artificial intelligence artix assembly async audio automation backups bash batch blog bookmarklet booting bug hunting c sharp c++ challenge chrome os cluster code codepen coding conundrums coding conundrums evolved command line compilers compiling compression containerisation css dailyprogrammer data analysis debugging demystification distributed computing docker documentation downtime electronics email embedded systems encryption es6 features ethics event experiment external first impressions future game github github gist gitlab graphics hardware hardware meetup holiday holidays html html5 html5 canvas infrastructure interfaces internet interoperability io.js jabber jam javascript js bin labs learning library linux lora low level lua maintenance manjaro network networking nibriboard node.js operating systems own your code pepperminty wiki performance phd photos php pixelbot portable privacy problem solving programming problems project projects prolog protocol protocols pseudo 3d python reddit redis reference releases rendering resource review rust searching secrets security series list server software sorting source code control statistics storage svg talks technical terminal textures thoughts three thing game three.js tool tutorial tutorials twitter ubuntu university update updates upgrade version control virtual reality virtualisation visual web website windows windows 10 xmpp xslt


Art by Mythdael