WriteUp: 16 Bytes of x86 that turn Matrix rain into sound

· math · Source ↗

TLDR

  • A 16-byte x86 real-mode DOS demo released at Outline 2026 renders a Sierpinski fractal in video memory and simultaneously drives the PC speaker using the same bytes.

Key Takeaways

  • The entire program fits in 16 bytes: BIOS int 10h sets text mode, DS is pointed to 0xB800, then a tight loop XORs memory and pipes each byte to port 61h.
  • XOR across memory with a -56 byte step implements Rule 60 cellular automata, producing a Sierpinski triangle distributed across 10 diagonal screen columns.
  • Port 61h Bit 1 controls the PC speaker cone; the same bit the fractal toggles, so geometry directly encodes audio as square waves with varying pulse width.
  • The -56 step (net -56, gcd(56,65536)=8) doubles the macro-cycle to 8,192 iterations, halving the fundamental audio frequency one octave vs. a 16-byte step.
  • Output is environment-sensitive: BIOS remnants in VGA RAM alter both visuals and audio timbre across different machines and emulators like DOSBox or PCem.

Hacker News Comment Review

  • No substantive HN discussion yet.

Original | Discuss on HN