http://pastebin.com/YkhRsuih - C
http://pastebin.com/L79CeeGB - Haskell
http://pastebin.com/LybWwGzm - JS
http://pastebin.com/ZVDiRmP6 - MHS this language cant take input (its an educational toy language for a course)
This book is highly recommended to anyone interested in how computers work; it starts off with very basic electronics and goes up to a full CPU, plus some software stuff near the end: http://www.charlespetzold.com/code/
This guy spent three years disassembling the Outrun arcade ROM, then 2 years re-implementing it in C++, then extending his engine with features like high fps and new game modes, and is now onto creating extender tools like track and time editors.
Along the way he found several new bugs and provides a fixed ROM which can be flashed to the arcade board. He's also got a project to develop an SoC which uses his engine to run an arcade cabinet, completely replacing the original board.
It's a phenomenal effort and an amazing blog to read back through.
I kinda wish there were more meetups that focused on this kind of stuff instead of the latest and greatest frameworks. This kind of fundamental theory is applicable in any kind of application and framework setting.
https://github.com/jarcane/MicroMini if you're curious.