Swap algorithm in MIPS (Assembly language)
For this to work, you'll need either a platform which can run MIPS, or you could download the Java-based simulator "MARS" and run it there. This was a project which is designed to teach how assembly works with low level instructions. I also call it a "high-level programming language appreciation project". After you've done this once, you probably won't want to write in assembly again. Although it was very enlightening. I am glad I did it.
I initially wrote everything in raw MIPS and then when I noticed some reusable code I added some macros which make the code a lot more readable (which you can see toward the top of the file).
You can also check out, build and compile the MIPS simulator via MIPS Source Code. Or get the jar here MIPS Simulator Download
How to run:
Navigate to the Mars exe file
./mars # program starts up
From inside the app, go to file, find the file
From the top bar select Run->Assemble
From the top bar select Run->Go



