fmulp st4 ;|s y x cy z ;|s x sy cx cy z
fmulp ;|sy x cy z ;|sx sy cx cy z
add al,0x7F ; loop 2x
-BIG equ $-1 ;=28799 (anything higher and you'll get overflow glitches)
jo Z
faddp st3 ;|sy cx cy+sx z
fsubp ;|new.z=cx-sy .x=cy+sx .y=z
popa
loop G
-C:popa ;=16993, background color multiplier
+ popa
; the visible pixels are A0000..AF9FF, I want X=0 Y=0 in the center
;Each pixel: cx=T dx:bx=YX:XX(init=9fca:0) di=adr(init=-4)
mov di,-4 ;di = address of pushed ax
;Compute ray direction.
- fild word[byte BIG+si-100h] ; store 28799 as a double, read as two floats
-C2 equ $-2 ;=20036, foreground color multiplier
+ fild word[BIG] ; store 28799 as a double, read as two floats
fst qword[bx] ; t_front@float[bx] = 0, t_back@float[bx+4] = 6.879
fild word[di+4-9]
fild word[di+4-8] ;|y=Y x=X z=BIG
B:
; Subtle highlight on the pyrite.
fld st0
- fimul word[byte C+si-100h] ; 16993 (background) or 20036 (pyrit)
+ fimul word[C] ; 16993 (background) or 20036 (pyrit)
fistp dword[di] ;|y x z
sar dword[di],22 ; if y>=-0.5 { chessboard } else { sky }
js E ; the sky is just y (= y^2 after gamma)
E:ret
+BIG dw 28799
+C dw 16993
+C2 dw 20036
+
times 510-($-$$) db 0
db 0x55,0xaa