4 ms·
I clicked on this fearing it was a "256 bytes of JS" (plus X GB of browser), and was pleasantly surprised it was actually 256 bytes.
by flopsamjetsam 6mo ago
I clicked on this fearing it was a "256 bytes of JS" (plus X GB of browser), and was pleasantly surprised it was actually 256 bytes.
- rustystump 6mo agoWhy is that bad? If the bytes could easily run within the same constraint in another env/language why the hate? I am with u on the excessive ram of browsers. It is insane. Still, it is one of the most portal and easy ways to share something. Heck, u can run a dos emulator in your browser.
- senfiaj 6mo agoProbably because JS has larger runtime, in JS you don't have to write about most of the low level code. So it's easier to squeeze code in JS than in ASM or machine code.
- layer8 6mo agoThis is probably in reference to things like Dwitter.net (https://news.ycombinator.com/item?id=46557489 https://news.ycombinator.com/item?id=46557489), where the browser (plus the Dwittet-specific runtime harness) contributes significantly higher-level functions than traditional demoscene targets like DOS PCs. It’s just a different thing. I see no “hate”, only an expression of preference for “bare-metal” demos.
- selcuka 6mo agoHere's a 13-byte demo that runs on Chrome browsers: chrome://dino
- irishcoffee 6mo agoIt is misleading to say "I wrote X in 1k bytes" when those 1k bytes were library calls to library calls totaling 300MB.
- whaleofatw2022 6mo agoRight... on the flipside its one thing to where it is X+minor overhead inclined lib calls Then a whole nother level of awesome where its literally just ASM
- rob74 6mo agoYeah, but it's a slippery slope, because no program runs in complete isolation. Even on the simplest 8 bit machines where there is no OS to speak of, you are still benefitting from the capabilities of the hardware - generating sound and music with the C64's SID takes a lot less bytes (and still sounds much better) than trying to do something comparable with more primitive hardware like the PC speaker. That's probably also the reason why this demo uses MIDI.
- direwolf20 6mo agoif your OpenGL driver had a glDoACoolDemo(); function, you wouldn't be allowed to call it. But if you find that among the regular functions are some code blocks that just happen to form a cool demo, you can use them and take credit for your discovery...
- xg15 6mo agoHad a similar thought. In theory, you're right, though in practice today it's "256 bytes of binary plus X MB of DOS emulator".
- gmueckl 6mo agoUnless I'm overlooking something, the demo only requires DOSBox to have a machine with predefined execution speed. There are no DOS interrupt calls that I can see. Other than that, the program could probably even be trivially modified to fit in a floppy disk MBR and could potentially run without underlying OS.
- bpeebles 6mo agoTo be more exact (in an excessive way), it uses the BIOS's code to set the video mode (INT 10h) which is probably a few dozen bytes (at least?) although I have been remiss at not ever reading them. And it depends on DOS configuring the memory space to leave an INT 20h call (to terminate the program) at a place that's easy to RET to. But, yeah, very little extra. But I'm not being negative at all and this is pretty nice code and on the impressive side of 256 byte demos from the 80s and 90s (and onward).
- aidenn0 6mo agoYes, this is very minimal; if it were self-booting the INT 20h call wouldn't be needed, but there's no getting around the INT 10h, unless you specialize for very specific hardware. The entire 5150 BIOS fit in 8k, so even if it were laden with BIOS calls (which it's not) then that would be an upper-bound.
- userbinator 6mo agoThe VBIOS is around 32-64k. The modesetting path is probably a few k. And it depends on DOS configuring the memory space to leave an INT 20h call (to terminate the program) at a place that's easy to RET to. This has always been the case, and actually inherited from CP/M.
- rob74 6mo ago
- rwoerz 6mo agoOr a 256 bytes prompt
- TapamN 6mo agoWell, it's "256 bytes of x86" (plus X KB of VESA bios) (plus Y KB of FM synth patches) (plus Z KB of microcode) (plus...)