RC RANDOM CHAOS

16 Bytes of x86 Assembly That Sing Sierpinski and Render Matrix Rain

· via Hacker News

Original source

Wake up! 16b

Hacker News →

Demoscener HellMood released a 16-byte DOS intro at the Outline Demoparty in May 2026 that simultaneously generates a Sierpinski triangle fractal on screen and drives the PC speaker with the same data. The program sets text mode via int 10h, points the data segment at the VGA text buffer at 0xB800, then loops over four instructions that read a byte, step backward 56 positions, XOR it into memory, and push it to speaker port 61h. The visible output resembles falling Matrix-style characters; the audible output is a gritty square wave shaped by the fractal’s bit pattern.

The math beneath the trick is binomial coefficients modulo 256: accumulating values with carry-free addition (XOR) reproduces rule 60 of elementary cellular automata, which Lucas’s theorem ties directly to the Sierpinski triangle. Because the BIOS clears the screen by filling memory with 0x20 spaces rather than zeros, and because the 64KB segment also contains shadowed video ROM code, the XOR operation picks up environmental noise that gives the sound its distinctive punk timbre. The backward 56-byte stride means the loop only touches multiples of 8 and visits just 10 columns, which is what creates the sparse vertical pillars rather than a solid fractal image.

The writeup is notable less for any practical application than as a study in algorithmic density — how a handful of opcodes can entangle graphics, audio, and number theory into a single self-referential output. It also documents how the effect varies across real hardware versus emulators, since memory contents before the XOR are not deterministic across BIOS versions.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.