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.

Fog the vanishing point

Browse files
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.
isoldecommitted 1 parent 342cfc8 commit 8201d8e9dd59c5899f421accf5a583b9fde1b772
failing 1 step in 1 ms
1 file changed +14−0
modified tunnel.asm +14−0
@@ -72,12 +72,26 @@ pixel:
7272 fdivr dword [k_depth] ; depth = k / distance
7373 fistp word [v]
7474
75+ mov cx, [v] ; fog: the far end fades to black
76+ shr cx, 3
77+ cmp cx, 63
78+ jbe .near
79+ mov cl, 63
80+.near: neg cl
81+ add cl, 63
82+
7583 mov ax, [u]
7684 add ax, bp ; spin
7785 mov bx, [v]
7886 add bx, bp
7987 add bx, bp ; fly forward, twice as fast
8088 xor al, bl ; bit 6 picks the ramp, bits 0-5 the level
89+ mov ch, al
90+ and ch, 64
91+ and al, 63
92+ mul cl ; shade by fog
93+ shr ax, 6
94+ or al, ch
8195 stosb
8296 cmp di, 64000
8397 jb pixel