Live data from Hacker News

Memories – 256 bytes demo winner of Revision 2020

sizecoding.org

11–20 of 123 posts

Re: Memories – 256 bytes demo winner of Revision 2020

#11
post #9

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

Yes, that would give some peace of mind, right? Unfortunately for us, that's not the case. The only platform specific code is the 8 instructions on top of "Code of framework" on http://www.sizecoding.org/wiki/Memories

First to set the video mode, and then to set up a timer used to progress time.

Re: Memories – 256 bytes demo winner of Revision 2020

#13
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?

I haven't had a look at the source code for this, but I expect that it syncs with the screen refresh rate.

Re: Memories – 256 bytes demo winner of Revision 2020

#15
Can anyone describe at a high level for a complete noob how this kind of thing works? Someone who is not going to be able to read a bunch of ASM and interpret it? I'm guessing that it is something along the lines of:

- the graphics "driver" reads values out of certain registers (AL and AH?) at a set interrupt (maybe every X clock cycles?) and writes one pixel to the screen of whatever color those registers had in them

- by writing values into those registers and aligning the number of operations the program does with the frequency of the interrupts, you can get animation?

Even achieving any sort of flow control so you can switch between the effects is mind-boggling to me.

Re: Memories – 256 bytes demo winner of Revision 2020

#16
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?

There is an OS-provided timer interrupt that you can hook in to, making sure your interrupt handler is called every X time units. I think it was something like 18 times per second by default, but changeable.

I used this to slow down my computer so that old games were playable. Hooked into the interrupt, wasted cycles, and could enjoy the game. :)

Re: Memories – 256 bytes demo winner of Revision 2020

#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 in the config is 20000 and there's a rough estimate of what these numbers translate to here

https://www.dosbox.com/wiki/Performance

So it looks like it's something along the lines of 'a 486 in the prime of its life'.

Re: Memories – 256 bytes demo winner of Revision 2020

#20
post #19

I've always thought the demo scene looked cool. Problem is, I don't really care about graphics and sound and am not an especially creative person. Are there are competitions that are purely objective? As in, the objective criteria is quantitative?

codegolf
Post reply on HN