Starbeamrainbowlabs

Stardust
Blog

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;
    system("PAUSE");
}

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 blender blog bookmarklet booting bug hunting c sharp c++ challenge chrome os cluster code codepen coding conundrums coding conundrums evolved command line compilers compiling compression conference conferences containerisation css dailyprogrammer data analysis debugging defining ai demystification distributed computing dns docker documentation downtime electronics email embedded systems encryption es6 features ethics event experiment external first impressions freeside future game github github gist gitlab graphics guide hardware hardware meetup holiday holidays html html5 html5 canvas infrastructure interfaces internet interoperability io.js jabber jam javascript js bin labs latex learning library linux lora low level lua maintenance manjaro minetest network networking nibriboard node.js open source operating systems optimisation outreach 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 release releases rendering research resource review rust searching secrets security series list server software sorting source code control statistics storage svg systemquery talks technical terminal textures thoughts three thing game three.js tool tutorial twitter ubuntu university update updates upgrade version control virtual reality virtualisation visual web website windows windows 10 worldeditadditions xmpp xslt

Archive

Art by Mythdael