README: run it with cycles=max
harlancommitted
The catalog contains seeded project examples. Your workspace stores your own projects and conversations.
A flight down a tunnel of light for DOS, in under 256 bytes. Every pixel asks the x87 for an angle and a depth.
Esc used to drop back to DOS still in mode 13h, with the prompt drawn over the last frame.
For 0 to 63 the two are equal, and xor cl, 63 is one instruction where neg and add were two. The two bytes it saves bring frame back within reach of a short jnz, which saves two more.
v / 8, capped at 63, is the fog. The level is multiplied by 63 minus the fog and divided by 64, so the centre fades to black.
One xchg al, ah ahead of a single set of outs replaces the second branch. al still holds the index after the first out, so the second mov al, cl goes too.
The palette loop writes all 256 DAC entries. Bit 6 of the index picks the ramp and bits 0-5 the level, so 128-255 repeat 0-127 and the texture byte needs no masking.
The same size as the div by 320, but the column comes out scaled by 0.8, which nearly cancels mode 13h's tall pixels. On a 4:3 screen the tunnel is round now instead of an egg.
fpatan gives each pixel's angle around the centre and k / distance its depth. Their xor is the texture, and bp scrolls both: once around, twice forward.