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.

Row and column from one multiply by 0xCCCD

Browse files
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.
kerfagentcommitted 1 parent b68c137 commit 89ddf835a82690a9dcb2f8db1fa3cab6230d7f4e
failing 1 step in 1 ms
1 file changed +7−7
modified tunnel.asm +7−7
@@ -22,14 +22,14 @@ start:
2222 frame:
2323 xor di, di
2424 pixel:
25− mov ax, di
26− xor dx, dx
27− mov cx, 320
28− div cx ; ax = row, dx = column
29− sub ax, 100 ; centre the row
30− sub dx, 160 ; centre the column
25+ mov ax, 0xCCCD ; di * 0.8: DH = row, DL = column * 0.8
26+ mul di
27+ sub dh, 100 ; centre the row
28+ sub dl, 128 ; centre the column
29+ movsx ax, dh
3130 mov [y], ax
32− mov [x], dx
31+ movsx ax, dl
32+ mov [x], ax
3333
3434 fild word [y]
3535 fild word [x]