From 0ceaac39cfd2743aa32e61faff5f948768654ed1 Mon Sep 17 00:00:00 2001 From: ataualpa Date: Sat, 20 Oct 2007 18:12:58 +0000 Subject: [PATCH] Some programs now use window style Y=4 git-svn-id: svn://kolibrios.org@661 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/demos/3DS/3DMATH.ASM | 109 + programs/demos/3DS/3DSHEART.ASM | 1984 ++++++++++++++++ programs/demos/3DS/3DSTPOT.ASM | 1991 +++++++++++++++++ programs/demos/3DS/3dspiral.asm | 440 ++++ programs/demos/3DS/FLAT3.ASM | 188 ++ programs/demos/3DS/FLATWAV.ASM | 762 +++++++ programs/demos/3DS/FLAT_CAT.ASM | 342 +++ programs/demos/3DS/GRD3.ASM | 481 ++++ programs/demos/3DS/GRD_CAT.ASM | 598 +++++ programs/demos/3DS/HRT.3DS | Bin 0 -> 36428 bytes programs/demos/3DS/TEAPOT.3DS | Bin 0 -> 63417 bytes programs/demos/3DS/TEX3.ASM | 507 +++++ programs/develop/fasm/trunk/build_ru.bat | 1 + programs/fs/kfar/trunk/build_ru.bat | 1 + programs/games/rsquare/trunk/build_ru.bat | 1 + programs/media/jpegview/trunk/build_ru.bat | 1 + programs/network/ftps/trunk/FTPS.ASM | 92 +- programs/network/httpc/trunk/httpc.asm | 22 +- programs/network/https/trunk/https.asm | 232 +- programs/network/netsendc/trunk/netsendc.asm | 76 +- programs/network/netsends/trunk/netsends.asm | 118 +- programs/network/popc/trunk/popc.asm | 4 +- programs/network/telnet/trunk/telnet.asm | 198 +- programs/other/period/trunk/build.bat | 1 + programs/system/icon_new/trunk/build_icon.bat | 1 + .../system/icon_new/trunk/build_iconmngr.bat | 1 + programs/system/panel/trunk/build_ru.bat | 1 + programs/system/rb/trunk/@RB.ASM | 2 +- 28 files changed, 7782 insertions(+), 372 deletions(-) create mode 100644 programs/demos/3DS/3DMATH.ASM create mode 100644 programs/demos/3DS/3DSHEART.ASM create mode 100644 programs/demos/3DS/3DSTPOT.ASM create mode 100644 programs/demos/3DS/3dspiral.asm create mode 100644 programs/demos/3DS/FLAT3.ASM create mode 100644 programs/demos/3DS/FLATWAV.ASM create mode 100644 programs/demos/3DS/FLAT_CAT.ASM create mode 100644 programs/demos/3DS/GRD3.ASM create mode 100644 programs/demos/3DS/GRD_CAT.ASM create mode 100644 programs/demos/3DS/HRT.3DS create mode 100644 programs/demos/3DS/TEAPOT.3DS create mode 100644 programs/demos/3DS/TEX3.ASM diff --git a/programs/demos/3DS/3DMATH.ASM b/programs/demos/3DS/3DMATH.ASM new file mode 100644 index 0000000000..dd022f13d9 --- /dev/null +++ b/programs/demos/3DS/3DMATH.ASM @@ -0,0 +1,109 @@ +x3d equ 0 +y3d equ 2 +z3d equ 4 +vec_x equ 0 +vec_y equ 4 +vec_z equ 8 +; 3d point - triple integer word coordinate +; vector - triple float dword coordinate +;----------------------in: -------------------------------- +;------------------------ esi - pointer to 1st 3d point --- +;------------------------ edi - pointer to 2nd 3d point --- +;------------------------ ebx - pointer to result vector -- +;---------------------- out : none ------------------------ +make_vector: + fninit + fild word[edi+x3d] ;edi+x3d + fisub word[esi+x3d] ;esi+x3d + fstp dword[ebx+vec_x] + + fild word[edi+y3d] + fisub word[esi+y3d] + fstp dword[ebx+vec_y] + + fild word[edi+z3d] + fisub word[esi+z3d] + fstp dword[ebx+vec_z] + +ret +;---------------------- in: ------------------------------- +;--------------------------- esi - pointer to 1st vector -- +;--------------------------- edi - pointer to 2nd vector -- +;--------------------------- ebx - pointer to result vector +;---------------------- out : none +cross_product: + fninit + fld dword [esi+vec_y] + fmul dword [edi+vec_z] + fld dword [esi+vec_z] + fmul dword [edi+vec_y] + fsubp ;st1 ,st + fstp dword [ebx+vec_x] + + fld dword [esi+vec_z] + fmul dword [edi+vec_x] + fld dword [esi+vec_x] + fmul dword [edi+vec_z] + fsubp ;st1 ,st + fstp dword [ebx+vec_y] + + fld dword [esi+vec_x] + fmul dword [edi+vec_y] + fld dword [esi+vec_y] + fmul dword [edi+vec_x] + fsubp ;st1 ,st + fstp dword [ebx+vec_z] +ret +;----------------------- in: ------------------------------ +;---------------------------- edi - pointer to vector ----- +;----------------------- out : none +normalize_vector: + fninit + fld dword [edi+vec_x] + fmul st, st + fld dword [edi+vec_y] + fmul st, st + fld dword [edi+vec_z] + fmul st, st + faddp st1, st + faddp st1, st + fsqrt + + ftst + fstsw ax + sahf + jnz @f + + fst dword [edi+vec_x] + fst dword [edi+vec_y] + fstp dword [edi+vec_z] + ret + @@: + fld st + fld st + fdivr dword [edi+vec_x] + fstp dword [edi+vec_x] + fdivr dword [edi+vec_y] + fstp dword [edi+vec_y] + fdivr dword [edi+vec_z] + fstp dword [edi+vec_z] +ret +;------------------in: ------------------------- +;------------------ esi - pointer to 1st vector +;------------------ edi - pointer to 2nd vector +;------------------out: ------------------------ +;------------------ st0 - dot-product +dot_product: + fninit + fld dword [esi+vec_x] + fmul dword [edi+vec_x] + fld dword [esi+vec_y] + fmul dword [edi+vec_y] + fld dword [esi+vec_z] + fmul dword [edi+vec_z] + faddp + faddp +ret + + + diff --git a/programs/demos/3DS/3DSHEART.ASM b/programs/demos/3DS/3DSHEART.ASM new file mode 100644 index 0000000000..333f1620a5 --- /dev/null +++ b/programs/demos/3DS/3DSHEART.ASM @@ -0,0 +1,1984 @@ +; +; application : Deus Caritas Est - app shows three models shading +; compiler : FASM 1.65.13 +; system : KolibriOS/MenuetOS +; author : macgub +; email : macgub3@wp.pl +; web : www.menuet.xt.pl +; Fell free to use this intro in your own distribution of KolibriOS/MenuetOS. +; Special greetings to all MenuetOS maniax in the world. +; I hope because my intros Christian Belive will be near to each of You. + + +; Some adjustments made by Madis Kalme +; madis.kalme@mail.ee +; I tried optimizing it a bit, but don't know if it was successful. The objects +; can be: +; 1) Read from a file (*.3DS standard) +; 2) Written in manually (at the end of the code) +SIZE_X equ 250 +SIZE_Y equ 250 +TIMEOUT equ 4 +ROUND equ 10 +TEX_X equ 512 ; texture width +TEX_Y equ 512 ; height +TEX_SHIFT equ 9 ; texture widith shifting +TEX equ SHIFTING ; TEX={SHIFTING | FLUENTLY} +FLUENTLY = 0 +SHIFTING = 1 +;CATMULL_SHIFT equ 8 +NON = 0 +MMX = 1 + +Ext = MMX ;Ext={ NON | MMX} + +use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd I_END ; memory for app + dd I_END ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +START: ; start of execution + cld + ; call alloc_buffer_mem + call read_from_file + call init_triangles_normals + call init_point_normals + call init_envmap + call draw_window + + +still: + mov eax,23 ; wait here for event with timeout + mov ebx,TIMEOUT + cmp [speed_flag],1 + jne .skip + mov eax,11 + .skip: + int 0x40 + + cmp eax,1 ; redraw request ? + je red + cmp eax,2 ; key in buffer ? + je key + cmp eax,3 ; button in buffer ? + je button + + jmp noclose + + red: ; redraw + call draw_window + jmp noclose + + key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + jmp noclose + + button: ; button + mov eax,17 ; get id + int 0x40 + + cmp ah,1 ; button id=1 ? + jne .ch_another + + mov eax,-1 ; close this program + int 0x40 + .ch_another: + cmp ah,2 + jne .ch_another1 + inc [r_flag] + cmp [r_flag],3 + jne noclose + mov [r_flag],0 + .ch_another1: + cmp ah,3 + jne .ch_another2 + inc [dr_flag] + cmp [dr_flag],3 + jne noclose + mov [dr_flag],0 + .ch_another2: + cmp ah,4 ; toggle speed + jne @f + inc [speed_flag] + cmp [speed_flag],2 + jne noclose + mov [speed_flag],0 + @@: + cmp ah,5 + jne @f ;scale- + mov [scale],0.7 + fninit + fld [sscale] + fmul [scale] + fstp [sscale] + call read_from_file + mov ax,[vect_x] ;-- last change + mov bx,[vect_y] + mov cx,[vect_z] + call add_vector +; call do_scale + @@: + cmp ah,6 + jne @f ; scale+ + mov [scale],1.3 + fninit + fld [sscale] + fmul [scale] + fstp [sscale] + call read_from_file + mov ax,[vect_x] + mov bx,[vect_y] + mov cx,[vect_z] + call add_vector + call init_triangles_normals + call init_point_normals + @@: + cmp ah,7 + jne @f + xor ax,ax ;add vector to object and rotary point + mov bx,-10 + xor cx,cx + call add_vector + sub [vect_y],10 + sub [yo],10 + @@: + cmp ah,8 + jne @f + xor ax,ax + xor bx,bx + mov cx,10 + call add_vector + add [vect_z],10 + add [zo],10 + @@: + cmp ah,9 + jne @f + mov ax,-10 + xor bx,bx + xor cx,cx + call add_vector + sub [vect_x],10 + sub [xo],10 + @@: + cmp ah,10 + jne @f + mov ax,10 + xor bx,bx + xor cx,cx + call add_vector + add [vect_x],10 + add [xo],10 + @@: + cmp ah,11 + jne @f + xor ax,ax + xor bx,bx + mov cx,-10 + call add_vector + sub [vect_z],10 + sub [zo],10 + @@: + cmp ah,12 + jne @f + xor ax,ax + mov bx,10 + xor cx,cx + call add_vector + add [vect_y],10 + add [yo],10 + @@: + cmp ah,13 ; change main color - + jne @f ; - lead color setting + cmp [max_color_r],245 + jge @f + add [max_color_r],10 + call init_envmap + @@: + cmp ah,14 + jne @f + cmp [max_color_g],245 + jge @f + add [max_color_g],10 + call init_envmap + @@: + cmp ah,15 + jne @f + cmp [max_color_b],245 + jge @f + add [max_color_b],10 + call init_envmap + @@: + cmp ah,16 ; change main color + jne @f + cmp [max_color_r],10 + jle @f + sub [max_color_r],10 + call init_envmap + @@: + cmp ah,17 + jne @f + cmp [max_color_g],10 + jle @f + sub [max_color_g],10 + call init_envmap + @@: + cmp ah,18 + jne @f + cmp [max_color_b],10 + jle @f + sub [max_color_b],10 + call init_envmap + @@: + cmp ah,19 + jne @f + inc [catmull_flag] + cmp [catmull_flag],2 + jne @f + mov [catmull_flag],0 + @@: + noclose: + + call calculate_angle ; calculates sinus and cosinus + call copy_point_normals + ; copy normals and rotate the copy using sin/cosbeta - best way + call rotate_point_normals + call calculate_colors + call copy_points + call rotate_points + call translate_perspective_points; translate from 3d to 2d + call clrscr ; clear the screen + cmp [dr_flag],2 + je @f + cmp [catmull_flag],1 ;if env_mapping sort faces + je @f + @@: + call sort_triangles + @@: + call fill_Z_buffer + + RDTSC + push eax + call draw_triangles ; draw all triangles from the list + + RDTSC + sub eax,[esp] + sub eax,41 + ; lea esi,[debug_points] + ; lea edi,[debug_points+6] + ; lea ebx,[debug_vector1] + ; call make_vector + ; fninit + ; fld [sinbeta_one] + ; fimul [debug_dwd] + ; fistp [debug_dd] + ; movzx eax,[debug_dd] + + + mov ecx,10 + .dc: + xor edx,edx + mov edi,10 + div edi + add dl,30h + mov [STRdata+ecx-1],dl + loop .dc + pop eax +macro show +{ + mov eax,7 ; put image + mov ebx,screen + mov ecx,SIZE_X shl 16 + SIZE_Y + mov edx,5 shl 16 + 20 + int 0x40 +} + show + mov eax,4 ; function 4 : write text to window + mov ebx,5*65536+23 ; [x start] *65536 + [y start] + mov ecx,-1 + mov edx,STRdata ; pointer to text beginning + mov esi,10 ; text length + int 40h + + + + jmp still + +;-------------------------------------------------------------------------------- +;-------------------------PROCEDURES--------------------------------------------- +;-------------------------------------------------------------------------------- +include "tex3.asm" +include "flat_cat.asm" +include "grd_cat.asm" +include "3dmath.asm" +include "grd3.asm" +include "flat3.asm" + + +;alloc_buffer_mem: +; mov eax,68 +; mov ebx,5 +; mov ecx,SIZE_X*SIZE_Y*3 +; int 0x40 +; mov [screen],eax +;ret +init_envmap: + +.temp equ word [ebp-2] + push ebp + mov ebp,esp + sub esp,2 + mov edi,envmap + fninit + + mov dx,-256 + .ie_ver: + mov cx,-256 + .ie_hor: + mov .temp,cx + fild .temp + fmul st,st0 + mov .temp,dx + fild .temp + fmul st,st0 + faddp + fsqrt + mov .temp,254 + fisubr .temp + fmul [env_const] + fistp .temp + mov ax,.temp + + or ax,ax + jge .ie_ok1 + xor ax,ax + jmp .ie_ok2 + .ie_ok1: + cmp ax,254 + jle .ie_ok2 + mov ax,254 + .ie_ok2: + push dx + mov bx,ax + mul [max_color_b] + shr ax,8 + stosb + mov ax,bx + mul [max_color_g] + shr ax,8 + stosb + mov ax,bx + mul [max_color_r] + shr ax,8 + stosb + pop dx + + inc cx + cmp cx,256 + jne .ie_hor + + inc dx + cmp dx,256 + jne .ie_ver + + mov esp,ebp + pop ebp +macro debug +{ + mov edi,envmap + mov ecx,512*512*3/4 + mov eax,0xffffffff + rep stosd +} +ret +calculate_colors: + fninit + xor ebx,ebx + movzx ecx,[points_count_var] + lea ecx,[ecx*3] + add ecx,ecx + .cc_again: + mov esi,light_vector + lea edi,[point_normals_rotated+ebx*2] + call dot_product + fcom [dot_min] + fstsw ax + sahf + ja .cc_ok1 + ffree st + mov dword[points_color+ebx],0 + mov word[points_color+ebx+4],0 + add ebx,6 + cmp ebx,ecx + jne .cc_again + jmp .cc_done + .cc_ok1: + fcom [dot_max] + fstsw ax + sahf + jb .cc_ok2 + ffree st + mov dword[points_color+ebx],0 ; clear r,g,b + mov word[points_color+ebx+4],0 + add ebx,6 + cmp ebx,ecx + jne .cc_again + jmp .cc_done + .cc_ok2: + fld st + fld st + fimul [max_color_r] + fistp word[points_color+ebx] ;each color as word + fimul [max_color_g] + fistp word[points_color+ebx+2] + fimul [max_color_b] + fistp word[points_color+ebx+4] + add ebx,6 + cmp ebx,ecx + jne .cc_again + .cc_done: +ret +copy_point_normals: + movzx ecx,[points_count_var] + shl ecx,2 + inc ecx + mov esi,point_normals + mov edi,point_normals_rotated + rep movsd +ret +rotate_point_normals: + movzx ecx,[points_count_var] + mov ebx,point_normals_rotated + fninit ; for now only rotate around Z axle + .again_r: + cmp [r_flag],1 + je .z_rot + cmp [r_flag],2 + je .x_rot + + .y_rot: + fld dword[ebx] ; x + fld [sinbeta] + fmul dword[ebx+8] ; z * sinbeta + fchs + fld [cosbeta] + fmul dword[ebx] ; x * cosbeta + faddp + fstp dword[ebx] ; new x + fmul [sinbeta] ; old x * sinbeta + fld [cosbeta] + fmul dword[ebx+8] ; z * cosbeta + faddp + fstp dword[ebx+8] ; new z + add ebx,12 + loop .y_rot + jmp .end_rot + .z_rot: + fld dword[ebx] ;x + fld [sinbeta] + fmul dword[ebx+4] ;y + fld [cosbeta] + fmul dword[ebx] ;x + faddp + fstp dword[ebx] ;new x + fmul [sinbeta] ; sinbeta * old x + fchs + fld [cosbeta] + fmul dword[ebx+4] ; cosbeta * y + faddp + fstp dword[ebx+4] ; new y + add ebx,12 + loop .z_rot + jmp .end_rot + .x_rot: + fld dword[ebx+4] ;y + fld [sinbeta] + fmul dword[ebx+8] ;z + fld [cosbeta] + fmul dword[ebx+4] ;y + faddp + fstp dword[ebx+4] ; new y + fmul [sinbeta] ; sinbeta * old y + fchs + fld [cosbeta] + fmul dword[ebx+8] + faddp + fstp dword[ebx+8] + add ebx,12 + loop .x_rot + .end_rot: +ret +init_triangles_normals: + mov ebx,triangles_normals + mov ebp,triangles + @@: + push ebx + 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 + 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 + add ebx,12 + mov esi,edi + movzx edi,word[ebp+4] ; third point index + lea edi,[edi*3] + lea edi,[points+edi*2] + call make_vector + mov edi,ebx ; edi - pointer to 2nd vector + mov esi,ebx + sub esi,12 ; esi - pointer to 1st vector + pop ebx + call cross_product + mov edi,ebx + call normalize_vector + add ebp,6 + add ebx,12 + cmp dword[ebp],-1 + jne @b +ret + +init_point_normals: +.x equ dword [ebp-4] +.y equ dword [ebp-8] +.z equ dword [ebp-12] +.point_number equ word [ebp-26] +.hit_faces equ word [ebp-28] + + fninit + mov ebp,esp + sub esp,28 + mov edi,point_normals + mov .point_number,0 + .ipn_loop: + mov .hit_faces,0 + mov .x,0 + mov .y,0 + mov .z,0 + mov esi,triangles + xor ecx,ecx ; ecx - triangle number + .ipn_check_face: + xor ebx,ebx ; ebx - 'position' in one triangle + .ipn_check_vertex: + movzx eax,word[esi+ebx] ; eax - point_number + cmp ax,.point_number + jne .ipn_next_vertex + push esi + mov esi,ecx + lea esi,[esi*3] + lea esi,[triangles_normals+esi*4] + ; shl esi,2 + ; add esi,triangles_normals + + fld .x + fadd dword[esi+vec_x] + fstp .x + fld .y + fadd dword[esi+vec_y] + fstp .y + fld .z + fadd dword[esi+vec_z] + fstp .z + pop esi + inc .hit_faces + jmp .ipn_next_face + .ipn_next_vertex: + add ebx,2 + cmp ebx,6 + jne .ipn_check_vertex + .ipn_next_face: + add esi,6 + inc ecx + cmp cx,[triangles_count_var] + jne .ipn_check_face + + fld .x + fidiv .hit_faces + fstp dword[edi+vec_x] + fld .y + fidiv .hit_faces + fstp dword[edi+vec_y] + fld .z + fidiv .hit_faces + fstp dword[edi+vec_z] + call normalize_vector + add edi,12 ;type vector 3d + inc .point_number + mov dx,.point_number + cmp dx,[points_count_var] + jne .ipn_loop + + mov esp,ebp +ret + +add_vector: + mov ebp,points + @@: + add word[ebp],ax + add word[ebp+2],bx + add word[ebp+4],cx + add ebp,6 + cmp dword[ebp],-1 + jne @b +ret +;do_scale: +; fninit +; mov ebp,points +; .next_sc: +; fld1 +; fsub [scale] +; fld st +; fimul [xo] +; fld [scale] +; fimul word[ebp] ;x +; faddp +; fistp word[ebp] +; fld st +; fimul [yo] +; fld [scale] +; fimul word[ebp+2] +; faddp +; fistp word[ebp+2] +; fimul [zo] +; fld [scale] +; fimul word[ebp+4] +; faddp +; fistp word[ebp+4] +; add ebp,6 +; cmp dword[ebp],-1 +; jne .next_sc +;ret +sort_triangles: + mov esi,triangles + mov edi,triangles_with_z + mov ebp,points_rotated + + make_triangle_with_z: ;makes list with triangles and z position + movzx eax,word[esi] + lea eax,[eax*3] + movzx ecx,word[ebp+eax*2+4] + + movzx eax,word[esi+2] + lea eax,[eax*3] + add cx,word[ebp+eax*2+4] + + movzx eax,word[esi+4] + lea eax,[eax*3] + add cx,word[ebp+eax*2+4] + + mov ax,cx + ; cwd + ; idiv word[i3] + movsd ; store vertex coordinates + movsw + stosw ; middle vertex coordinate 'z' in triangles_with_z list + cmp dword[esi],-1 + jne make_triangle_with_z + movsd ; copy end mark + mov eax,4 + lea edx,[edi-8-trizdd] + mov [high],edx + call quicksort + mov eax,4 + mov edx,[high] + call insertsort + jmp end_sort + + quicksort: + mov ecx,edx + sub ecx,eax + cmp ecx,32 + jc .exit + lea ecx,[eax+edx] + shr ecx,4 + lea ecx,[ecx*8-4]; i + mov ebx,[trizdd+eax]; trizdd[l] + mov esi,[trizdd+ecx]; trizdd[i] + mov edi,[trizdd+edx]; trizdd[h] + cmp ebx,esi + jg @f ; direction NB! you need to negate these to invert the order + if Ext=NON + mov [trizdd+eax],esi + mov [trizdd+ecx],ebx + mov ebx,[trizdd+eax-4] + mov esi,[trizdd+ecx-4] + mov [trizdd+eax-4],esi + mov [trizdd+ecx-4],ebx + mov ebx,[trizdd+eax] + mov esi,[trizdd+ecx] + else + movq mm0,[trizdq+eax-4] + movq mm1,[trizdq+ecx-4] + movq [trizdq+ecx-4],mm0 + movq [trizdq+eax-4],mm1 + xchg ebx,esi + end if + @@: + cmp ebx,edi + jg @f ; direction + if Ext=NON + mov [trizdd+eax],edi + mov [trizdd+edx],ebx + mov ebx,[trizdd+eax-4] + mov edi,[trizdd+edx-4] + mov [trizdd+eax-4],edi + mov [trizdd+edx-4],ebx + mov ebx,[trizdd+eax] + mov edi,[trizdd+edx] + else + movq mm0,[trizdq+eax-4] + movq mm1,[trizdq+edx-4] + movq [trizdq+edx-4],mm0 + movq [trizdq+eax-4],mm1 + xchg ebx,edi + end if + @@: + cmp esi,edi + jg @f ; direction + if Ext=NON + mov [trizdd+ecx],edi + mov [trizdd+edx],esi + mov esi,[trizdd+ecx-4] + mov edi,[trizdd+edx-4] + mov [trizdd+ecx-4],edi + mov [trizdd+edx-4],esi + else + movq mm0,[trizdq+ecx-4] + movq mm1,[trizdq+edx-4] + movq [trizdq+edx-4],mm0 + movq [trizdq+ecx-4],mm1 +; xchg ebx,esi + end if + @@: + mov ebp,eax ; direction + add ebp,8 ; j + if Ext=NON + mov esi,[trizdd+ebp] + mov edi,[trizdd+ecx] + mov [trizdd+ebp],edi + mov [trizdd+ecx],esi + mov esi,[trizdd+ebp-4] + mov edi,[trizdd+ecx-4] + mov [trizdd+ecx-4],esi + mov [trizdd+ebp-4],edi + else + movq mm0,[trizdq+ebp-4] + movq mm1,[trizdq+ecx-4] + movq [trizdq+ecx-4],mm0 + movq [trizdq+ebp-4],mm1 + end if + mov ecx,edx ; i; direction + mov ebx,[trizdd+ebp]; trizdd[j] + .loop: + sub ecx,8 ; direction + cmp [trizdd+ecx],ebx + jl .loop ; direction + @@: + add ebp,8 ; direction + cmp [trizdd+ebp],ebx + jg @b ; direction + cmp ebp,ecx + jge @f ; direction + if Ext=NON + mov esi,[trizdd+ecx] + mov edi,[trizdd+ebp] + mov [trizdd+ebp],esi + mov [trizdd+ecx],edi + mov edi,[trizdd+ecx-4] + mov esi,[trizdd+ebp-4] + mov [trizdd+ebp-4],edi + mov [trizdd+ecx-4],esi + else + movq mm0,[trizdq+ecx-4] + movq mm1,[trizdq+ebp-4] + movq [trizdq+ebp-4],mm0 + movq [trizdq+ecx-4],mm1 + end if + jmp .loop + @@: + if Ext=NON + mov esi,[trizdd+ecx] + mov edi,[trizdd+eax+8] + mov [trizdd+eax+8],esi + mov [trizdd+ecx],edi + mov edi,[trizdd+ecx-4] + mov esi,[trizdd+eax+4] + mov [trizdd+eax+4],edi + mov [trizdd+ecx-4],esi + else + movq mm0,[trizdq+ecx-4] + movq mm1,[trizdq+eax+4]; dir + movq [trizdq+eax+4],mm0; dir + movq [trizdq+ecx-4],mm1 + end if + add ecx,8 + push ecx edx + mov edx,ebp + call quicksort + pop edx eax + call quicksort + .exit: + ret + insertsort: + mov esi,eax + .start: + add esi,8 + cmp esi,edx + ja .exit + mov ebx,[trizdd+esi] + if Ext=NON + mov ecx,[trizdd+esi-4] + else + movq mm1,[trizdq+esi-4] + end if + mov edi,esi + @@: + cmp edi,eax + jna @f + cmp [trizdd+edi-8],ebx + jg @f ; direction + if Ext=NON + mov ebp,[trizdd+edi-8] + mov [trizdd+edi],ebp + mov ebp,[trizdd+edi-12] + mov [trizdd+edi-4],ebp + else + movq mm0,[trizdq+edi-12] + movq [trizdq+edi-4],mm0 + end if + sub edi,8 + jmp @b + @@: + if Ext=NON + mov [trizdd+edi],ebx + mov [trizdd+edi-4],ecx + else + movq [trizdq+edi-4],mm1 + end if + jmp .start + .exit: + ret + end_sort: + ; translate triangles_with_z to sorted_triangles + mov esi,triangles_with_z + ; mov edi,sorted_triangles + mov edi,triangles + again_copy: + if Ext=NON + movsd + movsw + add esi,2 + else + movq mm0,[esi] + movq [edi],mm0 + add esi,8 + add edi,6 + end if + cmp dword[esi],-1 + jne again_copy +; if Ext=MMX +; emms +; end if + movsd ; copy end mark too +ret + +clrscr: + mov edi,screen + mov ecx,SIZE_X*SIZE_Y*3/4 + xor eax,eax + if Ext=NON + rep stosd + else + pxor mm0,mm0 + @@: + movq [edi+00],mm0 + movq [edi+08],mm0 + movq [edi+16],mm0 + movq [edi+24],mm0 + add edi,32 + sub ecx,8 + jnc @b + end if +ret + +calculate_angle: + fninit +; fldpi +; fidiv [i180] + fld [piD180] + fimul [angle_counter] + fsincos + fstp [sinbeta] + fstp [cosbeta] + inc [angle_counter] + cmp [angle_counter],360 + jne end_calc_angle + mov [angle_counter],0 + end_calc_angle: +ret + +rotate_points: + fninit + mov ebx,points_rotated + again_r: + cmp [r_flag],1 + je .z_rot + cmp [r_flag],2 + je .x_rot + .y_rot: + mov eax,[ebx+2] ;z + mov ax,word[ebx] ;x + sub eax,dword[xo] + mov dword[xsub],eax + fld [sinbeta] + fimul [zsub] + fchs + fld [cosbeta] + fimul [xsub] + faddp + fiadd [xo] + fistp word[ebx] ;x + fld [sinbeta] + fimul [xsub] + fld [cosbeta] + fimul [zsub] + faddp + fiadd [zo] + fistp word[ebx+4] ;z + jmp .end_rot + .z_rot: + mov ax,word[ebx] + sub ax,word[xo] ;need optimization + mov [xsub],ax + mov ax,word[ebx+2] + sub ax,word[yo] + mov [ysub],ax + fld [sinbeta] + fimul [ysub] + fld [cosbeta] + fimul [xsub] + faddp + fiadd [xo] + fistp word[ebx] + fld [cosbeta] + fimul [ysub] + fld [sinbeta] + fimul [xsub] + fchs + faddp + fiadd [yo] + fistp word[ebx+2] + jmp .end_rot + .x_rot: + mov ax,word[ebx+2] + sub ax,[yo] + mov [ysub],ax + mov ax,word[ebx+4] + sub ax,word[zo] + mov [zsub],ax + fld [sinbeta] + fimul [zsub] + fld [cosbeta] + fimul [ysub] + faddp + fiadd [yo] + fistp word[ebx+2];y + fld [cosbeta] + fimul [zsub] + fld [sinbeta] + fimul [ysub] + fchs + faddp + fiadd [zo] + fistp word[ebx+4] + .end_rot: + add ebx,6 + cmp dword[ebx],-1 + jne again_r +ret + +draw_triangles: + mov esi,triangles + .again_dts: + mov ebp,points_rotated + if Ext=NON + movzx eax,word[esi] + mov [point_index1],ax + lea eax,[eax*3] + add eax,eax + push ebp + add ebp,eax + mov eax,[ebp] + mov dword[xx1],eax + mov eax,[ebp+4] + mov [zz1],ax + pop ebp + + + movzx eax,word[esi+2] + mov [point_index2],ax + lea eax,[eax*3] + add eax,eax + push ebp + add ebp,eax + mov eax,[ebp] + mov dword[xx2],eax + mov eax,[ebp+4] + mov [zz2],ax + pop ebp + + + movzx eax,word[esi+4] ; xyz3 = [ebp+[esi+4]*6] + mov [point_index3],ax + lea eax,[eax*3] + add eax,eax + ; push ebp + add ebp,eax + mov eax,[ebp] + mov dword[xx3],eax + mov eax,[ebp+4] + mov [zz3],ax + else + mov eax,dword[esi] ; don't know MMX + mov dword[point_index1],eax + ; shr eax,16 + ; mov [point_index2],ax + mov ax,word[esi+4] + mov [point_index3],ax + movq mm0,[esi] + pmullw mm0,qword[const6] + movd eax,mm0 + psrlq mm0,16 + movd ebx,mm0 + psrlq mm0,16 + movd ecx,mm0 + and eax,0FFFFh + and ebx,0FFFFh + and ecx,0FFFFh + movq mm0,[ebp+eax] + movq mm1,[ebp+ebx] + movq mm2,[ebp+ecx] + movq qword[xx1],mm0 + movq qword[xx2],mm1 + movq qword[xx3],mm2 +; emms + end if + push esi + ; culling + fninit + mov esi,point_index1 + mov ecx,3 + @@: + movzx eax,word[esi] + lea eax,[eax*3] + shl eax,2 + lea eax,[eax+point_normals_rotated] + fld dword[eax+8] + ftst + fstsw ax + sahf + jb @f + ffree st + loop @b + jmp .end_draw + @@: + ffree st ;is visable + + cmp [dr_flag],0 ; draw type flag + je .flat_draw + cmp [dr_flag],2 + je .env_mapping + + movzx edi,[point_index3] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + cmp [catmull_flag],0 + je @f + push [zz3] + @@: + push word[edi] + push word[edi+2] + push word[edi+4] + movzx edi,[point_index2] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + cmp [catmull_flag],0 + je @f + push [zz2] + @@: + push word[edi] + push word[edi+2] + push word[edi+4] + movzx edi,[point_index1] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + cmp [catmull_flag],0 + je @f + push [zz1] + @@: + push word[edi] + push word[edi+2] + push word[edi+4] + + ; 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 [max_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 [max_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 [max_color_r] + ; fistp [temp_col] + ; and [temp_col],0x00ff + ; push [temp_col] + ; push [temp_col] + ; push [temp_col] + +; xor edx,edx ; draw acording to position +; mov ax,[zz3] +; add ax,128 +; neg al +; and ax,0x00ff +; push ax +; neg al +; push ax +; mov dx,[yy3] +; and dx,0x00ff +; push dx +; mov ax,[zz2] +; add ax,128 +; neg al +; and ax,0x00ff +; push ax +; neg al +; push ax +; mov dx,[yy2] +; and dx,0x00ff +; push dx +; mov ax,[zz1] +; add ax,128 +; neg al +; and ax,0x00ff +; push ax +; neg al +; push ax +; mov dx,[yy1] +; and dx,0x00ff +; push dx + mov eax,dword[xx1] + ror eax,16 + mov ebx,dword[xx2] + ror ebx,16 + mov ecx,dword[xx3] + ror ecx,16 + lea edi,[screen] + cmp [catmull_flag],0 + je @f + lea esi,[Z_buffer] + call gouraud_triangle_z + jmp .end_draw + @@: + call gouraud_triangle + jmp .end_draw + .flat_draw: + + movzx edi,[point_index3] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + movzx eax,word[edi] + movzx ebx,word[edi+2] + movzx ecx,word[edi+4] + movzx edi,[point_index2] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + add ax,word[edi] + add bx,word[edi+2] + add cx,word[edi+4] + movzx edi,[point_index1] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + add ax,word[edi] + add bx,word[edi+2] + add cx,word[edi+4] + cwd + idiv [i3] + mov di,ax + shl edi,16 + mov ax,bx + cwd + idiv [i3] + mov di,ax + shl di,8 + mov ax,cx + cwd + idiv [i3] + mov edx,edi + mov dl,al + and edx,0x00ffffff + + + ; 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 + mov ebx,dword[xx2] + ror ebx,16 + mov ecx,dword[xx3] + ror ecx,16 + ; mov edi,screen + lea edi,[screen] + cmp [catmull_flag],0 + je @f + lea esi,[Z_buffer] + push word[zz3] + push word[zz2] + push word[zz1] + call flat_triangle_z + jmp .end_draw + @@: + call draw_triangle + jmp .end_draw + .env_mapping: + ; fninit + mov esi,point_index1 + sub esp,12 + mov edi,esp + mov ecx,3 + @@: + movzx eax,word[esi] + lea eax,[eax*3] + shl eax,2 + add eax,point_normals_rotated + ; 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] + + add edi,4 + add esi,2 + loop @b + + mov eax,dword[xx1] + ror eax,16 + mov ebx,dword[xx2] + ror ebx,16 + mov ecx,dword[xx3] + ror ecx,16 + mov edi,screen + mov esi,envmap + call tex_triangle + + .end_draw: + pop esi + add esi,6 + cmp dword[esi],-1 + jne .again_dts +ret +translate_points: +; fninit +; mov ebx,points_rotated +; again_trans: +; fild word[ebx+4] ;z1 +; fmul [sq] +; fld st +; fiadd word[ebx] ;x1 +; fistp word[ebx] +; fchs +; fiadd word[ebx+2] ;y1 +; fistp word[ebx+2] ;y1 + +; add ebx,6 +; cmp dword[ebx],-1 +; jne again_trans +;ret +translate_perspective_points: ;translate points from 3d to 2d using + fninit ;perspective equations + mov ebx,points_rotated + .again_trans: + fild word[ebx] + fisub [xobs] + fimul [zobs] + fild word[ebx+4] + fisub [zobs] + fdivp + fiadd [xobs] + fistp word[ebx] + fild word[ebx+2] + fisub [yobs] + fimul [zobs] + fild word[ebx+4] + fisub [zobs] + fdivp + fchs + fiadd [yobs] + fistp word[ebx+2] + add ebx,6 + cmp dword[ebx],-1 + jne .again_trans +ret + + +copy_points: + mov esi,points + mov edi,points_rotated + mov ecx,points_count*3+2 + rep movsw +ret + + + +read_from_file: + mov edi,triangles + xor ebx,ebx + xor ebp,ebp + mov esi,SourceFile + cmp [esi],word 4D4Dh + jne .exit ;Must be legal .3DS file + cmp dword[esi+2],EndFile-SourceFile + jne .exit ;This must tell the length + add esi,6 + @@: + cmp [esi],word 3D3Dh + je @f + add esi,[esi+2] + jmp @b + @@: + add esi,6 + .find4k: + cmp [esi],word 4000h + je @f + add esi,[esi+2] + cmp esi,EndFile + jc .find4k + jmp .exit + @@: + add esi,6 + @@: + cmp [esi],byte 0 + je @f + inc esi + jmp @b + @@: + inc esi + @@: + cmp [esi],word 4100h + je @f + add esi,[esi+2] + jmp @b + @@: + add esi,6 + @@: + cmp [esi],word 4110h + je @f + add esi,[esi+2] + jmp @b + @@: + movzx ecx,word[esi+6] + mov [points_count_var],cx + mov edx,ecx + add esi,8 + @@: + fld dword[esi+4] + fmul [sscale] + fadd [xoffset] + fld dword[esi+8] + fchs + fmul [sscale] + fadd [yoffset] + fld dword[esi+0] + fchs + fmul [sscale] + fistp word[points+ebx+4] + fistp word[points+ebx+2] + fistp word[points+ebx+0] + add ebx,6 + add esi,12 + dec ecx + jnz @b + @@: + mov dword[points+ebx],-1 + @@: + cmp [esi],word 4120h + je @f + add esi,[esi+2] + jmp @b + @@: + movzx ecx,word[esi+6] + mov [triangles_count_var],cx + add esi,8 + ;mov edi,triangles + @@: + movsd + movsw + add word[edi-6],bp + add word[edi-4],bp + add word[edi-2],bp + add esi,2 + dec ecx + jnz @b + add ebp,edx + jmp .find4k + + .exit: + mov dword[edi],-1 +ret + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + draw_window: + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 + + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,100*65536+SIZE_X+80 ; [x start] *65536 + [x size] + mov ecx,100*65536+SIZE_Y+30 ; [y start] *65536 + [y size] + mov edx,0x04000000 ; color of work area RRGGBB,8->color gl + mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl + mov edi,0x005080d0 ; color of frames RRGGBB + int 0x40 + + ; WINDOW LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,8*65536+8 ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + ; CLOSE BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+80-19)*65536+12 ; [x start] *65536 + [x size] + mov ecx,5*65536+12 ; [y start] *65536 + [y size] + mov edx,1 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + + ; ROTARY BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,25*65536+12 ; [y start] *65536 + [y size] + mov edx,2 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; ROTARY LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+28 ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelrot ; pointer to text beginning + mov esi,labelrotend-labelrot ; text length + int 0x40 + + ; DRAW MODE BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15)*65536+12 ; [y start] *65536 + [y size] + mov edx,3 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; DRAW MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+28+15 ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labeldrmod ; pointer to text beginning + mov esi,labeldrmodend-labeldrmod ; text length + int 0x40 + + ; SPEED BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*2)*65536+12 ; [y start] *65536 + [y size] + mov edx,4 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; SPEED MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*2) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelspeedmod ; pointer to text beginning + mov esi,labelspeedmodend-labelspeedmod ; text length + int 0x40 + + ; SCALE- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*3)*65536+12 ; [y start] *65536 + [y size] + mov edx,5 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; SCALE- MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*3) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzoomout ; pointer to text beginning + mov esi,labelzoomoutend-labelzoomout ; text length + int 0x40 + + ; SCALE+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*4)*65536+12 ; [y start] *65536 + [y size] + mov edx,6 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; SCALE+ MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*4) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzoomin ; pointer to text beginning + mov esi,labelzoominend-labelzoomin ; text length + int 0x40 + ; ADD VECTOR LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*5) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelvector ; pointer to text beginning + mov esi,labelvectorend-labelvector ; text length + int 0x40 + ; VECTOR Y- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*6)*65536+12 ; [y start] *65536 + [y size] + mov edx,7 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR Y- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*6) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelyminus ; pointer to text beginning + mov esi,labelyminusend-labelyminus ; text length + int 0x40 + ; VECTOR Z+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*6)*65536+12 ; [y start] *65536 + [y size] + mov edx,8 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR Z+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*6) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzplus ; pointer to text beginning + mov esi,labelzplusend-labelzplus ; text length + int 0x40 + ; VECTOR x- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*7)*65536+12 ; [y start] *65536 + [y size] + mov edx,9 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR x- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*7) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelxminus ; pointer to text beginning + mov esi,labelxminusend-labelxminus ; text length + int 0x40 + ; VECTOR x+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*7)*65536+12 ; [y start] *65536 + [y size] + mov edx,10 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR x+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*7) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelxplus ; pointer to text beginning + mov esi,labelxplusend-labelxplus ; text length + int 0x40 + ; VECTOR z- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*8)*65536+12 ; [y start] *65536 + [y size] + mov edx,11 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR z- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*8) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzminus ; pointer to text beginning + mov esi,labelzminusend-labelzminus ; text length + int 0x40 + ;VECTOR Y+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*8)*65536+12 ; [y start] *65536 + [y size] + mov edx,12 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR Y+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*8) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelyplus ; pointer to text beginning + mov esi,labelyplusend-labelyplus ; text length + int 0x40 + ; LEAD COLOR LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*9) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelmaincolor ; pointer to text beginning + mov esi,labelmaincolorend-labelmaincolor ; text length + int 0x40 + + ;RED+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] + mov edx,13 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;RED+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*10) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelredplus ; pointer to text beginning + mov esi,labelredplusend-labelredplus ; text length + int 0x40 + ;GREEN+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] + mov edx,14 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;GREEN+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*10) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelgreenplus ; pointer to text beginning + mov esi,labelgreenplusend-labelgreenplus ; text length + int 0x40 + ;BLUE+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] + mov edx,15 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;BLUE+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*10) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelblueplus ; pointer to text beginning + mov esi,labelblueplusend-labelblueplus ; text length + int 0x40 + ;RED- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] + mov edx,16 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;RED- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*11) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelredminus ; pointer to text beginning + mov esi,labelredminusend-labelredminus ; text length + int 0x40 + ;GREEN- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] + mov edx,17 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;GREEN- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*11) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelgreenminus ; pointer to text beginning + mov esi,labelgreenminusend-labelgreenminus ; text length + int 0x40 + ;BLUE- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] + mov edx,18 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;BLUE- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*11) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelblueminus ; pointer to text beginning + mov esi,labelblueminusend-labelblueminus ; text length + int 0x40 + ; Catmull LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*12) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelcatmullmod ; pointer to text beginning + mov esi,labelcatmullmodend-labelcatmullmod ; text length + int 0x40 + ; on/off BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*13)*65536+12 ; [y start] *65536 + [y size] + mov edx,19 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; on/off LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*13) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelonoff ; pointer to text beginning + mov esi,labelonoffend-labelonoff ; text length + int 0x40 + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + + ; DATA AREA + i3 dw 3 + light_vector dd 0.0,0.0,-1.0 + ; debug_vector dd 0.0,2.0,2.0 ;--debug + ; debug_vector1 dd 0.0,0.0,0.0 + ; debug_points dw 1,1,1,3,4,20 + ; debug_dd dw ? + ; debug_dwd dd 65535 + ; debug_counter dw 0 + dot_max dd 1.0 + dot_min dd 0.0 + env_const dd 1.2 + correct_tex dw 255 + max_color_r dw 255 + max_color_g dw 25 + max_color_b dw 35 + xobs dw SIZE_X / 2 ;200 ;observer + yobs dw SIZE_Y / 2 ;200 ;coordinates + zobs dw -500 + + + angle_counter dw 0 + piD180 dd 0.017453292519943295769236907684886 + ; sq dd 0.70710678118654752440084436210485 + const6 dw 6,6,6,6 + xo dw 130;87 + zo dw 0 + yo dw 100 + xoffset dd 130.0 + yoffset dd 150.0 + sscale dd 6.0 ; real scale + vect_x dw 0 + vect_y dw 0 + vect_z dw 0 + + + r_flag db 0 + dr_flag db 2 + speed_flag db 0 + catmull_flag db 0 + SourceFile file 'hrt.3ds' + EndFile: + labelrot: + db 'rot. mode' + labelrotend: + labeldrmod: + db 'shd. mode' + labeldrmodend: + labelspeedmod: + db 'spd. mode' + labelspeedmodend: + labelzoomout: + db 'zoom out' + labelzoomoutend: + labelzoomin: + db 'zoom in' + labelzoominend: + labelvector: + db 'add vector' + labelvectorend: + labelyminus: + db 'y -' + labelyminusend: + labelzplus: + db 'z +' + labelzplusend: + labelxminus: + db 'x -' + labelxminusend: + labelxplus: + db 'x +' + labelxplusend: + labelzminus: + db 'z -' + labelzminusend: + labelyplus: + db 'y +' + labelyplusend: + labelmaincolor: + db 'main color' + labelmaincolorend: + labelredplus: + db 'r +' + labelredplusend: + labelgreenplus: + db 'g +' + labelgreenplusend: + labelblueplus: + db 'b +' + labelblueplusend: + labelredminus: + db 'r -' + labelredminusend: + labelgreenminus: + db 'g -' + labelgreenminusend: + labelblueminus: + db 'b -' + labelblueminusend: + labelcatmullmod: + db 'catmull' + labelcatmullmodend: + labelonoff: + db 'on/off' + labelonoffend: + labelt: + db 'DEUS CARITAS EST' + if Ext=MMX + db ' (MMX)' + end if + labellen: + STRdata db '-1 ' +align 8 + @col dd ? + @y1 dw ? + @x1 dw ?;+8 + @y2 dw ? + @x2 dw ? + @y3 dw ? + @x3 dw ?;+16 + + @dx12 dd ? + @dx13 dd ?;+24 + @dx23 dd ? + + sinbeta dd ?;+32 + cosbeta dd ? + + xsub dw ? + zsub dw ?;+40 + ysub dw ? + + xx1 dw ? + yy1 dw ? + zz1 dw ?;+48 + xx2 dw ? + yy2 dw ? + zz2 dw ? + xx3 dw ?;+56 + yy3 dw ? + zz3 dw ? + scale dd ? ; help scale variable + ;screen dd ? ;pointer to screen buffer + triangles_count_var dw ? + points_count_var dw ? + + + point_index1 dw ? ;-\ + point_index2 dw ? ; } don't change order + point_index3 dw ? ;-/ + temp_col dw ? + high dd ? +align 8 + buffer dq ? + + err dd ? + drr dd ? + xx dd ? + yy dd ? + xst dd ? + yst dd ? +align 16 + points: + rw (EndFile-SourceFile)/12*3 + points_count = ($-points)/6 + triangles: + rw (EndFile-SourceFile)/12*3 + triangles_count = ($-triangles)/6 + +align 16 + points_rotated rw points_count*3 + 2 +align 16 + label trizdd dword + label trizdq qword + triangles_with_z rw triangles_count*4 + 2 ; triangles triple dw + z position +align 16 + triangles_normals rb triangles_count * 12 ; + point_normals rb points_count * 12 ;one 3dvector - triple float dword x,y,z +align 16 + point_normals_rotated rb points_count * 12 +align 16 + vectors rb 24 + points_color rb 6*points_count ; each color as word +; sorted_triangles rw triangles_count*3 + 2 +;align 16 + screen rb SIZE_X * SIZE_Y * 3 ; screen buffer + Z_buffer rb SIZE_X * SIZE_Y * 4 + envmap rb 512*512*3 + memStack rb 1000 ;memory area for stack + I_END: \ No newline at end of file diff --git a/programs/demos/3DS/3DSTPOT.ASM b/programs/demos/3DS/3DSTPOT.ASM new file mode 100644 index 0000000000..c57fef8f44 --- /dev/null +++ b/programs/demos/3DS/3DSTPOT.ASM @@ -0,0 +1,1991 @@ +; +; application : Cruce - app shows three models shading +; compiler : FASM 1.65.13 +; system : KolibriOS/MenuetOS +; author : macgub +; email : macgub3@wp.pl +; web : www.menuet.xt.pl +; Fell free to use this intro in your own distribution of KolibriOS/MenuetOS. +; Special greetings to all MenuetOS maniax in the world. +; I hope because my intros Christian Belive will be near to each of You. + + +; Some adjustments made by Madis Kalme +; madis.kalme@mail.ee +; I tried optimizing it a bit, but don't know if it was successful. The objects +; can be: +; 1) Read from a file (*.3DS standard) +; 2) Written in manually (at the end of the code) + +; Now the program uses window style Y=4 - 19.10.2007, by Ataualpa + +SIZE_X equ 250 +SIZE_Y equ 250 +TIMEOUT equ 4 +ROUND equ 10 +TEX_X equ 512 ; texture width +TEX_Y equ 512 ; height +TEX_SHIFT equ 9 ; texture widith shifting +TEX equ SHIFTING ; TEX={SHIFTING | FLUENTLY} +FLUENTLY = 0 +SHIFTING = 1 +;CATMULL_SHIFT equ 8 +NON = 0 +MMX = 1 + +Ext = MMX ;Ext={ NON | MMX} + +use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd I_END ; memory for app + dd I_END ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +START: ; start of execution + cld + ; call alloc_buffer_mem + call read_from_file + call init_triangles_normals + call init_point_normals + call init_envmap + call draw_window + + +still: + mov eax,23 ; wait here for event with timeout + mov ebx,TIMEOUT + cmp [speed_flag],1 + jne .skip + mov eax,11 + .skip: + int 0x40 + + cmp eax,1 ; redraw request ? + je red + cmp eax,2 ; key in buffer ? + je key + cmp eax,3 ; button in buffer ? + je button + + jmp noclose + + red: ; redraw + call draw_window + jmp noclose + + key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + jmp noclose + + button: ; button + mov eax,17 ; get id + int 0x40 + + cmp ah,1 ; button id=1 ? + jne .ch_another + + mov eax,-1 ; close this program + int 0x40 + .ch_another: + cmp ah,2 + jne .ch_another1 + inc [r_flag] + cmp [r_flag],3 + jne noclose + mov [r_flag],0 + .ch_another1: + cmp ah,3 + jne .ch_another2 + inc [dr_flag] + cmp [dr_flag],3 + jne noclose + mov [dr_flag],0 + .ch_another2: + cmp ah,4 ; toggle speed + jne @f + inc [speed_flag] + cmp [speed_flag],2 + jne noclose + mov [speed_flag],0 + @@: + cmp ah,5 + jne @f ;scale- + mov [scale],0.7 + fninit + fld [sscale] + fmul [scale] + fstp [sscale] + call read_from_file + mov ax,[vect_x] ;-- last change + mov bx,[vect_y] + mov cx,[vect_z] + call add_vector +; call do_scale + @@: + cmp ah,6 + jne @f ; scale+ + mov [scale],1.3 + fninit + fld [sscale] + fmul [scale] + fstp [sscale] + call read_from_file + mov ax,[vect_x] + mov bx,[vect_y] + mov cx,[vect_z] + call add_vector + call init_triangles_normals + call init_point_normals + @@: + cmp ah,7 + jne @f + xor ax,ax ;add vector to object and rotary point + mov bx,-10 + xor cx,cx + call add_vector + sub [vect_y],10 + sub [yo],10 + @@: + cmp ah,8 + jne @f + xor ax,ax + xor bx,bx + mov cx,10 + call add_vector + add [vect_z],10 + add [zo],10 + @@: + cmp ah,9 + jne @f + mov ax,-10 + xor bx,bx + xor cx,cx + call add_vector + sub [vect_x],10 + sub [xo],10 + @@: + cmp ah,10 + jne @f + mov ax,10 + xor bx,bx + xor cx,cx + call add_vector + add [vect_x],10 + add [xo],10 + @@: + cmp ah,11 + jne @f + xor ax,ax + xor bx,bx + mov cx,-10 + call add_vector + sub [vect_z],10 + sub [zo],10 + @@: + cmp ah,12 + jne @f + xor ax,ax + mov bx,10 + xor cx,cx + call add_vector + add [vect_y],10 + add [yo],10 + @@: + cmp ah,13 ; change main color - + jne @f ; - lead color setting + cmp [max_color_r],245 + jge @f + add [max_color_r],10 + call init_envmap + @@: + cmp ah,14 + jne @f + cmp [max_color_g],245 + jge @f + add [max_color_g],10 + call init_envmap + @@: + cmp ah,15 + jne @f + cmp [max_color_b],245 + jge @f + add [max_color_b],10 + call init_envmap + @@: + cmp ah,16 ; change main color + jne @f + cmp [max_color_r],10 + jle @f + sub [max_color_r],10 + call init_envmap + @@: + cmp ah,17 + jne @f + cmp [max_color_g],10 + jle @f + sub [max_color_g],10 + call init_envmap + @@: + cmp ah,18 + jne @f + cmp [max_color_b],10 + jle @f + sub [max_color_b],10 + call init_envmap + @@: + cmp ah,19 + jne @f + inc [catmull_flag] + cmp [catmull_flag],2 + jne @f + mov [catmull_flag],0 + @@: + noclose: + + call calculate_angle ; calculates sinus and cosinus + call copy_point_normals + ; copy normals and rotate the copy using sin/cosbeta - best way + call rotate_point_normals + call calculate_colors + call copy_points + call rotate_points + call translate_perspective_points; translate from 3d to 2d + call clrscr ; clear the screen + cmp [dr_flag],2 + je @f + cmp [catmull_flag],1 ;if env_mapping sort faces + je @f + @@: + call sort_triangles + @@: + call fill_Z_buffer + + RDTSC + push eax + call draw_triangles ; draw all triangles from the list + + RDTSC + sub eax,[esp] + sub eax,41 + ; lea esi,[debug_points] + ; lea edi,[debug_points+6] + ; lea ebx,[debug_vector1] + ; call make_vector + ; fninit + ; fld [sinbeta_one] + ; fimul [debug_dwd] + ; fistp [debug_dd] + ; movzx eax,[debug_dd] + + + mov ecx,10 + .dc: + xor edx,edx + mov edi,10 + div edi + add dl,30h + mov [STRdata+ecx-1],dl + loop .dc + pop eax +macro show +{ + mov eax,7 ; put image + mov ebx,screen + mov ecx,SIZE_X shl 16 + SIZE_Y + mov edx,5 shl 16 + 20 + int 0x40 +} + show + mov eax,4 ; function 4 : write text to window + mov ebx,5*65536+23 ; [x start] *65536 + [y start] + mov ecx,-1 + mov edx,STRdata ; pointer to text beginning + mov esi,10 ; text length + int 40h + + + + jmp still + +;-------------------------------------------------------------------------------- +;-------------------------PROCEDURES--------------------------------------------- +;-------------------------------------------------------------------------------- +include "tex3.asm" +include "flat_cat.asm" +include "grd_cat.asm" +include "3dmath.asm" +include "grd3.asm" +include "flat3.asm" + + +;alloc_buffer_mem: +; mov eax,68 +; mov ebx,5 +; mov ecx,SIZE_X*SIZE_Y*3 +; int 0x40 +; mov [screen],eax +;ret +init_envmap: + +.temp equ word [ebp-2] + push ebp + mov ebp,esp + sub esp,2 + mov edi,envmap + fninit + + mov dx,-256 + .ie_ver: + mov cx,-256 + .ie_hor: + mov .temp,cx + fild .temp + fmul st,st0 + mov .temp,dx + fild .temp + fmul st,st0 + faddp + fsqrt + mov .temp,254 + fisubr .temp + fmul [env_const] + fistp .temp + mov ax,.temp + + or ax,ax + jge .ie_ok1 + xor ax,ax + jmp .ie_ok2 + .ie_ok1: + cmp ax,254 + jle .ie_ok2 + mov ax,254 + .ie_ok2: + push dx + mov bx,ax + mul [max_color_b] + shr ax,8 + stosb + mov ax,bx + mul [max_color_g] + shr ax,8 + stosb + mov ax,bx + mul [max_color_r] + shr ax,8 + stosb + pop dx + + inc cx + cmp cx,256 + jne .ie_hor + + inc dx + cmp dx,256 + jne .ie_ver + + mov esp,ebp + pop ebp +macro debug +{ + mov edi,envmap + mov ecx,512*512*3/4 + mov eax,0xffffffff + rep stosd +} +ret +calculate_colors: + fninit + xor ebx,ebx + movzx ecx,[points_count_var] + lea ecx,[ecx*3] + add ecx,ecx + .cc_again: + mov esi,light_vector + lea edi,[point_normals_rotated+ebx*2] + call dot_product + fcom [dot_min] + fstsw ax + sahf + ja .cc_ok1 + ffree st + mov dword[points_color+ebx],0 + mov word[points_color+ebx+4],0 + add ebx,6 + cmp ebx,ecx + jne .cc_again + jmp .cc_done + .cc_ok1: + fcom [dot_max] + fstsw ax + sahf + jb .cc_ok2 + ffree st + mov dword[points_color+ebx],0 ; clear r,g,b + mov word[points_color+ebx+4],0 + add ebx,6 + cmp ebx,ecx + jne .cc_again + jmp .cc_done + .cc_ok2: + fld st + fld st + fimul [max_color_r] + fistp word[points_color+ebx] ;each color as word + fimul [max_color_g] + fistp word[points_color+ebx+2] + fimul [max_color_b] + fistp word[points_color+ebx+4] + add ebx,6 + cmp ebx,ecx + jne .cc_again + .cc_done: +ret +copy_point_normals: + movzx ecx,[points_count_var] + shl ecx,2 + inc ecx + mov esi,point_normals + mov edi,point_normals_rotated + rep movsd +ret +rotate_point_normals: + movzx ecx,[points_count_var] + mov ebx,point_normals_rotated + fninit ; for now only rotate around Z axle + .again_r: + cmp [r_flag],1 + je .z_rot + cmp [r_flag],2 + je .x_rot + + .y_rot: + fld dword[ebx] ; x + fld [sinbeta] + fmul dword[ebx+8] ; z * sinbeta + fchs + fld [cosbeta] + fmul dword[ebx] ; x * cosbeta + faddp + fstp dword[ebx] ; new x + fmul [sinbeta] ; old x * sinbeta + fld [cosbeta] + fmul dword[ebx+8] ; z * cosbeta + faddp + fstp dword[ebx+8] ; new z + add ebx,12 + loop .y_rot + jmp .end_rot + .z_rot: + fld dword[ebx] ;x + fld [sinbeta] + fmul dword[ebx+4] ;y + fld [cosbeta] + fmul dword[ebx] ;x + faddp + fstp dword[ebx] ;new x + fmul [sinbeta] ; sinbeta * old x + fchs + fld [cosbeta] + fmul dword[ebx+4] ; cosbeta * y + faddp + fstp dword[ebx+4] ; new y + add ebx,12 + loop .z_rot + jmp .end_rot + .x_rot: + fld dword[ebx+4] ;y + fld [sinbeta] + fmul dword[ebx+8] ;z + fld [cosbeta] + fmul dword[ebx+4] ;y + faddp + fstp dword[ebx+4] ; new y + fmul [sinbeta] ; sinbeta * old y + fchs + fld [cosbeta] + fmul dword[ebx+8] + faddp + fstp dword[ebx+8] + add ebx,12 + loop .x_rot + .end_rot: +ret +init_triangles_normals: + mov ebx,triangles_normals + mov ebp,triangles + @@: + push ebx + 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 + 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 + add ebx,12 + mov esi,edi + movzx edi,word[ebp+4] ; third point index + lea edi,[edi*3] + lea edi,[points+edi*2] + call make_vector + mov edi,ebx ; edi - pointer to 2nd vector + mov esi,ebx + sub esi,12 ; esi - pointer to 1st vector + pop ebx + call cross_product + mov edi,ebx + call normalize_vector + add ebp,6 + add ebx,12 + cmp dword[ebp],-1 + jne @b +ret + +init_point_normals: +.x equ dword [ebp-4] +.y equ dword [ebp-8] +.z equ dword [ebp-12] +.point_number equ word [ebp-26] +.hit_faces equ word [ebp-28] + + fninit + mov ebp,esp + sub esp,28 + mov edi,point_normals + mov .point_number,0 + .ipn_loop: + mov .hit_faces,0 + mov .x,0 + mov .y,0 + mov .z,0 + mov esi,triangles + xor ecx,ecx ; ecx - triangle number + .ipn_check_face: + xor ebx,ebx ; ebx - 'position' in one triangle + .ipn_check_vertex: + movzx eax,word[esi+ebx] ; eax - point_number + cmp ax,.point_number + jne .ipn_next_vertex + push esi + mov esi,ecx + lea esi,[esi*3] + lea esi,[triangles_normals+esi*4] + ; shl esi,2 + ; add esi,triangles_normals + + fld .x + fadd dword[esi+vec_x] + fstp .x + fld .y + fadd dword[esi+vec_y] + fstp .y + fld .z + fadd dword[esi+vec_z] + fstp .z + pop esi + inc .hit_faces + jmp .ipn_next_face + .ipn_next_vertex: + add ebx,2 + cmp ebx,6 + jne .ipn_check_vertex + .ipn_next_face: + add esi,6 + inc ecx + cmp cx,[triangles_count_var] + jne .ipn_check_face + + fld .x + fidiv .hit_faces + fstp dword[edi+vec_x] + fld .y + fidiv .hit_faces + fstp dword[edi+vec_y] + fld .z + fidiv .hit_faces + fstp dword[edi+vec_z] + call normalize_vector + add edi,12 ;type vector 3d + inc .point_number + mov dx,.point_number + cmp dx,[points_count_var] + jne .ipn_loop + + mov esp,ebp +ret + +add_vector: + mov ebp,points + @@: + add word[ebp],ax + add word[ebp+2],bx + add word[ebp+4],cx + add ebp,6 + cmp dword[ebp],-1 + jne @b +ret +;do_scale: +; fninit +; mov ebp,points +; .next_sc: +; fld1 +; fsub [scale] +; fld st +; fimul [xo] +; fld [scale] +; fimul word[ebp] ;x +; faddp +; fistp word[ebp] +; fld st +; fimul [yo] +; fld [scale] +; fimul word[ebp+2] +; faddp +; fistp word[ebp+2] +; fimul [zo] +; fld [scale] +; fimul word[ebp+4] +; faddp +; fistp word[ebp+4] +; add ebp,6 +; cmp dword[ebp],-1 +; jne .next_sc +;ret +sort_triangles: + mov esi,triangles + mov edi,triangles_with_z + mov ebp,points_rotated + + make_triangle_with_z: ;makes list with triangles and z position + movzx eax,word[esi] + lea eax,[eax*3] + movzx ecx,word[ebp+eax*2+4] + + movzx eax,word[esi+2] + lea eax,[eax*3] + add cx,word[ebp+eax*2+4] + + movzx eax,word[esi+4] + lea eax,[eax*3] + add cx,word[ebp+eax*2+4] + + mov ax,cx + ; cwd + ; idiv word[i3] + movsd ; store vertex coordinates + movsw + stosw ; middle vertex coordinate 'z' in triangles_with_z list + cmp dword[esi],-1 + jne make_triangle_with_z + movsd ; copy end mark + mov eax,4 + lea edx,[edi-8-trizdd] + mov [high],edx + call quicksort + mov eax,4 + mov edx,[high] + call insertsort + jmp end_sort + + quicksort: + mov ecx,edx + sub ecx,eax + cmp ecx,32 + jc .exit + lea ecx,[eax+edx] + shr ecx,4 + lea ecx,[ecx*8-4]; i + mov ebx,[trizdd+eax]; trizdd[l] + mov esi,[trizdd+ecx]; trizdd[i] + mov edi,[trizdd+edx]; trizdd[h] + cmp ebx,esi + jg @f ; direction NB! you need to negate these to invert the order + if Ext=NON + mov [trizdd+eax],esi + mov [trizdd+ecx],ebx + mov ebx,[trizdd+eax-4] + mov esi,[trizdd+ecx-4] + mov [trizdd+eax-4],esi + mov [trizdd+ecx-4],ebx + mov ebx,[trizdd+eax] + mov esi,[trizdd+ecx] + else + movq mm0,[trizdq+eax-4] + movq mm1,[trizdq+ecx-4] + movq [trizdq+ecx-4],mm0 + movq [trizdq+eax-4],mm1 + xchg ebx,esi + end if + @@: + cmp ebx,edi + jg @f ; direction + if Ext=NON + mov [trizdd+eax],edi + mov [trizdd+edx],ebx + mov ebx,[trizdd+eax-4] + mov edi,[trizdd+edx-4] + mov [trizdd+eax-4],edi + mov [trizdd+edx-4],ebx + mov ebx,[trizdd+eax] + mov edi,[trizdd+edx] + else + movq mm0,[trizdq+eax-4] + movq mm1,[trizdq+edx-4] + movq [trizdq+edx-4],mm0 + movq [trizdq+eax-4],mm1 + xchg ebx,edi + end if + @@: + cmp esi,edi + jg @f ; direction + if Ext=NON + mov [trizdd+ecx],edi + mov [trizdd+edx],esi + mov esi,[trizdd+ecx-4] + mov edi,[trizdd+edx-4] + mov [trizdd+ecx-4],edi + mov [trizdd+edx-4],esi + else + movq mm0,[trizdq+ecx-4] + movq mm1,[trizdq+edx-4] + movq [trizdq+edx-4],mm0 + movq [trizdq+ecx-4],mm1 +; xchg ebx,esi + end if + @@: + mov ebp,eax ; direction + add ebp,8 ; j + if Ext=NON + mov esi,[trizdd+ebp] + mov edi,[trizdd+ecx] + mov [trizdd+ebp],edi + mov [trizdd+ecx],esi + mov esi,[trizdd+ebp-4] + mov edi,[trizdd+ecx-4] + mov [trizdd+ecx-4],esi + mov [trizdd+ebp-4],edi + else + movq mm0,[trizdq+ebp-4] + movq mm1,[trizdq+ecx-4] + movq [trizdq+ecx-4],mm0 + movq [trizdq+ebp-4],mm1 + end if + mov ecx,edx ; i; direction + mov ebx,[trizdd+ebp]; trizdd[j] + .loop: + sub ecx,8 ; direction + cmp [trizdd+ecx],ebx + jl .loop ; direction + @@: + add ebp,8 ; direction + cmp [trizdd+ebp],ebx + jg @b ; direction + cmp ebp,ecx + jge @f ; direction + if Ext=NON + mov esi,[trizdd+ecx] + mov edi,[trizdd+ebp] + mov [trizdd+ebp],esi + mov [trizdd+ecx],edi + mov edi,[trizdd+ecx-4] + mov esi,[trizdd+ebp-4] + mov [trizdd+ebp-4],edi + mov [trizdd+ecx-4],esi + else + movq mm0,[trizdq+ecx-4] + movq mm1,[trizdq+ebp-4] + movq [trizdq+ebp-4],mm0 + movq [trizdq+ecx-4],mm1 + end if + jmp .loop + @@: + if Ext=NON + mov esi,[trizdd+ecx] + mov edi,[trizdd+eax+8] + mov [trizdd+eax+8],esi + mov [trizdd+ecx],edi + mov edi,[trizdd+ecx-4] + mov esi,[trizdd+eax+4] + mov [trizdd+eax+4],edi + mov [trizdd+ecx-4],esi + else + movq mm0,[trizdq+ecx-4] + movq mm1,[trizdq+eax+4]; dir + movq [trizdq+eax+4],mm0; dir + movq [trizdq+ecx-4],mm1 + end if + add ecx,8 + push ecx edx + mov edx,ebp + call quicksort + pop edx eax + call quicksort + .exit: + ret + insertsort: + mov esi,eax + .start: + add esi,8 + cmp esi,edx + ja .exit + mov ebx,[trizdd+esi] + if Ext=NON + mov ecx,[trizdd+esi-4] + else + movq mm1,[trizdq+esi-4] + end if + mov edi,esi + @@: + cmp edi,eax + jna @f + cmp [trizdd+edi-8],ebx + jg @f ; direction + if Ext=NON + mov ebp,[trizdd+edi-8] + mov [trizdd+edi],ebp + mov ebp,[trizdd+edi-12] + mov [trizdd+edi-4],ebp + else + movq mm0,[trizdq+edi-12] + movq [trizdq+edi-4],mm0 + end if + sub edi,8 + jmp @b + @@: + if Ext=NON + mov [trizdd+edi],ebx + mov [trizdd+edi-4],ecx + else + movq [trizdq+edi-4],mm1 + end if + jmp .start + .exit: + ret + end_sort: + ; translate triangles_with_z to sorted_triangles + mov esi,triangles_with_z + ; mov edi,sorted_triangles + mov edi,triangles + again_copy: + if Ext=NON + movsd + movsw + add esi,2 + else + movq mm0,[esi] + movq [edi],mm0 + add esi,8 + add edi,6 + end if + cmp dword[esi],-1 + jne again_copy +; if Ext=MMX +; emms +; end if + movsd ; copy end mark too +ret + +clrscr: + mov edi,screen + mov ecx,SIZE_X*SIZE_Y*3/4 + xor eax,eax + if Ext=NON + rep stosd + else + pxor mm0,mm0 + @@: + movq [edi+00],mm0 + movq [edi+08],mm0 + movq [edi+16],mm0 + movq [edi+24],mm0 + add edi,32 + sub ecx,8 + jnc @b + end if +ret + +calculate_angle: + fninit +; fldpi +; fidiv [i180] + fld [piD180] + fimul [angle_counter] + fsincos + fstp [sinbeta] + fstp [cosbeta] + inc [angle_counter] + cmp [angle_counter],360 + jne end_calc_angle + mov [angle_counter],0 + end_calc_angle: +ret + +rotate_points: + fninit + mov ebx,points_rotated + again_r: + cmp [r_flag],1 + je .z_rot + cmp [r_flag],2 + je .x_rot + .y_rot: + mov eax,[ebx+2] ;z + mov ax,word[ebx] ;x + sub eax,dword[xo] + mov dword[xsub],eax + fld [sinbeta] + fimul [zsub] + fchs + fld [cosbeta] + fimul [xsub] + faddp + fiadd [xo] + fistp word[ebx] ;x + fld [sinbeta] + fimul [xsub] + fld [cosbeta] + fimul [zsub] + faddp + fiadd [zo] + fistp word[ebx+4] ;z + jmp .end_rot + .z_rot: + mov ax,word[ebx] + sub ax,word[xo] ;need optimization + mov [xsub],ax + mov ax,word[ebx+2] + sub ax,word[yo] + mov [ysub],ax + fld [sinbeta] + fimul [ysub] + fld [cosbeta] + fimul [xsub] + faddp + fiadd [xo] + fistp word[ebx] + fld [cosbeta] + fimul [ysub] + fld [sinbeta] + fimul [xsub] + fchs + faddp + fiadd [yo] + fistp word[ebx+2] + jmp .end_rot + .x_rot: + mov ax,word[ebx+2] + sub ax,[yo] + mov [ysub],ax + mov ax,word[ebx+4] + sub ax,word[zo] + mov [zsub],ax + fld [sinbeta] + fimul [zsub] + fld [cosbeta] + fimul [ysub] + faddp + fiadd [yo] + fistp word[ebx+2];y + fld [cosbeta] + fimul [zsub] + fld [sinbeta] + fimul [ysub] + fchs + faddp + fiadd [zo] + fistp word[ebx+4] + .end_rot: + add ebx,6 + cmp dword[ebx],-1 + jne again_r +ret + +draw_triangles: + mov esi,triangles + .again_dts: + mov ebp,points_rotated + if Ext=NON + movzx eax,word[esi] + mov [point_index1],ax + lea eax,[eax*3] + add eax,eax + push ebp + add ebp,eax + mov eax,[ebp] + mov dword[xx1],eax + mov eax,[ebp+4] + mov [zz1],ax + pop ebp + + + movzx eax,word[esi+2] + mov [point_index2],ax + lea eax,[eax*3] + add eax,eax + push ebp + add ebp,eax + mov eax,[ebp] + mov dword[xx2],eax + mov eax,[ebp+4] + mov [zz2],ax + pop ebp + + + movzx eax,word[esi+4] ; xyz3 = [ebp+[esi+4]*6] + mov [point_index3],ax + lea eax,[eax*3] + add eax,eax + ; push ebp + add ebp,eax + mov eax,[ebp] + mov dword[xx3],eax + mov eax,[ebp+4] + mov [zz3],ax + else + mov eax,dword[esi] ; don't know MMX + mov dword[point_index1],eax + ; shr eax,16 + ; mov [point_index2],ax + mov ax,word[esi+4] + mov [point_index3],ax + movq mm0,[esi] + pmullw mm0,qword[const6] + movd eax,mm0 + psrlq mm0,16 + movd ebx,mm0 + psrlq mm0,16 + movd ecx,mm0 + and eax,0FFFFh + and ebx,0FFFFh + and ecx,0FFFFh + movq mm0,[ebp+eax] + movq mm1,[ebp+ebx] + movq mm2,[ebp+ecx] + movq qword[xx1],mm0 + movq qword[xx2],mm1 + movq qword[xx3],mm2 +; emms + end if + push esi + ; culling + fninit + mov esi,point_index1 + mov ecx,3 + @@: + movzx eax,word[esi] + lea eax,[eax*3] + shl eax,2 + lea eax,[eax+point_normals_rotated] + fld dword[eax+8] + ftst + fstsw ax + sahf + jb @f + ffree st + loop @b + jmp .end_draw + @@: + ffree st ;is visable + + cmp [dr_flag],0 ; draw type flag + je .flat_draw + cmp [dr_flag],2 + je .env_mapping + + movzx edi,[point_index3] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + cmp [catmull_flag],0 + je @f + push [zz3] + @@: + push word[edi] + push word[edi+2] + push word[edi+4] + movzx edi,[point_index2] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + cmp [catmull_flag],0 + je @f + push [zz2] + @@: + push word[edi] + push word[edi+2] + push word[edi+4] + movzx edi,[point_index1] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + cmp [catmull_flag],0 + je @f + push [zz1] + @@: + push word[edi] + push word[edi+2] + push word[edi+4] + + ; 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 [max_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 [max_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 [max_color_r] + ; fistp [temp_col] + ; and [temp_col],0x00ff + ; push [temp_col] + ; push [temp_col] + ; push [temp_col] + +; xor edx,edx ; draw acording to position +; mov ax,[zz3] +; add ax,128 +; neg al +; and ax,0x00ff +; push ax +; neg al +; push ax +; mov dx,[yy3] +; and dx,0x00ff +; push dx +; mov ax,[zz2] +; add ax,128 +; neg al +; and ax,0x00ff +; push ax +; neg al +; push ax +; mov dx,[yy2] +; and dx,0x00ff +; push dx +; mov ax,[zz1] +; add ax,128 +; neg al +; and ax,0x00ff +; push ax +; neg al +; push ax +; mov dx,[yy1] +; and dx,0x00ff +; push dx + mov eax,dword[xx1] + ror eax,16 + mov ebx,dword[xx2] + ror ebx,16 + mov ecx,dword[xx3] + ror ecx,16 + lea edi,[screen] + cmp [catmull_flag],0 + je @f + lea esi,[Z_buffer] + call gouraud_triangle_z + jmp .end_draw + @@: + call gouraud_triangle + jmp .end_draw + .flat_draw: + + movzx edi,[point_index3] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + movzx eax,word[edi] + movzx ebx,word[edi+2] + movzx ecx,word[edi+4] + movzx edi,[point_index2] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + add ax,word[edi] + add bx,word[edi+2] + add cx,word[edi+4] + movzx edi,[point_index1] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + add ax,word[edi] + add bx,word[edi+2] + add cx,word[edi+4] + cwd + idiv [i3] + mov di,ax + shl edi,16 + mov ax,bx + cwd + idiv [i3] + mov di,ax + shl di,8 + mov ax,cx + cwd + idiv [i3] + mov edx,edi + mov dl,al + and edx,0x00ffffff + + + ; 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 + mov ebx,dword[xx2] + ror ebx,16 + mov ecx,dword[xx3] + ror ecx,16 + ; mov edi,screen + lea edi,[screen] + cmp [catmull_flag],0 + je @f + lea esi,[Z_buffer] + push word[zz3] + push word[zz2] + push word[zz1] + call flat_triangle_z + jmp .end_draw + @@: + call draw_triangle + jmp .end_draw + .env_mapping: + ; fninit + mov esi,point_index1 + sub esp,12 + mov edi,esp + mov ecx,3 + @@: + movzx eax,word[esi] + lea eax,[eax*3] + shl eax,2 + add eax,point_normals_rotated + ; 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] + + add edi,4 + add esi,2 + loop @b + + mov eax,dword[xx1] + ror eax,16 + mov ebx,dword[xx2] + ror ebx,16 + mov ecx,dword[xx3] + ror ecx,16 + mov edi,screen + mov esi,envmap + call tex_triangle + + .end_draw: + pop esi + add esi,6 + cmp dword[esi],-1 + jne .again_dts +ret +translate_points: +; fninit +; mov ebx,points_rotated +; again_trans: +; fild word[ebx+4] ;z1 +; fmul [sq] +; fld st +; fiadd word[ebx] ;x1 +; fistp word[ebx] +; fchs +; fiadd word[ebx+2] ;y1 +; fistp word[ebx+2] ;y1 + +; add ebx,6 +; cmp dword[ebx],-1 +; jne again_trans +;ret +translate_perspective_points: ;translate points from 3d to 2d using + fninit ;perspective equations + mov ebx,points_rotated + .again_trans: + fild word[ebx] + fisub [xobs] + fimul [zobs] + fild word[ebx+4] + fisub [zobs] + fdivp + fiadd [xobs] + fistp word[ebx] + fild word[ebx+2] + fisub [yobs] + fimul [zobs] + fild word[ebx+4] + fisub [zobs] + fdivp + fchs + fiadd [yobs] + fistp word[ebx+2] + add ebx,6 + cmp dword[ebx],-1 + jne .again_trans +ret + + +copy_points: + mov esi,points + mov edi,points_rotated + mov ecx,points_count*3+2 + rep movsw +ret + + + +read_from_file: + mov edi,triangles + xor ebx,ebx + xor ebp,ebp + mov esi,SourceFile + cmp [esi],word 4D4Dh + jne .exit ;Must be legal .3DS file + cmp dword[esi+2],EndFile-SourceFile + jne .exit ;This must tell the length + add esi,6 + @@: + cmp [esi],word 3D3Dh + je @f + add esi,[esi+2] + jmp @b + @@: + add esi,6 + .find4k: + cmp [esi],word 4000h + je @f + add esi,[esi+2] + cmp esi,EndFile + jc .find4k + jmp .exit + @@: + add esi,6 + @@: + cmp [esi],byte 0 + je @f + inc esi + jmp @b + @@: + inc esi + @@: + cmp [esi],word 4100h + je @f + add esi,[esi+2] + jmp @b + @@: + add esi,6 + @@: + cmp [esi],word 4110h + je @f + add esi,[esi+2] + jmp @b + @@: + movzx ecx,word[esi+6] + mov [points_count_var],cx + mov edx,ecx + add esi,8 + @@: + fld dword[esi+4] + fmul [sscale] + fadd [xoffset] + fld dword[esi+8] + fchs + fmul [sscale] + fadd [yoffset] + fld dword[esi+0] + fchs + fmul [sscale] + fistp word[points+ebx+4] + fistp word[points+ebx+2] + fistp word[points+ebx+0] + add ebx,6 + add esi,12 + dec ecx + jnz @b + @@: + mov dword[points+ebx],-1 + @@: + cmp [esi],word 4120h + je @f + add esi,[esi+2] + jmp @b + @@: + movzx ecx,word[esi+6] + mov [triangles_count_var],cx + add esi,8 + ;mov edi,triangles + @@: + movsd + movsw + add word[edi-6],bp + add word[edi-4],bp + add word[edi-2],bp + add esi,2 + dec ecx + jnz @b + add ebp,edx + jmp .find4k + + .exit: + mov dword[edi],-1 +ret + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + draw_window: + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 + + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,100*65536+SIZE_X+80 ; [x start] *65536 + [x size] + mov ecx,100*65536+SIZE_Y+30 ; [y start] *65536 + [y size] + mov edx,0x04000000 ; color of work area RRGGBB,8->color gl + mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl + mov edi,0x005080d0 ; color of frames RRGGBB + int 0x40 + + ; WINDOW LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,8*65536+8 ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + ; ROTARY BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,25*65536+12 ; [y start] *65536 + [y size] + mov edx,2 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + + ; ROTARY LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+28 ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelrot ; pointer to text beginning + mov esi,labelrotend-labelrot ; text length + int 0x40 + + ; DRAW MODE BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15)*65536+12 ; [y start] *65536 + [y size] + mov edx,3 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + + ; DRAW MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+28+15 ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labeldrmod ; pointer to text beginning + mov esi,labeldrmodend-labeldrmod ; text length + int 0x40 + + ; SPEED BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*2)*65536+12 ; [y start] *65536 + [y size] + mov edx,4 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + + ; SPEED MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*2) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelspeedmod ; pointer to text beginning + mov esi,labelspeedmodend-labelspeedmod ; text length + int 0x40 + + ; SCALE- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*3)*65536+12 ; [y start] *65536 + [y size] + mov edx,5 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + + ; SCALE- MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*3) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzoomout ; pointer to text beginning + mov esi,labelzoomoutend-labelzoomout ; text length + int 0x40 + + ; SCALE+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*4)*65536+12 ; [y start] *65536 + [y size] + mov edx,6 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + + ; SCALE+ MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*4) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzoomin ; pointer to text beginning + mov esi,labelzoominend-labelzoomin ; text length + int 0x40 + + ; ADD VECTOR LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*5) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelvector ; pointer to text beginning + mov esi,labelvectorend-labelvector ; text length + int 0x40 + + ; VECTOR Y- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*6)*65536+12 ; [y start] *65536 + [y size] + mov edx,7 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + + ;VECTOR Y- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*6) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelyminus ; pointer to text beginning + mov esi,labelyminusend-labelyminus ; text length + int 0x40 + + ; VECTOR Z+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*6)*65536+12 ; [y start] *65536 + [y size] + mov edx,8 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + + ;VECTOR Z+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*6) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzplus ; pointer to text beginning + mov esi,labelzplusend-labelzplus ; text length + int 0x40 + + ; VECTOR x- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*7)*65536+12 ; [y start] *65536 + [y size] + mov edx,9 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + + ;VECTOR x- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*7) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelxminus ; pointer to text beginning + mov esi,labelxminusend-labelxminus ; text length + int 0x40 + ; VECTOR x+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*7)*65536+12 ; [y start] *65536 + [y size] + mov edx,10 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR x+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*7) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelxplus ; pointer to text beginning + mov esi,labelxplusend-labelxplus ; text length + int 0x40 + ; VECTOR z- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*8)*65536+12 ; [y start] *65536 + [y size] + mov edx,11 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR z- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*8) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzminus ; pointer to text beginning + mov esi,labelzminusend-labelzminus ; text length + int 0x40 + ;VECTOR Y+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*8)*65536+12 ; [y start] *65536 + [y size] + mov edx,12 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR Y+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*8) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelyplus ; pointer to text beginning + mov esi,labelyplusend-labelyplus ; text length + int 0x40 + ; LEAD COLOR LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*9) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelmaincolor ; pointer to text beginning + mov esi,labelmaincolorend-labelmaincolor ; text length + int 0x40 + + ;RED+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] + mov edx,13 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;RED+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*10) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelredplus ; pointer to text beginning + mov esi,labelredplusend-labelredplus ; text length + int 0x40 + ;GREEN+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] + mov edx,14 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;GREEN+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*10) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelgreenplus ; pointer to text beginning + mov esi,labelgreenplusend-labelgreenplus ; text length + int 0x40 + ;BLUE+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] + mov edx,15 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;BLUE+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*10) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelblueplus ; pointer to text beginning + mov esi,labelblueplusend-labelblueplus ; text length + int 0x40 + ;RED- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] + mov edx,16 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;RED- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*11) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelredminus ; pointer to text beginning + mov esi,labelredminusend-labelredminus ; text length + int 0x40 + ;GREEN- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] + mov edx,17 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;GREEN- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*11) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelgreenminus ; pointer to text beginning + mov esi,labelgreenminusend-labelgreenminus ; text length + int 0x40 + ;BLUE- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] + mov edx,18 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;BLUE- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*11) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelblueminus ; pointer to text beginning + mov esi,labelblueminusend-labelblueminus ; text length + int 0x40 + ; Catmull LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*12) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelcatmullmod ; pointer to text beginning + mov esi,labelcatmullmodend-labelcatmullmod ; text length + int 0x40 + ; on/off BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*13)*65536+12 ; [y start] *65536 + [y size] + mov edx,19 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; on/off LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*13) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelonoff ; pointer to text beginning + mov esi,labelonoffend-labelonoff ; text length + int 0x40 + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + + ; DATA AREA + i3 dw 3 + light_vector dd 0.0,0.0,-1.0 + ; debug_vector dd 0.0,2.0,2.0 ;--debug + ; debug_vector1 dd 0.0,0.0,0.0 + ; debug_points dw 1,1,1,3,4,20 + ; debug_dd dw ? + ; debug_dwd dd 65535 + ; debug_counter dw 0 + dot_max dd 1.0 + dot_min dd 0.0 + env_const dd 1.2 + correct_tex dw 255 + max_color_r dw 33 + max_color_g dw 255 + max_color_b dw 110 + xobs dw SIZE_X / 2 ;200 ;observer + yobs dw SIZE_Y / 2 ;200 ;coordinates + zobs dw -500 + + + angle_counter dw 0 + piD180 dd 0.017453292519943295769236907684886 + ; sq dd 0.70710678118654752440084436210485 + const6 dw 6,6,6,6 + xo dw 130;87 + zo dw 0 + yo dw 100 + xoffset dd 130.0 + yoffset dd 150.0 + sscale dd 2.0 ; real scale + vect_x dw 0 + vect_y dw 0 + vect_z dw 0 + + + r_flag db 0 + dr_flag db 0 + speed_flag db 0 + catmull_flag db 0 + SourceFile file 'teapot.3ds' + EndFile: + labelrot: + db 'rot. mode' + labelrotend: + labeldrmod: + db 'shd. mode' + labeldrmodend: + labelspeedmod: + db 'spd. mode' + labelspeedmodend: + labelzoomout: + db 'zoom out' + labelzoomoutend: + labelzoomin: + db 'zoom in' + labelzoominend: + labelvector: + db 'add vector' + labelvectorend: + labelyminus: + db 'y -' + labelyminusend: + labelzplus: + db 'z +' + labelzplusend: + labelxminus: + db 'x -' + labelxminusend: + labelxplus: + db 'x +' + labelxplusend: + labelzminus: + db 'z -' + labelzminusend: + labelyplus: + db 'y +' + labelyplusend: + labelmaincolor: + db 'main color' + labelmaincolorend: + labelredplus: + db 'r +' + labelredplusend: + labelgreenplus: + db 'g +' + labelgreenplusend: + labelblueplus: + db 'b +' + labelblueplusend: + labelredminus: + db 'r -' + labelredminusend: + labelgreenminus: + db 'g -' + labelgreenminusend: + labelblueminus: + db 'b -' + labelblueminusend: + labelcatmullmod: + db 'catmull' + labelcatmullmodend: + labelonoff: + db 'on/off' + labelonoffend: + labelt: + db 'AVE CRUCE SALUS MEA' + if Ext=MMX + db ' (MMX)' + end if + labellen: + STRdata db '-1 ' +align 8 + @col dd ? + @y1 dw ? + @x1 dw ?;+8 + @y2 dw ? + @x2 dw ? + @y3 dw ? + @x3 dw ?;+16 + + @dx12 dd ? + @dx13 dd ?;+24 + @dx23 dd ? + + sinbeta dd ?;+32 + cosbeta dd ? + + xsub dw ? + zsub dw ?;+40 + ysub dw ? + + xx1 dw ? + yy1 dw ? + zz1 dw ?;+48 + xx2 dw ? + yy2 dw ? + zz2 dw ? + xx3 dw ?;+56 + yy3 dw ? + zz3 dw ? + scale dd ? ; help scale variable + ;screen dd ? ;pointer to screen buffer + triangles_count_var dw ? + points_count_var dw ? + + + point_index1 dw ? ;-\ + point_index2 dw ? ; } don't change order + point_index3 dw ? ;-/ + temp_col dw ? + high dd ? +align 8 + buffer dq ? + + err dd ? + drr dd ? + xx dd ? + yy dd ? + xst dd ? + yst dd ? +align 16 + points: + rw (EndFile-SourceFile)/12*3 + points_count = ($-points)/6 + triangles: + rw (EndFile-SourceFile)/12*3 + triangles_count = ($-triangles)/6 + +align 16 + points_rotated rw points_count*3 + 2 +align 16 + label trizdd dword + label trizdq qword + triangles_with_z rw triangles_count*4 + 2 ; triangles triple dw + z position +align 16 + triangles_normals rb triangles_count * 12 ; + point_normals rb points_count * 12 ;one 3dvector - triple float dword x,y,z +align 16 + point_normals_rotated rb points_count * 12 +align 16 + vectors rb 24 + points_color rb 6*points_count ; each color as word +; sorted_triangles rw triangles_count*3 + 2 +;align 16 + screen rb SIZE_X * SIZE_Y * 3 ; screen buffer + Z_buffer rb SIZE_X * SIZE_Y * 4 + envmap rb 512*512*3 + memStack rb 1000 ;memory area for stack + I_END: \ No newline at end of file diff --git a/programs/demos/3DS/3dspiral.asm b/programs/demos/3DS/3dspiral.asm new file mode 100644 index 0000000000..dae8a7f1ad --- /dev/null +++ b/programs/demos/3DS/3dspiral.asm @@ -0,0 +1,440 @@ +; +; application : 3d shaking waved spiral +; compilator : fasm +; system : MenuetOS +; author : macgub +; email : macgub3@wp + +timeout equ 3 +maxx equ 600 ; window size +maxy equ 420 +use32 + + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x100000 ; memory for app + dd 0xbffff ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +START: ; start of execution + + call draw_window + +still: + +; mov eax,23 ; wait here for event +; mov ebx,timeout +; int 0x40 + mov eax,11 ; check for event no wait + int 0x40 + + cmp eax,1 ; redraw request ? + je red + cmp eax,2 ; key in buffer ? + je key + cmp eax,3 ; button in buffer ? + je button + + jmp noclose + + red: ; redraw + call draw_window + jmp still + + key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + jmp still + + button: ; button + mov eax,17 ; get id + int 0x40 + + cmp ah,1 ; button id=1 ? + jne noclose + + mov eax,-1 ; close this program + int 0x40 + noclose: + +; mov eax,13 +; mov ebx,20*65536+maxx-25 +; mov ecx,20*65536+maxy-25 +; xor edx,edx +; int 0x40 + + mov edi,screen_buf + mov ecx,maxx*maxy*3/4 + xor eax,eax + cld + rep stosd + + + call calc_deg + mov [z],0 + mov [sin_counter],0 + finit +oopz: + mov [x],0 + push [z] + call calc_sin_variable +oop: + push [x] +; call getcol ;(x,z) + call fun ; calculates y and y1 +; call rotateY + mov eax,[sin_variable] + add eax,[vector_x] ; vector_x + add [x],eax + mov eax,[vector_y] + add [y],eax ; vector_y + add [y1],eax + call point_perspective + call draw_point_3d + pop [x] + inc [x] + mov eax,[x] + cmp eax,[loop_counter] + jne oop + inc [sin_counter] + pop [z] + inc [z] + cmp [z],200 + jne oopz + + mov eax,7 + mov ebx,screen_buf + mov ecx,maxx*65536+maxy + mov edx,20*65536+20 + int 0x40 + + call set_elipse_dim + call set_vectors + +jmp still +;-----------------++++++PROCEDURES +getcol: + mov eax,[x_resolution] + mul [z] + add eax,[x] + mov ebx,eax + mov eax,35 + int 0x40 + mov [col],eax +ret + +set_vectors: + cmp [vector_x],55 + jne vec1 + mov [vector_dir_x],1 + vec1: + cmp [vector_x],250 + jne vec2 + mov [vector_dir_x],0 + vec2: + cmp [vector_dir_x],1 + jne vec3 + inc [vector_x] + jmp end_x + vec3: + dec [vector_x] + end_x: + cmp [vector_y],195 + jne vec4 + mov [vector_dir_y],1 + vec4: + cmp [vector_y],205 + jne vec5 + mov [vector_dir_y],0 + vec5: + cmp [vector_dir_y],1 + jne vec6 + inc [vector_y] + ret + vec6: + dec [vector_y] +ret +set_elipse_dim: + cmp [b],60 + jne go11 + mov [elipse_dir],0 + go11: + cmp [b],10 + jne go12 + mov [elipse_dir],1 + go12: + cmp [elipse_dir],1 + jne go13 + inc [b] + dec [a] + mov eax,[a] + mov [xo],eax + shl eax,1 + inc eax + mov [loop_counter],eax + ret + go13: + dec [b] + inc [a] + mov eax,[a] + mov [xo],eax + shl eax,1 + inc eax + mov [loop_counter],eax +ret + +calc_deg: + cmp [deg_counter], 360 + jne go_deg + mov [deg_counter],0 + go_deg: + fldpi + fidiv [deg_div] + fimul [deg_counter] + fstp [current_deg] +; fsincos +; fstp [cosbeta] +; fstp [sinbeta] + inc [deg_counter] + ret + +;rotateY: +; mov eax,[z] +; sub eax,[zoo] +; mov [subz],eax +; mov eax,[x] +; sub eax,[xoo] +; mov [subx],eax +; +; fld [sinbeta] +; fimul [subz] +; fchs +; fld [cosbeta] +; fimul[subx] +; faddp +; fiadd [xoo] +; fistp [x] + +; fld [sinbeta] +; fimul [subx] +; fld [cosbeta] +; fimul [subz] +; faddp +; fiadd [zoo] +; fistp [z] +; finit + +; ret + +point_perspective: + mov eax,[x] + sub eax,[xobs] + mov [xobssub],eax + mov eax,[z] + sub eax,[zobs] + mov [zobssub],eax + + mov eax,[y] + sub eax,[yobs] + mov [yobssub],eax + mov eax,[y1] + sub eax,[yobs] + mov [y1obssub],eax + + finit + fild [xobssub] + fidiv [zobssub] + fimul [zobs] + fchs + fiadd [xobs] + fistp [x] + fild [yobssub] + fidiv [zobssub] + fimul [zobs] + fchs + fiadd [yobs] + fistp [y] + +; mov eax,[xobssub] +; idiv [zobssub] +;; mov eax,edx +; imul [zobs] +; neg eax +; add eax,[xobs] +; mov [x],eax +; mov eax,[yobssub] +; idiv [zobssub] +;; mov eax,edx +; imul [zobs] +; neg eax +; add eax,[yobs] +; mov [y],eax + + fild [y1obssub] + fidiv [zobssub] + fimul [zobs] + fchs + fiadd [yobs] + fistp [y1] +ret +calc_sin_variable: + ;calculate sinus variable + fldpi + fidiv [sin_gran] + fimul [sin_counter] + fadd [current_deg] + fsin + fimul [sin_mul] + fistp [sin_variable] +ret + +fun: +; finit + fild [x] + fisub [xo] +; fchs +; faddp + fild [a] + fdivp st1,st + fmul st,st0 + fchs + fld1 + faddp + fsqrt + fimul [b] + fld st + fchs + fiadd [yo] + fistp [y] + fiadd [yo] + fistp [y1] +ret +draw_point_3d: + mov eax,[z] + imul [sq] + shr eax,10 + mov ebx,eax + neg eax + push eax + add eax,[y] + mov [y],eax + pop eax + add eax,[y1] + mov [y1],eax + mov eax,ebx + add eax,[x] + mov [x],eax + ;mov eax,1 + ;mov ebx,[x] + ;mov ecx,[y] + ;mov edx,[col] + ;int 0x40 + ;mov ecx,[y1] + ;int 0x40 + mov eax,maxx + mul [y] + add eax,[x] + mov ebx,eax + shl ebx,1 + add eax,ebx + add eax,screen_buf + mov ebx,[col] + or [eax],ebx + mov eax,maxx + mul [y1] + add eax,[x] + mov ebx,eax + shl ebx,1 + add eax,ebx + add eax,screen_buf + mov ebx,[col] + or [eax],ebx +ret + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* +draw_window: + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,100*65536+maxx+25 ; [x start] *65536 + [x size] + mov ecx,100*65536+maxy+25 ; [y start] *65536 + [y size] + mov edx,0x04000000 ; color of work area RRGGBB,8->color gl + mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl + mov edi,0x005080d0 ; color of frames RRGGBB + int 0x40 + ; WINDOW LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,8*65536+8 ; [x start] *65536 + [y start] + mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + +x_resolution dd 800 +vector_x dd 200 +vector_y dd 200 +vector_dir_x db 1 +vector_dir_y db 1 +elipse_dir db 1 + +deg_counter dd ? ; rotation variables +deg_div dd 20 +current_deg dd ? +;cosbeta dd ? +;sinbeta dd ? +;zoo dd 100 ; rotation axle +;xoo dd 40 +;yoo dd 20 +;subx dd ? +;suby dd ? +;subz dd ? + +xobs dd maxx/2 ; 320 observer variables +yobs dd maxy/2 ; 175 +zobs dd -200 +xobssub dd ? +yobssub dd ? +y1obssub dd ? +zobssub dd ? + +sin_variable dd ? +sin_mul dd 60 +sin_gran dd 30 +sin_counter dd 0 +sq dd 724 ; round( (sqrt2)/2*1024 ) +z dd ? +x dd ? +y dd ? +y1 dd ? +xo dd 70 ; center point , (loop counter-1)/2 +yo dd 20 +a dd 70 ; vertical half-axle +b dd 20 ; horizontal half-axle +loop_counter dd 141 ; axle granularity +col dd 0x00ffffff + +labelt: + db ' 3D SHAKING WAVED SPIRAL' +labellen: +screen_buf: + +I_END: + + + + diff --git a/programs/demos/3DS/FLAT3.ASM b/programs/demos/3DS/FLAT3.ASM new file mode 100644 index 0000000000..a2253bcba9 --- /dev/null +++ b/programs/demos/3DS/FLAT3.ASM @@ -0,0 +1,188 @@ +draw_triangle: + ;----------in - eax - x1 shl 16 + y1 + ;------------- -ebx - x2 shl 16 + y2 + ;---------------ecx - x3 shl 16 + y3 + ;---------------edx - color 0x00rrggbb + ;---------------edi - pointer to screen buffer + @ch3: + cmp ax,bx + jg @ch1 + @ch4: ; sort parameters + cmp bx,cx + jg @ch2 + jle @chEnd + @ch1: + xchg eax,ebx + jmp @ch4 + @ch2: + xchg ebx,ecx + jmp @ch3 + @chEnd: + mov dword[@y1],eax ; ....and store to user friendly variables + mov dword[@y2],ebx + mov dword[@y3],ecx + mov [@col],edx + mov edx,eax ; eax,ebx,ecx are ORd together into edx which means that + or edx,ebx ; if any *one* of them is negative a sign flag is raised + or edx,ecx + test edx,80008000h ; Check both X&Y at once + jne @end_triangle + + cmp [@x1],SIZE_X ; { + jg @end_triangle + cmp [@x2],SIZE_X ; This can be optimized with effort + jg @end_triangle + cmp [@x3],SIZE_X + jg @end_triangle ; } + + shr eax,16 + shr ebx,16 + shr ecx,16 + + neg ax ; calculate delta 12 + add ax,bx + cwde + shl eax,ROUND + cdq + mov bx,[@y2] + mov cx,[@y1] + sub bx,cx + ;cmp ebx,0 + jne @noZero1 + mov [@dx12],0 + jmp @yesZero1 + @noZero1: + idiv ebx + mov [@dx12],eax + @yesZero1: + + mov ax,[@x3] ; calculate delta 13 + sub ax,[@x1] + cwde + shl eax,ROUND + cdq + mov bx,[@y3] + mov cx,[@y1] + sub bx,cx + ;cmp ebx,0 + jne @noZero2 + mov [@dx13],0 + jmp @yesZero2 + @noZero2: + idiv ebx + mov [@dx13],eax + @yesZero2: + + mov ax,[@x3] ; calculate delta 23 [dx23] + sub ax,[@x2] + cwde + shl eax,ROUND + cdq + mov bx,[@y3] + mov cx,[@y2] + sub bx,cx + ;cmp ebx,0 + jne @noZero3 + mov [@dx23],0 + jmp @yesZero3 + @noZero3: + idiv ebx + mov [@dx23],eax + @yesZero3: + + movzx eax,word[@x1] ; eax - xk1 + shl eax,ROUND + mov ebx,eax ; ebx - xk2 + movzx esi,word[@y1] ; esi - y + @next_line1: + mov ecx,eax ; ecx - x11 + sar ecx,ROUND + mov edx,ebx ; edx - x12 + sar edx,ROUND + cmp ecx,edx + jle @nochg + xchg ecx,edx + @nochg: + pusha + mov ebx,ecx + sub edx,ecx + mov ecx,edx + mov edx,esi + mov eax,[@col] + call @horizontal_line + popa + add eax,[@dx13] + add ebx,[@dx12] + inc esi + cmp si,[@y2] + jl @next_line1 + + movzx esi,word[@y2] + movzx ebx,word[@x2] + shl ebx,ROUND + @next_line2: + mov ecx,eax + sar ecx,ROUND + mov edx,ebx + sar edx,ROUND + cmp ecx,edx + jle @nochg1 + xchg ecx,edx + @nochg1: + pusha + mov ebx,ecx + sub edx,ecx + mov ecx,edx + mov edx,esi + mov eax,[@col] + call @horizontal_line + popa + add eax,[@dx13] + add ebx,[@dx23] + inc esi + cmp si,[@y3] + jl @next_line2 + @end_triangle: +ret + +@horizontal_line: + ;---------in + ;---------eax - color of line, 0x00RRGGBB + ;---------ebx - x1 - x position of line begin + ;---------ecx - lenght of line + ;---------edx - y position of line + ;---------edi - pointer to buffer + jcxz @end_hor_l +; or edx,edx +; jl @end_hor_l + cmp edx,SIZE_Y + jg @end_hor_l + push eax + mov eax,SIZE_X*3 + mul edx + add edi,eax ; calculate line begin adress + ;add edi,ebx + ;shl ebx,1 + lea edi,[edi+ebx*2] + add edi,ebx + pop eax + cld + ;mov dword[edi-3],0000FF00h + @ddraw: ; Drawing horizontally: + ;push eax + stosd ; 4 bytes at a time + dec edi ; point to the 4th + ;shr eax,16 + ;stosb + ;pop eax + ;pusha ; If you want to draw pixel-by-pixel + ; mov eax,7 ; put image + ; mov ebx,screen + ; mov ecx,SIZE_X shl 16 + SIZE_Y + ; mov edx,5 shl 16 + 20 + ; int 0x40 + ;popa + loop @ddraw + mov byte[edi],0 ; The last 4th will be reset + @end_hor_l: +ret diff --git a/programs/demos/3DS/FLATWAV.ASM b/programs/demos/3DS/FLATWAV.ASM new file mode 100644 index 0000000000..7ae0f76572 --- /dev/null +++ b/programs/demos/3DS/FLATWAV.ASM @@ -0,0 +1,762 @@ +; +; application : Flag - Polonia in Tertio Millenium - wavy shading rotary area +; compiler : FASM +; system : MenuetOS +; author : macgub +; email : macgub3@wp.pl +; web : www.menuet.xt.pl +; Fell free to use this intro in your own distribution of MenuetOS. +SIZE_X equ 220 +SIZE_Y equ 260 +TIMEOUT equ 1 +ROUND equ 12 +points_count equ 50 +triangles_count equ 54 + +use32 + + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd I_END ; memory for app + dd I_END ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +START: ; start of execution + + call draw_window + ; call generate_map + +still: + + mov eax,23 ; wait here for event with timeout + mov ebx,TIMEOUT + cmp [speed_flag],0xff + jne speed_skip + mov eax,11 + speed_skip: + int 0x40 + + cmp eax,1 ; redraw request ? + je red + cmp eax,2 ; key in buffer ? + je key + cmp eax,3 ; button in buffer ? + je button + + jmp noclose + + red: ; redraw + call draw_window + jmp noclose + + key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + jmp noclose + + button: ; button + mov eax,17 ; get id + int 0x40 + + cmp ah,1 ; button id=1 ? + jne shad_button + mov eax,-1 ; close this program + int 0x40 + shad_button: + cmp ah,2 + jne speed_button + not [shad_flag] ; set shadow / flag mode + speed_button: + cmp ah,3 + jne noclose + not [speed_flag] + noclose: + + call calculate_angle ; calculates sinus and cosinus + call generate_map + call copy_points + call rotate_points + call translate_points ; translate from 3d to 2d + call clrscr ; clear the screen + call sort_triangles + call draw_triangles ; draw all triangles from the list + + mov eax,7 ; put image + mov ebx,screen + mov ecx,SIZE_X shl 16 + SIZE_Y + mov edx,5 shl 16 + 20 + int 0x40 + + jmp still +generate_map: + finit + mov edi,points + xor ebx,ebx ;z + again_gen1: + mov eax,70 ;x + again_gen: + mov word[edi],ax + mov word[edi+4],bx + fild word[edi] + fidiv [i20] + fadd [current_angle] + fsin + fimul [i20] + fiadd [i75] + fistp word [edi+2] +; fild word[edi] ;another map generation +; fisub [i100] +; fidiv [i75] +; fmul st,st0 +; fild word[edi+4] +; fisub [i50] +; fidiv [i20] +; fmul st,st0 +; faddp +; fsqrt +; fadd [current_angle] +; fsin +; fimul [i20] +; fiadd [i75] +; fistp word[edi+2] + + add ax,10 + add edi,6 + cmp ax,170 + jne again_gen + add bx,20 + cmp bx,100 + jne again_gen1 + mov dword[edi],0xffffffff +ret +i20 dw 20 +i50 dw 50 +i75 dw 75 +i100 dw 100 + +sort_triangles: + mov esi,triangles + mov edi,triangles_with_z + mov ebp,points_rotated + + make_triangle_with_z: ;makes list with triangles and z position + xor eax,eax + mov ax,word[esi] + shl eax,1 + mov ebx,eax + shl eax,1 + add eax,ebx + push ebp + add ebp,eax + xor ecx,ecx + mov cx,word[ebp+4] + pop ebp + + xor eax,eax + mov ax,word[esi+2] + shl eax,1 + mov ebx,eax + shl eax,1 + add eax,ebx + push ebp + add ebp,eax + add cx,word[ebp+4] + pop ebp + + xor eax,eax + mov ax,word[esi+4] + shl eax,1 + mov ebx,eax + shl eax,1 + add eax,ebx + push ebp + add ebp,eax + add cx,word[ebp+4] + pop ebp + + mov ax,cx + cwd + idiv [i3] + cld + movsd ; store vertex coordinates + movsw + stosw ; middle vertex coordinate 'z' in triangles_with_z list + cmp dword[esi],0xffffffff + jne make_triangle_with_z + movsd ; copy end mark + +;macro sort + + mov [sort_flag],1 + next_booble: + mov esi,triangles_with_z ;sort list triangles_with_z booble metod + cmp [sort_flag],0 + je end_sort + mov [sort_flag],0 + check_and_check: + ; cmp dword[esi],0xffffffff + ; je next_booble + cmp dword[esi+8],0xffffffff + je next_booble + mov ax,word[esi+6] + cmp ax,word[esi+14] + jge no_chg_pos + mov eax,dword[esi] + mov ebx,dword[esi+4] + xchg eax,dword[esi+8] + xchg ebx,dword[esi+12] + mov dword[esi],eax + mov dword[esi+4],ebx ; sort_flag=1 if change occured + mov [sort_flag],1 + no_chg_pos: + add esi,8 + jmp check_and_check ;check end mark end if greater + end_sort: + + ; translate triangles_with_z to sorted_triangles + mov esi,triangles_with_z + mov edi,sorted_triangles + again_copy: + movsd + movsw + add esi,2 + cmp dword[esi],0xffffffff + jne again_copy + movsd ; copy end mark too +ret +sort_flag db 0 +clrscr: + mov edi,screen + mov ecx,SIZE_X*SIZE_Y*3/4 + xor eax,eax + cld + rep stosd +ret +calculate_angle: + finit + fldpi + fidiv [i180] + fimul [angle_counter] + fst [current_angle] + fld st + fidiv [i2] + fsincos + fstp [singamma] + fstp [cosgamma] + fsincos + fstp [sinbeta] + fstp [cosbeta] + inc [angle_counter] + cmp [angle_counter],360 + jne end_calc_angle + mov [angle_counter],0 + end_calc_angle: +ret +i180 dw 90 +i2 dw 2 +rotate_points: + finit ; y axle rotate + mov ebx,points_rotated + again_r: + mov ax,word[ebx] ;x + sub ax,[xo] + mov [xsub],ax + mov ax,word[ebx+4] ;z + sub ax,[zo] + mov [zsub],ax + fld [sinbeta] + fimul [zsub] + fchs + fld [cosbeta] + fimul [xsub] + faddp + fiadd [xo] + fistp word[ebx] ;x + fld [sinbeta] + fimul [xsub] + ;fchs + fld [cosbeta] + fimul [zsub] + faddp + fiadd [zo] + fistp word[ebx+4] ;z + + mov ax,word[ebx+2] ;y ; z axle rotate + sub ax,[yo] + mov [ysub],ax + mov ax,word[ebx] ;x + sub ax,[xo] + mov [xsub],ax + fld [singamma] + fimul[ysub] + fld [cosgamma] + fimul [xsub] + faddp + fiadd [xo] + fistp word[ebx] ;x + fld [cosgamma] + fimul [ysub] + fld [singamma] + fimul [xsub] + fchs + faddp + fiadd [yo] + fistp word[ebx+2] ;y + + add ebx,6 + cmp dword[ebx],0xffffffff + jne again_r +ret +xsub dw ? +ysub dw ? +zsub dw ? +draw_triangles: + mov [tr_counter],1 + mov ebp,points_rotated +; mov esi,triangles + mov esi,sorted_triangles + again_dts: + xor eax,eax + mov ax,word[esi] + shl eax,1 + mov [dtpom],eax + shl eax,1 + add eax,[dtpom] + push ebp + add ebp,eax + mov ax,word[ebp] + mov [xx1],ax + mov ax,word[ebp+2] + mov [yy1],ax + mov ax,word[ebp+4] + mov [zz1],ax + pop ebp + + xor eax,eax + mov ax,word[esi+2] + shl eax,1 + mov [dtpom],eax + shl eax,1 + add eax,[dtpom] + push ebp + add ebp,eax + mov ax,word[ebp] + mov [xx2],ax + mov ax,word[ebp+2] + mov [yy2],ax + mov ax,word[ebp+4] + mov [zz2],ax + pop ebp + + xor eax,eax + mov ax,word[esi+4] + shl eax,1 + mov [dtpom],eax + shl eax,1 + add eax,[dtpom] + push ebp + add ebp,eax + mov ax,word[ebp] + mov [xx3],ax + mov ax,word[ebp+2] + mov [yy3],ax + mov ax,word[ebp+4] + mov [zz3],ax + pop ebp + push ebp + push esi + +macro set_flag +{ + mov edx,0x00ffffff + inc [tr_counter] + cmp [tr_counter],triangles_count/2 + jl skip_red + set_red: + mov edx,0x00ff0000 + skip_red: +} + + mov ax,[zz1] + add ax,[zz2] + add ax,[zz3] + cwd + idiv [i3] + sub ax,100 ;77 +; shl ax,1 + neg al + xor edx,edx + mov dh,al ;set color according to z position + mov dl,al +; push dx +; shl edx,8 +; pop dx + + cmp [shad_flag],0 + je skip_col + set_flag + skip_col: + mov ax,[xx1] + shl eax,16 + mov ax,[yy1] + mov bx,[xx2] + shl ebx,16 + mov bx,[yy2] + mov cx,[xx3] + shl ecx,16 + mov cx,[yy3] + mov edi,screen + call draw_triangle + pop esi + pop ebp + + add esi,6 + cmp dword[esi],0xffffffff + jne again_dts +ret +i3 dw 3 +tr_counter dw 0 +dtpom dd ? +xx1 dw ? +yy1 dw ? +zz1 dw ? +xx2 dw ? +yy2 dw ? +zz2 dw ? +xx3 dw ? +yy3 dw ? +zz3 dw ? +translate_points: + finit + mov ebx,points_rotated + again_trans: + fild word[ebx+4] ;z1 + fmul [sq] + fld st + fiadd word[ebx] ;x1 + fistp word[ebx] + fchs + fiadd word[ebx+2] ;y1 + fistp word[ebx+2] ;y1 + + add ebx,6 + cmp dword[ebx],0xffffffff + jne again_trans +ret +copy_points: + mov esi,points + mov edi,points_rotated + mov ecx,points_count*3+2 + cld + rep movsw +ret + +draw_triangle: +;----------in - eax - x1 shl 16 + y1 +;------------- -ebx - x2 shl 16 + y2 +;---------------ecx - x3 shl 16 + y3 +;---------------edx - color 0x00rrggbb +;---------------edi - pointer to screen buffer + @ch3: + cmp ax,bx + jg @ch1 + @ch4: ; sort parameters + cmp bx,cx + jg @ch2 + jle @chEnd + @ch1: + xchg eax,ebx + jmp @ch4 + @ch2: + xchg ebx,ecx + jmp @ch3 + @chEnd: + mov [@y1],ax ; ....and store to user friendly variables + mov [@y2],bx + mov [@y3],cx + shr eax,16 + shr ebx,16 + shr ecx,16 + mov [@x1],ax + mov [@x2],bx + mov [@x3],cx + mov [@col],edx + + cmp [@y1],0 + jl @end_triangle + cmp [@y2],0 + jl @end_triangle + cmp [@y3],0 + jl @end_triangle + cmp [@x1],0 + jl @end_triangle + cmp [@x2],0 + jl @end_triangle + cmp [@x3],0 + jl @end_triangle + cmp [@y1],SIZE_Y + jg @end_triangle + cmp [@y2],SIZE_Y + jg @end_triangle + cmp [@y3],SIZE_Y + jg @end_triangle + cmp [@x1],SIZE_X + jg @end_triangle + cmp [@x2],SIZE_X + jg @end_triangle + cmp [@x3],SIZE_X + jg @end_triangle + + neg ax ; calculate delta 12 + add ax,bx + cwde + shl eax,ROUND + cdq + mov bx,[@y2] + mov cx,[@y1] + sub ebx,ecx + cmp ebx,0 + jne @noZero1 + mov [@dx12],0 + jmp @yesZero1 + @noZero1: + idiv ebx + mov [@dx12],eax + @yesZero1: + + mov ax,[@x3] ; calculate delta 13 + sub ax,[@x1] + cwde + shl eax,ROUND + cdq + xor ebx,ebx + xor ecx,ecx + or bx,[@y3] + or cx,[@y1] + sub ebx,ecx + cmp ebx,0 + jne @noZero2 + mov [@dx13],0 + jmp @yesZero2 + @noZero2: + idiv ebx + mov [@dx13],eax + @yesZero2: + + mov ax,[@x3] ; calculate delta 23 [dx23] + sub ax,[@x2] + cwde + shl eax,ROUND + cdq + xor ebx,ebx + xor ecx,ecx + or bx,[@y3] + or cx,[@y2] + sub ebx,ecx + cmp ebx,0 + jne @noZero3 + mov [@dx23],0 + jmp @yesZero3 + @noZero3: + idiv ebx + mov [@dx23],eax + @yesZero3: + + + xor eax,eax ;eax - xk1 + or ax,[@x1] + shl eax,ROUND + mov ebx,eax ; ebx - xk2 + xor esi,esi ; esi - y + or si,[@y1] + @next_line1: + mov ecx,eax ; ecx - x11 + sar ecx,ROUND + mov edx,ebx ;edx - x12 + sar edx,ROUND + cmp ecx,edx + jle @nochg + xchg ecx,edx + @nochg: + pusha + mov ebx,ecx + sub edx,ecx + mov ecx,edx + mov edx,esi + mov eax,[@col] + call @horizontal_line + popa + add eax,[@dx13] + add ebx,[@dx12] + inc esi + cmp si,[@y2] + jl @next_line1 + + xor esi,esi + or si,[@y2] + xor ebx,ebx + mov bx,[@x2] + shl ebx,ROUND + @next_line2: + mov ecx,eax + sar ecx,ROUND + mov edx,ebx + sar edx,ROUND + cmp ecx,edx + jle @nochg1 + xchg ecx,edx + @nochg1: + pusha + mov eax,[@col] + mov ebx,ecx + sub edx,ecx + mov ecx,edx + mov edx,esi + call @horizontal_line + popa + add eax,[@dx13] + add ebx,[@dx23] + inc esi + cmp si,[@y3] + jl @next_line2 + @end_triangle: +ret +@col dd ? +@y1 dw ? +@x1 dw ? +@y2 dw ? +@x2 dw ? +@y3 dw ? +@x3 dw ? +@dx12 dd ? +@dx13 dd ? +@dx23 dd ? + +@horizontal_line: +;---------in +;---------eax - color of line, 0x00RRGGBB +;---------ebx - x1 - x position of line begin +;---------ecx - lenght of line +;---------edx - y position of line +;---------edi - pointer to buffer + jcxz @end_hor_l + push eax + mov eax,SIZE_X*3 + mul edx + add edi,eax ; calculate line begin adress + add edi,ebx + shl ebx,1 + add edi,ebx + pop eax + cld + @ddraw: + push eax + stosw + shr eax,16 + stosb + pop eax + loop @ddraw + @end_hor_l: +ret + + + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + + +draw_window: + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 + + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,100*65536+SIZE_X+20 ; [x start] *65536 + [x size] + mov ecx,100*65536+SIZE_Y+30 ; [y start] *65536 + [y size] + mov edx,0x04000000 ; color of work area RRGGBB,8->color gl + mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl + mov edi,0x005080d0 ; color of frames RRGGBB + int 0x40 + + ; WINDOW LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,8*65536+8 ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelt ; pointer to text beginning + mov esi,labellen-labelt ; text length + int 0x40 + + ; flag color button + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X-35)*65536+12 ; [x start] *65536 + [x size] + mov ecx,5*65536+12 ; [y start] *65536 + [y size] + mov edx,2 ; button id + mov esi,0x64504A ; button color RRGGBB + int 0x40 + + ; speed button + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X-53)*65536+12 ; [x start] *65536 + [x size] + mov ecx,5*65536+12 ; [y start] *65536 + [y size] + mov edx,3 ; button id + mov esi,0x64504A ; button color RRGGBB + int 0x40 + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + +; DATA AREA +angle_counter dw 0 +sq dd 0.707 +xo dw 110 ;87 +zo dw 0 +yo dw 125 +shad_flag db 0 +speed_flag db 0 + +triangles: +dw 0,1,10, 10,11,1, 1,2,11, 11,12,2, 2,3,12, 12,13,3, 3,4,13, 13,14,4, 4,5,14 +dw 14,15,5, 5,6,15, 15,16,6, 6,7,16, 16,17,7, 7,8,17, 17,18,8, 8,9,18, 18,19,9 +dw 10,11,20, 20,21,11, 11,12,21, 21,22,12, 12,13,22, 22,23,13, 13,14,23 +dw 23,24,14, 14,15,24, 24,25,15, 15,16,25, 25,26,16, 16,17,26, 26,27,17 +dw 17,18,27, 27,28,18, 18,19,28, 28,29,19, 20,21,30, 30,31,21, 21,22,31 +dw 31,32,22, 22,23,32, 32,33,23, 23,24,33, 33,34,24, 24,25,34, 34,35,25 +dw 25,26,35, 35,36,26, 26,27,36, 36,37,27, 27,28,37, 37,38,28, 28,29,38 +dw 38,39,29 + dd 0xffffffff ;<- end marker + + + +labelt: + db '3d wavy rotaring area' +labellen: +sinbeta rd 1 +cosbeta rd 1 +singamma rd 1 +cosgamma rd 1 +current_angle rd 1 + +points rw points_count*3 + 2 +points_rotated rw points_count*3 + 2 +triangles_with_z rw triangles_count*4 + 2 ; triangles triple dw + z position +sorted_triangles rw triangles_count*3 + 2 +screen rb SIZE_X * SIZE_Y * 3 ; screen buffer +memStack rb 1000 ;memory area for stack +I_END: + + + + diff --git a/programs/demos/3DS/FLAT_CAT.ASM b/programs/demos/3DS/FLAT_CAT.ASM new file mode 100644 index 0000000000..c07458ecc9 --- /dev/null +++ b/programs/demos/3DS/FLAT_CAT.ASM @@ -0,0 +1,342 @@ +CATMULL_SHIFT equ 16 +fill_Z_buffer: + mov eax,0x70000000 + mov edi,Z_buffer + mov ecx,SIZE_X*SIZE_Y + rep stosd +ret +flat_triangle_z: +; procedure drawing triangle with Z cordinate interpolation ------ +; (Catmull alghoritm)-------------------------------------------- +; ----------------in - eax - x1 shl 16 + y1 ---------------------- +; -------------------- ebx - x2 shl 16 + y2 ---------------------- +; -------------------- ecx - x3 shl 16 + y3 ---------------------- +; -------------------- edx - color 0x00RRGGBB -------------------- +; -------------------- esi - pointer to Z-buffer ----------------- +; -------------------- edi - pointer to screen buffer------------- +; -------------------- stack : z coordinates +; -------------------- Z-buffer : each z variable as dword +; -------------------- (Z coor. as word) shl CATMULL_SHIFT +.z1 equ word[ebp+4] +.z2 equ word[ebp+6] ; each z coordinate as word integer +.z3 equ word[ebp+8] + +.col equ dword[ebp-4] +.x1 equ word[ebp-6] +.y1 equ word[ebp-8] +.x2 equ word[ebp-10] +.y2 equ word[ebp-12] +.x3 equ word[ebp-14] +.y3 equ word[ebp-16] + +.dx12 equ dword[ebp-20] +.dz12 equ dword[ebp-24] +.dx13 equ dword[ebp-28] +.dz13 equ dword[ebp-32] +.dx23 equ dword[ebp-36] +.dz23 equ dword[ebp-40] +.zz1 equ dword[ebp-44] +.zz2 equ dword[ebp-48] + + mov ebp,esp + push edx ; store edx in variable .col + .sort2: + cmp ax,bx + jle .sort1 + xchg eax,ebx + mov dx,.z1 + xchg dx,.z2 + mov .z1,dx + .sort1: + cmp bx,cx + jle .sort3 + xchg ebx,ecx + mov dx,.z2 + xchg dx,.z3 + mov .z2,dx + jmp .sort2 + .sort3: + push eax ; store triangle coordinates in user friendly variables + push ebx + push ecx + mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that + and edx,ebx ; if *all* of them are negative a sign flag is raised + and edx,ecx + and edx,eax + test edx,80008000h ; Check both X&Y at once + jne .ft_loop2_end + ; cmp ax,SIZE_Y + ; jle @f + ; cmp bx,SIZE_Y + ; jle @f + ; cmp cx,SIZE_Y + ; jge @f + ; ror eax,16 + ; ror ebx,16 + ; ror ecx,16 + ; cmp ax,SIZE_X + ; jle @f + ; cmp bx,SIZE_X + ; jle @f + ; cmp cx,SIZE_X + ; jle @f + ; jmp .ft_loop2_end + ;@@: + sub esp,32 + + mov bx,.y2 ; calc delta 12 + sub bx,.y1 + jnz .ft_dx12_make + mov .dx12,0 + mov .dz12,0 + jmp .ft_dx12_done + .ft_dx12_make: + mov ax,.x2 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx12,eax + + mov ax,.z2 + sub ax,.z1 + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + mov .dz12,eax + .ft_dx12_done: + mov bx,.y3 ; calc delta 13 + sub bx,.y1 + jnz .ft_dx13_make + mov .dx13,0 + mov .dz13,0 + jmp .ft_dx13_done + .ft_dx13_make: + mov ax,.x3 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx13,eax + + mov ax,.z3 + sub ax,.z1 + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + mov .dz13,eax + .ft_dx13_done: + mov bx,.y3 ; calc delta 23 + sub bx,.y2 + jnz .gt_dx23_make + mov .dx23,0 + mov .dz23,0 + jmp .gt_dx23_done + .gt_dx23_make: + mov ax,.x3 + sub ax,.x2 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx23,eax + + mov ax,.z3 + sub ax,.z2 + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + mov .dz23,eax + .gt_dx23_done: + + movsx edx,.z1 + shl edx,CATMULL_SHIFT + mov .zz1,edx + mov .zz2,edx + movsx eax,.x1 + shl eax,ROUND ; eax - x1 + mov ebx,eax ; ebx - x2 + mov cx,.y1 + cmp cx,.y2 + jge .ft_loop1_end + .ft_loop1: + + pushad + + push .col + push cx ; y + sar ebx,ROUND + push bx ; x2 + sar eax,ROUND + push ax ; x1 + push .zz2 ; z2 shl CATMULL_SHIFT + push .zz1 ; z1 shl CATMULL_SHIFT + call flat_line_z + + popad + + add eax,.dx13 + add ebx,.dx12 + mov edx,.dz13 + add .zz1,edx + mov edx,.dz12 + add .zz2,edx + inc cx + cmp cx,.y2 + jl .ft_loop1 + .ft_loop1_end: + + movsx edx,.z2 + shl edx,CATMULL_SHIFT + mov .zz2,edx + movsx ebx,.x2 + shl ebx,ROUND + mov cx,.y2 + cmp cx,.y3 + jge .ft_loop2_end + .ft_loop2: + pushad + + push .col + push cx + sar ebx,ROUND + push bx + sar eax,ROUND + push ax ; x1 + push .zz2 ; z2 shl CATMULL_SHIFT + push .zz1 ; z1 shl CATMULL_SHIFT + call flat_line_z + + popad + + add eax,.dx13 + add ebx,.dx23 + mov edx,.dz13 + add .zz1,edx + mov edx,.dz23 + add .zz2,edx + inc cx + cmp cx,.y3 + jl .ft_loop2 + .ft_loop2_end: + + mov esp,ebp +ret 6 + +flat_line_z: +;---------------- +;-------------in edi - pointer to screen buffer ---------------------------------- +;--------------- esi - pointer to z-buffer (each Z varible dword)----------------- +;----------stack - (each z coordinate shifted shl CATMULL_SHIFT)------------------ +.z1 equ dword [ebp+4] +.z2 equ dword [ebp+8] +.x1 equ word [ebp+12] +.x2 equ word [ebp+14] +.y equ word [ebp+16] +.col equ dword [ebp+18] + +.dz equ dword [ebp-4] + + mov ebp,esp +;; sub esp,4 + mov ax,.y + or ax,ax + jl .fl_quit + cmp ax,SIZE_Y-1 + jg .fl_quit + + ; cmp .x1,0 + ; jge .fl_ok1 + ; cmp .x2,0 + ; jl .fl_quit + ; .fl_ok1: + ; cmp .x1,SIZE_X + ; jle .fl_ok2 + ; cmp .x2,SIZE_X + ; jg .fl_quit + ; .fl_ok2: + mov ax,.x1 + cmp ax,.x2 + je .fl_quit + jl .fl_ok + + xchg ax,.x2 + mov .x1,ax + mov edx,.z1 + xchg edx,.z2 + mov .z1,edx + .fl_ok: + cmp .x1,SIZE_X-1 + jg .fl_quit + cmp .x2,0 + jle .fl_quit + + mov eax,.z2 + sub eax,.z1 + cdq + mov bx,.x2 + sub bx,.x1 + movsx ebx,bx + idiv ebx +;; mov .dz,eax ; calculated delta - shifted .dz + push eax + + cmp .x1,0 + jge @f + movsx ebx,.x1 + neg ebx + imul ebx + add .z1,eax + mov .x1,0 + @@: + cmp .x2,SIZE_X + jl @f + mov .x2,SIZE_X + @@: + mov edx,SIZE_X + movsx eax,.y + mul edx ; edi = edi + (SIZE_X * y + x1)*3 + movsx edx,.x1 + add eax,edx + push eax + lea eax,[eax*3] + add edi,eax ; esi = esi + (SIZE_X * y + x1)*4 + pop eax + shl eax,2 + add esi,eax + + mov cx,.x2 + sub cx,.x1 + movzx ecx,cx + + mov eax,.col + mov ebx,.z1 ; ebx : curr. z + mov edx,.dz + .ddraw: + ;pushad + ;show + ;popad + cmp ebx,dword[esi] + jge .skip + stosd + dec edi + mov dword[esi],ebx + jmp .no_skip + .skip: + add edi,3 + .no_skip: + add esi,4 + add ebx,edx + loop .ddraw + + .fl_quit: + mov esp,ebp +ret 18 diff --git a/programs/demos/3DS/GRD3.ASM b/programs/demos/3DS/GRD3.ASM new file mode 100644 index 0000000000..ade6e1be47 --- /dev/null +++ b/programs/demos/3DS/GRD3.ASM @@ -0,0 +1,481 @@ +gouraud_triangle: +;------------------in - eax - x1 shl 16 + y1 --------- +;---------------------- ebx - x2 shl 16 + y2 --------- +;---------------------- ecx - x3 shl 16 + y3 --------- +;---------------------- edi - pointer to screen buffer +;---------------------- stack : colors---------------- +;----------------- procedure don't save registers !!-- +.col1r equ ebp+4 ; each color as word +.col1g equ ebp+6 +.col1b equ ebp+8 +.col2r equ ebp+10 +.col2g equ ebp+12 +.col2b equ ebp+14 +.col3r equ ebp+16 +.col3g equ ebp+18 +.col3b equ ebp+20 + +.x1 equ word[ebp-2] +.y1 equ word[ebp-4] +.x2 equ word[ebp-6] +.y2 equ word[ebp-8] +.x3 equ word[ebp-10] +.y3 equ word[ebp-12] + +.dc12r equ dword[ebp-16] +.dc12g equ dword[ebp-20] +.dc12b equ dword[ebp-24] +.dc13r equ dword[ebp-28] +.dc13g equ dword[ebp-32] +.dc13b equ dword[ebp-36] +.dc23r equ dword[ebp-40] +.dc23g equ dword[ebp-44] +.dc23b equ dword[ebp-48] + +.c1r equ dword[ebp-52] +.c1g equ dword[ebp-56] +.c1b equ dword[ebp-60] +.c2r equ dword[ebp-64] +.c2g equ dword[ebp-68] +.c2b equ dword[ebp-72] + +.dx12 equ dword[ebp-76] +.dx13 equ dword[ebp-80] +.dx23 equ dword[ebp-84] + + + + mov ebp,esp +; sub esp,72 + + .sort3: ; sort triangle coordinates... + cmp ax,bx + jle .sort1 + xchg eax,ebx + mov edx,dword[.col1r] + xchg edx,dword[.col2r] + mov dword[.col1r],edx + mov dx,word[.col1b] + xchg dx,word[.col2b] + mov word[.col1b],dx + .sort1: + cmp bx,cx + jle .sort2 + xchg ebx,ecx + mov edx,dword[.col2r] + xchg edx,dword[.col3r] + mov dword[.col2r],edx + mov dx,word[.col2b] + xchg dx,word[.col3b] + mov word[.col2b],dx + jmp .sort3 + .sort2: + push eax ;store triangle coordinates in user friendly variables + push ebx + push ecx + sub esp,72 ; set correctly value of esp + + mov edx,eax ; check only X triangle coordinate + or edx,ebx + or edx,ecx + test edx,80000000h + jne .gt_loop2_end + shr eax,16 + cmp ax,SIZE_X-1 + jg .gt_loop2_end + shr ebx,16 + cmp bx,SIZE_X-1 + jg .gt_loop2_end + shr ecx,16 + cmp cx,SIZE_X-1 + jg .gt_loop2_end + + + mov bx,.y2 ; calc deltas + sub bx,.y1 + jnz .gt_dx12_make + mov .dx12,0 + mov .dc12r,0 + mov .dc12g,0 + mov .dc12b,0 + jmp .gt_dx12_done + .gt_dx12_make: + + mov ax,.x2 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx12,eax + + mov ax,word[.col2r] + sub ax,word[.col1r] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc12r,eax + mov ax,word[.col2g] + sub ax,word[.col1g] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc12g,eax + mov ax,word[.col2b] + sub ax,word[.col1b] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc12b,eax +.gt_dx12_done: + + mov bx,.y3 + sub bx,.y1 + jnz .gt_dx13_make + mov .dx13,0 + mov .dc13r,0 + mov .dc13g,0 + mov .dc13b,0 + jmp .gt_dx13_done +.gt_dx13_make: + mov ax,.x3 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx13,eax + + mov ax,word[.col3r] + sub ax,word[.col1r] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc13r,eax + mov ax,word[.col3g] + sub ax,word[.col1g] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc13g,eax + mov ax,word[.col3b] + sub ax,word[.col1b] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc13b,eax +.gt_dx13_done: + + mov bx,.y3 + sub bx,.y2 + jnz .gt_dx23_make + mov .dx23,0 + mov .dc23r,0 + mov .dc23g,0 + mov .dc23b,0 + jmp .gt_dx23_done +.gt_dx23_make: + mov ax,.x3 + sub ax,.x2 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx23,eax + + mov ax,word[.col3r] + sub ax,word[.col2r] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc23r,eax + mov ax,word[.col3g] + sub ax,word[.col2g] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc23g,eax + mov ax,word[.col3b] + sub ax,word[.col2b] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc23b,eax +.gt_dx23_done: + + movsx eax,.x1 + shl eax,ROUND + mov ebx,eax + movsx edx,word[.col1r] + shl edx,ROUND + mov .c1r,edx + mov .c2r,edx + movsx edx,word[.col1g] + shl edx,ROUND + mov .c1g,edx + mov .c2g,edx + movsx edx,word[.col1b] + shl edx,ROUND + mov .c1b,edx + mov .c2b,edx + mov cx,.y1 + cmp cx,.y2 + jge .gt_loop1_end +.gt_loop1: + push eax ; eax - cur x1 + push ebx ; ebx - cur x2 + push cx ; cx - cur y + push edi + push ebp + + mov edx,.c2r ; c2r,c2g,c2b,c1r,c1g,c1b - current colors + sar edx,ROUND + push dx + mov edx,.c2g + sar edx,ROUND + push dx + mov edx,.c2b + sar edx,ROUND + push dx + mov edx,.c1r + sar edx,ROUND + push dx + mov edx,.c1g + sar edx,ROUND + push dx + mov edx,.c1b + sar edx,ROUND + push dx + push cx + sar ebx,ROUND + push bx + sar eax,ROUND + push ax + call gouraud_line + + pop ebp + pop edi + pop cx + pop ebx + pop eax + + mov edx,.dc13r + add .c1r,edx + mov edx,.dc13g + add .c1g,edx + mov edx,.dc13b + add .c1b,edx + mov edx,.dc12r + add .c2r,edx + mov edx,.dc12g + add .c2g,edx + mov edx,.dc12b + add .c2b,edx + + add eax,.dx13 + add ebx,.dx12 + inc cx + cmp cx,.y2 + jl .gt_loop1 +.gt_loop1_end: + + mov cx,.y2 + cmp cx,.y3 + jge .gt_loop2_end + movsx ebx,.x2 + shl ebx,ROUND + + movsx edx,word[.col2r] + shl edx,ROUND + mov .c2r,edx + movsx edx,word[.col2g] + shl edx,ROUND + mov .c2g,edx + movsx edx,word[.col2b] + shl edx,ROUND + mov .c2b,edx +.gt_loop2: + push eax ; eax - cur x1 + push ebx ; ebx - cur x2 + push cx + push edi + push ebp + + mov edx,.c2r + sar edx,ROUND + push dx + mov edx,.c2g + sar edx,ROUND + push dx + mov edx,.c2b + sar edx,ROUND + push dx + mov edx,.c1r + sar edx,ROUND + push dx + mov edx,.c1g + sar edx,ROUND + push dx + mov edx,.c1b + sar edx,ROUND + push dx + push cx + sar ebx,ROUND + push bx + sar eax,ROUND + push ax + call gouraud_line + + pop ebp + pop edi + pop cx + pop ebx + pop eax + + mov edx,.dc13r + add .c1r,edx + mov edx,.dc13g + add .c1g,edx + mov edx,.dc13b + add .c1b,edx + mov edx,.dc23r + add .c2r,edx + mov edx,.dc23g + add .c2g,edx + mov edx,.dc23b + add .c2b,edx + + add eax,.dx13 + add ebx,.dx23 + inc cx + cmp cx,.y3 + jl .gt_loop2 +.gt_loop2_end: + + ; add esp,84 + mov esp,ebp +ret 18 +gouraud_line: +;-------------in - edi - pointer to screen buffer +;----------------- stack - another parameters +.x1 equ word [ebp+4] +.x2 equ word [ebp+6] +.y equ word [ebp+8] +.col1b equ ebp+10 +.col1g equ ebp+12 +.col1r equ ebp+14 +.col2b equ ebp+16 +.col2g equ ebp+18 +.col2r equ ebp+20 +.dc_r equ dword[ebp-4] +.dc_g equ dword[ebp-8] +.dc_b equ dword[ebp-12] + mov ebp,esp + + mov ax,.y + or ax,ax + jl .gl_quit + cmp ax,SIZE_Y-1 + jg .gl_quit + + mov ax,.x1 + cmp ax,.x2 + je .gl_quit + jl .gl_ok + + xchg ax,.x2 + mov .x1,ax + mov eax,dword[.col1b] + xchg eax,dword[.col2b] + mov dword[.col1b],eax + mov ax,word[.col1r] + xchg ax,word[.col2r] + mov word[.col1r],ax +.gl_ok: + ; cmp .x1,SIZE_X-1 ;check + ; jg .gl_quit + ; cmp .x2,SIZE_X-1 + ; jl @f + ; mov .x2,SIZE_X-1 + ; @@: + ; cmp .x1,0 + ; jg @f + ; mov .x1,0 + ; @@: + ; cmp .x2,0 + ; jl .gl_quit + + movsx ecx,.y + mov eax,SIZE_X*3 + mul ecx + movsx ebx,.x1 + lea ecx,[ebx*2+eax] + add edi,ecx + add edi,ebx + + mov ax,word[.col2r] + sub ax,word[.col1r] + cwde + shl eax,ROUND + cdq + mov cx,.x2 + sub cx,.x1 + movsx ecx,cx + idiv ecx + ;mov .dc_r,eax ;first delta + push eax + + mov ax,word[.col2g] + sub ax,word[.col1g] + cwde + shl eax,ROUND + cdq + idiv ecx + ;mov .dc_g,eax + push eax + + mov ax,word[.col2b] + sub ax,word[.col1b] + cwde + shl eax,ROUND + cdq + idiv ecx + ; mov .dc_b,eax + push eax + + movsx ebx,word[.col1r] + shl ebx,ROUND + movsx edx,word[.col1g] + shl edx,ROUND + movsx esi,word[.col1b] + shl esi,ROUND +.gl_draw: + mov eax,ebx + sar eax,ROUND + stosb + mov eax,edx + sar eax,ROUND + stosb + mov eax,esi + sar eax,ROUND + stosb + add ebx,.dc_r + add edx,.dc_g + add esi,.dc_b + loop .gl_draw +.gl_quit: + ; add esp,12 + mov esp,ebp +ret 18 \ No newline at end of file diff --git a/programs/demos/3DS/GRD_CAT.ASM b/programs/demos/3DS/GRD_CAT.ASM new file mode 100644 index 0000000000..26942aaddd --- /dev/null +++ b/programs/demos/3DS/GRD_CAT.ASM @@ -0,0 +1,598 @@ +ROUND equ 8 +CATMULL_SHIFT equ 8 +gouraud_triangle_z: +;----procedure drawing gouraud triangle with z coordinate +;----interpolation ( Catmull alghoritm )----------------- +;------------------in - eax - x1 shl 16 + y1 ------------ +;---------------------- ebx - x2 shl 16 + y2 ------------ +;---------------------- ecx - x3 shl 16 + y3 ------------ +;---------------------- esi - pointer to Z-buffer-------- +;---------------------- Z-buffer filled with dd variables +;---------------------- shifted CATMULL_SHIFT------------ +;---------------------- edi - pointer to screen buffer--- +;---------------------- stack : colors------------------- +;----------------- procedure don't save registers !!----- +.col1r equ ebp+4 ; each color as word +.col1g equ ebp+6 ; each z coordinate as word +.col1b equ ebp+8 +.z1 equ ebp+10 +.col2r equ ebp+12 +.col2g equ ebp+14 +.col2b equ ebp+16 +.z2 equ ebp+18 +.col3r equ ebp+20 +.col3g equ ebp+22 +.col3b equ ebp+24 +.z3 equ ebp+26 + +.x1 equ word[ebp-2] +.y1 equ word[ebp-4] +.x2 equ word[ebp-6] +.y2 equ word[ebp-8] +.x3 equ word[ebp-10] +.y3 equ word[ebp-12] + +.dx12 equ dword[ebp-16] +.dz12 equ dword[ebp-20] +.dc12r equ dword[ebp-24] +.dc12g equ dword[ebp-28] +.dc12b equ dword[ebp-32] + +.dx13 equ dword[ebp-36] +.dz13 equ dword[ebp-40] +.dc13r equ dword[ebp-44] +.dc13g equ dword[ebp-48] +.dc13b equ dword[ebp-52] + +.dx23 equ dword[ebp-56] +.dz23 equ dword[ebp-60] +.dc23r equ dword[ebp-64] +.dc23g equ dword[ebp-68] +.dc23b equ dword[ebp-72] + +.c1r equ dword[ebp-76] +.c1g equ dword[ebp-80] +.c1b equ dword[ebp-84] +.c2r equ dword[ebp-88] +.c2g equ dword[ebp-92] +.c2b equ dword[ebp-96] +.zz1 equ dword[ebp-100] +.zz2 equ dword[ebp-104] + + mov ebp,esp + ; sub esp,84 + .sort3: ; sort triangle coordinates... + cmp ax,bx + jle .sort1 + xchg eax,ebx + mov edx,dword[.col1r] + xchg edx,dword[.col2r] + mov dword[.col1r],edx + mov edx,dword[.col1b] + xchg edx,dword[.col2b] + mov dword[.col1b],edx + .sort1: + cmp bx,cx + jle .sort2 + xchg ebx,ecx + mov edx,dword[.col2r] + xchg edx,dword[.col3r] + mov dword[.col2r],edx + mov edx,dword[.col2b] + xchg edx,dword[.col3b] + mov dword[.col2b],edx + jmp .sort3 + .sort2: + push eax ; store in variables + push ebx + push ecx + mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that + and edx,ebx ; if *all* of them are negative a sign flag is raised + and edx,ecx + and edx,eax + test edx,80008000h ; Check both X&Y at once + jne .gt_loop2_end + + mov bx,.y2 ; calc deltas + sub bx,.y1 + jnz .gt_dx12_make + ; mov .dx12,0 + ; mov .dz12,0 + ; mov .dc12r,0 + ; mov .dc12g,0 + ; mov .dc12b,0 + mov ecx,5 + @@: + push dword 0 + loop @b + jmp .gt_dx12_done + .gt_dx12_make: + mov ax,.x2 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx12,eax + push eax + + mov ax,word[.z2] + sub ax,word[.z1] + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + push eax + + mov ax,word[.col2r] + sub ax,word[.col1r] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc12r,eax + push eax + mov ax,word[.col2g] + sub ax,word[.col1g] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc12g,eax + push eax + mov ax,word[.col2b] + sub ax,word[.col1b] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc12b,eax + push eax + .gt_dx12_done: + + mov bx,.y3 ; calc deltas + sub bx,.y1 + jnz .gt_dx13_make + ; mov .dx13,0 + ; mov .dz13,0 + ; mov .dc13r,0 + ; mov .dc13g,0 + ; mov .dc13b,0 + mov ecx,5 + @@: + push dword 0 + loop @b + jmp .gt_dx13_done + .gt_dx13_make: + mov ax,.x3 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx13,eax + push eax + + mov ax,word[.z3] + sub ax,word[.z1] + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + push eax + + mov ax,word[.col3r] + sub ax,word[.col1r] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc13r,eax + push eax + mov ax,word[.col3g] + sub ax,word[.col1g] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc13g,eax + push eax + mov ax,word[.col3b] + sub ax,word[.col1b] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc13b,eax + push eax + .gt_dx13_done: + + mov bx,.y3 ; calc deltas + sub bx,.y2 + jnz .gt_dx23_make + ; mov .dx23,0 + ; mov .dz23,0 + ; mov .dc23r,0 + ; mov .dc23g,0 + ; mov .dc23b,0 + mov ecx,5 + @@: + push dword 0 + loop @b + jmp .gt_dx23_done + .gt_dx23_make: + mov ax,.x3 + sub ax,.x2 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx23,eax + push eax + + mov ax,word[.z3] + sub ax,word[.z2] + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + push eax + + mov ax,word[.col3r] + sub ax,word[.col2r] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc23r,eax + push eax + mov ax,word[.col3g] + sub ax,word[.col2g] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc23g,eax + push eax + mov ax,word[.col3b] + sub ax,word[.col2b] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc23b,eax + push eax + .gt_dx23_done: + sub esp,32 + + movsx eax,.x1 ; eax - cur x1 + shl eax,ROUND ; ebx - cur x2 + mov ebx,eax + movsx edx,word[.z1] + shl edx,CATMULL_SHIFT + mov .zz1,edx + mov .zz2,edx + movzx edx,word[.col1r] + shl edx,ROUND + mov .c1r,edx + mov .c2r,edx + movzx edx,word[.col1g] + shl edx,ROUND + mov .c1g,edx + mov .c2g,edx + movzx edx,word[.col1b] + shl edx,ROUND + mov .c1b,edx + mov .c2b,edx + mov cx,.y1 + cmp cx,.y2 + jge .gt_loop1_end + + .gt_loop1: + pushad + ; macro .debug + + mov edx,.c2r ; c2r,c2g,c2b,c1r,c1g,c1b - current colors + sar edx,ROUND + push dx + mov edx,.c2g + sar edx,ROUND + push dx + mov edx,.c2b + sar edx,ROUND + push dx + sar ebx,ROUND ; x2 + push bx + mov edx,.c1r + sar edx,ROUND + push dx + mov edx,.c1g + sar edx,ROUND + push dx + mov edx,.c1b + sar edx,ROUND + push dx + sar eax,ROUND + push ax ; x1 + push cx ; y + push .zz2 + push .zz1 + call gouraud_line_z + + popad + + mov edx,.dc13r + add .c1r,edx + mov edx,.dc13g + add .c1g,edx + mov edx,.dc13b + add .c1b,edx + mov edx,.dc12r + add .c2r,edx + mov edx,.dc12g + add .c2g,edx + mov edx,.dc12b + add .c2b,edx + mov edx,.dz13 + add .zz1,edx + mov edx,.dz12 + add .zz2,edx + + add eax,.dx13 + add ebx,.dx12 + inc cx + cmp cx,.y2 + jl .gt_loop1 + + .gt_loop1_end: + mov cx,.y2 + cmp cx,.y3 + jge .gt_loop2_end + + movsx ebx,.x2 ; eax - cur x1 + shl ebx,ROUND ; ebx - cur x2 + movsx edx,word[.z2] + shl edx,CATMULL_SHIFT + mov .zz2,edx + movzx edx,word[.col2r] + shl edx,ROUND + mov .c2r,edx + movzx edx,word[.col2g] + shl edx,ROUND + mov .c2g,edx + movzx edx,word[.col2b] + shl edx,ROUND + mov .c2b,edx + + .gt_loop2: + pushad + ; macro .debug + + mov edx,.c2r ; c2r,c2g,c2b,c1r,c1g,c1b - current colors + sar edx,ROUND + push dx + mov edx,.c2g + sar edx,ROUND + push dx + mov edx,.c2b + sar edx,ROUND + push dx + sar ebx,ROUND ; x2 + push bx + mov edx,.c1r + sar edx,ROUND + push dx + mov edx,.c1g + sar edx,ROUND + push dx + mov edx,.c1b + sar edx,ROUND + push dx + sar eax,ROUND + push ax ; x1 + push cx ; y + push .zz2 + push .zz1 + call gouraud_line_z + + popad + + mov edx,.dc13r + add .c1r,edx + mov edx,.dc13g + add .c1g,edx + mov edx,.dc13b + add .c1b,edx + mov edx,.dc23r + add .c2r,edx + mov edx,.dc23g + add .c2g,edx + mov edx,.dc23b + add .c2b,edx + mov edx,.dz13 + add .zz1,edx + mov edx,.dz23 + add .zz2,edx + + add eax,.dx13 + add ebx,.dx23 + inc cx + cmp cx,.y3 + jl .gt_loop2 + .gt_loop2_end: + + mov esp,ebp +ret 24 +gouraud_line_z: +;----------------- procedure drawing gouraud line +;----------------- with z coordinate interpolation +;----------------- esi - pointer to Z_buffer +;----------------- edi - pointer to screen buffer +;----------------- stack: +.z1 equ dword[ebp+4] ; z coordiunate shifted left CATMULL_SHIFT +.z2 equ dword[ebp+8] +.y equ word[ebp+12] +.x1 equ ebp+14 +.c1b equ ebp+16 +.c1g equ ebp+18 +.c1r equ ebp+20 +.x2 equ ebp+22 +.c2b equ ebp+24 +.c2g equ ebp+26 +.c2r equ ebp+28 +.dz equ dword[ebp-4] +.dc_r equ dword[ebp-8] +.dc_g equ dword[ebp-12] +.dc_b equ dword[ebp-14] +.cr equ dword[ebp-18] +.cg equ dword[ebp-22] +.cb equ dword[ebp-26] + mov ebp,esp + + mov ax,.y + or ax,ax + jl .gl_quit + cmp ax,SIZE_Y + jge .gl_quit + + mov eax,dword[.x1] + cmp ax,word[.x2] + je .gl_quit + jl @f + + xchg eax,dword[.x2] + mov dword[.x1],eax + mov eax,dword[.c1g] + xchg eax,dword[.c2g] + mov dword[.c1g],eax + mov eax,.z1 + xchg eax,.z2 + mov .z1,eax + @@: + cmp word[.x1],SIZE_X + jge .gl_quit + cmp word[.x2],0 + jle .gl_quit + + mov eax,.z2 + sub eax,.z1 + cdq + mov bx,word[.x2] ; dz = z2-z1/x2-x1 + sub bx,word[.x1] + movsx ebx,bx + idiv ebx + push eax + + mov ax,word[.c2r] + sub ax,word[.c1r] + cwde + shl eax,ROUND ; dc_r = c2r-c1r/x2-x1 + cdq + idiv ebx + push eax + + mov ax,word[.c2g] + sub ax,word[.c1g] + cwde + shl eax,ROUND + cdq + idiv ebx + push eax + + mov ax,word[.c2b] + sub ax,word[.c1b] + cwde + shl eax,ROUND + cdq + idiv ebx + push eax + + cmp word[.x1],0 + jg @f + mov eax,.dz + movsx ebx,word[.x1] + neg ebx + imul ebx + add .z1,eax + mov word[.x1],0 + + mov eax,.dc_r + imul ebx + sar eax,ROUND + add word[.c1r],ax + + mov eax,.dc_g + imul ebx + sar eax,ROUND + add word[.c1g],ax + + mov eax,.dc_b + imul ebx + sar eax,ROUND + add word[.c1b],ax + + @@: + cmp word[.x2],SIZE_X + jl @f + mov word[.x2],SIZE_X + @@: + sub esp,12 ; calculate memory begin + mov edx,SIZE_X ; in buffers + movzx eax,.y + mul edx + movzx edx,word[.x1] + add eax,edx + push eax + lea eax,[eax*3] + add edi,eax + pop eax + shl eax,2 + add esi,eax + + mov cx,word[.x2] + sub cx,word[.x1] + movzx ecx,cx + mov ebx,.z1 ; ebx - currrent z shl CATMULL_SIFT + mov edx,.dz ; edx - delta z + movzx eax,word[.c1r] + shl eax,ROUND + mov .cr,eax + movzx eax,word[.c1g] + shl eax,ROUND + mov .cg,eax + movzx eax,word[.c1b] + shl eax,ROUND + mov .cb,eax + .ddraw: + cmp ebx,dword[esi] + jge .skip + mov eax,.cr + sar eax,ROUND + stosb + mov eax,.cg + sar eax,ROUND + stosb + mov eax,.cb + sar eax,ROUND + stosb + mov dword[esi],ebx + jmp .no_skip + .skip: + add edi,3 + .no_skip: + add esi,4 + add ebx,edx + mov eax,.dc_r + add .cr,eax + mov eax,.dc_g + add .cg,eax + mov eax,.dc_b + add .cb,eax + loop .ddraw + + .gl_quit: + mov esp,ebp +ret 26 \ No newline at end of file diff --git a/programs/demos/3DS/HRT.3DS b/programs/demos/3DS/HRT.3DS new file mode 100644 index 0000000000000000000000000000000000000000..a21f9d98be070cf1dde8e812f205bca709bf2319 GIT binary patch literal 36428 zcmeFaXH*r-)-~L{y8!`3P*F?>7*Ii!WOjEoDkcylnhEBdbHc30h&hX5&SDPit~N)^ zIe|InqaNcoSDpKQ<9YtP|KBn0z2mM~bM30?RdXWjuC5+8GBRSOBv~XUNs<)&uU@^n z;MRKohyU50iL8`S2qC6n1Fz@^JvOdMeaSVWATn-}BjWoeO}zdG{Ub@${wMwOhh?~+ zTQw;kVw9x+50)xL{||;s{4W;!zu1KT#U^J^iISA2N%H^SVq<1VQvE(X`}D6?Lz47< zV6J+{ijve$sras>`D<2rW9!;cdXHA6Oj}lied~XY(RMlYA;Vs5&l7{i^?^m#R%&5EJ7Z1-EI>8>O4nbnW4vOQm%rte!|Z@wSX$YwpB zrjK4}XHLF4DLdlMzip?SN%g2reI|}+WTiedc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1ToNu$~v^AG6>9S55~O0O}lZ4TDcs`jYk zgq|$rNONeRDC6mbYFawgwyU*G&rxcGxg^_oqkLFNSNh*S?tixP(DLlfN@R9o*zDZM~?&e-5>?ibJfwT!BL9}=an?mN=jxdGg<0@5-#&uxf!?fu=rI zi|{tqiUwWXSybEa@N_K?_krNL*@3^Z;yJ$zP@Mp?Lj$F)$BdBlV2mPlxNF(+E`JJ-@ij%{_R+8;iO?!*T=Iw z-*sO{ZuNbaHEE)C-aWu-l+xn~$dMyHk7~PoI_YS2qm^}Xc}nZ=XUSc8ReN1a45`+= zruil@zjbt5NmoAA{`2{T<4&dyW`^|1%mH4P9r;x|^zD7)Nw?YBd_IdLPH;O4sP_Df z0Y>-B@p{>3(Pmff4}q#(b1BA%+8G`{=L4SuhA-6$s&?m|Q^uxG6J2fJIIX$Y!nH!G zy|#b75wz%z>%=3cm38WSM`6_tdX~l*x~Px4(R`;>u-Le`BC7pX)6zCxuIX7B6lwak ze&Q&q+ExAijRXI5il59=?#bQUS~1o3XcKBI@Nca>;feUXTpBG%wcRgOF-kyihliCVg21Pr&)Pr-jMwNmp`|VKVkU&^?v~-Tq&~v literal 0 HcmV?d00001 diff --git a/programs/demos/3DS/TEX3.ASM b/programs/demos/3DS/TEX3.ASM new file mode 100644 index 0000000000..afb0263ee9 --- /dev/null +++ b/programs/demos/3DS/TEX3.ASM @@ -0,0 +1,507 @@ +;--------------------------------------------------------------------- +;--------------------textured triangle procedure---------------------- +;--------------------------------------------------------------------- +tex_triangle: +;----------in - eax - x1 shl 16 + y1 +;-------------- ebx - x2 shl 16 + y2 +;---------------ecx - x3 shl 16 + y3 +;---------------edx - nothing +;---------------esi - pointer to texture buffer +;---------------edi - pointer to screen buffer +;-------------stack - texture coordinates +.tex_x1 equ ebp+4 +.tex_y1 equ ebp+6 +.tex_x2 equ ebp+8 +.tex_y2 equ ebp+10 +.tex_x3 equ ebp+12 +.tex_y3 equ ebp+14 + mov ebp,esp + + mov edx,dword[.tex_x1] ; check all parameters + or dx,dx + jl .tt_end + cmp dx,TEX_X-1 + jg .tt_end + shr edx,16 + or dx,dx + jl .tt_end + cmp dx,TEX_Y-1 + jg .tt_end + + mov edx,dword[.tex_x2] + or dx,dx + jl .tt_end + cmp dx,TEX_X-1 + jg .tt_end + shr edx,16 + or dx,dx + jl .tt_end + cmp dx,TEX_Y-1 + jg .tt_end + + mov edx,dword[.tex_x3] + or dx,dx + jl .tt_end + cmp dx,TEX_X-1 + jg .tt_end + shr edx,16 + cmp dx,TEX_Y-1 + jg .tt_end + or dx,dx + jl .tt_end + + mov edx,eax ; check X&Y triangle coordinate + or edx,ebx + or edx,ecx + test edx,80008000h + jne .tt_end + + ; or ax,ax + ; jl .tt_end + cmp ax,SIZE_Y + jg .tt_end + ror eax,16 + ; or ax,ax + ; jl .tt_end + cmp ax,SIZE_X + jg .tt_end + rol eax,16 + + ; or bx,bx + ; jl .tt_end + cmp bx,SIZE_Y + jg .tt_end + ror ebx,16 + ; or bx,bx + ; jl .tt_end + cmp bx,SIZE_X + jg .tt_end + rol ebx,16 + + ; or cx,cx + ; jl .tt_end + cmp cx,SIZE_Y + jg .tt_end + ror ecx,16 + ; or cx,cx + ; jl .tt_end + cmp cx,SIZE_X + jg .tt_end + rol ecx,16 ; uff.. parameters was checked + + cmp ax,bx ;sort all parameters + jle .tt_sort1 + xchg eax,ebx + mov edx,dword [.tex_x1] + xchg edx,dword [.tex_x2] + mov dword[.tex_x1],edx +.tt_sort1: + cmp ax,cx + jle .tt_sort2 + xchg eax,ecx + mov edx,dword [.tex_x1] + xchg edx,dword [.tex_x3] + mov dword [.tex_x1],edx +.tt_sort2: + cmp bx,cx + jle .tt_sort3 + xchg ebx,ecx + mov edx,dword [.tex_x2] + xchg edx,dword [.tex_x3] + mov dword [.tex_x2],edx +.tt_sort3: + mov [.y1],ax ; and store to user friendly variables + shr eax,16 + mov [.x1],ax + mov [.y2],bx + shr ebx,16 + mov [.x2],bx + mov [.y3],cx + shr ecx,16 + mov [.x3],cx + mov [.tex_ptr],esi + + movsx ebx,word[.y2] + sub bx,[.y1] + jnz .tt_dx12_make + + mov [.dx12],0 + mov [.tex_dx12],0 + mov [.tex_dy12],0 + jmp .tt_dx12_done +.tt_dx12_make: + mov ax,[.x2] + sub ax,[.x1] + cwde + shl eax,ROUND + cdq + idiv ebx + mov [.dx12],eax ; dx12 = (x2-x1)/(y2-y1) + + mov ax,word[.tex_x2] + sub ax,word[.tex_x1] + cwde + shl eax,ROUND + cdq + idiv ebx + mov [.tex_dx12],eax ; tex_dx12 = (tex_x2-tex_x1)/(y2-y1) + + mov ax,word[.tex_y2] + sub ax,word[.tex_y1] + cwde + shl eax,ROUND + cdq + idiv ebx + mov [.tex_dy12],eax ; tex_dy12 = (tex_y2-tex_y1)/(y2-y1) +.tt_dx12_done: + + movsx ebx,[.y3] + sub bx,[.y1] + jnz .tt_dx13_make + + mov [.dx13],0 + mov [.tex_dx13],0 + mov [.tex_dy13],0 + jmp .tt_dx13_done +.tt_dx13_make: + mov ax,[.x3] + sub ax,[.x1] + cwde + shl eax,ROUND + cdq + idiv ebx + mov [.dx13],eax ; dx13 = (x3-x1)/(y3-y1) + + mov ax,word[.tex_x3] + sub ax,word[.tex_x1] + cwde + shl eax,ROUND + cdq + idiv ebx + mov [.tex_dx13],eax ; tex_dx13 = (tex_x3-tex_x1)/(y3-y1) + + mov ax,word[.tex_y3] + sub ax,word[.tex_y1] + cwde + shl eax,ROUND + cdq + idiv ebx + mov [.tex_dy13],eax ; tex_dy13 = (tex_y3-tex_y1)/(y3-y1) +.tt_dx13_done: + + movsx ebx,[.y3] + sub bx,[.y2] + jnz .tt_dx23_make + + mov [.dx23],0 + mov [.tex_dx23],0 + mov [.tex_dy23],0 + jmp .tt_dx23_done +.tt_dx23_make: + mov ax,[.x3] + sub ax,[.x2] + cwde + shl eax,ROUND + cdq + idiv ebx + mov [.dx23],eax ; dx23 = (x3-x2)/(y3-y2) + + mov ax,word[.tex_x3] + sub ax,word[.tex_x2] + cwde + shl eax,ROUND + cdq + idiv ebx + mov [.tex_dx23],eax ; tex_dx23 = (tex_x3-tex_x2)/(y3-y2) + + mov ax,word[.tex_y3] + sub ax,word[.tex_y2] + cwde + shl eax,ROUND + cdq + idiv ebx + mov [.tex_dy23],eax ; tex_dy23 = (tex_y3-tex_y2)/(y3-y2) +.tt_dx23_done: + + movsx eax,[.x1] + shl eax,ROUND + mov ebx,eax + + movsx edx, word[.tex_x1] + shl edx,ROUND + mov [.scan_x1],edx + mov [.scan_x2],edx + movsx edx, word[.tex_y1] + shl edx,ROUND + mov [.scan_y1],edx + mov [.scan_y2],edx + + mov cx,[.y1] + cmp cx, [.y2] + jge .tt_loop1_end +.tt_loop1: + push edi + push eax + push ebx + push cx + push ebp + + mov edx, [.scan_y2] + sar edx, ROUND + push dx + mov edx, [.scan_x2] + sar edx, ROUND + push dx + mov edx, [.scan_y1] + sar edx, ROUND + push dx + mov edx, [.scan_x1] + sar edx, ROUND + push dx + push [.tex_ptr] + + push cx + mov edx,ebx + sar edx,ROUND + push dx + mov edx,eax + sar edx,ROUND + push dx + call textured_line + + pop ebp + pop cx + pop ebx + pop eax + pop edi + + mov edx, [.tex_dx13] + add [.scan_x1], edx + mov edx, [.tex_dx12] + add [.scan_x2], edx + mov edx, [.tex_dy13] + add [.scan_y1], edx + mov edx, [.tex_dy12] + add [.scan_y2], edx + + add eax, [.dx13] + add ebx, [.dx12] + inc cx + cmp cx,[.y2] + jl .tt_loop1 +.tt_loop1_end: + + + mov cx,[.y2] + cmp cx, [.y3] + jge .tt_loop2_end + + movsx ebx,[.x2] + shl ebx,ROUND + + movsx edx, word[.tex_x2] + shl edx,ROUND + mov [.scan_x2],edx + movsx edx, word[.tex_y2] + shl edx,ROUND + mov [.scan_y2],edx + +.tt_loop2: + push edi + push eax + push ebx + push cx + push ebp + + mov edx, [.scan_y2] + sar edx, ROUND + push dx + mov edx, [.scan_x2] + sar edx, ROUND + push dx + mov edx, [.scan_y1] + sar edx, ROUND + push dx + mov edx, [.scan_x1] + sar edx, ROUND + push dx + push [.tex_ptr] + + push cx + mov edx,ebx + sar edx,ROUND + push dx + mov edx,eax + sar edx,ROUND + push dx + call textured_line + + pop ebp + pop cx + pop ebx + pop eax + pop edi + + mov edx, [.tex_dx13] + add [.scan_x1], edx + mov edx, [.tex_dx23] + add [.scan_x2], edx + mov edx, [.tex_dy13] + add [.scan_y1], edx + mov edx, [.tex_dy23] + add [.scan_y2], edx + + add eax, [.dx13] + add ebx, [.dx23] + inc cx + cmp cx,[.y3] + jl .tt_loop2 +.tt_loop2_end: + +.tt_end: + mov esp,ebp +ret 12 +.x1 dw ? +.y1 dw ? +.x2 dw ? +.y2 dw ? +.x3 dw ? +.y3 dw ? +.dx12 dd ? +.dx13 dd ? +.dx23 dd ? +.tex_dx12 dd ? +.tex_dy12 dd ? +.tex_dx13 dd ? +.tex_dy13 dd ? +.tex_dx23 dd ? +.tex_dy23 dd ? +.tex_ptr dd ? + +.scan_x1 dd ? +.scan_y1 dd ? +.scan_x2 dd ? +.scan_y2 dd ? + + +textured_line: +;-----in -edi screen buffer pointer +;------------ stack: + .x1 equ word [ebp+4] + .x2 equ word [ebp+6] + .y equ word [ebp+8] + + .tex_ptr equ dword [ebp+10] + .tex_x1 equ word [ebp+14] + .tex_y1 equ word [ebp+16] + .tex_x2 equ word [ebp+18] + .tex_y2 equ word [ebp+20] + + mov ebp,esp + + mov ax,.y + or ax,ax + jl .tl_quit + cmp ax,SIZE_Y + jg .tl_quit + + mov ax,.x1 + cmp ax,.x2 + je .tl_quit + jl .tl_ok + + xchg ax,.x2 + mov .x1,ax + + mov ax,.tex_x1 + xchg ax,.tex_x2 + mov .tex_x1,ax + + mov ax,.tex_y1 + xchg ax,.tex_y2 + mov .tex_y1,ax + + .tl_ok: + mov ebx,edi + movsx edi,.y + mov eax,SIZE_X*3 + mul edi + mov edi,eax + movsx eax,.x1 + add edi,eax + shl eax,1 + add edi,eax + add edi,ebx + + mov cx,.x2 + sub cx,.x1 + movsx ecx,cx + + mov ax,.tex_x2 + sub ax,.tex_x1 + cwde + shl eax,ROUND + cdq + idiv ecx + mov [.tex_dx],eax ; tex_dx=(tex_x2-tex_x1)/(x2-x1) + + mov ax,.tex_y2 + sub ax,.tex_y1 + cwde + shl eax,ROUND + cdq + idiv ecx + mov [.tex_dy],eax ; tex_dy = (tex_y2-tex_y1)/(x2-x1) + + movsx eax,.tex_x1 + shl eax,ROUND + movsx ebx,.tex_y1 + shl ebx,ROUND + cld + .tl_loop: + mov edx,eax + mov esi,ebx + sar edx,ROUND + sar esi,ROUND + macro .fluent + { + push eax + push edx + mov eax,TEX_X*3 + mul esi + mov esi,eax + pop edx + pop eax + } + macro .shift + { + shl esi,TEX_SHIFT + lea esi,[esi*3] + ;push edx + ;mov edx,esi + ;shl esi,1 + ;add esi,edx + ;pop edx + } + if TEX = FLUENTLY + .fluent + end if + if TEX = SHIFTING + .shift + end if + lea edx,[edx*3] + add esi,edx + ; shl edx,1 + ; add esi,edx + add esi,.tex_ptr + movsd + dec edi + add eax,[.tex_dx] + add ebx,[.tex_dy] + loop .tl_loop + + .tl_quit: + mov esp,ebp +ret 18 + .tex_dx dd ? + .tex_dy dd ? diff --git a/programs/develop/fasm/trunk/build_ru.bat b/programs/develop/fasm/trunk/build_ru.bat index 8b14218bdd..69a5437498 100644 --- a/programs/develop/fasm/trunk/build_ru.bat +++ b/programs/develop/fasm/trunk/build_ru.bat @@ -2,4 +2,5 @@ @echo lang fix ru >lang.inc @fasm fasm.asm fasm @erase lang.inc +@kpack fasm @pause \ No newline at end of file diff --git a/programs/fs/kfar/trunk/build_ru.bat b/programs/fs/kfar/trunk/build_ru.bat index b0ca73ff89..c5ffa6ecd9 100644 --- a/programs/fs/kfar/trunk/build_ru.bat +++ b/programs/fs/kfar/trunk/build_ru.bat @@ -2,4 +2,5 @@ @echo lang fix ru >lang.inc @fasm kfar.asm kfar @erase lang.inc +@kpack kfar @pause \ No newline at end of file diff --git a/programs/games/rsquare/trunk/build_ru.bat b/programs/games/rsquare/trunk/build_ru.bat index 5c9f6f6923..32c91aaf7d 100644 --- a/programs/games/rsquare/trunk/build_ru.bat +++ b/programs/games/rsquare/trunk/build_ru.bat @@ -1,4 +1,5 @@ @echo lang fix ru >lang.inc @fasm rsquare.asm rsquare @erase lang.inc +kpack rsquare @pause \ No newline at end of file diff --git a/programs/media/jpegview/trunk/build_ru.bat b/programs/media/jpegview/trunk/build_ru.bat index d2a7da4349..2cf6968185 100644 --- a/programs/media/jpegview/trunk/build_ru.bat +++ b/programs/media/jpegview/trunk/build_ru.bat @@ -2,4 +2,5 @@ @echo lang fix ru >lang.inc @fasm jpegview.asm jpegview @erase lang.inc +@kpack jpegview @pause \ No newline at end of file diff --git a/programs/network/ftps/trunk/FTPS.ASM b/programs/network/ftps/trunk/FTPS.ASM index 2a4cb4f931..a1dd089428 100644 --- a/programs/network/ftps/trunk/FTPS.ASM +++ b/programs/network/ftps/trunk/FTPS.ASM @@ -20,7 +20,7 @@ use32 dd 0x7FFF0 ; esp = 0x7FFF0 dd 0, 0 ; no params, no path -include '..\..\..\macros.inc' +include 'macros.inc' ; Various states of client connection USER_NONE equ 0 ; Awaiting a connection USER_CONNECTED equ 1 ; User just connected, prompt given @@ -66,7 +66,7 @@ still: ; If the socket closed by remote host, open it again. cmp eax, 7 je con - + ; If socket closed by Reset, open it again cmp eax, 11 je con @@ -180,7 +180,7 @@ draw_window: xor eax,eax ; DRAW WINDOW mov ebx,100*65536+491 + 8 +15 mov ecx,100*65536+270 + 20 ; 20 for status bar - mov edx,0x13000000 + mov edx,0x14000000 mov edi,labelt mcall @@ -434,17 +434,17 @@ outputStr: mcall pop edx pop esi - + cmp eax, 0 je os_exit - - ; The TCP/IP transmit queue is full; Wait a bit, then retry + + ; The TCP/IP transmit queue is full; Wait a bit, then retry pusha mov eax,5 mov ebx,1 ; Delay for up 100ms mcall popa - jmp outputStr + jmp outputStr os_exit: ret @@ -475,13 +475,13 @@ outputDataStr: cmp eax, 0 je ods_exit - ; The TCP/IP transmit queue is full; Wait a bit, then retry + ; The TCP/IP transmit queue is full; Wait a bit, then retry pusha mov eax,5 mov ebx,20 ; Delay for upto 200ms mcall popa - jmp outputDataStr + jmp outputDataStr ods_exit: ret @@ -582,7 +582,7 @@ disconnect: mov ecx,[CmdSocket] mcall ret - + ;*************************************************************************** @@ -841,7 +841,7 @@ pps002: ; The data connection is already open. ; ; Inputs -; None +; None ; ; Outputs ; None @@ -1002,7 +1002,7 @@ sd_exit: ; file descriptor ; ; Inputs -; None +; None ; ; Outputs ; None @@ -1010,32 +1010,32 @@ sd_exit: ;*************************************************************************** setupFilePath: mov esi, buff + 4 ; Point to (1 before) first character of file - + ; Skip any trailing spaces or / character -sfp001: +sfp001: inc esi cmp [esi], byte ' ' je sfp001 cmp [esi], byte '/' je sfp001 - + ; esi points to start of filename. - - + + ; Copy across the directory path '/' ; into the fileinfoblock mov edi, filename mov dword [edi], '/RD/' mov word [edi+4], '1/' add edi, 6 - + ; Copy across the filename sfp002: cld movsb cmp [esi], byte 0x0d jne sfp002 - mov [edi], byte 0 + mov [edi], byte 0 ret @@ -1050,7 +1050,7 @@ sfp002: ; The file to send is named in the buff string ; ; Inputs -; None +; None ; ; Outputs ; None @@ -1065,7 +1065,7 @@ sendFile: and dword [ebx+4], 0 ; first block sf002a: - ; now read the file.. + ; now read the file.. mov eax,70 mcall test eax, eax @@ -1088,9 +1088,9 @@ sf002a: add dword [ebx+4], edx jmp sf002a -sf_exit: +sf_exit: ret - + ;*************************************************************************** ; Function @@ -1101,7 +1101,7 @@ sf_exit: ; The file to receive is named in the buff string ; ; Inputs -; None +; None ; ; Outputs ; None @@ -1109,7 +1109,7 @@ sf_exit: ;*************************************************************************** getFile: call setupFilePath - + ; init fileblock descriptor, for file write xor eax, eax mov [fsize], eax ; Start filelength at 0 @@ -1117,7 +1117,7 @@ getFile: inc eax inc eax mov [fileinfoblock], eax ; write cmd - + ; Read data from the socket until the socket closes ; loop ; loop @@ -1127,7 +1127,7 @@ getFile: ; sleep 100ms ; until socket no longer connected ; write file to ram - + gf000: mov eax, 53 mov ebx, 2 ; Get # of bytes in input queue @@ -1135,20 +1135,20 @@ gf000: mcall test eax, eax je gf_sleep - + mov eax, 53 mov ebx, 3 ; Get a byte from socket in bl mov ecx, [DataSocket] mcall ; returned data in bl - + mov esi, text + 0x1300 add esi, dword [fsize] mov [esi], bl inc dword [fsize] - + ; dummy, write to screen - ;call printChar - + ;call printChar + jmp gf000 gf_sleep: @@ -1176,8 +1176,8 @@ gf001: mov ebx,10 ; Delay for up 100ms mcall jmp gf000 ; try for more data - - + + @@ -1203,12 +1203,12 @@ cmdCWD: ; Only / is valid for the ramdisk cmp [buff+5], byte 0x0d jne ccwd_000 - + ; OK, show the directory name text mov esi, chdir mov edx, chdir_end - chdir jmp ccwd_001 - + ccwd_000: ; Tell user there is no such directory mov esi, noFileStr @@ -1292,22 +1292,22 @@ cmdDELE: mcall pop dword [ebx+16] pop dword [ebx+12] - + test eax, eax jne cmdDele_err mov esi, delokStr mov edx, delokStr_end - delokStr call outputStr - + jmp cmdDele_exit - -cmdDele_err: + +cmdDele_err: mov esi, noFileStr mov edx, noFileStr_end - noFileStr call outputStr - - + + cmdDele_exit: ret @@ -1340,7 +1340,7 @@ cl001: ; send directory listing call sendDir - + ; Close port call disconnectData @@ -1376,7 +1376,7 @@ cr001: ; send data to remote user call sendFile - + ; Close port call disconnectData @@ -1418,7 +1418,7 @@ cs001: ; get data file from remote user call getFile - + mov esi, endStr mov edx, endStr_end - endStr call outputStr @@ -1612,7 +1612,7 @@ dirinfoblock: dirpath db '/sys',0 fsize: dd 0 - + state db 0 buffptr dd 0 buff: times 256 db 0 ; Could put this after iend diff --git a/programs/network/httpc/trunk/httpc.asm b/programs/network/httpc/trunk/httpc.asm index 41c64f19fb..9e0d3c7f4c 100644 --- a/programs/network/httpc/trunk/httpc.asm +++ b/programs/network/httpc/trunk/httpc.asm @@ -23,17 +23,17 @@ DEBUGGING_DISABLED equ 0 DEBUGGING_STATE equ DEBUGGING_DISABLED use32 - org 0x0 - db 'MENUET01' ; header - dd 0x01 ; header version - dd START ; entry point - dd I_END ; image size - dd 0x100000 ; required memory - dd 0x100000 ; esp - dd 0x0 , 0x0 ; I_Param , I_Path + org 0x0 + db 'MENUET01' ; header + dd 0x01 ; header version + dd START ; entry point + dd I_END ; image size + dd 0x100000 ; required memory + dd 0x100000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Path include 'lang.inc' -include '..\..\..\macros.inc' +include 'macros.inc' ;include "DEBUG.INC" URLMAXLEN equ 50 ; maximum length of url string @@ -1392,11 +1392,11 @@ draw_window: mov eax,0 ; function 0 : define and draw window mov ebx,50*65536+550 ; [x start] *65536 + [x size] mov ecx,50*65536+400 ; [y start] *65536 + [y size] - mov edx,0x13ffffff ; color of work area RRGGBB,8->color gl + mov edx,0x14ffffff ; color of work area RRGGBB,8->color gl mov edi,title ; WINDOW LABEL mcall - + mov esi, URLMAXLEN ; URL mov eax,4 ; function 4 : write text to window mov ebx,30*65536+38 ; [x start] *65536 + [y start] diff --git a/programs/network/https/trunk/https.asm b/programs/network/https/trunk/https.asm index b69b97b3f7..6045af826a 100644 --- a/programs/network/https/trunk/https.asm +++ b/programs/network/https/trunk/https.asm @@ -19,17 +19,17 @@ version equ '0.6' use32 - org 0x0 + org 0x0 - db 'MENUET01' ; 8 byte id - dd 0x01 ; required os - dd START ; program start - dd I_END ; program image size - dd 0x400000 ; required amount of memory - dd 0x20000 - dd 0,0 ; reserved=no extended header + db 'MENUET01' ; 8 byte id + dd 0x01 ; required os + dd START ; program start + dd I_END ; program image size + dd 0x400000 ; required amount of memory + dd 0x20000 + dd 0,0 ; reserved=no extended header -include "..\..\..\MACROS.INC" +include "MACROS.INC" ; 0x0+ - program image ; 0x1ffff - stack @@ -42,7 +42,7 @@ filel: dd 0 dd 50000 dd 0x20000 - db '/sys/board.htm',0 + db '/sys/board.htm',0 files: dd 2 @@ -53,7 +53,7 @@ files: db '/sys/board.htm',0 -START: ; start of execution +START: ; start of execution mov eax,70 mov ebx,filel @@ -81,7 +81,7 @@ START: ; start of execution mov [last_status],-2 call clear_input red: - call draw_window ; at first, draw the window + call draw_window ; at first, draw the window still: @@ -110,26 +110,26 @@ last_status dd 0x0 check_events: - cmp eax,1 ; redraw request ? + cmp eax,1 ; redraw request ? jz red - cmp eax,2 ; key in buffer ? + cmp eax,2 ; key in buffer ? jz key - cmp eax,3 ; button in buffer ? + cmp eax,3 ; button in buffer ? jz button ret -key: ; Keys are not valid at this part of the - mov al,2 ; loop. Just read it and ignore +key: ; Keys are not valid at this part of the + mov al,2 ; loop. Just read it and ignore mcall ret -button: ; button +button: ; button - mov al,17 ; get id + mov al,17 ; get id mcall - cmp ah,1 ; close + cmp ah,1 ; close jnz tst2 mov eax,53 mov ebx,8 @@ -146,9 +146,9 @@ button: ; button mov eax,53 mov ebx,5 mov ecx,80 ; local port # - http - mov edx,0 ; no remote port specified - mov esi,0 ; no remote ip specified - mov edi,0 ; PASSIVE open + mov edx,0 ; no remote port specified + mov esi,0 ; no remote ip specified + mov edi,0 ; PASSIVE open mcall mov [socket], eax mov [posy],1 @@ -160,7 +160,7 @@ button: ; button call check_status ret tst3: - cmp ah,4 ; button id=4 ? + cmp ah,4 ; button id=4 ? jnz no4 mov [server_active],0 close_socket: @@ -181,9 +181,9 @@ button: ; button mov eax,53 mov ebx,5 mov ecx,80 ; local port # - http - mov edx,0 ; no remote port specified - mov esi,0 ; no remote ip specified - mov edi,0 ; PASSIVE open + mov edx,0 ; no remote port specified + mov esi,0 ; no remote ip specified + mov edi,0 ; PASSIVE open mcall mov [socket], eax no_re_open: @@ -211,8 +211,8 @@ button: ; button jmp still no4: - cmp ah,6 ; read directory - je read_string + cmp ah,6 ; read directory + je read_string ret @@ -240,9 +240,9 @@ start_transmission: wait_for_data: call check_for_incoming_data cmp [input_text+256+1],dword 'GET ' - je data_received + je data_received cmp [input_text+256+1],dword 'POST' - je data_received + je data_received mov eax,5 mov ebx,1 mcall @@ -291,7 +291,7 @@ start_transmission: add [filepos],edx cmp [file_left],0 - jg newblock + jg newblock no_http_request: @@ -363,14 +363,14 @@ send_header: pusha - mov eax,53 ; send response and file length + mov eax,53 ; send response and file length mov ebx,7 mov ecx,[socket] mov edx,h_len-html_header mov esi,html_header mcall - mov eax,53 ; send file type + mov eax,53 ; send file type mov ebx,7 mov ecx,[socket] mov edx,[type_len] @@ -380,13 +380,13 @@ send_header: popa ret -fileinfo dd 0 - dd 0 - dd 0 - dd 512 - dd 0x100000 -getf db '/sys/' - times 50 db 0 +fileinfo dd 0 + dd 0 + dd 0 + dd 512 + dd 0x100000 +getf db '/sys/' + times 50 db 0 wanted_file: times 100 db 0 getflen dd 6 @@ -395,30 +395,30 @@ make_room: pusha - mov edx,ecx + mov edx,ecx - mov esi,0x20000 - add esi,[board_size] - mov edi,esi - add edi,edx - mov ecx,[board_size] - sub ecx,board1-board - inc ecx + mov esi,0x20000 + add esi,[board_size] + mov edi,esi + add edi,edx + mov ecx,[board_size] + sub ecx,board1-board + inc ecx std - rep movsb + rep movsb cld popa ret -from_i dd 0x0 +from_i dd 0x0 from_len dd 0x0 message dd 0x0 message_len dd 0x0 -read_file: ; start of execution +read_file: ; start of execution mov [fileinfo+16],eax shl ebx, 9 @@ -428,7 +428,7 @@ read_file: ; start of execution mov [filename+40*2+6],dword 'UNK ' cmp [input_text+256+1],dword 'POST' - je yes_new_message + je yes_new_message cmp [input_text+256+11],dword 'oard' ; server board message jne no_server_message_2 @@ -454,7 +454,7 @@ read_file: ; start of execution newfroms: inc esi cmp esi,input_text+256*20 - je no_server_message_2 + je no_server_message_2 cmp [esi],dword 'from' jne newfroms @@ -464,11 +464,11 @@ read_file: ; start of execution mov edx,0 name_new_len: cmp [esi+edx],byte 13 - je name_found_len + je name_found_len cmp [esi+edx],byte '&' - je name_found_len + je name_found_len cmp edx,1000 - je name_found_len + je name_found_len inc edx jmp name_new_len @@ -480,7 +480,7 @@ read_file: ; start of execution newmessages: inc esi cmp esi,input_text+256*20 - je no_server_message_2 + je no_server_message_2 cmp [esi],dword 'sage' jne newmessages @@ -491,11 +491,11 @@ read_file: ; start of execution new_len: inc edx cmp [esi+edx],byte ' ' - je found_len + je found_len cmp [esi+edx],byte 13 jbe found_len cmp edx,input_text+5000 - je found_len + je found_len jmp new_len found_len: mov [message_len],edx @@ -552,14 +552,14 @@ read_file: ; start of execution call make_room - mov esi,board1 ; first part + mov esi,board1 ; first part mov edi,0x20000 add edi,board1-board mov ecx,edx cld rep movsb - mov esi,[from_i] ; name + mov esi,[from_i] ; name mov edi,0x20000 add edi,board1-board add edi,board1e-board1 @@ -567,7 +567,7 @@ read_file: ; start of execution cld rep movsb - mov esi,board2 ; middle part + mov esi,board2 ; middle part mov edi,0x20000 add edi,board1-board + board1e-board1 add edi,[from_len] @@ -575,7 +575,7 @@ read_file: ; start of execution cld rep movsb - mov esi,[message] ; message + mov esi,[message] ; message mov edi,0x20000 add edi,board1-board + board1e-board1 + board2e-board2 add edi,[from_len] @@ -659,7 +659,7 @@ read_file: ; start of execution cld new_let: cmp [esi],byte ' ' - je no_new_let + je no_new_let cmp edi,wanted_file+30 jge no_new_let movsb @@ -672,10 +672,10 @@ read_file: ; start of execution cmp esi,input_text+256+6 jne no_index mov edi,wanted_file - mov [edi+0],dword 'inde' - mov [edi+4],dword 'x.ht' - mov [edi+8],byte 'm' - mov [edi+9],byte 0 + mov [edi+0],dword 'inde' + mov [edi+4],dword 'x.ht' + mov [edi+8],byte 'm' + mov [edi+9],byte 0 add edi,9 mov [file_type],htm @@ -686,9 +686,9 @@ read_file: ; start of execution no_index: cmp [edi-3],dword 'htm'+0 - je htm_header + je htm_header cmp [edi-3],dword 'HTM'+0 - je htm_header + je htm_header jmp no_htm_header htm_header: mov [file_type],htm @@ -698,9 +698,9 @@ read_file: ; start of execution no_htm_header: cmp [edi-3],dword 'png'+0 - je png_header + je png_header cmp [edi-3],dword 'PNG'+0 - je png_header + je png_header jmp no_png_header png_header: mov [file_type],png @@ -710,9 +710,9 @@ read_file: ; start of execution no_png_header: cmp [edi-3],dword 'gif'+0 - je gif_header + je gif_header cmp [edi-3],dword 'GIF'+0 - je gif_header + je gif_header jmp no_gif_header gif_header: mov [file_type],gif @@ -722,9 +722,9 @@ read_file: ; start of execution no_gif_header: cmp [edi-3],dword 'jpg'+0 - je jpg_header + je jpg_header cmp [edi-3],dword 'JPG'+0 - je jpg_header + je jpg_header jmp no_jpg_header jpg_header: mov [file_type],jpg @@ -734,13 +734,13 @@ read_file: ; start of execution no_jpg_header: cmp [edi-3],dword 'asm'+0 - je txt_header + je txt_header cmp [edi-3],dword 'ASM'+0 - je txt_header + je txt_header cmp [edi-3],dword 'txt'+0 - je txt_header + je txt_header cmp [edi-3],dword 'TXT'+0 - je txt_header + je txt_header jmp no_txt_header txt_header: mov [file_type],txt @@ -766,13 +766,13 @@ read_file: ; start of execution cld rep movsb - mov [fileinfo+12],dword 1 ; file exists ? + mov [fileinfo+12],dword 1 ; file exists ? mov eax,70 mov ebx,fileinfo mcall - cmp eax,0 ; file not found - message - je file_found + cmp eax,0 ; file not found - message + je file_found mov edi,et call set_time mov edi,ed @@ -988,7 +988,7 @@ check_status: mcall cmp eax,[status] - je c_ret + je c_ret mov [status],eax add al,48 mov [text+12],al @@ -999,8 +999,8 @@ check_status: ret -addr dd 0x0 -ya dd 0x0 +addr dd 0x0 +ya dd 0x0 filename2: times 100 db 32 @@ -1028,11 +1028,11 @@ read_string: mcall shr eax,8 cmp eax,13 - je read_done + je read_done cmp eax,8 jnz nobsl cmp edi,[addr] - jz f11 + jz f11 sub edi,1 mov [edi],byte 32 call print_text @@ -1096,33 +1096,33 @@ print_text: draw_window: - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,1 ; 1, start of draw + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw mcall - ; DRAW WINDOW - mov eax,0 ; function 0 : define and draw window - mov ebx,100*65536+480 ; [x start] *65536 + [x size] - mov ecx,100*65536+215 ; [y start] *65536 + [y size] - mov edx,0x13ffffff ; color of work area RRGGBB - mov edi,title ; WINDOW LABEL + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,100*65536+480 ; [x start] *65536 + [x size] + mov ecx,100*65536+215 ; [y start] *65536 + [y size] + mov edx,0x14ffffff ; color of work area RRGGBB + mov edi,title ; WINDOW LABEL mcall - mov eax,8 ; function 8 : define and draw button - mov ebx,(40)*65536+20 ; [x start] *65536 + [x size] - mov ecx,59*65536+9 ; [y start] *65536 + [y size] - mov edx,2 ; button id - mov esi,0x66aa66 ; button color RRGGBB + mov eax,8 ; function 8 : define and draw button + mov ebx,(40)*65536+20 ; [x start] *65536 + [x size] + mov ecx,59*65536+9 ; [y start] *65536 + [y size] + mov edx,2 ; button id + mov esi,0x66aa66 ; button color RRGGBB mcall - ; function 8 : define and draw button - mov ebx,(40)*65536+20 ; [x start] *65536 + [x size] + ; function 8 : define and draw button + mov ebx,(40)*65536+20 ; [x start] *65536 + [x size] mov ecx,72*65536+9 ; [y start] *65536 + [y size] - mov edx,4 ; button id - mov esi,0xaa6666 ; button color RRGGBB + mov edx,4 ; button id + mov esi,0xaa6666 ; button color RRGGBB mcall - ; Enter directory + ; Enter directory mov ebx,(25)*65536+66 mov ecx,135*65536+15 mov edx,6 @@ -1143,8 +1143,8 @@ draw_window: call draw_data - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,2 ; 2, end of draw + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw mcall ret @@ -1154,7 +1154,7 @@ draw_data: pusha - mov ebx,25*65536+35 ; draw info text with function 4 + mov ebx,25*65536+35 ; draw info text with function 4 mov ecx,0x000000 mov edx,text mov esi,35 @@ -1186,7 +1186,7 @@ draw_data: mov [input_text+4],dword 'IVED' mov [input_text+8],dword ': ' - mov ebx,255*65536+35 ; draw info text with function 4 + mov ebx,255*65536+35 ; draw info text with function 4 mov ecx,0x000000 mov edx,input_text mov esi,35 @@ -1215,7 +1215,7 @@ draw_data: ; DATA AREA -status dd 0x0 +status dd 0x0 text: db 'TCB status: x ' @@ -1296,8 +1296,8 @@ unkl: title db appname,version,0 -socket dd 0x0 -server_active db 0x0 +socket dd 0x0 +server_active db 0x0 board: @@ -1354,8 +1354,8 @@ db "",13,10 board_end: -board_size dd 0x0 -board_messages dd 0x0 +board_size dd 0x0 +board_messages dd 0x0 input_text: diff --git a/programs/network/netsendc/trunk/netsendc.asm b/programs/network/netsendc/trunk/netsendc.asm index ab65fd3de9..298972d66c 100644 --- a/programs/network/netsendc/trunk/netsendc.asm +++ b/programs/network/netsendc/trunk/netsendc.asm @@ -1,21 +1,21 @@ ; ; NetSend(Client) -; +; ; Автор: Hex ; Сайт: www.mestack.narod.ru -; +; ; Описание: ; Программа для обмена сообщениями в сети.Клиентская часть. ; ; Compile with FASM for Menuet ; Компилируется FASM'ом для Менуэт ОС ; - - + + use32 - + org 0x0 - + db 'MENUET01' ; 8 byte id dd 1 ; header version dd START ; program start @@ -23,26 +23,26 @@ use32 dd mem ; required amount of memory dd mem ; stack pointer dd 0, 0 ; param, icon - + include 'lang.inc' -include '..\..\..\macros.inc' - +include 'macros.inc' + START: ; start of execution - + mov eax,53 ; open socket mov ebx,0 mov ecx,0x4000 ; local port mov edx,0x5000 ; remote port mov esi,dword [remote_ip] ; node IP mcall - + mov [socketNum], eax -red: +red: call draw_window ; at first, draw the window - + still: - + mov eax,10 ; wait here for event mcall @@ -55,11 +55,11 @@ key: mov al,2 mcall jmp still - + button: mov al,17 mcall - + dec ah ; button id=1 ? jnz noclose mov eax, 53 @@ -76,7 +76,7 @@ button: ;; SEND CODE TO REMOTE ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - + send_xcode: mov eax,53 ; SEND CODE TO REMOTE @@ -87,35 +87,35 @@ send_xcode: mcall jmp still - - + + ; ********************************************* ; ******* WINDOW DEFINITIONS AND DRAW ******** ; ********************************************* - - + + draw_window: - + mov eax,12 ; function 12:tell os about windowdraw mov ebx,1 ; 1, start of draw mcall - + ; DRAW WINDOW mov eax,0 ; function 0 : define and draw window mov ebx,100*65536+250 ; [x start] *65536 + [x size] mov ecx,60*65536+150 ; [y start] *65536 + [y size] - mov edx,0x13ffffff ; color of work area RRGGBB + mov edx,0x14ffffff ; color of work area RRGGBB mov edi,title ; WINDOW LABEL mcall - - + + mov eax,8 ; SEND MESSAGE mov ebx,50*65536+145 mov ecx,47*65536+13 mov edx,2 mov esi,0x667788 mcall - + mov eax,4 mov ebx,25*65536+50 ; draw info text with function 4 mov ecx,0x000000 @@ -127,17 +127,17 @@ draw_window: add edx,esi cmp [edx],byte 'x' jnz newline - + mov eax,12 ; function 12:tell os about windowdraw mov ebx,2 ; 2, end of draw mcall - + ret - - + + ; DATA AREA - -if lang eq ru + +if lang eq ru text: db ' Послать сообщение ' db ' ' @@ -153,16 +153,16 @@ text: db ' Remote address : 192.168.0.2 ' db 'Text and address in end of source ' db 'x' ; <- END MARKER, DONT DELETE -end if - +end if + title db 'NetSend(Client)',0 - + remote_ip db 192,168,1,2 - + send_data db 'Привет,это тест!Hello,this is a test!' end_message: - + I_END: align 4 socketNum dd ? diff --git a/programs/network/netsends/trunk/netsends.asm b/programs/network/netsends/trunk/netsends.asm index 9d42363f53..0084849718 100644 --- a/programs/network/netsends/trunk/netsends.asm +++ b/programs/network/netsends/trunk/netsends.asm @@ -1,33 +1,33 @@ ; ; NetSend(Server) -; +; ; Автор: Hex ; Сайт: www.mestack.narod.ru -; +; ; Описание: ; Программа для обмена сообщениями в сети.Серверная часть. ; ; Compile with FASM for Menuet ; Компилируется FASM'ом для Менуэт ОС ; - + use32 - org 0x0 - db 'MENUET01' ; header - dd 0x01 ; header version - dd START ; entry point - dd I_END ; image size - dd I_END+0x10000 ; required memory - dd I_END+0x10000 ; esp - dd 0x0 , 0x0 ; I_Param , I_Path - + org 0x0 + db 'MENUET01' ; header + dd 0x01 ; header version + dd START ; entry point + dd I_END ; image size + dd I_END+0x10000 ; required memory + dd I_END+0x10000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Path + include 'lang.inc' -include '..\..\..\macros.inc' +include 'macros.inc' remote_ip db 192,168,0,1 - - + + START: ; start of execution - + mov eax, 53 ; open receiver socket mov ebx, 0 mov ecx, 0x5000 ; local port @@ -37,73 +37,73 @@ START: ; start of execution mov [socketNum],eax mov [0],eax ; save for remote code -red: +red: call draw_window ; at first, draw the window - + still: - + mov eax,23 ; wait here for event mov ebx,1 mcall - + cmp eax,1 ; redraw request ? jz red cmp eax,2 ; key in buffer ? jz key cmp eax,3 ; button in buffer ? jz button - + mov eax,53 ; data from cluster terminal ? mov ebx,2 mov ecx,[socketNum] mcall - + cmp eax,0 jne data_arrived - + jmp still - + key: mov eax,2 mcall jmp still - + button: - + mov eax,53 mov ebx,1 mov ecx,[socketNum] mcall or eax,-1 mcall - - + + data_arrived: - + mov eax,5 ; wait a second for everything to arrive mov ebx,10 mcall - + mov edi,I_END - + get_data: - + mov eax,53 mov ebx,3 mov ecx,[socketNum] mcall - + mov [edi],bl inc edi - + mov eax,53 mov ebx,2 mov ecx,[socketNum] mcall - + cmp eax,0 jne get_data - + mov eax,4 mov ebx,10*65536+60 add ebx,[y] @@ -111,35 +111,35 @@ data_arrived: mov edx,I_END mov esi,100 mcall - + add [y],10 - + jmp still - + y dd 0x10 - - - + + + ; ********************************************* ; ******* WINDOW DEFINITIONS AND DRAW ******** ; ********************************************* - - + + draw_window: - + mov eax,12 ; function 12:tell os about windowdraw mov ebx,1 ; 1, start of draw mcall - + ; DRAW WINDOW mov eax,0 ; function 0 : define and draw window mov ebx,100*65536+300 ; [x start] *65536 + [x size] mov ecx,100*65536+330 ; [y start] *65536 + [y size] - mov edx,0x13ffffff ; color of work area RRGGBB + mov edx,0x14ffffff ; color of work area RRGGBB mov edi,title ; WINDOW LABEL mcall - - + + ; Re-draw the screen text cld mov eax,4 @@ -153,18 +153,18 @@ draw_window: add edx,40 cmp [edx],byte 'x' jnz newline - - + + mov eax,12 ; function 12:tell os about windowdraw mov ebx,2 ; 2, end of draw mcall - + ret - - + + ; DATA AREA - -if lang eq ru + +if lang eq ru text: db 'Данный адрес : 192.168.0.2 ' db 'Прослушиваемый порт : 0x5000 ' @@ -177,10 +177,10 @@ text: db 'Received messages: ' db 'x' ; <- END MARKER, DONT DELETE end if - + title db 'NetSend(Server)',0 - + socketNum dd 0x0 - + I_END: diff --git a/programs/network/popc/trunk/popc.asm b/programs/network/popc/trunk/popc.asm index 26a5440fa0..37e7c92920 100644 --- a/programs/network/popc/trunk/popc.asm +++ b/programs/network/popc/trunk/popc.asm @@ -9,7 +9,7 @@ ;; Compile with FASM for Menuet ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -include '..\..\..\macros.inc' +include 'macros.inc' version equ '0.1' use32 @@ -811,7 +811,7 @@ draw_window: mov eax,0 ; draw window mov ebx,5*65536+435 mov ecx,5*65536+232 - mov edx,0x13ffffff + mov edx,0x14ffffff mov edi,labelt mcall diff --git a/programs/network/telnet/trunk/telnet.asm b/programs/network/telnet/trunk/telnet.asm index 109eecbbdb..d507265802 100644 --- a/programs/network/telnet/trunk/telnet.asm +++ b/programs/network/telnet/trunk/telnet.asm @@ -6,20 +6,20 @@ ; use32 - org 0x0 - db 'MENUET01' ; header - dd 0x01 ; header version - dd START ; entry point - dd I_END ; image size - dd I_END+0x10000 ; required memory - dd I_END+0x10000 ; esp - dd 0x0 , 0x0 ; I_Param , I_Path + org 0x0 + db 'MENUET01' ; header + dd 0x01 ; header version + dd START ; entry point + dd I_END ; image size + dd I_END+0x10000 ; required memory + dd I_END+0x10000 ; esp + dd 0x0 , 0x0 ; I_Param , I_Path include 'lang.inc' -include '..\..\..\macros.inc' +include 'macros.inc' -START: ; start of execution +START: ; start of execution ; Clear the screen memory mov eax, ' ' @@ -43,22 +43,22 @@ still: mov [socket_status], eax cmp eax, ebx - je waitev + je waitev red: call draw_window waitev: - mov eax,23 ; wait here for event + mov eax,23 ; wait here for event mov ebx,20 mcall - cmp eax,1 ; redraw request ? - je red - cmp eax,2 ; key in buffer ? - je key - cmp eax,3 ; button in buffer ? - je button + cmp eax,1 ; redraw request ? + je red + cmp eax,2 ; key in buffer ? + je key + cmp eax,3 ; button in buffer ? + je button ; any data from the socket? @@ -105,11 +105,11 @@ handle_data: mov al, [telnetstate] cmp al, 0 - je state0 + je state0 cmp al, 1 - je state1 + je state1 cmp al, 2 - je state2 + je state2 jmp hd001 state0: @@ -138,7 +138,7 @@ state2: ret hd001: - cmp bl,13 ; BEGINNING OF LINE + cmp bl,13 ; BEGINNING OF LINE jne nobol mov ecx,[pos] add ecx,1 @@ -154,7 +154,7 @@ hd001: jmp newdata nobol: - cmp bl,10 ; LINE DOWN + cmp bl,10 ; LINE DOWN jne nolf addx1: add [pos],dword 1 @@ -168,7 +168,7 @@ hd001: jmp cm1 nolf: - cmp bl,8 ; BACKSPACE + cmp bl,8 ; BACKSPACE jne nobasp mov eax,[pos] dec eax @@ -178,7 +178,7 @@ hd001: jmp newdata nobasp: - cmp bl,15 ; CHARACTER + cmp bl,15 ; CHARACTER jbe newdata mov eax,[pos] mov [eax+text],bl @@ -188,7 +188,7 @@ hd001: mov ebx,[scroll+4] imul ebx,80 cmp eax,ebx - jb noeaxz + jb noeaxz mov esi,text+80 mov edi,text mov ecx,ebx @@ -201,16 +201,16 @@ hd001: newdata: ret - key: ; KEY - mov eax,2 ; send to modem + key: ; KEY + mov eax,2 ; send to modem mcall mov ebx, [socket_status] - cmp ebx, 4 ; connection open? - jne still ; no, so ignore key + cmp ebx, 4 ; connection open? + jne still ; no, so ignore key shr eax,8 - cmp eax,178 ; ARROW KEYS + cmp eax,178 ; ARROW KEYS jne noaup mov al,'A' call arrow @@ -240,10 +240,10 @@ hd001: jmp still - button: ; BUTTON + button: ; BUTTON mov eax,17 mcall - cmp ah,1 ; CLOSE PROGRAM + cmp ah,1 ; CLOSE PROGRAM jne noclose mov eax,53 @@ -254,7 +254,7 @@ hd001: or eax,-1 mcall noclose: - cmp ah, 2 ; Set IP + cmp ah, 2 ; Set IP jne notip mov [string_x], dword 78 @@ -267,9 +267,9 @@ hd001: ip1: inc esi cmp [esi],byte '0' - jb ip2 + jb ip2 cmp [esi],byte '9' - jg ip2 + jg ip2 imul eax,10 movzx ebx,byte [esi] sub ebx,48 @@ -287,7 +287,7 @@ hd001: jmp still notip: - cmp ah, 3 ; set port + cmp ah, 3 ; set port jne notport mov [string_x], dword 215 @@ -300,9 +300,9 @@ notip: ip11: inc esi cmp [esi],byte '0' - jb ip21 + jb ip21 cmp [esi],byte '9' - jg ip21 + jg ip21 imul eax,10 movzx ebx,byte [esi] sub ebx,48 @@ -318,24 +318,24 @@ notip: jmp still notport: - cmp ah, 4 ; connect + cmp ah, 4 ; connect jne notcon mov eax, [socket_status] cmp eax, 4 - je still + je still call connect jmp still notcon: - cmp ah,5 ; disconnect + cmp ah,5 ; disconnect jne notdiscon call disconnect jmp still -notdiscon: ; Echo Toggle +notdiscon: ; Echo Toggle cmp ah, 6 jne still @@ -376,7 +376,7 @@ tm_000: pop bx mov al, [echo] cmp al, 0 - je tm_001 + je tm_001 push bx call handle_data @@ -409,17 +409,17 @@ disconnect: connect: pusha - mov ecx, 1000 ; local port starting at 1000 + mov ecx, 1000 ; local port starting at 1000 getlp: - inc ecx + inc ecx push ecx - mov eax, 53 - mov ebx, 9 + mov eax, 53 + mov ebx, 9 mcall - pop ecx - cmp eax, 0 ; is this local port in use? - jz getlp ; yes - so try next + pop ecx + cmp eax, 0 ; is this local port in use? + jz getlp ; yes - so try next mov eax,53 mov ebx,5 @@ -431,7 +431,7 @@ getlp: shl edx, 8 mov dl, [ip_address] mov esi, edx - movzx edx, word [port] ; telnet port id + movzx edx, word [port] ; telnet port id mov edi,1 ; active open mcall mov [socket], eax @@ -455,10 +455,10 @@ draw_window: mov ebx,1 mcall - xor eax,eax ; DRAW WINDOW + xor eax,eax ; DRAW WINDOW mov ebx,100*65536+491 + 8 +15 mov ecx,100*65536+270 + 20 ; 20 for status bar - mov edx,0x13000000 + mov edx,0x14000000 mov edi,title mcall @@ -469,14 +469,14 @@ draw_window: mov edx, 0x00557799 mcall - mov eax,8 ; BUTTON 2: SET IP + mov eax,8 ; BUTTON 2: SET IP mov ebx,4*65536+70 mov ecx,273*65536+12 mov esi, 0x00557799 mov edx,2 mcall - mov eax,4 ; Button text + mov eax,4 ; Button text mov ebx,6*65536+276 mov ecx,0x00ffffff mov edx,setipt @@ -485,7 +485,7 @@ draw_window: mov eax,47 - mov edi,ip_address ; display IP address + mov edi,ip_address ; display IP address mov edx,78*65536+276 mov esi,0x00ffffff mov ebx,3*65536 @@ -495,16 +495,16 @@ draw_window: add edx,6*4*65536 inc edi cmp edi,ip_address+4 - jb ipdisplay + jb ipdisplay - mov eax,8 ; BUTTON 3: SET PORT + mov eax,8 ; BUTTON 3: SET PORT mov ebx,173*65536+38 mov ecx,273*65536+12 mov edx,3 mov esi, 0x00557799 mcall - mov eax,4 ; Button text + mov eax,4 ; Button text mov ebx,178*65536+276 mov ecx,0x00ffffff mov edx,setportt @@ -512,21 +512,21 @@ draw_window: mcall - mov edx,216*65536+276 ; display port + mov edx,216*65536+276 ; display port mov esi,0x00ffffff mov ebx,4*65536 mov eax,47 movzx ecx,word [port] mcall - mov eax,8 ; BUTTON 4: Connect + mov eax,8 ; BUTTON 4: Connect mov ebx,250*65536+50 mov ecx,273*65536+12 mov esi, 0x00557799 mov edx,4 mcall - mov eax,4 ; Button text + mov eax,4 ; Button text mov ebx,255*65536+276 mov ecx,0x00ffffff mov edx,cont @@ -534,7 +534,7 @@ draw_window: mcall - mov eax,8 ; BUTTON 5: disconnect + mov eax,8 ; BUTTON 5: disconnect mov ebx,303*65536+70 mov ecx,273*65536+12 mov edx,5 @@ -542,7 +542,7 @@ draw_window: mcall - mov eax,4 ; Button text + mov eax,4 ; Button text mov ebx,307*65536+276 mov ecx,0x00ffffff mov edx,dist @@ -550,22 +550,22 @@ draw_window: mcall - mov esi,contlen-contt ; display connected status + mov esi,contlen-contt ; display connected status mov edx, contt mov eax, [socket_status] - cmp eax, 4 ; 4 is connected - je pcon + cmp eax, 4 ; 4 is connected + je pcon mov esi,discontlen-discontt mov edx, discontt pcon: - mov eax,4 ; status text + mov eax,4 ; status text mov ebx,380*65536+276 mov ecx,0x00ffffff mcall - mov eax,8 ; BUTTON 6: echo + mov eax,8 ; BUTTON 6: echo mov ebx,460*65536+50 mov ecx,273*65536+12 mov edx,6 @@ -581,7 +581,7 @@ pcon: mov esi,echoolen-echoot peo: - mov eax,4 ; Button text + mov eax,4 ; Button text mov ebx,463*65536+276 mov ecx,0x00ffffff mcall @@ -622,7 +622,7 @@ draw_text: ; erase character pusha - mov edx, 0 ; bg colour + mov edx, 0 ; bg colour mov ecx, ebx add ecx, 26 shl ecx, 16 @@ -656,11 +656,11 @@ draw_text: add esi,1 add eax,6 cmp eax,80*6 - jb newletter + jb newletter mov eax,0 add ebx,10 cmp ebx,24*10 - jb newletter + jb newletter popa ret @@ -686,11 +686,11 @@ read_string: mcall shr eax,8 cmp eax,13 - je read_done + je read_done cmp eax,8 jnz nobsl cmp edi,string - jz f11 + jz f11 sub edi,1 mov [edi],byte '_' call print_text @@ -699,7 +699,7 @@ read_string: cmp eax,dword 31 jbe f11 cmp eax,dword 95 - jb keyok + jb keyok sub eax,32 keyok: mov [edi],al @@ -750,41 +750,41 @@ print_text: ; DATA AREA -telnetrep db 0xff,0xfc,0x00 -telnetstate db 0 +telnetrep db 0xff,0xfc,0x00 +telnetstate db 0 string_length dd 16 string_x dd 200 string_y dd 60 -string db '________________' +string db '________________' -tx_buff db 0, 10 -ip_address db 001,002,003,004 -port db 0,0 -echo db 0 -socket dd 0x0 -socket_status dd 0x0 -pos dd 80 * 1 -scroll dd 1 - dd 24 -wcolor dd 0x000000 -title db 'Telnet v0.1',0 -setipt db 'IP Address: . . .' +tx_buff db 0, 10 +ip_address db 001,002,003,004 +port db 0,0 +echo db 0 +socket dd 0x0 +socket_status dd 0x0 +pos dd 80 * 1 +scroll dd 1 + dd 24 +wcolor dd 0x000000 +title db 'Telnet v0.1',0 +setipt db 'IP Address: . . .' setiplen: -setportt db 'Port:' +setportt db 'Port:' setportlen: -cont db 'Connect' +cont db 'Connect' conlen: -dist db 'Disconnect' +dist db 'Disconnect' dislen: -contt db 'Connected' +contt db 'Connected' contlen: -discontt db 'Disconnected' +discontt db 'Disconnected' discontlen: -echot db 'Echo On' +echot db 'Echo On' echolen: -echoot db 'Echo Off' +echoot db 'Echo Off' echoolen: diff --git a/programs/other/period/trunk/build.bat b/programs/other/period/trunk/build.bat index 9108319564..4222b8e757 100644 --- a/programs/other/period/trunk/build.bat +++ b/programs/other/period/trunk/build.bat @@ -1,2 +1,3 @@ @fasm period.asm period +@kpack period @pause \ No newline at end of file diff --git a/programs/system/icon_new/trunk/build_icon.bat b/programs/system/icon_new/trunk/build_icon.bat index 6331f98afa..2d6e8558cf 100644 --- a/programs/system/icon_new/trunk/build_icon.bat +++ b/programs/system/icon_new/trunk/build_icon.bat @@ -2,4 +2,5 @@ @echo lang fix ru >lang.inc @fasm icon.asm @icon @erase lang.inc +@kpack @icon @pause \ No newline at end of file diff --git a/programs/system/icon_new/trunk/build_iconmngr.bat b/programs/system/icon_new/trunk/build_iconmngr.bat index b3f854f933..4c2116626a 100644 --- a/programs/system/icon_new/trunk/build_iconmngr.bat +++ b/programs/system/icon_new/trunk/build_iconmngr.bat @@ -2,4 +2,5 @@ @echo lang fix ru >lang.inc @fasm iconmngr.asm iconmngr @erase lang.inc +@kpack iconmngr @pause \ No newline at end of file diff --git a/programs/system/panel/trunk/build_ru.bat b/programs/system/panel/trunk/build_ru.bat index d3170f094a..412b60cbd1 100644 --- a/programs/system/panel/trunk/build_ru.bat +++ b/programs/system/panel/trunk/build_ru.bat @@ -2,4 +2,5 @@ @echo lang fix ru >lang.inc @fasm @panel.asm @panel @erase lang.inc +@kpack @panel @pause \ No newline at end of file diff --git a/programs/system/rb/trunk/@RB.ASM b/programs/system/rb/trunk/@RB.ASM index a71f6eeb4c..cbb47bfe57 100644 --- a/programs/system/rb/trunk/@RB.ASM +++ b/programs/system/rb/trunk/@RB.ASM @@ -346,7 +346,7 @@ DATA strtbl startapps ,\ <"/sys/PIC4",0> ,\ <"/sys/DESKTOP",0> ,\ - <"/sys/ICON",0>,\ + <"/sys/ICONMNGR",0>,\ <"/sys/SETUP",0> ,\ <"/sys/VRR",0> ,\ <"/sys/CPU",0>