Rev 8232 | Rev 8719 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8232 | Rev 8666 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ; application : View3ds ver. 0.071 - tiny .3ds and .asc files viewer |
1 | ; application : View3ds ver. 0.072 - tiny .3ds and .asc files viewer |
2 | ; with a few graphics effects demonstration. |
2 | ; with a few graphics effects demonstration. |
3 | ; compiler : FASM |
3 | ; compiler : FASM |
4 | ; system : KolibriOS |
4 | ; system : KolibriOS |
5 | ; author : Macgub aka Maciej Guba |
5 | ; author : Macgub aka Maciej Guba |
6 | ; email : macgub3@wp.pl |
6 | ; email : macgub3@wp.pl |
7 | ; web : http://macgub.vxm.pl |
7 | ; web : http://macgub.j.pl, http://macgub.co.pl |
8 | ; Fell free to use this intro in your own distribution of KolibriOS. |
8 | ; Fell free to use this intro in your own distribution of KolibriOS. |
9 | ; Special greetings to KolibriOS team . |
9 | ; Special greetings to KolibriOS team . |
10 | ; I hope because my demos Christian Belive will be near to each of You. |
10 | ; I hope because my demos Christian Belive will be near to each of You. |
Line 17... | Line 17... | ||
17 | ; 1) Read from a file (*.3DS standard) |
17 | ; 1) Read from a file (*.3DS standard) |
18 | ; 2) Written in manually (at the end of the code) ; now not exist |
18 | ; 2) Written in manually (at the end of the code) ; now not exist |
19 | 19 | ||
Line 20... | Line 20... | ||
20 | 20 | ||
21 | SIZE_X equ 512 |
21 | SIZE_X equ 500 |
22 | SIZE_Y equ 512 ; ///// I want definitely |
22 | SIZE_Y equ 600 ; ///// I want definitely |
23 | TIMEOUT equ 10 ; ------ say: |
23 | TIMEOUT equ 10 ; ------ say: |
24 | ROUND equ 10 ; \ @ @/ keep smiling every |
24 | ROUND equ 10 ; \ @ @/ keep smiling every |
25 | TEX_X equ 512 ; texture width ; \ ./ / day. |
25 | TEX_X equ 512 ; texture width ; \ ./ / day. |
26 | TEX_Y equ 512 ; height ; \/ / |
26 | TEX_Y equ 512 ; height ; \/ / |
Line 53... | Line 53... | ||
53 | dd 0x0 ; I_Icon |
53 | dd 0x0 ; I_Icon |
54 | 54 | ||
Line 55... | Line 55... | ||
55 | START: ; start of execution |
55 | START: ; start of execution |
56 | cld |
56 | cld |
57 | mov eax, 500 shl 16 + 600 ; ... or set manually |
- | |
58 | mov [size_y_var],ax |
57 | push dword (SIZE_Y shr 3) * 3 |
59 | shr ax,1 |
- | |
60 | mov [vect_y],ax |
- | |
61 | - | ||
62 | - | ||
63 | shr ax,2 |
- | |
64 | movzx ebx,ax |
- | |
65 | movzx ebx,ax |
- | |
66 | lea ebx,[ebx*3] |
- | |
67 | push ebx |
- | |
68 | fninit |
58 | fninit |
69 | fild dword[esp] |
59 | fild dword[esp] |
70 | fstp [rsscale] |
60 | fstp [rsscale] |
71 | pop ebx |
61 | pop ebx |
Line 72... | Line -... | ||
72 | - | ||
73 | shr eax,16 |
- | |
74 | mov [size_x_var],ax |
- | |
75 | shr ax,1 |
- | |
76 | mov [vect_x],ax |
- | |
77 | - | ||
78 | ; mov eax, 20 shl 16 + 20 |
62 | |
Line 79... | Line 63... | ||
79 | mov [x_start],dword 20 shl 16 + 20 ;eax |
63 | mov [x_start],dword 20 shl 16 + 20 ;eax |
80 | 64 | ||
Line 130... | Line 114... | ||
130 | ;mov [draw_win_at_first],0 |
114 | ;mov [draw_win_at_first],0 |
131 | ;mov eax,40 ; set events mask |
115 | ;mov eax,40 ; set events mask |
132 | ;mov ebx,1100000000000000000000000100111b |
116 | ;mov ebx,1100000000000000000000000100111b |
133 | ;int 0x40 |
117 | ;int 0x40 |
134 | 118 | if Ext >= SSE3 |
|
- | 119 | mov eax,1 |
|
- | 120 | cpuid |
|
- | 121 | bt ecx,0 ; is sse3 on board? |
|
- | 122 | jc @f |
|
- | 123 | mov [max_dr_flg],12 |
|
- | 124 | @@: |
|
135 | 125 | end if |
|
- | 126 | ||
Line 136... | Line 127... | ||
136 | still: |
127 | still: |
137 | cmp [edit_flag],1 |
128 | cmp [edit_flag],1 |
138 | jne @f |
129 | jne @f |
139 | mov eax,40 ; set events mask |
130 | mov eax,40 ; set events mask |
Line 266... | Line 257... | ||
266 | cmp ah,5 |
257 | cmp ah,5 |
267 | jne @f |
258 | jne @f |
268 | .zoom_out: |
259 | .zoom_out: |
269 | mov dword[scale],0.7 |
260 | mov dword[scale],0.7 |
270 | fninit |
261 | movss xmm0,[rsscale] |
- | 262 | mulss xmm0,[scale] |
|
- | 263 | movss [rsscale],xmm0 |
|
- | 264 | ; fninit |
|
271 | fld [rsscale] |
265 | ; fld [rsscale] |
272 | fmul [scale] |
266 | ; fmul [scale] |
273 | fstp [rsscale] |
267 | ; fstp [rsscale] |
274 | 268 | ||
- | 269 | ||
Line 275... | Line 270... | ||
275 | @@: |
270 | @@: |
276 | cmp ah,6 ; ah = 6 -> scale+ |
271 | cmp ah,6 ; ah = 6 -> scale+ |
277 | jne @f |
272 | jne @f |
278 | .zoom_in: |
273 | .zoom_in: |
279 | mov dword[scale],1.3 |
274 | mov dword[scale],1.3 |
- | 275 | movss xmm0,[rsscale] |
|
- | 276 | mulss xmm0,[scale] |
|
- | 277 | movss [rsscale],xmm0 |
|
- | 278 | ||
280 | fninit |
279 | ; fninit |
281 | fld [rsscale] |
280 | ; fld [rsscale] |
282 | fmul [scale] |
281 | ; fmul [scale] |
283 | fstp [rsscale] |
282 | ; fstp [rsscale] |
Line 284... | Line 283... | ||
284 | 283 | ||
285 | @@: |
284 | @@: |
286 | cmp ah,9 ; lights random ; 'flat' 0 |
285 | cmp ah,9 ; lights random ; 'flat' 0 |
287 | jne .next_m5 ; 'grd ' 1 |
286 | jne .next_m5 ; 'grd ' 1 |
Line 546... | Line 545... | ||
546 | cmp [fire_flag],0 |
545 | cmp [fire_flag],0 |
547 | jne @f |
546 | jne @f |
548 | call clrscr ; clear the screen |
547 | call clrscr ; clear the screen |
549 | @@: |
548 | @@: |
550 | ; cmp [catmull_flag],1 ;non sort if Catmull = on |
- | |
551 | ; je .no_sort |
- | |
552 | ; 64 indexes call sort_triangles |
- | |
553 | .no_sort: |
- | |
554 | cmp [dr_flag],7 ; fill if 2tex and texgrd |
549 | cmp [dr_flag],7 ; fill if 2tex and texgrd |
555 | jge @f |
550 | jge @f |
556 | cmp [catmull_flag],0 ;non fill if Catmull = off |
551 | cmp [catmull_flag],0 ;non fill if Catmull = off |
557 | je .non_f |
552 | je .non_f |
558 | cmp [dr_flag],6 ; non fill if dots |
553 | cmp [dr_flag],6 ; non fill if dots |
Line 571... | Line 566... | ||
571 | call clear_vertices_index |
566 | call clear_vertices_index |
572 | call draw_handlers |
567 | call draw_handlers |
573 | ; call edit |
568 | ; call edit |
574 | 569 | ||
Line 575... | Line -... | ||
575 | - | ||
576 | - | ||
577 | - | ||
578 | - | ||
579 | - | ||
580 | .no_edit: |
570 | .no_edit: |
Line 581... | Line 571... | ||
581 | 571 | ||
582 | .blurrr: |
572 | .blurrr: |
583 | cmp [sinus_flag],0 |
573 | cmp [sinus_flag],0 |
Line 603... | Line 593... | ||
603 | call do_emboss |
593 | call do_emboss |
604 | 594 | ||
Line 605... | Line 595... | ||
605 | @@: |
595 | @@: |
Line 606... | Line -... | ||
606 | - | ||
607 | 596 | ||
608 | cmp [inc_bright_flag],0 ; increase brightness |
597 | cmp [inc_bright_flag],0 ; increase brightness |
609 | je .no_inc_bright |
598 | je .no_inc_bright |
610 | movzx ebx,[inc_bright_flag] |
599 | movzx ebx,[inc_bright_flag] |
611 | shl ebx,4 |
600 | shl ebx,4 |
Line 778... | Line 767... | ||
778 | 767 | ||
Line 779... | Line 768... | ||
779 | ;-------------------------------------------------------------------------------- |
768 | ;-------------------------------------------------------------------------------- |
780 | ;-------------------------PROCEDURES--------------------------------------------- |
769 | ;-------------------------PROCEDURES--------------------------------------------- |
781 | ;-------------------------------------------------------------------------------- |
770 | ;-------------------------------------------------------------------------------- |
782 | include "FLAT_CAT.INC" |
771 | include "flat_cat.inc" |
783 | include "TEX_CAT.INC" |
772 | include "tex_cat.inc" |
784 | include "BUMP_CAT.INC" |
773 | include "bump_cat.inc" |
785 | include "3DMATH.INC" |
774 | include "3dmath.inc" |
786 | include "GRD_LINE.INC" |
775 | include "grd_line.inc" |
787 | include "B_PROCS.INC" |
776 | include "b_procs.inc" |
788 | include "A_PROCS.INC" |
777 | include "a_procs.inc" |
789 | include "GRD_CAT.INC" |
778 | include "grd_cat.inc" |
790 | include "BUMP_TEX.INC" |
779 | include "bump_tex.inc" |
791 | include "GRD_TEX.INC" |
780 | include "grd_tex.inc" |
792 | include "TWO_TEX.INC" |
781 | include "two_tex.inc" |
793 | include "ASC.INC" |
782 | include "asc.inc" |
794 | if Ext >= SSE3 |
783 | if Ext >= SSE3 |
795 | include "3R_PHG.INC" |
784 | include "3r_phg.inc" |
796 | include '3STENCIL.INC' |
785 | include '3stencil.inc' |
797 | include '3GLASS.INC' |
786 | include '3glass.inc' |
- | 787 | include '3glass_tex.inc' |
|
798 | end if |
788 | end if |
799 | clear_vertices_index: |
789 | clear_vertices_index: |
800 | mov edi,[vertices_index_ptr] |
790 | mov edi,[vertices_index_ptr] |
801 | movzx eax,word[size_x_var] |
791 | movzx eax,word[size_x_var] |
802 | movzx ecx,word[size_y_var] |
792 | movzx ecx,word[size_y_var] |
Line 1243... | Line 1233... | ||
1243 | mov al,byte[esi+13] ; g |
1233 | mov al,byte[esi+13] ; g |
1244 | push ax |
1234 | push ax |
1245 | mov al,byte[esi+12] ; r |
1235 | mov al,byte[esi+12] ; r |
1246 | push ax |
1236 | push ax |
1247 | mov al,byte[esi+20] ; b max color |
1237 | ; pxor xmm1,xmm1 |
- | 1238 | ; movd xmm0,[esi+12] |
|
- | 1239 | ; punpckhbw xmm0,xmm1 |
|
- | 1240 | ; sub esp,8 |
|
- | 1241 | ; movq [esp],xmm0 |
|
- | 1242 | ||
- | 1243 | ||
- | 1244 | mov al,byte[esi+20] ; b max color |
|
1248 | push ax |
1245 | push ax |
1249 | mov al,byte[esi+19] ; g |
1246 | mov al,byte[esi+19] ; g |
1250 | push ax |
1247 | push ax |
1251 | mov al,byte[esi+18] ; r |
1248 | mov al,byte[esi+18] ; r |
1252 | push ax |
1249 | push ax |
Line 1419... | Line 1416... | ||
1419 | .env_done: |
1416 | .env_done: |
1420 | mov esp,ebp |
1417 | mov esp,ebp |
1421 | pop ebp |
1418 | pop ebp |
1422 | ret |
1419 | ret |
1423 | if Ext >= SSE3 |
1420 | if Ext >= SSE2 |
1424 | init_point_normals: |
1421 | init_point_normals: |
1425 | .z equ dword [ebp-8] |
1422 | .z equ dword [ebp-8] |
1426 | .y equ dword [ebp-12] |
1423 | .y equ dword [ebp-12] |
1427 | .x equ [ebp-16] |
1424 | .x equ [ebp-16] |
1428 | .point_number equ dword [ebp-28] |
1425 | .point_number equ dword [ebp-28] |
1429 | .hit_faces equ dword [ebp-32] |
1426 | .hit_faces equ dword [ebp-32] |
Line 1430... | Line -... | ||
1430 | - | ||
1431 | fninit |
1427 | |
1432 | push ebp |
1428 | push ebp |
1433 | mov ebp,esp |
1429 | mov ebp,esp |
1434 | sub esp,64 |
1430 | sub esp,64 |
1435 | and ebp,-16 |
1431 | and ebp,-16 |
Line 1468... | Line 1464... | ||
1468 | cmp ecx,[triangles_count_var] |
1464 | cmp ecx,[triangles_count_var] |
1469 | jne .ipn_check_face |
1465 | jne .ipn_check_face |
1470 | cvtsi2ss xmm6,.hit_faces |
1466 | cvtsi2ss xmm6,.hit_faces |
1471 | movaps xmm7,.x |
1467 | movaps xmm7,.x |
1472 | rcpss xmm6,xmm6 |
1468 | |
- | 1469 | rcpss xmm6,xmm6 |
|
1473 | shufps xmm6,xmm6,11000000b |
1470 | shufps xmm6,xmm6,11000000b |
1474 | mulps xmm7,xmm6 |
1471 | mulps xmm7,xmm6 |
1475 | movaps xmm6,xmm7 |
1472 | movlps [edi],xmm7 |
1476 | mulps xmm6,xmm6 |
- | |
1477 | andps xmm6,[zero_hgst_dd] |
- | |
1478 | haddps xmm6,xmm6 |
- | |
1479 | haddps xmm6,xmm6 |
- | |
1480 | rsqrtps xmm6,xmm6 |
- | |
1481 | mulps xmm7,xmm6 |
- | |
1482 | movlps [edi],xmm7 |
- | |
1483 | movhlps xmm7,xmm7 |
1473 | movhlps xmm7,xmm7 |
1484 | movss [edi+8],xmm7 |
1474 | movss [edi+8],xmm7 |
1485 | add edi,12 |
1475 | call normalize_vector |
- | 1476 | ; movaps xmm6,xmm7 |
|
- | 1477 | ; mulps xmm6,xmm6 |
|
- | 1478 | ; andps xmm6,[zero_hgst_dd] |
|
- | 1479 | ; haddps xmm6,xmm6 |
|
- | 1480 | ; haddps xmm6,xmm6 |
|
- | 1481 | ; rsqrtps xmm6,xmm6 |
|
- | 1482 | ; mulps xmm7,xmm6 |
|
- | 1483 | ; movlps [edi],xmm7 |
|
- | 1484 | ; movhlps xmm7,xmm7 |
|
- | 1485 | ; movss [edi+8],xmm7 |
|
- | 1486 | ||
- | 1487 | add edi,12 |
|
1486 | inc .point_number |
1488 | inc .point_number |
1487 | mov edx,.point_number |
1489 | mov edx,.point_number |
1488 | cmp edx,[points_count_var] |
1490 | cmp edx,[points_count_var] |
1489 | jne .ipn_loop |
1491 | jne .ipn_loop |
1490 | 1492 | ||
Line 1702... | Line 1704... | ||
1702 | movd dword[eax],mm1 |
1704 | movd dword[eax],mm1 |
1703 | @@: |
1705 | @@: |
1704 | if Ext >= SSE3 |
1706 | if Ext >= SSE3 |
1705 | cmp [dr_flag],13 |
1707 | cmp [dr_flag],13 |
1706 | jne .no_stencil |
1708 | jnge .no_stencil |
1707 | mov esi,[triangles_ptr] |
1709 | mov esi,[triangles_ptr] |
1708 | mov ecx,[triangles_count_var] |
1710 | mov ecx,[triangles_count_var] |
1709 | @@: |
1711 | @@: |
1710 | push esi |
1712 | push esi |
1711 | push ecx |
1713 | push ecx |
1712 | 1714 | ||
Line 1766... | Line 1768... | ||
1766 | mov ecx,[triangles_count_var] |
1768 | mov ecx,[triangles_count_var] |
1767 | .again_dts: |
1769 | .again_dts: |
1768 | push ecx |
1770 | push ecx |
1769 | mov ebp,[points_translated_ptr] |
1771 | mov ebp,[points_translated_ptr] |
1770 | if Ext >= SSE2 |
1772 | if Ext = NON |
1771 | mov eax,dword[esi] |
1773 | mov eax,dword[esi] |
1772 | mov [point_index1],eax |
1774 | mov [point_index1],eax |
1773 | lea eax,[eax*3] |
1775 | lea eax,[eax*3] |
1774 | add eax,eax |
1776 | add eax,eax |
1775 | push ebp |
1777 | push ebp |
1776 | add ebp,eax |
1778 | add ebp,eax |
Line 1810... | Line 1812... | ||
1810 | mov eax,[ebp+4] |
1812 | mov eax,[ebp+4] |
1811 | mov [zz3],ax |
1813 | mov [zz3],ax |
1812 | else |
1814 | else |
1813 | movq mm0,[esi] ; don't know MMX |
1815 | movq mm0,[esi] ; don't know MMX |
1814 | mov qword[point_index1],mm0 |
1816 | movq qword[point_index1],mm0 |
1815 | ; shr eax,16 |
1817 | ; shr eax,16 |
1816 | ; mov [point_index2],ax |
1818 | ; mov [point_index2],ax |
1817 | mov eax,dword[esi+8] |
1819 | mov eax,dword[esi+8] |
1818 | mov [point_index3],eax |
1820 | mov [point_index3],eax |
1819 | movdqu xmm0,[esi] |
1821 | movdqu xmm0,[esi] |
1820 | paddd xmm0,xmm0 |
1822 | paddd xmm0,xmm0 |
Line 1886... | Line 1888... | ||
1886 | mov eax,dword[esi] |
1888 | mov eax,dword[esi] |
1887 | lea eax,[eax*3] |
1889 | lea eax,[eax*3] |
1888 | shl eax,2 |
1890 | shl eax,2 |
1889 | add eax,[points_normals_rot_ptr] |
1891 | add eax,[points_normals_rot_ptr] |
1890 | ; lea eax,[eax+point_normals_rotated] |
1892 | bt dword[eax+8],+31 |
- | 1893 | jc .no_culling |
|
- | 1894 | ; lea eax,[eax+point_normals_rotated] |
|
1891 | fld dword[eax+8] ; ***************************** |
1895 | ; fld dword[eax+8] ; ***************************** |
1892 | ftst ; CHECKING OF Z COOFICIENT OF |
1896 | ; ftst ; CHECKING OF Z COOFICIENT OF |
1893 | fstsw ax ; NORMAL VECTOR |
1897 | ; fstsw ax ; NORMAL VECTOR |
1894 | sahf |
1898 | ; sahf |
1895 | jb @f |
1899 | ; jb @f |
1896 | ffree st |
1900 | ; ffree st |
1897 | loop @b |
1901 | loop @b |
1898 | jmp .end_draw ; non visable |
1902 | jmp .end_draw ; non visable |
1899 | @@: |
1903 | ; @@: |
1900 | ffree st ;is visable |
1904 | ; ffree st ;is visable |
1901 | .no_culling: |
1905 | .no_culling: |
1902 | cmp [dr_flag],0 ; draw type flag |
1906 | cmp [dr_flag],0 ; draw type flag |
1903 | je .flat_draw |
1907 | je .flat_draw |
1904 | cmp [dr_flag],2 |
1908 | cmp [dr_flag],2 |
1905 | je .env_mapping |
1909 | je .env_mapping |
1906 | cmp [dr_flag],3 |
1910 | cmp [dr_flag],3 |
Line 1923... | Line 1927... | ||
1923 | cmp [dr_flag],12 |
1927 | cmp [dr_flag],12 |
1924 | je .r_phg |
1928 | je .r_phg |
1925 | cmp [dr_flag],13 |
1929 | cmp [dr_flag],13 |
1926 | je .glass |
1930 | je .glass |
1927 | end if ; **************** |
1931 | cmp [dr_flag],14 |
- | 1932 | je .glass_tex |
|
- | 1933 | ||
- | 1934 | end if ; **************** |
|
1928 | mov esi,point_index3 ; do Gouraud shading |
1935 | mov esi,point_index3 ; do Gouraud shading |
1929 | mov ecx,3 |
1936 | mov ecx,3 |
1930 | .again_grd_draw: |
1937 | .again_grd_draw: |
1931 | mov eax,dword[esi] |
1938 | mov eax,dword[esi] |
1932 | shl eax,2 |
1939 | shl eax,2 |
1933 | lea eax,[eax*3] |
1940 | lea eax,[eax*3] |
1934 | add eax,[points_normals_rot_ptr] |
1941 | add eax,[points_normals_rot_ptr] |
1935 | ; texture x=(rotated point normal -> x * 255)+255 |
1942 | if Ext < SSE |
- | 1943 | ; texture x=(rotated point normal -> x * 255)+255 |
|
1936 | fld dword[eax] ; x cooficient of normal vector |
1944 | fld dword[eax] ; x cooficient of normal vector |
1937 | fimul [correct_tex] |
1945 | fmul dword[correct_texf] |
1938 | fiadd [correct_tex] |
1946 | fadd dword[correct_texf] |
1939 | fistp [temp1] |
1947 | fistp [temp1] |
1940 | ; texture y=(rotated point normal -> y * 255)+255 |
1948 | ; texture y=(rotated point normal -> y * 255)+255 |
1941 | fld dword[eax+4] ; y cooficient |
1949 | fld dword[eax+4] ; y cooficient |
1942 | fimul [correct_tex] |
1950 | fmul dword[correct_texf] |
1943 | fiadd [correct_tex] |
1951 | fadd dword[correct_texf] |
1944 | fistp [temp2] |
1952 | fistp [temp2] |
1945 | 1953 | mov eax,[temp2] |
|
1946 | mov eax,[temp2] |
- | |
1947 | mov ebx,[temp1] |
1954 | mov ebx,[temp1] |
1948 | and ebx,0xfffffff |
1955 | else |
- | 1956 | movlps xmm0,[eax] |
|
- | 1957 | mulps xmm0,[correct_texf] |
|
- | 1958 | addps xmm0,[correct_texf] |
|
- | 1959 | cvtps2dq xmm0,xmm0 |
|
- | 1960 | movd eax,xmm0 |
|
- | 1961 | psrldq xmm0,4 |
|
- | 1962 | movd ebx,xmm0 |
|
- | 1963 | end if |
|
- | 1964 | and ebx,0xfffffff |
|
1949 | shl eax,TEX_SHIFT |
1965 | shl eax,TEX_SHIFT |
1950 | add eax,ebx |
1966 | add eax,ebx |
1951 | lea eax,[eax*3+color_map] |
1967 | lea eax,[eax*3+color_map] |
1952 | mov eax,dword[eax] |
1968 | mov eax,dword[eax] |
1953 | ; cmp [catmull_flag],1 ; put on stack z coordinate if necessary |
1969 | ; cmp [catmull_flag],1 ; put on stack z coordinate if necessary |
Line 2048... | Line 2064... | ||
2048 | fninit ; FLAT DRAWING |
2064 | fninit ; FLAT DRAWING |
2049 | mov eax,[point_index1] |
2065 | mov eax,[point_index1] |
2050 | mov ebx,[point_index2] |
2066 | mov ebx,[point_index2] |
2051 | mov ecx,[point_index3] |
2067 | mov ecx,[point_index3] |
2052 | shl eax,2 |
2068 | ; shl eax,2 |
2053 | shl ebx,2 |
2069 | imul eax,[i12] |
- | 2070 | imul ebx,[i12] |
|
- | 2071 | imul ecx,[i12] |
|
- | 2072 | ; shl ebx,2 |
|
2054 | shl ecx,2 |
2073 | ; shl ecx,2 |
2055 | lea eax,[eax*3] ;+point_normals_rotated] |
2074 | ; lea eax,[eax*3] ;+point_normals_rotated] |
2056 | add eax,[points_normals_rot_ptr] |
2075 | add eax,[points_normals_rot_ptr] |
2057 | lea ebx,[ebx*3] ;+point_normals_rotated] |
2076 | ; lea ebx,[ebx*3] ;+point_normals_rotated] |
2058 | add ebx,[points_normals_rot_ptr] |
2077 | add ebx,[points_normals_rot_ptr] |
2059 | lea ecx,[ecx*3] ;+point_normals_rotated] |
2078 | ; lea ecx,[ecx*3] ;+point_normals_rotated] |
2060 | add ecx,[points_normals_rot_ptr] |
2079 | add ecx,[points_normals_rot_ptr] |
2061 | fld dword[eax] ; x cooficient of normal vector |
2080 | fld dword[eax] ; x cooficient of normal vector |
2062 | fadd dword[ebx] |
2081 | fadd dword[ebx] |
2063 | fadd dword[ecx] |
2082 | fadd dword[ecx] |
2064 | fidiv [i3] |
2083 | fidiv [i3] |
2065 | fimul [correct_tex] |
2084 | fmul dword[correct_texf] |
2066 | fiadd [correct_tex] |
2085 | fadd dword[correct_texf] |
2067 | fistp [temp1] ;dword[esp-4] ; x temp variables |
2086 | fistp [temp1] ;dword[esp-4] ; x temp variables |
2068 | fld dword[eax+4] ; y cooficient of normal vector |
2087 | fld dword[eax+4] ; y cooficient of normal vector |
2069 | fadd dword[ebx+4] |
2088 | fadd dword[ebx+4] |
2070 | fadd dword[ecx+4] |
2089 | fadd dword[ecx+4] |
2071 | fidiv [i3] |
2090 | fidiv [i3] |
2072 | fimul [correct_tex] |
2091 | fmul dword[correct_texf] |
2073 | fiadd [correct_tex] |
2092 | fadd dword[correct_texf] |
2074 | fistp [temp2] ;dword[esp-8] ; y |
2093 | fistp [temp2] ;dword[esp-8] ; y |
2075 | mov edx,[temp2] ;dword[esp-8] |
2094 | mov edx,[temp2] ;dword[esp-8] |
2076 | and edx,0xfffffff |
2095 | and edx,0xfffffff |
2077 | and [temp1],0xfffffff |
2096 | and [temp1],0xfffffff |
2078 | shl edx,TEX_SHIFT |
2097 | shl edx,TEX_SHIFT |
2079 | add edx,[temp1] ;dword[esp-4] |
2098 | add edx,[temp1] ;dword[esp-4] |
Line 2126... | Line 2145... | ||
2126 | mov eax,dword[esi] |
2145 | mov eax,dword[esi] |
2127 | lea eax,[eax*3] |
2146 | lea eax,[eax*3] |
2128 | shl eax,2 |
2147 | shl eax,2 |
2129 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
2148 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
2130 | ; texture x=(rotated point normal -> x * 255)+255 |
2149 | movlps xmm0,[eax] |
2131 | fld dword[eax] |
- | |
2132 | fimul [correct_tex] |
2150 | mulps xmm0,[correct_texf] |
2133 | fiadd [correct_tex] |
2151 | addps xmm0,[correct_texf] |
2134 | fistp word[edi] |
2152 | cvtps2dq xmm0,xmm0 |
2135 | ; texture y=(rotated point normal -> y * 255)+255 |
2153 | packssdw xmm0,xmm0 |
2136 | fld dword[eax+4] |
- | |
2137 | fimul [correct_tex] |
2154 | movd [edi],xmm0 |
2138 | fiadd [correct_tex] |
- | |
2139 | fistp word[edi+2] |
- | |
2140 | 2155 | add edi,4 |
|
2141 | add edi,4 |
- | |
2142 | add esi,4 |
2156 | add esi,4 |
2143 | loop @b |
2157 | loop @b |
2144 | 2158 | ||
Line 2145... | Line 2159... | ||
2145 | mov eax,dword[xx1] |
2159 | mov eax,dword[xx1] |
Line 2176... | Line 2190... | ||
2176 | fld1 |
2190 | fld1 |
2177 | fld1 |
2191 | fld1 |
2178 | faddp |
2192 | faddp |
2179 | fmulp |
2193 | fmulp |
2180 | fimul [correct_tex] |
2194 | fmul dword[correct_texf] |
2181 | fiadd [correct_tex] |
2195 | fadd dword[correct_texf] |
2182 | fistp word[edi] |
2196 | fistp word[edi] |
2183 | mov word[edi+2],0 |
2197 | mov word[edi+2],0 |
2184 | ; fistp word[edi+2] |
2198 | ; fistp word[edi+2] |
2185 | ; # last change |
2199 | ; # last change |
2186 | ; ; texture x=(rotated point normal -> x * 255)+255 |
2200 | ; ; texture x=(rotated point normal -> x * 255)+255 |
2187 | ; fld dword[eax] |
2201 | ; fld dword[eax] |
Line 2228... | Line 2242... | ||
2228 | @@: |
2242 | @@: |
2229 | mov eax,dword[esi] |
2243 | mov eax,dword[esi] |
2230 | lea eax,[eax*3] |
2244 | lea eax,[eax*3] |
2231 | shl eax,2 |
2245 | shl eax,2 |
2232 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
2246 | ; imul eax,[i12] |
- | 2247 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
|
2233 | ; texture x=(rotated point normal -> x * 255)+255 |
2248 | ; texture x=(rotated point normal -> x * 255)+255 |
2234 | fld dword[eax] |
2249 | |
2235 | fimul [correct_tex] |
- | |
2236 | fiadd [correct_tex] |
- | |
2237 | fistp word[edi] |
- | |
2238 | ; texture y=(rotated point normal -> y * 255)+255 |
- | |
2239 | fld dword[eax+4] |
- | |
2240 | fimul [correct_tex] |
- | |
2241 | fiadd [correct_tex] |
- | |
2242 | fistp word[edi+2] |
- | |
2243 | - | ||
Line -... | Line 2250... | ||
- | 2250 | movlps xmm0,[eax] |
|
- | 2251 | mulps xmm0,[correct_texf] |
|
- | 2252 | addps xmm0,[correct_texf] |
|
- | 2253 | cvtps2dq xmm0,xmm0 |
|
- | 2254 | packssdw xmm0,xmm0 |
|
- | 2255 | movd [edi],xmm0 |
|
2244 | add edi,4 |
2256 | add edi,4 |
2245 | add esi,4 |
2257 | add esi,4 |
2246 | loop @b |
2258 | loop @b |
Line 2247... | Line 2259... | ||
2247 | 2259 | ||
Line 2251... | Line 2263... | ||
2251 | push dword[esi] |
2263 | push dword[esi] |
2252 | mov esi,[point_index2] |
2264 | mov esi,[point_index2] |
2253 | shl esi,2 |
2265 | shl esi,2 |
2254 | add esi,tex_points |
2266 | add esi,tex_points |
2255 | ; lea esi,[esi*3] |
2267 | push dword[esi] |
2256 | ; lea esi,[points+2+esi*2] |
- | |
2257 | push dword[esi] |
- | |
2258 | ; push dword[xx2] |
2268 | mov esi,[point_index1] |
2259 | mov esi,[point_index1] |
- | |
2260 | shl esi,2 |
2269 | shl esi,2 |
2261 | add esi,tex_points |
2270 | add esi,tex_points |
2262 | ; lea esi,[esi*3] |
2271 | push dword[esi] |
2263 | ; lea esi,[points+2+esi*2] |
- | |
2264 | push dword[esi] |
- | |
2265 | ; push dword[xx1] |
2272 | |
2266 | - | ||
Line 2267... | Line 2273... | ||
2267 | mov eax,dword[xx1] |
2273 | mov eax,dword[xx1] |
2268 | ror eax,16 |
2274 | ror eax,16 |
2269 | mov ebx,dword[xx2] |
2275 | mov ebx,dword[xx2] |
2270 | ror ebx,16 |
2276 | ror ebx,16 |
Line 2369... | Line 2375... | ||
2369 | .aagain_grd_draw: |
2375 | .aagain_grd_draw: |
Line 2370... | Line 2376... | ||
2370 | 2376 | ||
2371 | lea edx,[ecx*3] |
2377 | lea edx,[ecx*3] |
2372 | push word[edx*2+xx1-2] ; zz1 ,2 ,3 |
2378 | push word[edx*2+xx1-2] ; zz1 ,2 ,3 |
2373 | fninit |
2379 | ; fninit |
2374 | mov eax,dword[esi] |
2380 | mov eax,dword[esi] |
2375 | shl eax,2 |
2381 | shl eax,2 |
2376 | lea eax,[eax*3] ;+point_normals_rotated] |
2382 | lea eax,[eax*3] ;+point_normals_rotated] |
- | 2383 | add eax,[points_normals_rot_ptr] |
|
2377 | add eax,[points_normals_rot_ptr] |
2384 | if Ext < SSE |
2378 | ; texture x=(rotated point normal -> x * 255)+255 |
2385 | ; texture x=(rotated point normal -> x * 255)+255 |
2379 | fld dword[eax] ; x cooficient of normal vector |
2386 | fld dword[eax] ; x cooficient of normal vector |
2380 | fimul [correct_tex] |
2387 | fmul dword[correct_texf] |
2381 | fiadd [correct_tex] |
2388 | fadd dword[correct_texf] |
2382 | fistp [temp1] ;word[ebp-2] |
2389 | fistp [temp1] ;word[ebp-2] |
2383 | ; texture y=(rotated point normal -> y * 255)+255 |
2390 | ; texture y=(rotated point normal -> y * 255)+255 |
2384 | fld dword[eax+4] ; y cooficient |
2391 | fld dword[eax+4] ; y cooficient |
2385 | fimul [correct_tex] |
2392 | fmul dword[correct_texf] |
2386 | fiadd [correct_tex] |
2393 | fadd dword[correct_texf] |
2387 | fistp [temp2] ;word[ebp-4] |
- | |
2388 | 2394 | fistp [temp2] ;word[ebp-4] |
|
2389 | mov eax,[temp2] ;word[ebp-4] |
2395 | mov eax,[temp2] |
- | 2396 | mov ebx,[temp1] |
|
- | 2397 | else |
|
- | 2398 | movlps xmm0,[eax] |
|
- | 2399 | mulps xmm0,[correct_texf] |
|
- | 2400 | addps xmm0,[correct_texf] |
|
- | 2401 | cvtps2dq xmm0,xmm0 |
|
- | 2402 | movd eax,xmm0 |
|
- | 2403 | psrldq xmm0,4 |
|
- | 2404 | movd ebx,xmm0 |
|
2390 | mov ebx,[temp1] ;word[ebp-2] |
2405 | end if |
2391 | and ebx,0xfffffff ; some onjects need thid 'and' |
2406 | and ebx,0xfffffff ; some onjects need thid 'and' |
2392 | shl eax,TEX_SHIFT |
2407 | shl eax,TEX_SHIFT |
2393 | add eax,ebx |
2408 | add eax,ebx |
2394 | lea eax,[eax*3] |
2409 | lea eax,[eax*3] |
Line 2454... | Line 2469... | ||
2454 | lea eax,[eax*3] |
2469 | lea eax,[eax*3] |
2455 | shl eax,2 |
2470 | shl eax,2 |
2456 | add eax,[points_normals_rot_ptr] |
2471 | add eax,[points_normals_rot_ptr] |
2457 | ; texture x=(rotated point normal -> x * 255)+255 |
2472 | ; texture x=(rotated point normal -> x * 255)+255 |
2458 | fld dword[eax] |
2473 | movlps xmm0,[eax] |
- | 2474 | mulps xmm0,[correct_texf] |
|
- | 2475 | addps xmm0,[correct_texf] |
|
- | 2476 | cvtps2dq xmm0,xmm0 |
|
- | 2477 | packssdw xmm0,xmm0 |
|
- | 2478 | movd [edi],xmm0 |
|
- | 2479 | ; fld dword[eax] |
|
2459 | fimul [correct_tex] |
2480 | ; fmul dword[correct_texf] |
2460 | fiadd [correct_tex] |
2481 | ; fadd dword[correct_texf] |
2461 | fistp word[edi] |
2482 | ; fistp word[edi] |
2462 | 2483 | ||
Line 2463... | Line 2484... | ||
2463 | ; texture y=(rotated point normal -> y * 255)+255 |
2484 | ; texture y=(rotated point normal -> y * 255)+255 |
2464 | fld dword[eax+4] |
2485 | ; fld dword[eax+4] |
2465 | fimul [correct_tex] |
2486 | ; fmul dword[correct_texf] |
2466 | fiadd [correct_tex] |
2487 | ; fadd dword[correct_texf] |
2467 | fistp word[edi+2] |
2488 | ; fistp word[edi+2] |
2468 | and word[edi+2],0x7fff ; some objects need it |
2489 | and word[edi+2],0x7fff ; some objects need it |
2469 | add edi,4 |
2490 | add edi,4 |
2470 | add esi,4 |
2491 | add esi,4 |
2471 | loop @b |
2492 | loop @b |
Line 2514... | Line 2535... | ||
2514 | mov eax,dword[esi] |
2535 | mov eax,dword[esi] |
2515 | lea eax,[eax*3] |
2536 | lea eax,[eax*3] |
2516 | shl eax,2 |
2537 | shl eax,2 |
2517 | add eax,[points_normals_rot_ptr] |
2538 | add eax,[points_normals_rot_ptr] |
2518 | ; texture x=(rotated point normal -> x * 255)+255 |
2539 | if Ext >= SSE |
- | 2540 | ; texture x=(rotated point normal -> x * 255)+255 |
|
2519 | fld dword[eax] |
2541 | movlps xmm0,[eax] |
- | 2542 | mulps xmm0,[correct_texf] |
|
- | 2543 | addps xmm0,[correct_texf] |
|
- | 2544 | cvtps2dq xmm0,xmm0 |
|
- | 2545 | packssdw xmm0,xmm0 |
|
- | 2546 | movd [edi],xmm0 |
|
- | 2547 | else |
|
- | 2548 | fld dword[eax] |
|
2520 | fimul [correct_tex] |
2549 | fimul [correct_tex] |
2521 | fiadd [correct_tex] |
2550 | fiadd [correct_tex] |
2522 | fistp word[edi] |
2551 | fistp word[edi] |
2523 | ; texture y=(rotated point normal -> y * 255)+255 |
2552 | ; texture y=(rotated point normal -> y * 255)+255 |
2524 | fld dword[eax+4] |
2553 | fld dword[eax+4] |
2525 | fimul [correct_tex] |
2554 | fimul [correct_tex] |
2526 | fiadd [correct_tex] |
2555 | fiadd [correct_tex] |
2527 | fistp word[edi+2] |
2556 | fistp word[edi+2] |
2528 | 2557 | end if |
|
2529 | add edi,4 |
2558 | add edi,4 |
2530 | add esi,4 |
2559 | add esi,4 |
2531 | loop @b |
2560 | loop @b |
2532 | 2561 | ||
Line 2533... | Line 2562... | ||
2533 | ; push dword 1 shl 16 + 1 ; emap coords |
2562 | ; push dword 1 shl 16 + 1 ; emap coords |
Line 2573... | Line 2602... | ||
2573 | mov eax,dword[esi] |
2602 | mov eax,dword[esi] |
2574 | shl eax,2 |
2603 | shl eax,2 |
2575 | lea eax,[eax*3] |
2604 | lea eax,[eax*3] |
2576 | add eax,[points_normals_rot_ptr] |
2605 | add eax,[points_normals_rot_ptr] |
2577 | ; texture ;x=(rotated point normal -> x * 255)+255 |
2606 | if Ext>=SSE2 |
- | 2607 | movlps xmm0,[eax] |
|
- | 2608 | mulps xmm0,[correct_texf] |
|
- | 2609 | addps xmm0,[correct_texf] |
|
- | 2610 | cvtps2dq xmm0,xmm0 |
|
- | 2611 | movd eax,xmm0 |
|
- | 2612 | psrldq xmm0,4 |
|
- | 2613 | movd ebx,xmm0 |
|
- | 2614 | else if |
|
- | 2615 | ; texture ;x=(rotated point normal -> x * 255)+255 |
|
2578 | fld dword[eax] ; x cooficient of normal vector |
2616 | fld dword[eax] ; x cooficient of normal vector |
2579 | fimul [correct_tex] |
2617 | fmul dword[correct_texf] |
2580 | fiadd [correct_tex] |
2618 | fadd dword[correct_texf] |
2581 | fistp [temp1] ;word[esp-2] |
2619 | fistp [temp1] ;word[esp-2] |
2582 | ; texture y=(rotated point normal -> y * 255)+255 |
2620 | ; texture y=(rotated point normal -> y * 255)+255 |
2583 | fld dword[eax+4] ; y cooficient |
2621 | fld dword[eax+4] ; y cooficient |
2584 | fimul [correct_tex] |
2622 | fmul dword[correct_texf] |
2585 | fiadd [correct_tex] |
2623 | fadd dword[correct_texf] |
2586 | fistp [temp2] ;word[esp-4] |
2624 | fistp [temp2] ;word[esp-4] |
2587 | 2625 | mov eax,[temp2] ;word[esp-4] |
|
2588 | mov eax,[temp2] ;word[esp-4] |
- | |
2589 | mov ebx,[temp1] ;word[esp-2] |
2626 | mov ebx,[temp1] ;word[esp-2] |
2590 | and ebx,0xfffffff |
2627 | end if |
- | 2628 | and ebx,0xfffffff |
|
2591 | shl eax,TEX_SHIFT |
2629 | shl eax,TEX_SHIFT |
2592 | add eax,ebx |
2630 | add eax,ebx |
2593 | lea eax,[eax*3+color_map] |
2631 | lea eax,[eax*3+color_map] |
2594 | mov eax,dword[eax] |
2632 | mov eax,dword[eax] |
2595 | lea ebx,[ecx-1] |
2633 | lea ebx,[ecx-1] |
Line 2797... | Line 2835... | ||
2797 | ror ebx,16 |
2835 | ror ebx,16 |
2798 | mov ecx,dword[xx3] |
2836 | mov ecx,dword[xx3] |
2799 | ror ecx,16 |
2837 | ror ecx,16 |
2800 | mov edi,[screen_ptr] |
2838 | mov edi,[screen_ptr] |
2801 | mov esi,[Zbuffer_ptr] |
2839 | mov edx,[Zbuffer_ptr] |
- | 2840 | mov esi,[Zbuffer_ptr] |
|
2802 | 2841 | ||
Line 2803... | Line 2842... | ||
2803 | call glass_tri |
2842 | call glass_tri |
- | 2843 | jmp .end_draw |
|
- | 2844 | ||
- | 2845 | .glass_tex: |
|
- | 2846 | movd xmm5,[size_y_var] |
|
- | 2847 | punpcklwd xmm5,[the_zero] |
|
- | 2848 | pshufd xmm5,xmm5,01110011b |
|
- | 2849 | ||
- | 2850 | mov eax,[point_index1] |
|
- | 2851 | mov ebx,[point_index2] |
|
- | 2852 | mov ecx,[point_index3] |
|
- | 2853 | imul eax,[i12] |
|
- | 2854 | imul ebx,[i12] |
|
- | 2855 | imul ecx,[i12] |
|
- | 2856 | add eax,[points_normals_rot_ptr] |
|
- | 2857 | add ebx,[points_normals_rot_ptr] |
|
- | 2858 | add ecx,[points_normals_rot_ptr] |
|
- | 2859 | movups xmm0,[eax] |
|
- | 2860 | movups xmm1,[ebx] |
|
- | 2861 | movups xmm2,[ecx] |
|
- | 2862 | andps xmm0,[zero_hgst_dd] |
|
- | 2863 | andps xmm1,[zero_hgst_dd] |
|
- | 2864 | andps xmm2,[zero_hgst_dd] |
|
- | 2865 | xorps xmm3,xmm3 |
|
- | 2866 | ||
- | 2867 | mov eax,[point_index1] |
|
- | 2868 | mov ebx,[point_index2] |
|
- | 2869 | mov ecx,[point_index3] |
|
- | 2870 | imul eax,[i12] |
|
- | 2871 | imul ebx,[i12] |
|
- | 2872 | imul ecx,[i12] |
|
- | 2873 | add eax,[points_rotated_ptr] |
|
- | 2874 | add ebx,[points_rotated_ptr] |
|
- | 2875 | add ecx,[points_rotated_ptr] |
|
- | 2876 | push dword[ecx+8] |
|
- | 2877 | push dword[ebx+8] |
|
- | 2878 | push dword[eax+8] |
|
- | 2879 | movups xmm4,[esp] |
|
- | 2880 | add esp,12 |
|
- | 2881 | andps xmm4,[zero_hgst_dd] |
|
- | 2882 | ||
- | 2883 | mov esi,[point_index3] ; tex map coords |
|
- | 2884 | shl esi,2 |
|
- | 2885 | add esi,tex_points |
|
- | 2886 | push dword[esi] |
|
- | 2887 | mov esi,[point_index2] |
|
- | 2888 | shl esi,2 |
|
- | 2889 | add esi,tex_points |
|
- | 2890 | push dword[esi] |
|
- | 2891 | mov esi,[point_index1] |
|
- | 2892 | shl esi,2 |
|
- | 2893 | add esi,tex_points |
|
- | 2894 | push dword[esi] |
|
- | 2895 | movups xmm6,[esp] |
|
- | 2896 | add esp,12 |
|
- | 2897 | ; pshuflw xmm6,xmm6,10110001b |
|
- | 2898 | ; pshufhw xmm6,xmm6,10110001b |
|
- | 2899 | ||
- | 2900 | movzx eax,word[size_x_var] |
|
- | 2901 | andps xmm6,[zero_hgst_dd] |
|
- | 2902 | movd xmm7,eax |
|
- | 2903 | pslldq xmm7,12 |
|
- | 2904 | por xmm6,xmm7 |
|
- | 2905 | ||
- | 2906 | ||
- | 2907 | mov eax,dword[xx1] |
|
- | 2908 | ror eax,16 |
|
- | 2909 | mov ebx,dword[xx2] |
|
- | 2910 | ror ebx,16 |
|
- | 2911 | mov ecx,dword[xx3] |
|
- | 2912 | ror ecx,16 |
|
- | 2913 | mov edx,texmap |
|
- | 2914 | mov edi,[screen_ptr] |
|
- | 2915 | mov esi,[Zbuffer_ptr] |
|
- | 2916 | ||
- | 2917 | call glass_tex_tri |
|
Line 2804... | Line 2918... | ||
2804 | 2918 | ||
2805 | jmp .end_draw |
2919 | jmp .end_draw |
Line 3182... | Line 3296... | ||
3182 | add esi,8 |
3296 | add esi,8 |
3183 | ;mov edi,triangles |
3297 | ;mov edi,triangles |
3184 | @@: |
3298 | @@: |
3185 | movzx eax,word[esi] |
3299 | movzx eax,word[esi] |
3186 | stosd |
3300 | add eax,ebp |
- | 3301 | stosd |
|
3187 | movzx eax,word[esi+2] |
3302 | movzx eax,word[esi+2] |
3188 | stosd |
3303 | add eax,ebp |
- | 3304 | stosd |
|
3189 | movzx eax,word[esi+4] |
3305 | movzx eax,word[esi+4] |
3190 | stosd |
3306 | add eax,ebp |
- | 3307 | stosd |
|
3191 | add dword[edi-12],ebp |
3308 | ; add dword[edi-12],ebp |
3192 | add dword[edi-8],ebp |
3309 | ; add dword[edi-8],ebp |
3193 | add dword[edi-4],ebp |
3310 | ; add dword[edi-4],ebp |
3194 | add esi,8 |
3311 | add esi,8 |
3195 | dec ecx |
3312 | dec ecx |
3196 | jnz @b |
3313 | jnz @b |
3197 | add ebp,edx |
3314 | add ebp,edx |
3198 | jmp .find4k |
3315 | jmp .find4k |
3199 | mov eax,-1 ;<---mark if OK |
3316 | mov eax,-1 ;<---mark if OK |
Line 3269... | Line 3386... | ||
3269 | 3386 | ||
Line 3270... | Line 3387... | ||
3270 | 3387 | ||
3271 | - | ||
3272 | read_from_disk: |
- | |
3273 | if USE_LFN |
3388 | |
3274 | ;- |
3389 | read_from_disk: |
3275 | mov eax, 68 |
3390 | mov eax, 68 |
Line 3276... | Line -... | ||
3276 | mov ebx, 11 |
- | |
3277 | int 0x40 ; -> create heap |
- | |
3278 | - | ||
3279 | ; mov eax, 70 |
- | |
3280 | ; mov ebx, file_info |
- | |
3281 | ; mov dword[ebx], 5 ; -> subfunction number |
- | |
3282 | ; int 0x40 ; -> read file size |
- | |
3283 | ; mov ebx, [fptr] |
- | |
3284 | ; mov ebx, dword[ebx+32] |
- | |
3285 | ; inc ebx |
- | |
3286 | ; mov [fsize], ebx |
- | |
3287 | - | ||
3288 | - | ||
3289 | - | ||
3290 | ; mov eax, 68 |
- | |
3291 | ; mov ebx, 12 |
- | |
3292 | ; mov ecx, [fsize] |
- | |
3293 | ; int 0x40 ; -> allocate memory for file |
- | |
3294 | ; mov [fptr], eax ; -> eax = pointer to allocated mem |
- | |
3295 | - | ||
3296 | ; mov eax, 70 |
- | |
3297 | ; mov ebx, file_info |
3391 | mov ebx, 11 |
3298 | ; mov dword[ebx],0 |
3392 | int 0x40 ; -> create heap |
3299 | ; int 0x40 ; -> read file |
3393 | |
3300 | ;load kpacked files by Leency |
3394 | ;load kpacked files by Leency |
3301 | mov eax,68 |
3395 | mov eax,68 |
Line 3312... | Line 3406... | ||
3312 | jmp @f |
3406 | jmp @f |
3313 | .open_opened_well: |
3407 | .open_opened_well: |
3314 | xor eax,eax |
3408 | xor eax,eax |
3315 | @@: |
3409 | @@: |
3316 | else |
3410 | ; eax = 0 -> ok file loaded |
3317 | mov eax,58 |
- | |
3318 | mov ebx,file_info |
- | |
3319 | int 0x40 |
- | |
3320 | - | ||
3321 | mov eax,ebx |
- | |
3322 | shr eax,9 |
- | |
3323 | inc eax |
- | |
3324 | mov [fsize],eax |
- | |
3325 | - | ||
3326 | - | ||
3327 | - | ||
3328 | ; mov ecx,ebx |
- | |
3329 | ; add ecx,MEM_END |
- | |
3330 | ; mov ebx,1 |
- | |
3331 | ; mov eax,64 ; allocate mem - resize app mem |
- | |
3332 | ; for points and triangles |
- | |
3333 | int 0x40 |
- | |
3334 | - | ||
3335 | mov eax,58 |
- | |
3336 | mov ebx,file_info |
- | |
3337 | int 0x40 |
- | |
3338 | end if |
- | |
3339 | ; eax = 0 -> ok file loaded |
- | |
3340 | ret |
- | |
3341 | ; eax = 0 -> ok file loaded |
- | |
3342 | ret |
3411 | ret |
3343 | read_param: |
3412 | |
- | 3413 | read_param: |
|
3344 | mov esi,I_Param |
3414 | mov esi,I_Param |
3345 | cmp dword[esi],0 |
3415 | cmp dword[esi],0 |
3346 | je .end |
3416 | je .end |
3347 | cmp byte[esi],'/' |
3417 | cmp byte[esi],'/' |
3348 | je .copy |
3418 | je .copy |
Line 3594... | Line 3664... | ||
3594 | 3664 | ||
Line 3595... | Line 3665... | ||
3595 | 3665 | ||
Line 3596... | Line 3666... | ||
3596 | ; DATA AREA ************************************ |
3666 | ; DATA AREA ************************************ |
3597 | 3667 | ||
3598 | include 'DATA.INC' |
3668 | include 'data.inc' |