Subversion Repositories Kolibri OS

Rev

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

Rev 5269 Rev 5353
Line 1... Line 1...
1
; Some simple mathematical functions. Don't look for some logic in
1
; Some simple mathematical functions. Don't look for some logic in
2
; the function names :-)
2
; the function names :-)
Line 3... Line 3...
3
 
3
 
Line -... Line 4...
-
 
4
; ******* Gestion des matrices 4x4 ******
-
 
5
 
-
 
6
if DEBUG
-
 
7
f_m4m db 'gl_M4_Mul',0
-
 
8
f_m4ml db 'gl_M4_MulLeft',0
4
; ******* Gestion des matrices 4x4 ******
9
end if
5
 
10
 
6
align 4
11
align 4
7
proc gl_M4_Id uses eax ecx edi, a:dword
12
proc gl_M4_Id uses eax ecx edi, a:dword
8
	mov edi,[a]
13
	mov edi,[a]
Line 113... Line 118...
113
	sub edi,sizeof.M4
118
	sub edi,sizeof.M4
114
	rep movsd ;êîïèðîâàíèå ìàòðèö [a]=[c]
119
	rep movsd ;êîïèðîâàíèå ìàòðèö [a]=[c]
Line 115... Line 120...
115
 
120
 
116
	mov edx,[c]
121
	mov edx,[c]
-
 
122
	mov dword[i],0
-
 
123
	mov eax,ebp
117
	mov dword[i],0
124
	sub eax,sizeof.M4
118
	.cycle_0: ;i
125
	.cycle_0: ;i
119
		xor ebx,ebx
126
		xor ebx,ebx ;j=0
120
		.cycle_1: ;j
-
 
121
			finit
127
		.cycle_1: ;j
122
			fldz ;sum=0
128
			fldz ;sum=0
123
			xor ecx,ecx
-
 
124
			mov eax,ebp
-
 
125
			sub eax,sizeof.M4
129
			xor ecx,ecx ;k=0
126
			M4_reg edi,eax,dword[i],0
130
			M4_reg edi,eax,dword[i],0
127
			.cycle_2: ;k
131
			.cycle_2: ;k
128
				fld dword[edi]
132
				fld dword[edi]
129
				add edi,4
133
				add edi,4
130
				M4_reg esi,[b],ecx,ebx
134
				M4_reg esi,[b],ecx,ebx
131
				fmul dword[esi]
135
				fmul dword[esi]
132
				fadd st0,st1 ;sum += a[i][k] * b[k][j]
136
				faddp ;sum += a[i][k] * b[k][j]
133
				inc ecx
-
 
134
				add eax,4
137
				inc ecx
135
				cmp ecx,4
138
				cmp ecx,4
136
				jl .cycle_2
139
				jl .cycle_2
137
			fstp dword[edx] ;c[i][j] = sum
140
			fstp dword[edx] ;c[i][j] = sum
138
			add edx,4
141
			add edx,4
139
			inc ebx
142
			inc ebx
140
			cmp ebx,4
143
			cmp ebx,4
141
			jl .cycle_1
144
			jl .cycle_1
142
		inc dword[i]
145
		inc dword[i]
143
		cmp dword[i],4
146
		cmp dword[i],4
144
		jl .cycle_0
-
 
145
	finit
147
		jl .cycle_0
146
if DEBUG ;gl_M4_MulLeft
148
if DEBUG ;gl_M4_MulLeft
147
	stdcall dbg_print,f_m4ml,txt_nl
149
	stdcall dbg_print,f_m4ml,txt_nl
148
	stdcall gl_print_matrix,[c],4
150
	stdcall gl_print_matrix,[c],4
149
	stdcall dbg_print,txt_sp,txt_nl
151
	stdcall dbg_print,txt_sp,txt_nl