From: Richard W.M. Jones Date: Fri, 25 Oct 2019 17:19:53 +0000 (+0100) Subject: Replace more magic constants in the code. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=7ba690b16dd3b4806d6772e3154ef0c9c3291ebe;p=pyrit.git Replace more magic constants in the code. --- diff --git a/pyrit.asm b/pyrit.asm index ac14df0..5b100c4 100644 --- a/pyrit.asm +++ b/pyrit.asm @@ -103,7 +103,6 @@ Z:fld st1 ;|y x y z ;|x sy x cy z 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 @@ -115,7 +114,7 @@ S:fstp dword[bp+si] ;[bp+100]=.z [bp+104]=.x [bp+108]=.y 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) @@ -129,8 +128,7 @@ X2: 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 @@ -236,7 +234,7 @@ Y:fld dword[bx+di] ;|(rd'pf) rd.y .x .z ; reads pf->dot_rd 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) @@ -270,5 +268,9 @@ B: E:ret +BIG dw 28799 +C dw 16993 +C2 dw 20036 + times 510-($-$$) db 0 db 0x55,0xaa