Subversion Repositories Kolibri OS

Rev

Rev 1245 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1245 Rev 2984
Line -... Line 1...
-
 
1
do_sinus:
-
 
2
   .x	   equ	[ebp-8]
-
 
3
   .y	   equ	[ebp-12]
-
 
4
   .new_y  equ	[ebp-16]
-
 
5
   .temp   equ	[ebp-20]
-
 
6
   push    ebp
-
 
7
   mov	   ebp,esp
-
 
8
   sub	   esp,64
-
 
9
   mov	   dword .x,0
-
 
10
   mov	   dword .y,0
-
 
11
   mov	   esi,[screen_ptr]
-
 
12
   mov	   edi,[Zbuffer_ptr]
-
 
13
   push    edi
-
 
14
   ;  clear Zbuffer temporally used as image buffer
-
 
15
   mov	   ecx,SIZE_X*SIZE_Y
-
 
16
   xor	   eax,eax
-
 
17
   cld
-
 
18
   rep	   stosd
-
 
19
   pop	   edi
-
 
20
;   movzx   eax,[sinus_flag]
-
 
21
;   mov     edx,10
-
 
22
;   mul     edx
-
 
23
;   mov     [sin_amplitude],eax
-
 
24
;   mov     [sin_frq],eax
-
 
25
   fninit
-
 
26
;if Ext = SSE2
-
 
27
;   movups  xmm1,[const0123]   ; xmm1 - init values
-
 
28
;   mov     eax,0x000000ff
-
 
29
;   movd    xmm2,eax
-
 
30
;   shufps  xmm2,xmm2,0        ; xmm2 - mask value
-
 
31
;   mov     eax,4
-
 
32
;   movd    xmm3,eax
-
 
33
;   shufps  xmm3,xmm3,0
-
 
34
 .again:
-
 
35
if  0
-
 
36
   fild    dword .x
-
 
37
   fidiv   [sin_frq]
-
 
38
   fsin
-
 
39
   fimul   [sin_amplitude]
-
 
40
   fiadd   dword .y
-
 
41
   fistp   dword .new_y
-
 
42
else
-
 
43
   fild    dword .x
-
 
44
   fmul    [sin_frq]
-
 
45
   fistp   dword .temp
-
 
46
   mov	   eax, .temp
-
 
47
;   mov     bx, [angle_x]
-
 
48
;   add     bx, [angle_y]
-
 
49
;   movzx   ebx,bx
-
 
50
;   shr     ebx,1       ; change phase
-
 
51
;   add     eax,ebx
-
 
52
 
-
 
53
 
-
 
54
   and	   eax, 0x000000ff
-
 
55
 
-
 
56
;   cdq
-
 
57
 ;  mul     [sin_frq]
-
 
58
;   and      eax,0x000000ff
-
 
59
;   and     ax,0x00ff
-
 
60
;   cwde
-
 
61
 
-
 
62
   fld	   dword [sin_tab+eax*4]
-
 
63
   fimul   dword [sin_amplitude]
-
 
64
   fiadd   dword .y
-
 
65
   fistp   dword .new_y
-
 
66
end if
-
 
67
   mov	   eax,.new_y
-
 
68
   or	   eax,eax
-
 
69
   jl	   .skip
-
 
70
   cmp	   eax,SIZE_Y
-
 
71
   jg	   .skip
-
 
72
;   mov     edx,SIZE_X
-
 
73
;   mul     edx
-
 
74
   shl	   eax,9
-
 
75
   add	   eax,dword .x
-
 
76
   lea	   ebx,[eax*3]
-
 
77
   mov	   eax,[esi]
-
 
78
   mov	   [edi+ebx],eax
-
 
79
 .skip:
-
 
80
   add	   esi,3
-
 
81
   inc	   dword .x
-
 
82
   cmp	   dword .x,SIZE_X
-
 
83
   jl	   .again
-
 
84
   mov	   dword .x,0
-
 
85
   inc	   dword .y
-
 
86
   cmp	   dword .y,SIZE_Y
-
 
87
   jl	   .again
-
 
88
 
-
 
89
   ; copy from temporary buffer -> Zbuffer to screen
-
 
90
   mov	   esi,[Zbuffer_ptr]
-
 
91
   mov	   edi,[screen_ptr]
-
 
92
   mov	   ecx,SIZE_X*SIZE_Y*3/4
-
 
93
   cld
-
 
94
   rep	   movsd
-
 
95
 
-
 
96
 
-
 
97
   mov	   esp,ebp
-
 
98
   pop	   ebp
-
 
99
ret
-
 
100
 
-
 
101
 
1
draw_dots:
102
draw_dots:
2
   mov	   esi,[points_translated_ptr]
103
   mov	   esi,[points_translated_ptr]
3
   movzx   ecx,[points_count_var]
104
   movzx   ecx,[points_count_var]
4
 .drw:
105
 .drw:
5
 @@:
106
 @@: