Live data from Hacker News

Memories – 256 bytes demo winner of Revision 2020

sizecoding.org

81–90 of 123 posts

Re: Memories – 256 bytes demo winner of Revision 2020

#81
post #9

Tiny binaries probably relied heavily on the native OS's system libraries.

(author here) interesting guess, but wrong, as others explained. for maximum purity you can try to NOT call any dos functions or interrupts. i gave that a try in the production "noint10h" ;) https://www.pouet.net/prod.php?which=80769

Re: Memories – 256 bytes demo winner of Revision 2020

#82
post #69
post #63

Earlier quoted context omitted.

Unreasonably impossible as of yet, yes. For handy reference: 8^8: 16,777,216 8^16: 281,474,976,710,656 8^32: 79,228,162,514,264,337,593,543,950,336 8^64: 6,277,101,735,386,680,763,835,789,423,207,666,416,102,355,444,464,034,512,896 8^128: ... 8^256: ? 8^512: hello from the other side of the quantum dimension 8^8 sounds interesting. 16 million reboots of a real {PC,C64,ST,Amiga,Mac,Z80,...} sounds like a collectively…

Thats weird "reference". Why 8 as the base number? Nobody works with 3bit bytes. 8^8 == 2^24 == 2^(8 * 3) == 256^3, i.e. the combination space of three bytes . The smallest category in pouet for reference is 32b (or 256 bits), so 2^256 combinations to brute force. For comparison usually 128bit encryption is considered "safe" and infeasible to brute force. You might be able to constrain the search space to only valid…

You could further constrain it to exclude a lot of instructions and instruction pairs that makes no sense given the context. E.g. any instruction pair where the second one makes the first one redundant, such as the second instruction clobbering the same register the first one modified. Or a "ret" in the first few instructions...

It'd probably not constrain the search space nearly enough though.

But even if it did and you'd somehow manage to even generate every combination, you'd still face the second problem of how to evaluate if they do something "interesting enough" to be worthwhile reviewing.

Re: Memories – 256 bytes demo winner of Revision 2020

#83

The source code really looks like black magic. It's incredible they were able to cram the tunnel effect into 64 bytes [1]. The entire video is here [2], if you just want to watch the final product. EDIT: link fixed. [1] https://www.pouet.net/prod.php?which=85227 [2] https://www.youtube.com/watch?v=Imquk_3oFf4

There's something beautiful about the fact that the video is FAR larger in size than the program that initially generated the output. Almost worth watching for that fact alone.

I’ve pondered before the idea of a video codec that works like RAR, where the video embeds an arbitrary user-specified virtual machine that can be used to decode the video frames. (How is this not just a program binary? Because it still would have the semantics of a video stream, with no random access to frame data, only tape-head-like access.)

Seems like this would be perfect for videos that are just e.g. gameplay of games made of tiles+sprites: the video could just store one copy of the assets, and the frames could just be tile maps + sprite position information.

It would also work well for “videos” that are really just a single static image. Or videos that are visualizations of the audio stream: the VM could actually take the audio frames as input and output the respective video frame.

Re: Memories – 256 bytes demo winner of Revision 2020

#84
post #32

I am always very impressed when I see these demos and how much can be done with so little. If you are like me you just jumped to Youtube[1] to see it in action. When trying to make my significant other to understand what was happening I wanted to run it myself. I was amazed how simple that was! - Install the assembler[2] - Install dosbox[3] - Get the source[4] and put it into c:\temp\demo\memories.asm - Start nasm an…

