the 16 byte DOS demo from #revision2026 running on real hardware

holy… HOW

@domi 16.. byte?

@RafiX c40448ab260345ae260305c1e802ebf2

that’s it. that’s the demo.

@domi @RafiX its such a thing

; si, di might be 100, FFFE? https://www.pcjs.org/documents/misc/DOS_COM_Startup_Registers.pdf
les ax,word [si] ; (es, ax) = (ds:[si], ds:[si+2])
loop: dec ax
stosw
add ax,[es:di-82];52h
add ax,[es:di]
shr ax, 2
jmp loop
@mothcompute I would have assumed that ES is b800, as it needs to write into text memory...? So yes, the values it reads from the stack need to be somewhat correct to overlap with the VGA text memory. Someone needs to inspect this!
@root42 nope, es is initialized to AB48 (from the instruction bytes from dec ax) whose range still covers all of text memory. it relies on the com starting with si = 100h; the stack isnt used
mothcompute (@[email protected])

``` ;si=0x100 https://www.pcjs.org/documents/misc/DOS_COM_Startup_Registers.pdf s: les ax,word [si] ; es = [s+2] -> 0xAB48 l: dec ax stosw ;es:[di]=ax add ax,[es:di-82] add ax,[es:di] shr ax, 2 jmp l ```

merpstodon!
@mothcompute @root42 The other clever trick I see here, if I understand the code correctly (I'm not really an assembly guy) is that the code sums two integers and divides the result by 4: this way no matter what you find in memory at the start, you'll sooner or later arrive to 0, and when you decrement ax you restart from 65535, converging to the same pattern no matter what.
@prestissimo yes. And the 82 backwards gives the motion to the upper left. It’s a little bit like the classic fire effect where you average and decrement values from the line below.
Edit: i would have assumed the offset should be 162 (2 bytes per character), but it seems they take the character halfway down the line to the left…
@prestissimo I have tried out with offset 162, and it works, too. Looks slightly different, but maybe that's what they were originally going for...? not sure!

@domi @RafiX If I remember correctly someone did a space search of the 8 byte demos some time ago with a limited machine code set (it had to set a graphical mode mode and have a jmp of some kind at the end).

Can't find it now :(

Puppy Farmer by Rift & Digital Sounds System

demotool for Windows, released in may 2012

pouët.net
@[email protected] @[email protected] Insane.

I mean, sure, it's just a PRNG writing into video RAM... but still very cool to get it done that short.

My attempt at decompiling (correct modulo the mistakes):
uint16_t *base = 0xAB480; base[0x7FFF] = 0x04C3; for (uint15_t d = 0; ; ++d) { base[d] = (base[d - 1] + base[d - 0x29] + base[d]) >> 2 - 1; }
Basically a base-65536 linear shift register of length 32768. Part of which covers the 2048 entries of video memory area from segment 0xB800, and some other random memory that's safe to write and simply does nothing in the usual case.

(I had to take freedom to make d an uint15_t to get the wraparound where needed)

The cool part is of course where the pointer into video RAM (in the original assembly the value of the ES register) comes from:
0x0000000000000100: C4 04 les ax, ptr [si] 0x0000000000000102: 48 dec ax 0x0000000000000103: AB stosw word ptr es:[di], ax
As SI starts at 0100, this will read AX from C4 04 (i.e. 04C4), and ES from the two following bytes 48 AB (AB48) - i.e. from its own machine code which happens to have the right bytes there. The STOSW is critical. This is technically part of the graphics mode video RAM A000-AFFF, however as the code writes an entire 64k block from there, also covers any segemnts until BB47, which in particular covers both the monochrome text mode video RAM from B000 to B7FF and the "interesting part" of color text mode video RAM from B800 to BFFF.
@domi @RafiX category MD5 hashes you can execute
@lritter @RafiX md5sum*, sha256 is a whopping 2x larger!!

@domi @lritter @RafiX oh, executable MD5 hashes with a known and meaningful input would be kind of possible, maybe

reminds me of https://shells.aachen.ccc.de/~spq/md5.gif

@lritter @domi @RafiX Makes me wonder if a checksum which hashes to itself (that *has* to exist…) could also be a demo.
@lanodan @domi @RafiX i occasionally think about this problem, without results.
@lritter @domi @RafiX "Hello, I'm going to need all the LLM-datacenters for some serious number crunching"
@domi a 16 byte payload for some kind of interpreter, I assume
@efi yes, in this case the interpreter is called “intel pentium”
@domi that uses x86, right? there's a lot of things 16 bytes can do
@domi @efi launched in DOS though, right?
@lanodan @efi DOS 7, i believe. a random floppy from my ~
@domi when do we show a lecker kaffee trinken demo
@snow do you wanna help with demomaking? :D i’d be up for that
@domi it sounds fun but i'm bad with math and graphics-programming :x

@snow i’m not good at it either! we can learn together! :D

i have started hacking up a demo for bash with graphics (yeah) and audio (… yeah), but i’m fine with virtually any platform :D

@domi @snow I've got a pc-98 available I've been wanting to write a demo for forever
@shiz @snow i need to fetch my PC-98 from PL :) but i’m a total n00b for this platform
@domi @shiz *adds pc-98 to shopping list*
@domi @snow @shiz PC-98 demo meetup at eth0?
@domi @snow @shiz I only have a PC with Windows 98, no PC-98

@domi @snow so technically I have *two* at RevSpace, a PC-9821Ap and a PC-9801VX :>

and some years ago I started writing a basic graphics library for the GDC/GCRG/EGC: https://codeberg.org/shiz/gfxi

it's not much (yet), but it's a start?

@domi main hypothesis before diassembling the thing would be one of those bulk moves x86 has to the graphics region ? (though i don't see that in the hex so i'm probably wrong)
wonder if it'd run on a non-AT machine
@domi so no dosbox bug used as suspected in the stream
@domi this looks like a frame from Hackers (1995)
@domi The code:
- Sets ES:AX to *[DS:SI]. For a COM exe in DOSBox this resolves to AB48:04C4.
- Thanks to real mode, segment AB48 happens to include all of B800:0000 - B800:0FA0, AKA the text display buffer.
- The code loops through every 16-bit word in segment AB48
- AX is incremented by current word + the word 82 spaces behind (AKA one full horizontal screen row + 2)
- AX is divided by 4
- AX is decremented by 1
- AX is stored into ES:DI, DI is incremented by 2
Result: a moving, fading pattern
@domi Is there a binary for this one?
@joan_am scroll through the replies?
@domi you typed it in by hand, right?