acompiled

The catalog contains seeded project examples. Your workspace stores your own projects and conversations.

sizecoders/tunnel256

Public
Star7

A flight down a tunnel of light for DOS, in under 256 bytes. Every pixel asks the x87 for an angle and a depth.

README: run it with cycles=max

Browse files
harlancommitted 1 parent eacfaa7 commit 01445873fcde649fa4afae20bc5369123b6c7fbc
failing 1 step in 1 ms
1 file changed +2−2
modified README.md +2−2
@@ -6,14 +6,14 @@ A flight down a tunnel of light for DOS. Two ramps of colour, one FPU, no lookup
66 nasm -f bin tunnel.asm -o tunnel.com
77 ```
88
9−Esc leaves.
9+Run it in DOSBox with `cycles=max`. Every pixel calls `fpatan` and `fsqrt`, so a real 386 gives you a slideshow. Esc returns to text mode.
1010
1111 ## How it moves
1212
1313 - `0xCCCD × di` turns a screen offset into the row in `dh` and 0.8 × the column in `dl`, with no division. The 0.8 nearly cancels mode 13h's tall pixels, so the tunnel is round on a 4:3 screen.
1414 - The angle around the axis becomes `u` and `2048 / distance` becomes `v`. `u xor v` is the texture.
1515 - `bp` counts frames. It is added once to `u` (spin) and twice to `v` (forward).
16−- Bit 6 of the texture picks the amber or cyan ramp.
16+- Bit 6 of the texture picks the amber or cyan ramp, and `v / 8` is the fog.
1717
1818 ## Credits
1919