diff --git a/programs/demos/3DS/B_PROCS.INC b/programs/demos/3DS/B_PROCS.INC index 2a83effa52..1e50ace04c 100644 --- a/programs/demos/3DS/B_PROCS.INC +++ b/programs/demos/3DS/B_PROCS.INC @@ -749,8 +749,9 @@ if Ext>=SSE2 push ecx mov edi,[screen_ptr] movzx ecx,word[size_x_var] ;SIZE_X*3/4 - lea ecx,[ecx*3] + lea ecx,[ecx*3+1] shr ecx,2 + ; mov ecx,SIZE_X*3/4 xor eax,eax rep stosd diff --git a/programs/demos/3DS/DATA.INC b/programs/demos/3DS/DATA.INC index a89b231f60..fa67d6106f 100644 --- a/programs/demos/3DS/DATA.INC +++ b/programs/demos/3DS/DATA.INC @@ -38,7 +38,7 @@ XYZpartices: db 'X','Y','Z' i10 dw 10 - + draw_win_at_first db 1 menu: db 2 ; button number = index @@ -314,7 +314,7 @@ base_vector: if Ext=SSE2 db ' (SSE2)' end if - db ' 0.066',0 + db ' 0.067',0 labellen: STRdata db '-1 ' @@ -440,6 +440,10 @@ align 8 dw ? size_x_var: dw ? + x_start: + dw ? + y_start: + dw ? ;=== @@ -526,6 +530,8 @@ end if ; screen rb SIZE_X * SIZE_Y * 3 ; screen buffer ;align 16 ; Z_buffer rb SIZE_X * SIZE_Y * 4 + procinfo: + rb 1024 ; process info I_Param rb 256 memStack rb 4000 ;memory area for stack align 16 diff --git a/programs/demos/3DS/History.txt b/programs/demos/3DS/History.txt index c36d14b14c..9dd1c56cdf 100644 --- a/programs/demos/3DS/History.txt +++ b/programs/demos/3DS/History.txt @@ -1,4 +1,9 @@ +View 3ds 0,066 - X 2016 +1. App window size according to current screen resolution. +2. New emboss procedure. +----------------------------------------------------------------------------------- + View3ds 0.065 - Feb 2015 1. Asc files support. ----------------------------------------------------------------------------------- diff --git a/programs/demos/3DS/README.TXT b/programs/demos/3DS/README.TXT index a0bd89fcf0..9443b1d7e7 100644 --- a/programs/demos/3DS/README.TXT +++ b/programs/demos/3DS/README.TXT @@ -1,10 +1,10 @@ -View3ds 0.066 - tiny viewer to .3ds and .asc files with several graphics +View3ds 0.067 - tiny viewer to .3ds and .asc files with several graphics effects implementation. What's new? -1. App window size according to current screen resolution; -2, New emboss procedure. +1. Sizable app window. + Buttons description: 1. rotary: choosing rotary axle: x, y, x+y. @@ -35,4 +35,4 @@ Buttons description: 20. bright - -> decrease picture brightness. 21. wav effect -> do effect based sine function. - Maciej Guba X 2016 + Maciej Guba XI 2016 diff --git a/programs/demos/3DS/VIEW3DS.ASM b/programs/demos/3DS/VIEW3DS.ASM index d7fea9b2b4..05e1c87b79 100644 --- a/programs/demos/3DS/VIEW3DS.ASM +++ b/programs/demos/3DS/VIEW3DS.ASM @@ -1,11 +1,11 @@ -; application : View3ds ver. 0.066 - tiny .3ds and .asc files viewer -; with a few graphics effects demonstration. +; application : View3ds ver. 0.067 - tiny .3ds and .asc files viewer +; with a few graphics effects demonstration. ; compiler : FASM ; system : KolibriOS ; author : Macgub aka Maciej Guba ; email : macgub3@wp.pl -; web : www.macgub.hekko.pl +; web : www.macgub.hekko.pl ; Fell free to use this intro in your own distribution of KolibriOS. ; Special greetings to KolibriOS team . ; I hope because my intros Christian Belive will be near to each of You. @@ -20,19 +20,19 @@ SIZE_X equ 512 -SIZE_Y equ 512 ; ///// I want definitely -TIMEOUT equ 10 ; ------ say: -ROUND equ 10 ; \ @ @/ keep smiling every -TEX_X equ 512 ; texture width ; \ ./ / day. -TEX_Y equ 512 ; height ; \/ / -TEX_SHIFT equ 9 ; texture width shifting ; __||__ / -TEXTURE_SIZE EQU (TEX_X * TEX_Y)-1 ; /| | -TEX equ SHIFTING ; TEX={SHIFTING | FLUENTLY} ; / \ / -FLUENTLY = 0 ; / | | -SHIFTING = 1 ; ------ -CATMULL_SHIFT equ 8 ; | | -LIGHT_SIZE equ 22 ; | | -NON = 0 ; -/ \- +SIZE_Y equ 512 ; ///// I want definitely +TIMEOUT equ 10 ; ------ say: +ROUND equ 10 ; \ @ @/ keep smiling every +TEX_X equ 512 ; texture width ; \ ./ / day. +TEX_Y equ 512 ; height ; \/ / +TEX_SHIFT equ 9 ; texture width shifting ; __||__ / +TEXTURE_SIZE EQU (TEX_X * TEX_Y)-1 ; /| | +TEX equ SHIFTING ; TEX={SHIFTING | FLUENTLY} ; / \ / +FLUENTLY = 0 ; / | | +SHIFTING = 1 ; ------ +CATMULL_SHIFT equ 8 ; | | +LIGHT_SIZE equ 22 ; | | +NON = 0 ; -/ \- MMX = 1 SSE = 2 SSE2 = 3 @@ -54,15 +54,18 @@ use32 START: ; start of execution cld - mov eax,14 - int 0x40 - sub eax,150 shl 16 + 150 + ; mov eax,14 ; window size according to cur res ... + ; int 0x40 + ; sub eax,150 shl 16 + 150 + mov eax, 600 shl 16 + 600 ; ... or set manually mov [size_y_var],ax shr ax,1 mov [vect_y],ax - shr ax,1 + + shr ax,2 movzx ebx,ax + lea ebx,[ebx*3] push ebx fninit fild dword[esp] @@ -74,6 +77,9 @@ START: ; start of execution shr ax,1 mov [vect_x],ax + mov eax, 20 shl 16 + 20 + mov [x_start],eax + call alloc_buffer_mem call read_param @@ -107,6 +113,10 @@ START: ; start of execution end if call read_from_file .opt: + + + ; call alloc_buffer_mem ; alloc memfor screnn and z buffer + call optimize_object1 ; proc in file b_procs.asm ; set point(0,0,0) in center and calc all coords ; to be in <-1.0,1.0> @@ -117,12 +127,12 @@ START: ; start of execution call init_envmap_cub call generate_texture2 call init_sincos_tab - call do_color_buffer ; intit color_map mov edi,bumpmap call calc_bumpmap call calc_bumpmap_coords ; bump and texture mapping call draw_window + mov [draw_win_at_first],0 still: @@ -143,7 +153,28 @@ still: jmp noclose - red: ; redraw + red: ; redraw + mov eax,9 ; get process info + mov ebx,procinfo + mov ecx,-1 + int 0x40 + mov eax,[procinfo+42] ; read params of window + sub eax,115 + mov [size_x_var],ax + shr ax,1 + mov [vect_x],ax +; + mov eax,[procinfo+46] + sub eax,30 + mov [size_y_var],ax + shr ax,1 + mov [vect_y],ax + + mov eax,[procinfo+34] + mov [x_start],ax + mov eax,[procinfo+38] + mov [y_start],ax + call alloc_buffer_mem ;realloc mem for scr & z buffs call draw_window jmp noclose @@ -172,9 +203,9 @@ still: jne .next_m6 cmp [dr_flag],2 jne @f - ; call init_envmap2 ; <----! this don't works in env mode - ; and more than ~18 kb objects - ; call init_envmap_cub2 + ; call init_envmap2 ; <----! this don't works in env mode + ; and more than ~18 kb objects + ; call init_envmap_cub2 @@: cmp [dr_flag],4 jne @f @@ -201,19 +232,19 @@ still: fstp [rsscale] @@: - cmp ah,9 ; lights random ; 'flat' 0 + cmp ah,9 ; lights random ; 'flat' 0 jne .next_m5 ; 'grd ' 1 call make_random_lights ; 'env ' 2 call normalize_all_light_vectors ; 'bump' 3 - call do_color_buffer ; intit color_map ; 'tex ' 4 - ; cmp [emboss_flag],1 ; 'pos ' 5 - ; je @f ; 'dots' 6 - ; cmp [dr_flag],8 - ; jge @f - ; cmp [dr_flag],2 ; 'txgr' 7 - ; jl .next_m5 ; '2tex' 8 - ; cmp [dr_flag],3 ; 'btex' 9 - ; jg .next_m5 + call do_color_buffer ; intit color_map ; 'tex ' 4 + ; cmp [emboss_flag],1 ; 'pos ' 5 + ; je @f ; 'dots' 6 + ; cmp [dr_flag],8 + ; jge @f + ; cmp [dr_flag],2 ; 'txgr' 7 + ; jl .next_m5 ; '2tex' 8 + ; cmp [dr_flag],3 ; 'btex' 9 + ; jg .next_m5 ; @@: call init_envmap2 ; update env map if shading model = environment or bump .next_m5: @@ -235,15 +266,15 @@ still: cmp [emboss_flag],1 call init_envmap2 @@: -; cmp ah,17 -; jne .next_m -; cmp [move_flag],2 -; jne @f -; call draw_window ; redraw other labels to navigation buttons +; cmp ah,17 +; jne .next_m +; cmp [move_flag],2 +; jne @f +; call draw_window ; redraw other labels to navigation buttons ; @@: -; cmp [move_flag],0 -; jne .next_m -; call draw_window ; redraw other labels to navigation buttons +; cmp [move_flag],0 +; jne .next_m +; call draw_window ; redraw other labels to navigation buttons .next_m: cmp ah,18 jne .next_m2 @@ -298,8 +329,8 @@ still: jne .next cmp [move_flag],0 jne @f -; cmp [move_flag],2 -; je .set_light1 +; cmp [move_flag],2 +; je .set_light1 sub [vect_y],10 jmp .next @@: @@ -310,19 +341,19 @@ still: @@: sub [sin_amplitude],10 ;-------------------------------------------------- -; .set_light1: ; r - -; movzx ebx,[light_no_flag] ; * 22 -; mov ecx,ebx -; shl ebx,4 -; shl ecx,1 -; add ebx,ecx -; shl ecx,1 -; add ebx,ecx -; add ebx,lights+6 ; 6 -> light vector size +; .set_light1: ; r - +; movzx ebx,[light_no_flag] ; * 22 +; mov ecx,ebx +; shl ebx,4 +; shl ecx,1 +; add ebx,ecx +; shl ecx,1 +; add ebx,ecx +; add ebx,lights+6 ; 6 -> light vector size ; -; movzx ecx,[light_comp_flag] -; lea ecx,[ecx*3} -; add ebx,ecx ; ebx -> color to set +; movzx ecx,[light_comp_flag] +; lea ecx,[ecx*3} +; add ebx,ecx ; ebx -> color to set ;--------------------------------------------------- .next: @@ -383,7 +414,7 @@ still: jne .next5 cmp [move_flag],0 jne @f - ; call add_vector + ; call add_vector add [vect_y],10 jmp .next5 @@: @@ -456,9 +487,9 @@ still: movzx ecx,[points_count_var] call translate_points -; cmp [dr_flag],5 -; jne @f -; call calc_attenuation_light +; cmp [dr_flag],5 +; jne @f +; call calc_attenuation_light ; @@: cmp [fire_flag],0 jne @f @@ -628,7 +659,7 @@ if Ext >= SSE je .no_max ;movzx ebx,[max_flag] .again_max: -; push ecx +; push ecx mov edi,screen mov ecx,SIZE_X*3/4 ; ; pxor mm5,mm5 @@ -661,7 +692,7 @@ end if if Ext >= SSE cmp [min_flag],0 je .no_min -; push ecx +; push ecx mov edi,screen mov ecx,SIZE_X*3/4 ; ; pxor mm5,mm5 @@ -707,7 +738,7 @@ end if pop eax mov eax,7 ; put image - mov ebx,screen + mov ebx,[screen_ptr] mov ecx,[size_y_var] ; mov ecx,SIZE_X shl 16 + SIZE_Y mov edx,5 shl 16 + 25 @@ -765,9 +796,45 @@ include "ASC.INC" alloc_buffer_mem: + mov eax, 68 + mov ebx, 11 + int 0x40 ; -> create heap, to be sure + + movzx ecx,word[size_x_var] movzx eax,word[size_y_var] mul ecx + ; add eax,100 + push eax + lea ecx,[eax*3] + mov eax,68 + mov ebx,20 + mov edx,[screen_ptr] + cmp [draw_win_at_first],1 + jne @f + xor edx,edx + @@: + int 0x40 + mov [screen_ptr],eax + + pop ecx + shl ecx,2 + mov eax,68 + mov ebx,20 + mov edx,[Zbuffer_ptr] + cmp [draw_win_at_first],1 + jne @f + xor edx,edx + @@: + int 0x40 + mov [Zbuffer_ptr],eax + +if 0 +;old Menuet style alloc + movzx ecx,word[size_x_var] + movzx eax,word[size_y_var] + add eax,200 + mul ecx lea ecx,[eax*3] add ecx,16 and ecx,0xfffffff0 @@ -776,17 +843,18 @@ alloc_buffer_mem: add ecx,eax add ecx,MEM_END mov ebx,1 - mov eax,64 ; allocate mem - resize app mem + mov eax,64 ; allocate mem - resize app mem int 0x40 mov [screen_ptr],MEM_END mov [Zbuffer_ptr],MEM_END pop ecx add [Zbuffer_ptr],ecx +end if ret update_flags: ; updates flags and writing flag description -; in ah - button number +; in ah - button number push ax mov edi,menu .ch_another: @@ -806,7 +874,7 @@ update_flags: jne .ch_another .write: ; clreol {pascal never dies} -; * eax = 13 - function number +; * eax = 13 - function number ; * ebx = [coordinate on axis x]*65536 + [size on axis x] ; * ecx = [coordinate on axis y]*65536 + [size on axis y] ; * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill @@ -848,7 +916,7 @@ ret normalize_all_light_vectors: mov edi,lights @@: - call normalize_vector ; 3dmath.inc + call normalize_vector ; 3dmath.inc add edi,LIGHT_SIZE cmp edi,lightsend ;ecx jl @b @@ -856,14 +924,14 @@ ret calc_bumpmap_coords: ; map texture, bump ;macro .comment222 -; ; planar mapping -; mov esi,points -; mov edi,tex_points +; ; planar mapping +; mov esi,points +; mov edi,tex_points ; @@: -; add esi,2 -; movsd -; cmp dword[esi],dword -1 -; jne @b +; add esi,2 +; movsd +; cmp dword[esi],dword -1 +; jne @b ; .Pi2 equ dword[ebp-4] @@ -877,15 +945,15 @@ calc_bumpmap_coords: ; map texture, bump mov edi,tex_points movzx ecx,[points_count_var] inc ecx -; cmp [map_tex_flag],1 -; jne .cylindric +; cmp [map_tex_flag],1 +; jne .cylindric ; spherical mapping around y axle @@: fld dword[esi] ; x coord fld dword[esi+8] ; z coord fpatan ; arctg(st1/st) -; fdiv .Pi2 +; fdiv .Pi2 fdiv st0,st1 fimul [tex_x_div2] fiadd [tex_x_div2] @@ -912,26 +980,26 @@ calc_bumpmap_coords: ; map texture, bump add edi,4 loop @b ffree st0 -; jmp .end_map +; jmp .end_map ; .cylindric: -; fld dword[esi] ; around y axle -; fld dword[esi+8] -; fpatan -; fdiv st0,st1 -; fimul [tex_x_div2] -; fiadd [tex_x_div2] -; fistp word[edi] +; fld dword[esi] ; around y axle +; fld dword[esi+8] +; fpatan +; fdiv st0,st1 +; fimul [tex_x_div2] +; fiadd [tex_x_div2] +; fistp word[edi] -; fld dword[esi+4] -; fimul [tex_y_div2] -; fiadd [tex_y_div2] -; fistp word[edi+2] +; fld dword[esi+4] +; fimul [tex_y_div2] +; fiadd [tex_y_div2] +; fistp word[edi+2] -; add esi,12 -; add edi,4 -; loop .cylindric -; ffree st0 -;; mov esp,ebp +; add esi,12 +; add edi,4 +; loop .cylindric +; ffree st0 +;; mov esp,ebp ; .end_map: ret @@ -951,9 +1019,9 @@ init_envmap2: ; do env_map using many light sources mov edi,envmap fninit - mov dx,- TEX_Y / 2 ;256 ; dx - vertical coordinate = y + mov dx,- TEX_Y / 2 ;256 ; dx - vertical coordinate = y .ie_ver: - mov cx,- TEX_X / 2 ;256 ; cx - horizontal coord = x + mov cx,- TEX_X / 2 ;256 ; cx - horizontal coord = x .ie_hor: xor ebx,ebx mov dword .col_b, 0 @@ -1025,8 +1093,8 @@ init_envmap2: ; do env_map using many light sources mov al,byte[esi+15] ; r push ax push eax ; earlier - dot pr - ; fstp .dot_product - ; push .dot_product + ; fstp .dot_product + ; push .dot_product call calc_one_col pop ebp ; eax-0x00rrggbb @@ -1067,7 +1135,7 @@ ret do_color_buffer: ; do color buffer for Gouraud, flat shading -;env_map 512 x 512 x 3 bytes ; many lights using +;env_map 512 x 512 x 3 bytes ; many lights using .temp equ word [ebp-2] .nz equ dword [ebp-6] ; dword .ny equ dword [ebp-10] @@ -1082,9 +1150,9 @@ do_color_buffer: ; do color buffer for Gouraud, flat shading mov edi,color_map fninit - mov dx,- TEX_Y / 2 ;-256 ; dx - vertical coordinate = y + mov dx,- TEX_Y / 2 ;-256 ; dx - vertical coordinate = y .ie_ver: - mov cx,- TEX_X / 2 ;256 ; cx - horizontal coord = x + mov cx,- TEX_X / 2 ;256 ; cx - horizontal coord = x .ie_hor: mov .temp,cx fild .temp @@ -1149,8 +1217,8 @@ do_color_buffer: ; do color buffer for Gouraud, flat shading mov al,byte[esi+15] ; r push ax push eax ; earlier - dot pr - ; fstp .dot_product - ; push .dot_product + ; fstp .dot_product + ; push .dot_product call calc_one_col pop ebp ; eax-0x00rrggbb @@ -1249,7 +1317,7 @@ init_point_normals: push esi mov esi,ecx lea esi,[esi*3] - ; lea esi,[triangles_normals+esi*4] + ; lea esi,[triangles_normals+esi*4] shl esi,2 add esi,[triangles_normals_ptr] @@ -1303,16 +1371,16 @@ init_triangles_normals2: mov ebx,vectors movzx esi,word[ebp] ; first point index lea esi,[esi*3] -; lea esi,[points+esi*2] ; esi - pointer to 1st 3d point +; lea esi,[points+esi*2] ; esi - pointer to 1st 3d point shl esi,2 add esi,[points_ptr] movzx edi,word[ebp+2] ; first point index lea edi,[edi*3] shl edi,2 add edi,[points_ptr] -; movzx edi,word[ebp+2] ; second point index -; lea edi,[edi*3] -; lea edi,[points+edi*2] ; edi - pointer to 2nd 3d point +; movzx edi,word[ebp+2] ; second point index +; lea edi,[edi*3] +; lea edi,[points+edi*2] ; edi - pointer to 2nd 3d point call make_vector_r add ebx,12 mov esi,edi @@ -1320,7 +1388,7 @@ init_triangles_normals2: lea edi,[edi*3] shl edi,2 add edi,[points_ptr] -; lea edi,[points+edi*2] +; lea edi,[points+edi*2] call make_vector_r mov edi,ebx ; edi - pointer to 2nd vector mov esi,ebx @@ -1357,7 +1425,7 @@ sort_triangles: mov ax,cx ; cwd - ; idiv word[i3] + ; idiv word[i3] movsd ; store vertex coordinates movsw stosw ; middle vertex coordinate 'z' in triangles_with_z list @@ -1366,8 +1434,8 @@ sort_triangles: movsd ; copy end mark mov eax,4 lea edx,[edi-8-trizdd] - ; lea edx, [edi-8] - ; sub edx,[triangles_w_z_ptr] + ; lea edx, [edi-8] + ; sub edx,[triangles_w_z_ptr] mov [high],edx call quicksort mov eax,4 @@ -1383,10 +1451,10 @@ sort_triangles: lea ecx,[eax+edx] shr ecx,4 lea ecx,[ecx*8-4]; -; mov edi,[triangles_w_z_ptr] -; mov ebx,[edi+eax] -; mov esi,[edi+ecx] -; mov edi,[edi+edx] +; mov edi,[triangles_w_z_ptr] +; mov ebx,[edi+eax] +; mov esi,[edi+ecx] +; mov edi,[edi+edx] mov ebx,[trizdd+eax]; trizdd[l] mov esi,[trizdd+ecx]; trizdd[i] mov edi,[trizdd+edx]; trizdd[h] @@ -1402,13 +1470,13 @@ sort_triangles: mov ebx,[trizdd+eax] mov esi,[trizdd+ecx] else -; push ebx -; mov ebx,[triangles_w_z_ptr] -; movq mm0,[ebx+eax-4] -; movq mm1,[ebx+ecx-4] -; movq [ebx+ecx-4],mm0 -; movq [ebx+eax-4],mm1 -; pop ebx +; push ebx +; mov ebx,[triangles_w_z_ptr] +; movq mm0,[ebx+eax-4] +; movq mm1,[ebx+ecx-4] +; movq [ebx+ecx-4],mm0 +; movq [ebx+eax-4],mm1 +; pop ebx movq mm0,[trizdq+eax-4] movq mm1,[trizdq+ecx-4] movq [trizdq+ecx-4],mm0 @@ -1428,17 +1496,17 @@ sort_triangles: mov ebx,[trizdd+eax] mov edi,[trizdd+edx] else -; push ebx -; mov ebx,[triangles_w_z_ptr] -; movq mm0,[ebx+eax-4] -; movq mm1,[ebx+edx-4] -; movq [ebx+edx-4],mm0 -; movq [ebx+eax-4],mm1 +; push ebx +; mov ebx,[triangles_w_z_ptr] +; movq mm0,[ebx+eax-4] +; movq mm1,[ebx+edx-4] +; movq [ebx+edx-4],mm0 +; movq [ebx+eax-4],mm1 movq mm0,[trizdq+eax-4] movq mm1,[trizdq+edx-4] movq [trizdq+edx-4],mm0 movq [trizdq+eax-4],mm1 -; pop ebx +; pop ebx xchg ebx,edi end if @@: @@ -1452,13 +1520,13 @@ sort_triangles: mov [trizdd+ecx-4],edi mov [trizdd+edx-4],esi else -; push ebx -; mov ebx,[triangles_w_z_ptr] -; movq mm0,[ebx+ecx-4] -; movq mm1,[ebx+edx-4] -; movq [ebx+edx-4],mm0 -; movq [ebx+ecx-4],mm1 -; pop ebx +; push ebx +; mov ebx,[triangles_w_z_ptr] +; movq mm0,[ebx+ecx-4] +; movq mm1,[ebx+edx-4] +; movq [ebx+edx-4],mm0 +; movq [ebx+ecx-4],mm1 +; pop ebx movq mm0,[trizdq+ecx-4] movq mm1,[trizdq+edx-4] @@ -1479,13 +1547,13 @@ sort_triangles: mov [trizdd+ecx-4],esi mov [trizdd+ebp-4],edi else -; push ebx -; mov ebx,[triangles_w_z_ptr] -; movq mm0,[ebx+ebp-4] -; movq mm1,[ebx+ecx-4] -; movq [ebx+ecx-4],mm0 -; movq [ebx+ebp-4],mm1 -; pop ebx +; push ebx +; mov ebx,[triangles_w_z_ptr] +; movq mm0,[ebx+ebp-4] +; movq mm1,[ebx+ecx-4] +; movq [ebx+ecx-4],mm0 +; movq [ebx+ebp-4],mm1 +; pop ebx movq mm0,[trizdq+ebp-4] movq mm1,[trizdq+ecx-4] @@ -1494,20 +1562,20 @@ sort_triangles: end if mov ecx,edx ; i; direction mov ebx,[trizdd+ebp]; trizdd[j] -; mov ebx, [triangles_w_z_ptr] -; add ebx, ebp +; mov ebx, [triangles_w_z_ptr] +; add ebx, ebp - ; push eax - ; mov eax, [triangles_w_z_ptr] + ; push eax + ; mov eax, [triangles_w_z_ptr] .loop: sub ecx,8 ; direction cmp [trizdd+ecx],ebx -; cmp [eax+ecx],ebx +; cmp [eax+ecx],ebx jl .loop ; direction @@: add ebp,8 ; direction cmp [trizdd+ebp],ebx -; cmp [eax+ebp],ebx +; cmp [eax+ebp],ebx jg @b ; direction cmp ebp,ecx jge @f ; direction @@ -1521,17 +1589,17 @@ sort_triangles: mov [trizdd+ebp-4],edi mov [trizdd+ecx-4],esi else -; movq mm0,[eax+ecx-4] -; movq mm1,[eax+ebp-4] -; movq [eax+ebp-4],mm0 -; movq [eax+ecx-4],mm1 +; movq mm0,[eax+ecx-4] +; movq mm1,[eax+ebp-4] +; movq [eax+ebp-4],mm0 +; movq [eax+ecx-4],mm1 movq mm0,[trizdq+ecx-4] movq mm1,[trizdq+ebp-4] movq [trizdq+ebp-4],mm0 movq [trizdq+ecx-4],mm1 end if jmp .loop -; pop eax +; pop eax @@: if Ext=NON mov esi,[trizdd+ecx] @@ -1543,13 +1611,13 @@ sort_triangles: mov [trizdd+eax+4],edi mov [trizdd+ecx-4],esi else -; push edx -; mov edx,[triangles_w_z_ptr] -; movq mm0,[edx+ecx-4] -; movq mm1,[edx+eax+4]; dir -; movq [edx+eax+4],mm0; dir -; movq [edx+ecx-4],mm1 -; pop edx +; push edx +; mov edx,[triangles_w_z_ptr] +; movq mm0,[edx+ecx-4] +; movq mm1,[edx+eax+4]; dir +; movq [edx+eax+4],mm0; dir +; movq [edx+ecx-4],mm1 +; pop edx movq mm0,[trizdq+ecx-4] movq mm1,[trizdq+eax+4]; dir @@ -1571,25 +1639,25 @@ sort_triangles: cmp esi,edx ja .exit mov ebx,[trizdd+esi] -; mov ebx,[triangles_w_z_ptr] -; add ebx,esi +; mov ebx,[triangles_w_z_ptr] +; add ebx,esi if Ext=NON mov ecx,[trizdd+esi-4] else -; push ebx -; mov ebx,[triangles_w_z_ptr] -; movq mm1,[ebx+esi-4] +; push ebx +; mov ebx,[triangles_w_z_ptr] +; movq mm1,[ebx+esi-4] movq mm1,[trizdq+esi-4] -; pop ebx +; pop ebx end if mov edi,esi @@: cmp edi,eax jna @f -; push eax -; mov eax,[triangles_w_z_ptr] -; cmp [eax+edi-8],ebx -; pop eax +; push eax +; mov eax,[triangles_w_z_ptr] +; cmp [eax+edi-8],ebx +; pop eax cmp [trizdd+edi-8],ebx jg @f ; direction if Ext=NON @@ -1598,13 +1666,13 @@ sort_triangles: mov ebp,[trizdd+edi-12] mov [trizdd+edi-4],ebp else -; push eax -; mov eax,[triangles_w_z_ptr] -; movq mm0,[eax+edi-12] -; movq [eax+edi-4],mm0 +; push eax +; mov eax,[triangles_w_z_ptr] +; movq mm0,[eax+edi-12] +; movq [eax+edi-4],mm0 movq mm0,[trizdq+edi-12] movq [trizdq+edi-4],mm0 -; pop eax +; pop eax end if sub edi,8 jmp @b @@ -1613,11 +1681,11 @@ sort_triangles: mov [trizdd+edi],ebx mov [trizdd+edi-4],ecx else -; push eax -; mov eax,[triangles_w_z_ptr] -; movq [eax+edi-4],mm1 +; push eax +; mov eax,[triangles_w_z_ptr] +; movq [eax+edi-4],mm1 movq [trizdq+edi-4],mm1 -; pop eax +; pop eax end if jmp .start .exit: @@ -1625,8 +1693,8 @@ sort_triangles: end_sort: ; translate triangles_with_z to sorted_triangles mov esi,triangles_with_z -; mov esi,[triangles_w_z_ptr] - ; mov edi,sorted_triangles +; mov esi,[triangles_w_z_ptr] + ; mov edi,sorted_triangles mov edi,[triangles_ptr] again_copy: if Ext=NON @@ -1642,13 +1710,13 @@ sort_triangles: cmp dword[esi],-1 jne again_copy ; if Ext=MMX -; emms +; emms ; end if movsd ; copy end mark too ret clrscr: - mov edi,screen + mov edi,[screen_ptr] movzx ecx,word[size_x_var] movzx eax,word[size_y_var] imul ecx,eax @@ -1724,7 +1792,7 @@ draw_triangles: mov [point_index3],ax lea eax,[eax*3] add eax,eax - ; push ebp + ; push ebp add ebp,eax mov eax,[ebp] mov dword[xx3],eax @@ -1733,8 +1801,8 @@ draw_triangles: else mov eax,dword[esi] ; don't know MMX mov dword[point_index1],eax - ; shr eax,16 - ; mov [point_index2],ax + ; shr eax,16 + ; mov [point_index2],ax mov ax,word[esi+4] mov [point_index3],ax movq mm0,[esi] @@ -1753,7 +1821,7 @@ draw_triangles: movq qword[xx1],mm0 movq qword[xx2],mm1 movq qword[xx3],mm2 -; emms +; emms end if ; ********************************* push esi ; fninit ; DO culling AT FIRST @@ -1766,7 +1834,7 @@ draw_triangles: lea eax,[eax*3] shl eax,2 add eax,[points_normals_rot_ptr] -; lea eax,[eax+point_normals_rotated] +; lea eax,[eax+point_normals_rotated] fld dword[eax+8] ; ***************************** ftst ; CHECKING OF Z COOFICIENT OF fstsw ax ; NORMAL VECTOR @@ -1842,44 +1910,44 @@ draw_triangles: jnz .again_grd_draw jmp .both_draw - ; movzx edi,[point_index3] ;gouraud shading according to light vector - ; lea edi,[edi*3] - ; lea edi,[4*edi+point_normals_rotated] ; edi - normal - ; mov esi,light_vector - ; call dot_product - ; fabs - ; fimul [orginal_color_r] - ; fistp [temp_col] - ; and [temp_col],0x00ff - ; push [temp_col] - ; push [temp_col] - ; push [temp_col] + ; movzx edi,[point_index3] ;gouraud shading according to light vector + ; lea edi,[edi*3] + ; lea edi,[4*edi+point_normals_rotated] ; edi - normal + ; mov esi,light_vector + ; call dot_product + ; fabs + ; fimul [orginal_color_r] + ; fistp [temp_col] + ; and [temp_col],0x00ff + ; push [temp_col] + ; push [temp_col] + ; push [temp_col] - ; movzx edi,[point_index2] - ; lea edi,[edi*3] - ; lea edi,[4*edi+point_normals_rotated] ; edi - normal - ; mov esi,light_vector - ; call dot_product - ; fabs - ; fimul [orginal_color_r] - ; fistp [temp_col] - ; and [temp_col],0x00ff - ; push [temp_col] - ; push [temp_col] - ; push [temp_col] + ; movzx edi,[point_index2] + ; lea edi,[edi*3] + ; lea edi,[4*edi+point_normals_rotated] ; edi - normal + ; mov esi,light_vector + ; call dot_product + ; fabs + ; fimul [orginal_color_r] + ; fistp [temp_col] + ; and [temp_col],0x00ff + ; push [temp_col] + ; push [temp_col] + ; push [temp_col] - ; movzx edi,[point_index1] - ; lea edi,[edi*3] - ; lea edi,[4*edi+point_normals_rotated] ; edi - normal - ; mov esi,light_vector - ; call dot_product - ; fabs - ; fimul [orginal_color_r] - ; fistp [temp_col] - ; and [temp_col],0x00ff - ; push [temp_col] - ; push [temp_col] - ; push [temp_col] + ; movzx edi,[point_index1] + ; lea edi,[edi*3] + ; lea edi,[4*edi+point_normals_rotated] ; edi - normal + ; mov esi,light_vector + ; call dot_product + ; fabs + ; fimul [orginal_color_r] + ; fistp [temp_col] + ; and [temp_col],0x00ff + ; push [temp_col] + ; push [temp_col] + ; push [temp_col] .rainbow: cmp [catmull_flag],1 ; put on stack z coordinate if necessary jne @f @@ -1916,10 +1984,10 @@ draw_triangles: ror ebx,16 mov ecx,dword[xx3] ror ecx,16 - lea edi,[screen] + mov edi,[screen_ptr] cmp [catmull_flag],0 je @f - ; lea esi,[Z_buffer] + ; lea esi,[Z_buffer] mov esi,[Zbuffer_ptr] call gouraud_triangle_z jmp .end_draw @@ -1965,17 +2033,17 @@ draw_triangles: - ; mov ax,[zz1] ; z position depend draw - ; add ax,[zz2] - ; add ax,[zz3] - ; cwd - ; idiv [i3] ; = -((a+b+c)/3+130) - ; add ax,130 - ; neg al - ; xor edx,edx - ; mov ah,al ;set color according to z position - ; shl eax,8 - ; mov edx,eax + ; mov ax,[zz1] ; z position depend draw + ; add ax,[zz2] + ; add ax,[zz3] + ; cwd + ; idiv [i3] ; = -((a+b+c)/3+130) + ; add ax,130 + ; neg al + ; xor edx,edx + ; mov ah,al ;set color according to z position + ; shl eax,8 + ; mov edx,eax mov eax,dword[xx1] ror eax,16 @@ -1983,11 +2051,11 @@ draw_triangles: ror ebx,16 mov ecx,dword[xx3] ror ecx,16 - ; mov edi,screen - lea edi,[screen] + ; mov edi,screen + mov edi,[screen_ptr] cmp [catmull_flag],0 je @f - ; lea esi,[Z_buffer] + ; lea esi,[Z_buffer] mov esi,[Zbuffer_ptr] push word[zz3] push word[zz2] @@ -2015,17 +2083,17 @@ draw_triangles: shl eax,2 add eax,[points_normals_rot_ptr] ;point_normals_rotated ; # -; fld dword[eax] -; fmul dword[eax+4] -; fld1 -; fld1 -; faddp -; fmulp -; fimul [correct_tex] -; fiadd [correct_tex] -; fistp word[edi] -; mov word[edi+2],0 -;; fistp word[edi+2] +; fld dword[eax] +; fmul dword[eax+4] +; fld1 +; fld1 +; faddp +; fmulp +; fimul [correct_tex] +; fiadd [correct_tex] +; fistp word[edi] +; mov word[edi+2],0 +;; fistp word[edi+2] ; # last change ; texture x=(rotated point normal -> x * 255)+255 fld dword[eax] @@ -2048,11 +2116,11 @@ draw_triangles: ror ebx,16 mov ecx,dword[xx3] ror ecx,16 - mov edi,screen + mov edi,[screen_ptr] mov esi,envmap cmp [catmull_flag],0 je @f - ; mov edx,Z_buffer + ; mov edx,Z_buffer mov edx,[Zbuffer_ptr] call tex_triangle_z jmp .end_draw @@ -2088,18 +2156,18 @@ draw_triangles: fiadd [correct_tex] fistp word[edi] mov word[edi+2],0 -; fistp word[edi+2] +; fistp word[edi+2] ; # last change -; ; texture x=(rotated point normal -> x * 255)+255 -; fld dword[eax] -; fimul [correct_tex] -; fiadd [correct_tex] -; fistp word[edi] -; ; texture y=(rotated point normal -> y * 255)+255 -; fld dword[eax+4] -; fimul [correct_tex] -; fiadd [correct_tex] -; fistp word[edi+2] +; ; texture x=(rotated point normal -> x * 255)+255 +; fld dword[eax] +; fimul [correct_tex] +; fiadd [correct_tex] +; fistp word[edi] +; ; texture y=(rotated point normal -> y * 255)+255 +; fld dword[eax+4] +; fimul [correct_tex] +; fiadd [correct_tex] +; fistp word[edi+2] ; # end of last ch. add edi,4 add esi,2 @@ -2115,7 +2183,7 @@ draw_triangles: mov esi,envmap_cub cmp [catmull_flag],0 je @f - ; mov edx,Z_buffer + ; mov edx,Z_buffer mov edx,[Zbuffer_ptr] call tex_triangle_z jmp .end_draw @@ -2129,7 +2197,7 @@ draw_triangles: ; fninit cmp [catmull_flag],0 je @f -; push Z_buffer +; push Z_buffer push [Zbuffer_ptr] push [zz3] push [zz2] @@ -2166,17 +2234,17 @@ draw_triangles: movzx esi,[point_index2] shl esi,2 add esi,tex_points -; lea esi,[esi*3] -; lea esi,[points+2+esi*2] +; lea esi,[esi*3] +; lea esi,[points+2+esi*2] push dword[esi] - ; push dword[xx2] + ; push dword[xx2] movzx esi,[point_index1] shl esi,2 add esi,tex_points -; lea esi,[esi*3] -; lea esi,[points+2+esi*2] +; lea esi,[esi*3] +; lea esi,[points+2+esi*2] push dword[esi] - ; push dword[xx1] + ; push dword[xx1] mov eax,dword[xx1] ror eax,16 @@ -2184,7 +2252,7 @@ draw_triangles: ror ebx,16 mov ecx,dword[xx3] ror ecx,16 - mov edi,screen + mov edi,[screen_ptr] mov esi,envmap mov edx,bumpmap ;BUMP_MAPPING @@ -2224,51 +2292,51 @@ draw_triangles: ror ebx,16 mov ecx,dword[xx3] ror ecx,16 - mov edi,screen + mov edi,[screen_ptr] mov esi,texmap cmp [catmull_flag],0 je @f - ; mov edx,Z_buffer + ; mov edx,Z_buffer mov edx,[Zbuffer_ptr] call tex_triangle_z - ; call tex_plus_grd_trianlgle + ; call tex_plus_grd_trianlgle jmp .end_draw @@: call tex_triangle jmp .end_draw ; .ray: -; grd_triangle according to points index -; cmp [catmull_flag],0 -; je @f -; push [zz3] ; spot light with attenuation +; grd_triangle according to points index +; cmp [catmull_flag],0 +; je @f +; push [zz3] ; spot light with attenuation ; @@: -; movzx eax,[point_index3] ; env_map - points color list -; shl eax,1 ; each color as word, 0x00rr00gg00bb.. -; lea eax,[3*eax+bumpmap] -; push word[eax] -; push word[eax+2] -; push word[eax+4] -; cmp [catmull_flag],0 -; je @f -; push [zz2] +; movzx eax,[point_index3] ; env_map - points color list +; shl eax,1 ; each color as word, 0x00rr00gg00bb.. +; lea eax,[3*eax+bumpmap] +; push word[eax] +; push word[eax+2] +; push word[eax+4] +; cmp [catmull_flag],0 +; je @f +; push [zz2] ; @@: -; movzx eax,[point_index2] ; env_map - points color list -; shl eax,1 ; each color as word, 0x00rr00gg00bb.. -; lea eax,[eax*3+bumpmap] -; push word[eax] -; push word[eax+2] -; push word[eax+4] -; cmp [catmull_flag],0 -; je @f -; push [zz1] +; movzx eax,[point_index2] ; env_map - points color list +; shl eax,1 ; each color as word, 0x00rr00gg00bb.. +; lea eax,[eax*3+bumpmap] +; push word[eax] +; push word[eax+2] +; push word[eax+4] +; cmp [catmull_flag],0 +; je @f +; push [zz1] ; @@: -; movzx eax,[point_index1] ; env_map - points color list -; shl eax,1 ; each color as word, 0xrr00gg00bb00.. -; lea eax,[eax*3+bumpmap] -; push word[eax] -; push word[eax+2] -; push word[eax+4] -; jmp .both_draw +; movzx eax,[point_index1] ; env_map - points color list +; shl eax,1 ; each color as word, 0xrr00gg00bb00.. +; lea eax,[eax*3+bumpmap] +; push word[eax] +; push word[eax+2] +; push word[eax+4] +; jmp .both_draw .grd_tex: ; smooth shading + texture push ebp @@ -2338,7 +2406,7 @@ draw_triangles: ror ebx,16 mov ecx,dword[xx3] ror ecx,16 - mov edi,screen + mov edi,[screen_ptr] mov edx,texmap mov esi,[Zbuffer_ptr] @@ -2399,7 +2467,7 @@ draw_triangles: ror ebx,16 mov ecx,dword[xx3] ror ecx,16 - mov edi,screen + mov edi,[screen_ptr] mov esi,texmap mov edx,envmap @@ -2453,9 +2521,9 @@ draw_triangles: add esi,2 loop @b -; push dword 1 shl 16 + 1 ; emap coords -; push dword 127 shl 16 + 1 -; push dword 127 shl 16 + 127 +; push dword 1 shl 16 + 1 ; emap coords +; push dword 127 shl 16 + 1 +; push dword 127 shl 16 + 127 movzx esi,[point_index3] ; bump map coords shl esi,2 @@ -2471,9 +2539,9 @@ draw_triangles: add esi,tex_points push dword[esi] -; push dword 1 shl 16 + 127 -; push dword 127 shl 16 + 127 -; push dword 1 shl 16 + 1 ; bump coords +; push dword 1 shl 16 + 127 +; push dword 127 shl 16 + 127 +; push dword 1 shl 16 + 1 ; bump coords mov eax,dword[xx1] ror eax,16 @@ -2481,7 +2549,7 @@ draw_triangles: ror ebx,16 mov ecx,dword[xx3] ror ecx,16 - mov edi,screen + mov edi,[screen_ptr] mov esi,envmap mov edx,bumpmap @@ -2522,12 +2590,12 @@ draw_triangles: dec ecx jnz .again_line_param -; mov eax,[edges_ptr] ; this not works correctly -; add eax,[edges_counter] ; I mean chosing overlapped edges. -; mov bl,[eax] ; -; test bl,00000001b ; -; jz @f ; - mov edi,screen +; mov eax,[edges_ptr] ; this not works correctly +; add eax,[edges_counter] ; I mean chosing overlapped edges. +; mov bl,[eax] ; +; test bl,00000001b ; +; jz @f ; + mov edi,[screen_ptr] mov esi,[Zbuffer_ptr] mov eax,[col1] @@ -2556,13 +2624,13 @@ draw_triangles: call smooth_line @@: -; mov eax,[edges_ptr] ; this not works correctly -; add eax,[edges_counter] -; mov bl,[eax] -; test bl,00000010b -; jz @f +; mov eax,[edges_ptr] ; this not works correctly +; add eax,[edges_counter] +; mov bl,[eax] +; test bl,00000010b +; jz @f - mov edi,screen + mov edi,[screen_ptr] mov esi,[Zbuffer_ptr] mov eax,[col1] @@ -2592,13 +2660,13 @@ draw_triangles: call smooth_line @@: -; mov eax,[edges_ptr] ; this not works correctly -; add eax,[edges_counter] ; -; mov bl,[eax] ; -; test bl,00000100b ; -; jz @f ; +; mov eax,[edges_ptr] ; this not works correctly +; add eax,[edges_counter] ; +; mov bl,[eax] ; +; test bl,00000100b ; +; jz @f ; - mov edi,screen + mov edi,[screen_ptr] mov esi,[Zbuffer_ptr] mov eax,[col3] @@ -2667,7 +2735,7 @@ fill_Z_buffer: end if ret -read_tp_variables: ; read [triangles_count_var] and [points_count_var] +read_tp_variables: ; read [triangles_count_var] and [points_count_var] ; and allocate memory xor ebx,ebx xor ebp,ebp @@ -2739,7 +2807,7 @@ read_tp_variables: ; read [triangles_count_var] and [points_count_var] add ebx,6 add esi,12 - ; dec ecx + ; dec ecx loop @b @@: @@ -2757,7 +2825,7 @@ read_tp_variables: ; read [triangles_count_var] and [points_count_var] add esi,8 dec ecx jnz @b -; xor ecx,ecx +; xor ecx,ecx add ebp,edx jmp .find4k mov eax,-1 ;<---mark if OK @@ -2778,11 +2846,11 @@ read_from_file: end if cmp [esi],word 4D4Dh jne .exit ;Must be legal .3DS file -; cmp dword[esi+2],EndFile-SourceFile -; jne .exit ;This must tell the length +; cmp dword[esi+2],EndFile-SourceFile +; jne .exit ;This must tell the length mov eax,dword[esi+2] - ; cmp eax,[fsize] - ; jne .exit + ; cmp eax,[fsize] + ; jne .exit add eax,esi mov [EndFile],eax ; @@ -2839,19 +2907,19 @@ read_from_file: push dword[esi+0] pop dword[edi+ebx*2+8] pop edi -; fld dword[esi+4] -; fstp dword[real_points+ebx*2+0] ; x -; fld dword[esi+8] -; fstp dword[real_points+ebx*2+4] ; y -; fld dword[esi+0] -; fstp dword[real_points+ebx*2+8] ; z +; fld dword[esi+4] +; fstp dword[real_points+ebx*2+0] ; x +; fld dword[esi+8] +; fstp dword[real_points+ebx*2+4] ; y +; fld dword[esi+0] +; fstp dword[real_points+ebx*2+8] ; z add ebx,6 add esi,12 dec ecx jnz @b @@: - ; mov dword[points+ebx],-1 + ; mov dword[points+ebx],-1 push edi mov edi,[points_ptr] mov dword[edi+ebx*2],-1 ; end mark (not always in use) @@ -2865,7 +2933,7 @@ read_from_file: movzx ecx,word[esi+6] add [triangles_count_var],cx add esi,8 - ;mov edi,triangles + ;mov edi,triangles @@: movsd movsw @@ -2901,28 +2969,28 @@ alloc_mem_for_tp: int 0x40 ; -> allocate memory to triangles mov [triangles_ptr], eax ; -> eax = pointer to allocated mem -; mov eax, 68 -; movzx ecx, [triangles_count_var] -; inc ecx -; mov edx,[edges_ptr] -; int 0x40 ; -> allocate memory to edges -; mov [edges_ptr], eax ; -> eax = pointer to allocated mem +; mov eax, 68 +; movzx ecx, [triangles_count_var] +; inc ecx +; mov edx,[edges_ptr] +; int 0x40 ; -> allocate memory to edges +; mov [edges_ptr], eax ; -> eax = pointer to allocated mem -; mov eax,-1 ; fill edges list -; movzx ecx,[triangles_count_var] ; importand if object generated -; shr ecx,2 -; inc ecx -; mov edi,[edges_ptr] -; cld -; rep stosd +; mov eax,-1 ; fill edges list +; movzx ecx,[triangles_count_var] ; importand if object generated +; shr ecx,2 +; inc ecx +; mov edi,[edges_ptr] +; cld +; rep stosd -; mov eax, 68 -; mov ebx, 12 -; movzx ecx, [triangles_count_var] -; shl ecx, 4 -; int 0x40 -; mov [triangles_w_z_ptr], eax ; for trainagles_with_z list +; mov eax, 68 +; mov ebx, 12 +; movzx ecx, [triangles_count_var] +; shl ecx, 4 +; int 0x40 +; mov [triangles_w_z_ptr], eax ; for trainagles_with_z list ; ststic memory mov eax, 68 @@ -2942,7 +3010,7 @@ alloc_mem_for_tp: mov [points_normals_ptr], eax mov eax, 68 - ; mov ebx, 12 + ; mov ebx, 12 movzx ecx, [points_count_var] lea ecx,[3+ecx*3] shl ecx, 2 @@ -3016,7 +3084,7 @@ else ; mov ecx,ebx ; add ecx,MEM_END ; mov ebx,1 -; mov eax,64 ; allocate mem - resize app mem +; mov eax,64 ; allocate mem - resize app mem ; for points and triangles int 0x40 @@ -3078,14 +3146,14 @@ buttons: ; draw some buttons (all but navigation and close ) cmp byte[edi+11],255 ; if max_flag=255 je @f ; skip ; flag description -; mov eax,4 ; function 4 : write text to window -; movzx ebx,byte[edi] -; sub bl,2 -; lea ebx,[ebx*3] -; lea ebx,[ebx*5] -; add ebx,(SIZE_X+12+70)*65536+28 ; [x start] *65536 + [y start] +; mov eax,4 ; function 4 : write text to window +; movzx ebx,byte[edi] +; sub bl,2 +; lea ebx,[ebx*3] +; lea ebx,[ebx*5] +; add ebx,(SIZE_X+12+70)*65536+28 ; [x start] *65536 + [y start] add ebx,70*65536 -; mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) +; mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) movzx edx,byte[edi+12] ; current flag shl edx,2 ; * 4 = text length add edx,dword[edi+13] ; pointer to text beginning @@ -3106,14 +3174,19 @@ ret int 0x40 ; DRAW WINDOW - mov eax,0 ; function 0 : define and draw window - mov ebx,50*65536;+SIZE_X;+80+30 ; [x start] *65536 + [x size] - mov ecx,50*65536;+SIZE_Y;+30 ; [y start] *65536 + [y size] + mov eax,0 ; function 0 : define and draw window + mov bx,[x_start] + shl ebx,16 + mov cx,[y_start] + shl ecx,16 +;ebx - [x start] *65536 + [x size] +;ecx - [y start] *65536 + [y size] mov bx,[size_x_var] add bx,115 mov cx,[size_y_var] add cx,30 - mov edx,0x14000000 ; color of work area RRGGBB,8->color gl + ; @@: + mov edx,0x13000000 ; color of work area RRGGBB,8->color gl mov edi,labelt ; WINDOW LABEL int 0x40 @@ -3121,7 +3194,7 @@ ret .Y_ADD equ 1 ;-> offset of 'add vector' buttons - ; ADD VECTOR LABEL ; add vector buttons - 30 ++ + ; ADD VECTOR LABEL ; add vector buttons - 30 ++ mov eax,4 ; function 4 : write text to window movzx ebx,word[size_x_var] shl ebx,16 @@ -3129,9 +3202,9 @@ ret mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) mov edx,labelvector ; pointer to text beginning mov esi,labelvectorend-labelvector ; text length - ; cmp [move_flag],2 - ; jne @f - ; add edx,navigation_size + ; cmp [move_flag],2 + ; jne @f + ; add edx,navigation_size ; @@: int 0x40 ; VECTOR Y- BUTTON @@ -3152,8 +3225,8 @@ ret mov edx,labelyminus ; pointer to text beginning mov esi,labelyminusend-labelyminus ; text length cmp [move_flag],2 - ; jne @f - ; add edx,navigation_size + ; jne @f + ; add edx,navigation_size ; @@: int 0x40 ; VECTOR Z+ BUTTON @@ -3173,9 +3246,9 @@ ret mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) mov edx,labelzplus ; pointer to text beginning mov esi,labelzplusend-labelzplus ; text length - ; cmp [move_flag],2 - ; jne @f - ; add edx,navigation_size + ; cmp [move_flag],2 + ; jne @f + ; add edx,navigation_size ; @@: int 0x40 @@ -3196,9 +3269,9 @@ ret mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) mov edx,labelxminus ; pointer to text beginning mov esi,labelxminusend-labelxminus ; text length - ; cmp [move_flag],2 - ; jne @f - ; add edx,navigation_size + ; cmp [move_flag],2 + ; jne @f + ; add edx,navigation_size ; @@: int 0x40 ; VECTOR x+ BUTTON @@ -3218,9 +3291,9 @@ ret mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) mov edx,labelxplus ; pointer to text beginning mov esi,labelxplusend-labelxplus ; text length - ; cmp [move_flag],2 - ; jne @f - ; add edx,navigation_size + ; cmp [move_flag],2 + ; jne @f + ; add edx,navigation_size ; @@: int 0x40 ; VECTOR z- BUTTON @@ -3240,9 +3313,9 @@ ret mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) mov edx,labelzminus ; pointer to text beginning mov esi,labelzminusend-labelzminus ; text length - ; cmp [move_flag],2 - ; jne @f - ; add edx,navigation_size + ; cmp [move_flag],2 + ; jne @f + ; add edx,navigation_size ; @@: int 0x40 ;VECTOR Y+ BUTTON @@ -3262,9 +3335,9 @@ ret mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB ) mov edx,labelyplus ; pointer to text beginning mov esi,labelyplusend-labelyplus ; text length - ; cmp [move_flag],2 - ; jne @f - ; add edx,navigation_size + ; cmp [move_flag],2 + ; jne @f + ; add edx,navigation_size ; @@: int 0x40 @@ -3274,7 +3347,7 @@ ret ret - ; DATA AREA ************************************ + ; DATA AREA ************************************ include 'DATA.INC' align 16