Rev 9521 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9521 | Rev 9740 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ; application : View3ds ver. 0.076 - tiny .3ds and .asc files viewer |
1 | ; application : View3ds ver. 0.077 - 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 |
Line 65... | Line 65... | ||
65 | 65 | ||
Line 66... | Line 66... | ||
66 | call alloc_buffer_mem |
66 | call alloc_buffer_mem |
67 | call read_param |
67 | call read_param |
68 | call read_from_disk ; read, if all is ok eax = 0 |
68 | call read_from_disk ; read, if all is ok eax = 0 |
- | 69 | btr eax,31 ; mark 1 |
|
69 | cmp eax,0 |
70 | cmp eax,0 |
70 | jne .gen |
71 | jne .gen |
- | 72 | bts eax,31 ; mark 2 |
|
71 | mov esi,[fptr] |
73 | mov esi,[fptr] |
72 | cmp [esi],word 4D4Dh |
74 | cmp [esi],word 4D4Dh |
73 | jne .asc |
75 | jne .asc_gen |
74 | call read_tp_variables ; init points and triangles count variables |
76 | call read_tp_variables ; init points and triangles count variables |
75 | cmp eax,0 |
77 | cmp eax,0 |
76 | - | ||
77 | jne .malloc |
78 | jne .malloc |
- | 79 | xor eax,eax ; if failed read -> generate |
|
78 | .gen: |
80 | .gen: |
- | 81 | .asc_gen: ; read asc file or generate |
|
- | 82 | push eax |
|
79 | ; if no house.3ds on board - generate |
83 | ; if no house.3ds on rd - generate |
80 | xor bl,bl ; reallocate memory |
84 | xor bl,bl ; allocate memory |
81 | mov [triangles_count_var],20000 |
85 | mov [triangles_count_var],20000 |
82 | mov [points_count_var],20000 |
86 | mov [points_count_var],20000 |
83 | call alloc_mem_for_tp |
87 | call alloc_mem_for_tp |
84 | - | ||
- | 88 | pop eax |
|
- | 89 | bt eax,31 |
|
- | 90 | jc .asc |
|
85 | mov bl,[generator_flag] |
91 | mov bl,[generator_flag] |
86 | call generate_object |
92 | call generate_object |
- | 93 | mov ax,1 ;mark |
|
- | 94 | ||
87 | jmp .opt |
95 | jmp .opt |
88 | .asc: |
96 | .asc: |
- | 97 | ; xor bl,bl |
|
89 | mov [triangles_count_var],10000 ; to do: read asc header |
98 | ; mov [triangles_count_var],20000 ; to do: read asc header |
90 | mov [points_count_var],10000 |
99 | ; mov [points_count_var],20000 |
91 | call alloc_mem_for_tp |
100 | ; call alloc_mem_for_tp |
92 | call read_asc |
101 | call read_asc |
- | 102 | xor ax,ax |
|
93 | jmp .opt |
103 | jmp .opt |
94 | .malloc: |
104 | .malloc: |
95 | call alloc_mem_for_tp |
105 | call alloc_mem_for_tp |
96 | call read_from_file |
106 | call read_from_file |
97 | .opt: |
107 | .opt: |
- | 108 | if Ext >= SSE2 |
|
- | 109 | push ax |
|
- | 110 | end if |
|
98 | call optimize_object1 ; proc in file b_procs.asm |
111 | call optimize_object1 ; proc in file b_procs.asm |
99 | ; set point(0,0,0) in center and calc all coords |
112 | ; set point(0,0,0) in center and calc all coords |
100 | ; to be in <-1.0,1.0> |
113 | ; to be in <-1.0,1.0> |
101 | call normalize_all_light_vectors |
114 | call normalize_all_light_vectors |
102 | call copy_lights ; to aligned float |
115 | call copy_lights ; to aligned float |
103 | call init_triangles_normals2 |
116 | ; call init_triangles_normals2 |
- | 117 | ||
Line 104... | Line 118... | ||
104 | 118 | ||
- | 119 | if Ext >= SSE2 |
|
105 | if Ext >= SSE2 |
120 | ; if first byte of ax set -> old style normal vectors finding |
106 | call detect_chunks |
121 | call detect_chunks |
107 | mov [chunks_number],ecx |
122 | mov [chunks_number],ecx |
108 | mov [chunks_ptr],ebx |
- | |
- | 123 | mov [chunks_ptr],ebx |
|
- | 124 | push esi |
|
- | 125 | push edi |
|
109 | 126 | call init_triangles_normals2 |
|
110 | ; esi - tri_ch |
127 | ; esi - tri_ch |
111 | ; edi - t_ptr - every vertice index - pointer to to all triangles |
128 | ; edi - t_ptr - every vertice index - pointer to to all triangles |
- | 129 | ; that have this index |
|
- | 130 | pop edi |
|
- | 131 | pop esi |
|
- | 132 | pop ax |
|
112 | ; that have this index |
133 | |
Line 113... | Line 134... | ||
113 | end if |
134 | end if |
Line 114... | Line 135... | ||
114 | 135 | ||
Line 120... | Line 141... | ||
120 | call init_sincos_tab |
141 | call init_sincos_tab |
121 | call do_color_buffer ; intit color_map |
142 | call do_color_buffer ; intit color_map |
122 | if Ext >= SSE3 |
143 | if Ext >= SSE3 |
123 | call init_point_lights |
144 | call init_point_lights |
124 | mov [fire_flag],0 ; proteza |
145 | end if |
125 | end if |
- | |
126 | mov edi,bumpmap |
146 | mov edi,bumpmap |
127 | call calc_bumpmap |
147 | call calc_bumpmap |
128 | call calc_bumpmap_coords ; bump and texture mapping |
148 | call calc_bumpmap_coords ; bump and texture mapping |
129 | call do_edges_list |
149 | call do_edges_list |
130 | call draw_window |
150 | call draw_window |
Line 204... | Line 224... | ||
204 | @@: |
224 | @@: |
205 | jmp noclose |
225 | jmp noclose |
206 | 226 | ||
Line 207... | Line 227... | ||
207 | red: ; redraw |
227 | red: ; redraw |
- | 228 | ; xor edx,edx |
|
- | 229 | ; @@: |
|
- | 230 | ; push edx |
|
208 | mov eax,9 ; get process info |
231 | mov eax,9 ; get process info |
209 | mov ebx,procinfo |
232 | mov ebx,procinfo |
210 | mov ecx,-1 |
233 | or ecx,-1 |
211 | int 0x40 |
234 | int 0x40 |
- | 235 | ; pop edx |
|
- | 236 | ; inc edx |
|
- | 237 | ; cmp dword[procinfo+26],50000000 ; ~ 10 Mbytes |
|
- | 238 | ; jb @f |
|
- | 239 | ; cmp edx,1 |
|
- | 240 | ; je @b |
|
- | 241 | ||
- | 242 | ||
- | 243 | ; @@: |
|
212 | mov eax,[procinfo+42] ; read params of window |
244 | mov eax,[procinfo+42] ; read params of window |
213 | sub eax,225 |
245 | sub eax,225 |
214 | mov [size_x_var],ax |
246 | mov [size_x_var],ax |
215 | shr ax,1 |
247 | shr ax,1 |
216 | mov [vect_x],ax |
248 | mov [vect_x],ax |
Line 295... | Line 327... | ||
295 | jge add_vec_buttons |
327 | jge add_vec_buttons |
296 | call update_flags ; update flags and write labels of flags |
328 | call update_flags ; update flags and write labels of flags |
297 | 329 | ||
Line 298... | Line 330... | ||
298 | ; do other operations according to flag |
330 | ; do other operations according to flag |
299 | cmp ah,3 ; ah = 3 -> shading model |
331 | ; cmp ah,3 ; ah = 3 -> shading model |
300 | jne .next_m6 |
332 | ; jne .next_m6 |
301 | cmp [dr_flag],2 |
333 | ; cmp [dr_flag],2 |
302 | jne @f |
334 | ; jne @f |
303 | ; call init_envmap2 ; <----! this don't works in env mode |
335 | ; call init_envmap2 ; <----! this don't works in env mode |
304 | ; and more than ~18 kb objects |
336 | ; and more than ~18 kb objects |
305 | ; call init_envmap_cub2 |
337 | ; call init_envmap_cub2 |
306 | @@: |
338 | ; @@: |
307 | cmp [dr_flag],4 |
339 | cmp [dr_flag],4 |
308 | jne @f |
340 | jne @f |
309 | call generate_texture2 |
341 | call generate_texture2 |
Line 310... | Line 342... | ||
310 | 342 | ||
Line 400... | Line 432... | ||
400 | if Ext >= SSE2 |
432 | if Ext >= SSE2 |
401 | call detect_chunks |
433 | call detect_chunks |
402 | mov [chunks_number],ecx |
434 | mov [chunks_number],ecx |
403 | mov [chunks_ptr],ebx |
435 | mov [chunks_ptr],ebx |
404 | 436 | mov ax,1 ; - old style detecting normal vectors |
|
405 | ; esi - tri_ch |
- | |
- | 437 | ; esi - tri_ch |
|
406 | ; edi - t_ptr - every vertice index - pointer to to all triangles |
438 | ; edi - t_ptr - every vertice index - pointer to to all triangles |
407 | ; that have this index |
439 | ; that have this index |
408 | end if |
440 | end if |
409 | 441 | ||
Line 410... | Line 442... | ||
410 | call init_point_normals |
442 | call init_point_normals |
411 | call calc_bumpmap_coords ; bump and texture mapping |
443 | call calc_bumpmap_coords ; bump and texture mapping |
412 | call do_edges_list |
444 | call do_edges_list |
413 | call write_info |
445 | call write_info |
- | 446 | ||
414 | .next_m2: |
447 | .next_m2: |
415 | cmp ah,19 |
448 | cmp ah,19 |
416 | je @f |
449 | je @f |
417 | cmp ah,20 |
450 | cmp ah,20 |
418 | jne .next_m3 |
451 | jne .next_m3 |
Line 691... | Line 724... | ||
691 | mul ecx |
724 | mul ecx |
692 | lea ecx,[eax*4] |
725 | lea ecx,[eax*4] |
693 | 726 | ||
Line 694... | Line 727... | ||
694 | if (Ext = MMX)|(Ext = SSE) |
727 | if (Ext = MMX)|(Ext = SSE) |
- | 728 | emms |
|
695 | mov bh,bl |
729 | mov bh,bl |
696 | push bx |
730 | push bx |
697 | shl ebx,16 |
731 | shl ebx,16 |
698 | pop bx |
732 | pop bx |
699 | push ebx |
733 | push ebx |
Line 882... | Line 916... | ||
882 | movzx eax,word[size_x_var] |
916 | movzx eax,word[size_x_var] |
883 | movzx ecx,word[size_y_var] |
917 | movzx ecx,word[size_y_var] |
884 | imul ecx,eax |
918 | imul ecx,eax |
885 | xor eax,eax |
919 | xor eax,eax |
886 | shr ecx,1 |
920 | ; shr ecx,1 |
887 | rep stosd |
921 | rep stosd |
888 | ret |
922 | ret |
889 | edit: ; mmx required, edit mesh by vertex |
923 | |
- | 924 | edit: ; mmx required, edit mesh by vertex |
|
890 | push ebp |
925 | push ebp |
891 | mov ebp,esp |
926 | mov ebp,esp |
892 | sub esp,128 |
927 | sub esp,128 |
893 | 928 | ||
Line 894... | Line 929... | ||
894 | .y_coord equ ebp-2 |
929 | .y_coord equ ebp-2 |
895 | .x_coord equ ebp-4 |
930 | .x_coord equ ebp-4 |
896 | .points_translated equ ebp-10 |
931 | .points_translated equ ebp-10 |
897 | .points equ ebp-22 |
932 | .points equ ebp-26 |
898 | .points_rotated equ ebp-34 |
933 | .points_rotated equ ebp-26-16 |
899 | .mx equ ebp-70 |
934 | .mx equ ebp-26-56 |
Line 900... | Line 935... | ||
900 | 935 | ||
901 | macro check_bar |
936 | macro check_bar |
902 | { |
937 | { |
903 | movzx ebx,word[.x_coord] |
938 | movzx ebx,word[.x_coord] |
904 | movzx ecx,word[.y_coord] |
939 | movzx ecx,word[.y_coord] |
905 | movzx edx,word[size_x_var] |
940 | movzx edx,word[size_x_var] |
906 | imul edx,ecx |
941 | imul edx,ecx |
907 | add ebx,edx |
- | |
908 | push ebx |
942 | add ebx,edx |
909 | mov ecx,ebx |
943 | mov ecx,ebx |
910 | shl ecx,2 |
- | |
911 | ; lea ecx,[ebx*2] |
944 | shl ecx,2 |
912 | lea ebx,[ebx*3] |
- | |
913 | 945 | lea ebx,[ebx*3] |
|
914 | cmp [dr_flag],12 |
- | |
915 | jl @f |
946 | cmp [dr_flag],10 |
916 | add ebx,[esp] |
- | |
917 | @@: |
- | |
918 | add esp,4 |
947 | cmovg ebx,ecx |
919 | add ebx,[screen_ptr] |
948 | add ebx,[screen_ptr] |
920 | mov ebx,[ebx] |
949 | mov ebx,[ebx] |
921 | and ebx,0x00ffffff |
950 | and ebx,0x00ffffff |
922 | cmp ebx,0x00ff0000 ; is handle bar ? |
951 | cmp ebx,0x00ff0000 ; is handle bar ? |
Line 933... | Line 962... | ||
933 | movd mm3,[size_y_var] |
962 | movd mm3,[size_y_var] |
934 | pcmpgtw mm0,mm1 |
963 | pcmpgtw mm0,mm1 |
935 | pcmpgtw mm3,mm1 |
964 | pcmpgtw mm3,mm1 |
936 | pxor mm3,mm0 |
965 | pxor mm3,mm0 |
937 | movd eax,mm3 |
966 | pmovmskb eax,mm3 |
938 | mov cx,ax |
967 | and eax,1111b |
939 | shr eax,16 |
- | |
940 | and ax,cx |
- | |
941 | or ax,ax |
968 | |
- | 969 | or ax,ax |
|
942 | jz .no_edit |
970 | jz .no_edit |
943 | 971 | ||
Line 944... | Line 972... | ||
944 | 972 | ||
945 | movd mm0,ebx |
973 | movd mm0,ebx |
946 | psubw mm1,mm0 |
974 | psubw mm1,mm0 |
Line 947... | Line 975... | ||
947 | movd eax,mm1 |
975 | movd eax,mm1 |
948 | 976 | ||
949 | ; store both x and y coordinates |
- | |
950 | ror eax,16 |
- | |
951 | ; push eax |
977 | ; store both x and y coordinates |
952 | ; sub esp,256 |
978 | ror eax,16 |
953 | mov [.x_coord],eax |
979 | mov [.x_coord],eax |
Line 954... | Line 980... | ||
954 | test word[mouse_state],100000000b |
980 | test word[mouse_state],100000000b |
Line 955... | Line -... | ||
955 | jz .not_press ; check if left mouse button press |
- | |
956 | 981 | jz .not_press ; check if left mouse button press |
|
957 | ; left button pressed |
982 | |
958 | 983 | ; left button pressed |
|
959 | 984 | ||
960 | check_bar |
985 | check_bar |
Line 990... | Line 1015... | ||
990 | jz .end |
1015 | jz .end |
991 | check_bar |
1016 | check_bar |
992 | jne .end |
1017 | jne .end |
993 | 1018 | ||
Line 994... | Line 1019... | ||
994 | mov esi,[vertex_edit_no] |
1019 | movd xmm0,[edit_end_x] |
995 | ; dec esi |
1020 | punpcklwd xmm0,[the_zero] |
996 | lea esi,[esi*3] |
1021 | movd xmm1,[vect_x] |
997 | add esi,esi |
1022 | punpcklwd xmm1,[the_zero] |
998 | add esi,[points_translated_ptr] |
1023 | ; movd xmm2,[offset_y] |
999 | emms |
1024 | ; punpcklwd xmm2,[the_zero] |
1000 | - | ||
1001 | movd mm1,dword[esi] |
1025 | psubd xmm0,xmm1 |
1002 | paddw mm1,mm0 |
1026 | ; psubd xmm0,xmm2 |
1003 | psubw mm1,qword[vect_x] |
1027 | cvtdq2ps xmm0,xmm0 |
1004 | movd dword[esi],mm1 |
1028 | movups [.points],xmm0 |
Line 1005... | Line -... | ||
1005 | - | ||
1006 | lea edi,[.points] |
- | |
1007 | ; detranslate |
- | |
1008 | fninit |
- | |
1009 | fild word[esi+4] |
- | |
1010 | fstp dword[edi+8] |
- | |
1011 | fild word[esi+2] |
- | |
1012 | fisub word[offset_x] |
- | |
1013 | fstp dword[edi+4] |
- | |
1014 | fild word[esi] |
- | |
1015 | fisub word[offset_y] ; proteza |
- | |
Line 1016... | Line 1029... | ||
1016 | fstp dword[edi] |
1029 | |
1017 | 1030 | ||
1018 | mov esi,matrix |
1031 | mov esi,matrix |
Line 1035... | Line 1048... | ||
1035 | cld |
1048 | cld |
1036 | movsd |
1049 | movsd |
1037 | movsd |
1050 | movsd |
1038 | movsd |
1051 | movsd |
1039 | ; mov ecx,3 |
1052 | |
1040 | ; cld |
- | |
1041 | ; rep movsd |
- | |
1042 | - | ||
1043 | - | ||
Line -... | Line 1053... | ||
- | 1053 | mov dword[edit_start_x],0 |
|
1044 | mov dword[edit_end_x],0 |
1054 | mov dword[edit_end_x],0 |
1045 | mov [vertex_edit_no],-1 |
1055 | mov [vertex_edit_no],-1 |
Line 1046... | Line 1056... | ||
1046 | 1056 | ||
1047 | .no_edit: |
1057 | .no_edit: |
Line 1094... | Line 1104... | ||
1094 | mov [vertices_index_ptr],eax |
1104 | mov [vertices_index_ptr],eax |
1095 | 1105 | ||
Line 1096... | Line 1106... | ||
1096 | mov esp,ebp |
1106 | mov esp,ebp |
1097 | pop ebp |
1107 | pop ebp |
1098 | 1108 | ret |
|
Line 1099... | Line 1109... | ||
1099 | 1109 | ||
1100 | 1110 | ||
Line 1509... | Line 1519... | ||
1509 | init_point_normals: |
1519 | init_point_normals: |
1510 | ;in: |
1520 | ;in: |
1511 | ; esi - tri_ch |
1521 | ; esi - tri_ch |
1512 | ; edi - t_ptr |
1522 | ; edi - t_ptr |
1513 | .z equ dword [ebp-8] |
1523 | ; ax = 1 -> old style finding normals |
- | 1524 | .z equ dword [ebp-8] |
|
1514 | .y equ dword [ebp-12] |
1525 | .y equ dword [ebp-12] |
1515 | .x equ [ebp-16] |
1526 | .x equ [ebp-16] |
1516 | .point_number equ dword [ebp-28] |
1527 | .point_number equ dword [ebp-28] |
1517 | .hit_faces equ dword [ebp-32] |
1528 | .hit_faces equ dword [ebp-32] |
1518 | .t_ptr equ dword [ebp-36] |
1529 | .t_ptr equ dword [ebp-36] |
1519 | .tri_ch equ dword [ebp-40] |
1530 | .tri_ch equ dword [ebp-40] |
1520 | .max_val equ dword [ebp-44] |
1531 | .max_val equ dword [ebp-44] |
1521 | 1532 | .mark equ word [ebp-45] |
|
- | 1533 | ||
Line 1522... | Line 1534... | ||
1522 | push ebp |
1534 | push ebp |
1523 | mov ebp,esp |
1535 | mov ebp,esp |
1524 | sub esp,64 |
1536 | sub esp,64 |
1525 | and ebp,-16 |
1537 | and ebp,-16 |
1526 | mov .t_ptr,edi |
1538 | mov .t_ptr,edi |
1527 | mov .tri_ch,esi |
1539 | mov .tri_ch,esi |
Line 1528... | Line -... | ||
1528 | - | ||
1529 | - | ||
1530 | - | ||
- | 1540 | ||
- | 1541 | ; mov .mark,ax |
|
- | 1542 | bt ax,0 |
|
Line 1531... | Line 1543... | ||
1531 | 1543 | jc .old1 |
|
1532 | 1544 | ||
1533 | 1545 | ||
Line 1579... | Line 1591... | ||
1579 | jnz .lp1 |
1591 | jnz .lp1 |
1580 | 1592 | ||
Line 1581... | Line 1593... | ||
1581 | jmp .end |
1593 | jmp .end |
Line -... | Line 1594... | ||
- | 1594 | ||
- | 1595 | .old1: |
|
- | 1596 | ||
Line 1582... | Line 1597... | ||
1582 | 1597 | xor edx,edx |
|
Line 1583... | Line 1598... | ||
1583 | 1598 | ||
1584 | .old: |
1599 | .old: |
Line 1642... | Line 1657... | ||
1642 | inc .point_number |
1657 | inc .point_number |
1643 | mov edx,.point_number |
1658 | mov edx,.point_number |
1644 | cmp edx,[points_count_var] |
1659 | cmp edx,[points_count_var] |
1645 | jne .ipn_loop |
1660 | jne .ipn_loop |
1646 | .end: |
1661 | ; cmp .mark,1 |
- | 1662 | ; je .end1 |
|
- | 1663 | ; always free if Ext>=SSE2 |
|
- | 1664 | .end: |
|
1647 | 1665 | ||
Line 1648... | Line 1666... | ||
1648 | mov eax,68 |
1666 | mov eax,68 |
1649 | mov ebx,13 |
1667 | mov ebx,13 |
1650 | mov ecx,.t_ptr |
1668 | mov ecx,.t_ptr |
Line 1654... | Line 1672... | ||
1654 | mov ebx,13 |
1672 | mov ebx,13 |
1655 | mov ecx,.tri_ch |
1673 | mov ecx,.tri_ch |
1656 | int 0x40 |
1674 | int 0x40 |
1657 | 1675 | ||
Line 1658... | Line 1676... | ||
1658 | 1676 | ; .end1: |
|
Line 1659... | Line 1677... | ||
1659 | 1677 | ||
1660 | 1678 | ||
1661 | add esp,64 |
1679 | add esp,64 |
Line 1815... | Line 1833... | ||
1815 | mov edi,[screen_ptr] |
1833 | mov edi,[screen_ptr] |
1816 | movzx ecx,word[size_x_var] |
1834 | movzx ecx,word[size_x_var] |
1817 | movzx eax,word[size_y_var] |
1835 | movzx eax,word[size_y_var] |
1818 | imul ecx,eax |
1836 | imul ecx,eax |
1819 | 1837 | cld |
|
1820 | - | ||
1821 | xor eax,eax |
1838 | xor eax,eax |
1822 | if Ext=NON |
1839 | ; if Ext=NON |
1823 | rep stosd |
1840 | rep stosd |
1824 | else if Ext = MMX |
1841 | ; else if Ext = MMX |
1825 | pxor mm0,mm0 |
1842 | ; pxor mm0,mm0 |
1826 | @@: |
1843 | ; @@: |
1827 | movq [edi+00],mm0 |
1844 | ; movq [edi+00],mm0 |
1828 | movq [edi+08],mm0 |
1845 | ; movq [edi+08],mm0 |
1829 | movq [edi+16],mm0 |
1846 | ; movq [edi+16],mm0 |
1830 | movq [edi+24],mm0 |
1847 | ; movq [edi+24],mm0 |
1831 | add edi,32 |
1848 | ; add edi,32 |
1832 | sub ecx,8 |
1849 | ; sub ecx,8 |
1833 | jnc @b |
1850 | ; jnc @b |
1834 | else |
1851 | ; else |
1835 | push ecx |
1852 | ; push ecx |
1836 | mov ecx,edi |
1853 | ; mov ecx,edi |
1837 | and ecx,0x0000000f |
1854 | ; and ecx,0x0000000f |
1838 | rep stosb |
1855 | ; rep stosb |
1839 | pop ecx |
1856 | ; pop ecx |
1840 | and ecx,0xfffffff0 |
1857 | ; and ecx,0xfffffff0 |
1841 | xorps xmm0,xmm0 |
1858 | ; xorps xmm0,xmm0 |
1842 | @@: |
1859 | ; @@: |
1843 | movaps [edi],xmm0 |
1860 | ; movaps [edi],xmm0 |
1844 | movaps [edi+16],xmm0 |
1861 | ; movaps [edi+16],xmm0 |
1845 | movaps [edi+32],xmm0 |
1862 | ; movaps [edi+32],xmm0 |
1846 | movaps [edi+48],xmm0 |
1863 | ; movaps [edi+48],xmm0 |
1847 | add edi,64 |
1864 | ; add edi,64 |
1848 | sub ecx,16 |
1865 | ; sub ecx,16 |
1849 | jnz @b |
1866 | ; jnz @b |
1850 | end if |
1867 | ; end if |
1851 | 1868 | ||
Line 1852... | Line 1869... | ||
1852 | ret |
1869 | ret |
Line 1853... | Line 1870... | ||
1853 | 1870 | ||
Line 1877... | Line 1894... | ||
1877 | 1894 | ||
Line 1878... | Line 1895... | ||
1878 | 1895 | ||
1879 | push ebp |
1896 | push ebp |
1880 | mov ebp,esp |
1897 | mov ebp,esp |
Line 1881... | Line 1898... | ||
1881 | sub esp,60 |
1898 | sub esp,64 |
1882 | 1899 | ||
Line 2775... | Line 2792... | ||
2775 | ; cmp ebx,0 |
2792 | ; cmp ebx,0 |
2776 | ; je @f |
2793 | ; je @f |
2777 | ; int3 |
2794 | ; int3 |
2778 | ; @@: |
2795 | ; @@: |
2779 | mov eax, .index1x12 |
2796 | |
- | 2797 | mov eax, .index1x12 |
|
2780 | mov ebx, .index2x12 |
2798 | mov ebx, .index2x12 |
2781 | mov ecx, .index3x12 |
2799 | mov ecx, .index3x12 |
2782 | add eax,[points_rotated_ptr] |
2800 | add eax,[points_rotated_ptr] |
2783 | add ebx,[points_rotated_ptr] |
2801 | add ebx,[points_rotated_ptr] |
2784 | add ecx,[points_rotated_ptr] |
2802 | add ecx,[points_rotated_ptr] |
Line 2943... | Line 2961... | ||
2943 | 2961 | ||
2944 | 2962 | ||
2945 | 2963 | ||
Line 2946... | Line 2964... | ||
2946 | .eend: |
2964 | .eend: |
Line 2947... | Line 2965... | ||
2947 | add esp,60 |
2965 | add esp,64 |
Line 2948... | Line 2966... | ||
2948 | pop ebp |
2966 | pop ebp |
2949 | 2967 | ||
2950 | ret |
2968 | ret |
2951 | 2969 | ||
2952 | 2970 | ||
2953 | draw_handlers: |
2971 | draw_handlers: |
2954 | 2972 | ||
2955 | ; in eax - render model |
2973 | ; in eax - render model |
Line 3318... | Line 3336... | ||
3318 | mov edx,[triangles_ptr] |
3336 | mov edx,[triangles_ptr] |
3319 | int 0x40 ; -> allocate memory to triangles |
3337 | int 0x40 ; -> allocate memory to triangles |
3320 | mov [triangles_ptr], eax ; -> eax = pointer to allocated mem |
3338 | mov [triangles_ptr], eax ; -> eax = pointer to allocated mem |
3321 | 3339 | ||
Line 3322... | Line 3340... | ||
3322 | mov eax, 68 |
3340 | ; mov eax, 68 |
3323 | mov ecx,[triangles_count_var] |
3341 | ; mov ecx,[triangles_count_var] |
3324 | imul ecx,[i36] |
3342 | ; imul ecx,[i36] |
3325 | mov edx,[edges_ptr] |
3343 | ; mov edx,[edges_ptr] |
3326 | int 0x40 ; -> allocate memory to triangles |
3344 | ; int 0x40 ; -> allocate memory to triangles |
3327 | mov [edges_ptr], eax ; -> eax = pointer to allocated mem |
3345 | ; mov [edges_ptr], eax ; -> eax = pointer to allocated mem |
Line 3328... | Line 3346... | ||
3328 | 3346 | ||
Line 3329... | Line 3347... | ||
3329 | 3347 | ||
Line 3409... | Line 3427... | ||
3409 | @@: |
3427 | @@: |
3410 | ; eax = 0 -> ok file loaded |
3428 | ; eax = 0 -> ok file loaded |
3411 | ret |
3429 | ret |
3412 | read_param: |
3430 | read_param: |
3413 | mov esi,I_Param |
3431 | cld |
- | 3432 | mov esi,I_Param |
|
3414 | cmp dword[esi],0 |
3433 | cmp dword[esi],0 |
3415 | je .end |
3434 | je .end |
3416 | cmp byte[esi],'/' |
3435 | cmp byte[esi],'/' |
3417 | je .copy |
3436 | je .copy |
3418 | mov edi,esi |
3437 | mov edi,esi |
Line 3541... | Line 3560... | ||
3541 | ; ********************************************* |
3560 | ; ********************************************* |
3542 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
3561 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
3543 | ; ********************************************* |
3562 | ; ********************************************* |
3544 | draw_window: |
3563 | draw_window: |
3545 | movzx eax,[fire_flag] |
3564 | mov eax,12 ; function 12:tell os about windowdraw |
3546 | push eax |
- | |
3547 | ; int3 |
- | |
3548 | mov eax,12 ; function 12:tell os about windowdraw |
- | |
3549 | mov ebx,1 ; 1, start of draw |
3565 | mov ebx,1 ; 1, start of draw |
3550 | int 0x40 |
3566 | int 0x40 |
3551 | 3567 | ||
Line 3552... | Line 3568... | ||
3552 | ; DRAW WINDOW |
3568 | ; DRAW WINDOW |
Line 3730... | Line 3746... | ||
3730 | 3746 | ||
Line 3731... | Line 3747... | ||
3731 | mov eax,12 ; function 12:tell os about windowdraw |
3747 | mov eax,12 ; function 12:tell os about windowdraw |
3732 | mov ebx,2 ; 2, end of draw |
3748 | mov ebx,2 ; 2, end of draw |
3733 | int 0x40 |
3749 | int 0x40 |
3734 | pop eax |
3750 | ; pop eax |
3735 | mov [fire_flag],al |
3751 | ; mov [fire_flag],al |
3736 | ret |
3752 | ret |
Line 3737... | Line 3753... | ||
3737 | 3753 |