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!