top | item 47132102

Show HN: X86CSS – An x86 CPU emulator written in CSS

275 points| rebane2001 | 6 days ago |lyra.horse

93 comments

order

Dylan16807|6 days ago

> A hover-based clock, such as the one in Jane Ori's CPU Hack, is fast and stable, but requires you to hold your mouse on the screen, which some people claim does not count as turing complete for whatever reason, so I wanted this demo to be fully functional with zero user input.

That hover clock post is from 2023 and the "some people claim does not count" post is 2022. They were probably talking about the ones that make you check thousands of boxes to drive the logic forward.

Anyway, very cool advancement.

rebane2001|5 days ago

I wasn't sure whether to address the disconnect in the FAQ - I wanted it to be short and readable.

The idea is that, since a long time ago, there has always been demos that prove turing completeness and other programmy qualities in CSS, but that which people dismiss as requiring user inputs. The ones around by the time the comment got made were definitely at the "keep on clicking on the same spot on the screen" level - essentially just providing a clock.

And seeing discussion from after Jane Ori's hack, many still claim that even as much as hovering your mouse on a specific part of the screen makes css not a programming language.

mbreese|5 days ago

This is a cool demo, but it tells me that CSS might be too complex now. Why should you be able to emulate a CPU with a styling language? I’m not sure what you get by using a Turing complete language for visual styling.

FartyMcFarter|5 days ago

I don't know much about CSS, but Turing completeness is notorious for showing up in systems unintentionally.

It doesn't take much to be Turing-complete - if a system provides unbounded read/write memory plus branching or conditional recursion you're usually there.

As an example, Magic The Gathering (the card game) is Turing-complete: https://arxiv.org/abs/1904.09828 . You can use creature tokens as memory and various game mechanics to do flow control. Was this intentional by the designers? Most likely not...

namuol|5 days ago

Less JavaScript is a bad thing now?

dmitrygr|6 days ago

There is absolutely no reason for css to be turing complete. None. That being said, well done

notepad0x90|6 days ago

Can an argument be bade that CSS only exists becuase javascript failed to develop a styling component to displace it?

I like to think webassembly is the right track. But ECMAScript and CSS alike need(ed) to devolve into a simpler byte-code like intermediary language syntax.

Browsers supporting complex languages has always been a bad idea, what they need to support is capabilities, and access and security primitives. wasm hasn't displaced javascript, because afaik, the wasm spec for browsers doesn't require them to implement javascript (and ideally, CSS) via wasm.

Instead of distilling, simplifying and speccing CSS and Javascript, browsers caked on layers upon layers of complicated features. The idea that browsers should define and regulate the languages developers use to write front-end code needs to die.

naillang|5 days ago

[deleted]

senfiaj|5 days ago

I have mixed feelings. On the one hand, it's impressive, but on the other, it's concerning that CSS is turning into "JavaScript 2".

0x7cfe|5 days ago

Now we can embed a cryptominer on a page even with JS disabled! /s

notpushkin|6 days ago

Whoa!

Completely unrelated but somehow unsurprising:

Zero-day CSS: CVE-2026-2441 exists in the wild - https://news.ycombinator.com/item?id=47062748 - February 2026 (233 comments)

magicalist|5 days ago

That was in the C++ implementation of the CSS interface that gets exposed to JS, though, there wasn't an exploit from CSS.

carra|6 days ago

I don't think it's that unrelated. If you make a system way more complex than it should be (clearly the case with CSS) it's obvious the risk of vulnerabilities increases exponentially.

btdmaster|5 days ago

Very cool. The horsle demo made me think, how hard would it be to add a virtual memory address (or a non-8086 RAND instruction) that returns a random byte (that would allow it to pick a random value and get a standard wordle working in principle)

I see CSS random() is only supported by Safari, I wonder if there's some side channel that would work in Chrome specifically? (I guess timing the user input would work)

rebane2001|5 days ago

It's really easy, I was considering adding it.

The easiest way is to make an @property that's animated at ridiculous speeds that can be sampled to get (sort of) random bits.

RedShift1|5 days ago

Definitely in the "they didn't stop to think if they should" category.

sgjohnson|5 days ago

They probably did, and just determined that it would be fun.

