HeadlinesBriefing favicon HeadlinesBriefing.com

CSS-Only x86 CPU Emulator Runs 8086 Machine Code

Hacker News •
×

Developer Lyra Rebane has built x86CSS, a working x86 CPU emulator entirely in CSS without JavaScript. The project demonstrates a C program compiled with GCC into 8086 machine code executing fully within browser stylesheets. The emulator implements most of the x86 architecture using CSS animations and container queries.

Unlike previous CSS-based CPU demos that required mouse interaction, x86CSS runs autonomously using a clock mechanism built into the stylesheet. While a script tag provides a faster clock, the emulator functions without JavaScript through CSS animations. The project currently works only in Chromium-based browsers and requires a minimal HTML structure with a style tag.

Users can compile their own programs for the emulator using gcc-ia16 or assembly code. The system includes 1.5KB of memory by default, with programs loading at address 0x100. Custom I/O addresses allow interfacing with the emulated environment. Though not practical for real-world applications, the project showcases the creative potential of CSS and pays homage to the original 16-bit x86 architecture that powered early personal computers.