For macOS users (with brew): brew install dosbox nasm nasm memories.asm -fbin -o memories.com dosbox mount D ~/Development/memories (or whatever) D: memories So, almost the same! Hit FN+Ctrl+F12 to speed it up (it's time-independent, for smoother animations, hit that combination quite a few times). It didn't output any audio for me, but that's probably fixable.

Using `dosbox .` skips two steps by mounting the current directory (at least on linux where I tried it)

Re: Memories – 256 bytes demo winner of Revision 2020

#85
post #71

On a related note: 2019, "Dope on Wax" was 1st in the PC 64k section. There is a breakdown of this demo on youtube, it's roughly ~2 hours. They explained how they made this demo. Really interesting to watch. Demo: https://www.youtube.com/watch?v=QhqT0DhV9yE Breakdown: https://www.youtube.com/watch?v=hFIyj5Yv440

It's wonderful. More impressed with this being 64k than the originally posted 256 bytes.

PC64k is the main size constrained demo format, where people do seriously impressive things. 256b is the masochists category, where doing anything at all is hard. 4k intros are in between.

It's interesting that the demo scene is very Windows/DOS focused, unlike other hacker scenes. Linux or Mac demos are basically not a thing. You're far more likely to see C64 or Amiga demos.

Re: Memories – 256 bytes demo winner of Revision 2020

#86
post #71

Earlier quoted context omitted.

It's wonderful. More impressed with this being 64k than the originally posted 256 bytes.

PC64k is the main size constrained demo format, where people do seriously impressive things. 256b is the masochists category, where doing anything at all is hard. 4k intros are in between. It's interesting that the demo scene is very Windows/DOS focused, unlike other hacker scenes. Linux or Mac demos are basically not a thing. You're far more likely to see C64 or Amiga demos.

Well I guess it makes sense after all, because in DOS you kinda have an "API", for instance using the default interrupts you can select video modes, and the video memory is mapped at a fixed offset and so forth. In Linux due to API fragmentation it would be hard to agree on something that works in the future, and even know likely more setup boilerplate setup code is needed.

Re: Memories – 256 bytes demo winner of Revision 2020

#87

Normally these demos are filled with all kinds of 'tricks' to make things smaller. Things like self modifying code, using bits of the bios or video ROM in ways they weren't intended by jumping into the middle of them, saving space by using code as data or vice versa, tiny packers which compress or uncompress the code, massive pregenerated buffers to do runtime lookups to generate data in one order but use it in anoth…

May I please have a list of demos that do all those things? That sounds really cool.

- Jumping into the middle of video ROM and/or the BIOS

- Using substantial amounts of code as data

- Pregenerated buffers and data reordering

oooooo.

Re: Memories – 256 bytes demo winner of Revision 2020

#88
post #68
post #55

Earlier quoted context omitted.

A handler for executing arbitrary code. What could possibly go wrong?

We already allow arbitrary code to execute by clicking a link, in the form of JavaScript. You may argue that JS is sandboxed, but so is DOSBox. At least DOSBox can’t easily connect to remote servers over the internet.

Correct me if I'm wrong, I haven't used DOSBOX for a decade but doesn't it have the ability to access hard drives and mount them?

Given that, it's not much of a sandbox.

Or does that require intervention from the host system rather than auto-mounting home and similar?

Re: Memories – 256 bytes demo winner of Revision 2020

#89
post #50
post #33

> In 320x200 mode, instead of constructing X and Y from the screen pointer DI with DIV, you can get a decent estimation with multiplying the screen pointer with 0xCCCD and read X and Y from the 8bit registers DH (+DL as 16bit value) and DL (+AH as 16bit value). The idea is to interpret DI as a kind of 16 bit float in the range [0,1], from start to end. Multiplying this number in [0,1] with 65536 / 320 = 204,8 results…

This explanation was so confusing that I had to write a program to get it clear in my head. https://gistpreview.github.io/?9b252f267cd1fdf9754059bb73a18... More clearly: DI = (y * 320) + x Multiply by 0xCCCD => (y * 0x1000040) + (x * 0xcccd) Take top byte is equivalent to divide by 0x1000000. So that gives you Y. The next lower (third) byte is then (x * 0xcccd / 0x10000) == (x * 52429 / 65536) =~ (x * 256/320). And t…

(author here) you're right (about confusing), i wasn't expecting more than a few people to actually read this ;) at least i quickly repaired the float/fixed thing.

Re: Memories – 256 bytes demo winner of Revision 2020

#90
post #18
post #4

How do you handle time with such small code size? I see a timer interrupt for the music, but what about the animation? Is it dependent on the speed of the underlying CPU?

It depends on the speed of the CPU - if you look at the archive at https://www.pouet.net/prod.php?which=85227 , you'll find a DOSBox config specifically for this demo. If you run it in DOSBox you can fiddle with the emulation speed by pressing C-F11 and C-F12 and you'll notice the speed of the animation change. Later: Your question made me wonder what the performance of virtual 'target CPU' is - the 'cycles' setting…

(author here) "you'll notice the speed of the animation change" that might be, but the demo is designed to run at equal speed on all systems (it hooks into the timer) if you experience animation speed differences, that means your system can not handle what dosbox (on high cycles) demands. It should be noted that DosBox is far slower than people expect it to be, and also, that in actual competitions in the demoscene, real modern hardware is booted to Freedos, but has no sound. So if you want sound (with MIDI) in a competition, you have to stick to the rather slow dosbox, and even optimize against an emulator which can be really really weird. (https://www.pouet.net/topic.php?which=11881) I wouldn't claim the demo runs fine on a real 486, but a pentium should do, as a variation of the raycast tunnel part indicates (https://www.youtube.com/watch?v=5_3CU6shKlY)
Post reply on HN