Final Stage: incredible graphical demo shows what you can do with 4 kilobytes of source code


Originally published at:


I’m conversant in a few high-level languages and have a passing knowledge of rudimentary assembly code instructions. Can anyone give me an idea of what sort of instructions are contained in these 4KB of code? I suppose when the topic is ‘extremely clever ways to write programs’, a simple explanation is not easy to provide.

To what extent do these take advantage of features built into GPUs or CPUs? I mean, I can write a functioning executable that’s super-small because it actually just calls libraries built into its runtime environment.


Yeah - please some one dumb this down so I can appreciate it more.

I mean, if there is 4k of code, why does it need gigs of ram? I assume it is using a lot of stuff built into the hrardware??


It depends on the rules of the contest, but generally, it must be an executable of no more than 4K. No doubt they use a multitude of tricks to get down that small, but essentially what you are looking at is a procedurally generated scene.


…that should be enough for anyone!


So happy the nK demo scene still exists!

These just blow my mind


I guess that’s down to how you define “code”.

If I wrote an in-browser Pong clone in Javascript, I’d say it was like a 1KB download because I assume the browser and the Javascript interpreter are already there, and that the user has installed an OS that can run the browser, and that the OS has all the drivers required to make the display and input devices work.

As the saying goes, “if you wish to make an apple pie from scratch, you must first invent the universe.”


It greatly pleases me that the moribund demo scene is still cranking out wonderful things.

On a tangential note, a few years ago the source code for Second Realty was put on GitHub.

And a fascinating reverse engineering of the largely undocumented code:


The headline says “source code,” not executable.

I guess it doesn’t matter. Carry on, everyone.


To give this a bit of context, most assembly instructions are generally between 1 and 5 bytes long. Even just calling out to a library requires 5 bytes, and usually a bunch of push instructions to push parameters.

Now, given that this demo is only 4092 bytes long… this is an amazing feat. It manages to include music, management (os and memory), a script, and even visuals. In the equivalent of 1000 instructions.

(I’m ignoring tricks here, like exe compression, which they did use ).

Absolutely mind blowing!


This topic was automatically closed after 5 days. New replies are no longer allowed.