The other week I had a fun project to implement IPv6 support in TempleOS. I did stop to think whether I should, and determined that absolutely not.

I asked Claude to start planning on doing it. It started referencing ZealOS, which is a fork of TempleOS and already has a functioning TCP stack.

That's when I determined that it would no longer even be fun, because someone else had already done all the heavy lifting, and gave up.

BirAdam|5 days ago

I know everyone is saying "CSS doesn't need to be Turing complete" but... to me, this just shows the JS isn't needed anymore.

freakynit|6 days ago

Incredible achievement. Horrible development on CSS front.

CSS should NOT be becoming turing complete. Nor any other DSL.

mspreij|5 days ago

> CSS should NOT be becoming turing complete. Nor any other DSL

Hasn't it been so for a while? I mean I agree with you but it's a bit late

pjmlp|5 days ago

That is the problem though, DSLs always end up becoming turing complete, because there is always that use case they don't cover.

csmantle|6 days ago

I think we can look forward to running this on more non-Chrome browsers once @function [0] gets wider support?

[0]: https://caniuse.com/wf-function

rebane2001|6 days ago

It relies on a few things, but @functions, if() statements, and container style queries are the main ones.

ebolyen|5 days ago

The moxy of this is inspiring.

I'm curious to know what you would rate as the most important features to make this work? It seems like calc+if do a lot of the heavy lifting, but the new function syntax is what makes instruction lookup tractable.

andrewstuart|6 days ago

Abomination! (Makes sign of cross)

Also: wow.

namuol|5 days ago

Predictably, all the same people who bemoan JS ubiquity feel the need to express their distaste for advances in CSS in this thread. Nobody is actually doing stuff like this in real applications, it’s just a demo, for fun.

I get the feeling some people just hate the web.

Dylan16807|5 days ago

Your grumpiness contradicts itself. To the extent that it's just for fun, it's not an advance.

And CSS being Turing complete doesn't make it suitable to replace any JS it couldn't already replace, so why can't JS-haters dislike the idea? If I didn't like a language and people offered an even worse to use replacement I'd be justified in having distaste for it!

hudecekdev|6 days ago

This is absolutely horrible... in a good way. Kinda like Doom in a PDF. Well done.

voidUpdate|5 days ago

So is this x86 compatible, or 8086 compatible? Because those are different things

bux93|5 days ago

There's a list of the supported opcodes on the page if you scroll down.

sunbum|5 days ago

If it was 8086 they would have written 8086

randfur|5 days ago

Really looking forward to a how it works post. What is that READMEM_1??

rebane2001|5 days ago

it's a placeholder that gets replaces by the python script on build

Aloha|6 days ago

This feels like... just because you can, doesnt mean you should.

MetaMonk|6 days ago

this is incredible

warpspin|5 days ago

Next step: Start Chrome in emulated X86CSS and start X86CSS in emulated Chrome.

nottorp|5 days ago

Next logical step is to compile the CSS to webassembly, of course!

_s_a_m_|6 days ago

Only Chrome ..

NoiseBert69|5 days ago

Bruh...

Can it mine bitcoins or run worms?

gurjeet|6 days ago

> Your browser is unable to run this demo. Please try with an up-to-date Chromium-based browser.

Sorry to see internet regressing to Internet Explorer days.

Edited to add: This is the message I get when using Firefox.

StilesCrisis|6 days ago

Not really, Internet Explorer was single platform and closed source.

zenon_paradox|6 days ago

[deleted]

rebane2001|6 days ago

i'm glad llms won't be coming after my niche anytime soon

nsonha|6 days ago

I realy hope an AI did this intead of human, such a waste of time (the css part, not the x86)

marmakoide|5 days ago

Don't look at the end destination, look at the journey to the destination

* Learn low-level details of a basic but real-world CPU

* Practice the brain gymnastic of programming an atypical Turing-complete computer

Your created new connections in your brain, put to use some of the old established connections. Having a machine spit-out the emulator would rob you of all that. Like, you can drive from A to B, but running for A to B can do you much good.

saagarjha|5 days ago

This seems like a great use of time actually

rebane2001|5 days ago

I did not use any AI

sakesun|5 days ago

If an AI can do this, it's definitely an AGI.