Subversion Repositories Kolibri OS

Rev

Rev 9237 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9237 Rev 9512
Line 2... Line 2...
2
ROUND equ 8
2
ROUND equ 8
3
;NON=0
3
;NON=0
4
;MMX=1
4
;MMX=1
5
;Ext=MMX
5
;SSE=2
-
 
6
;SSE2=3
-
 
7
 
-
 
8
;Ext=SSE2
6
;TEX_SIZE=0x3fff
9
 
-
 
10
 
-
 
11
;TEX_SIZE=0x3fff
7
;SIZE_X equ 512
12
;SIZE_X equ 512
8
;SIZE_Y equ 512
13
;SIZE_Y equ 512
9
;ROUND = 8
14
;ROUND = 8
10
;TEX_SHIFT equ 6
15
 ; TEX_SHIFT equ 6
11
 
16
 ; TEXTURE_SIZE = 0xFFFFF
-
 
17
 
Line 12... Line 18...
12
; procedure drawing textured triangle with Gouraud shading
18
; procedure drawing textured triangle with Gouraud shading
13
; Z-buffer alghoritm included, Z coord interpolation ----
19
; Z-buffer alghoritm included, Z coord interpolation ----
14
; I set the color by this way -- (col1 * col2)/256 ------
20
; I set the color by this way -- (col1 * col2)/256 ------
15
;------------------in - eax - x1 shl 16 + y1 ------------
21
;------------------in - eax - x1 shl 16 + y1 ------------
Line 33... Line 39...
33
   .tex_y1  equ [ebp+30]
39
   .tex_y1  equ [ebp+30]
34
   .tex_x1  equ [ebp+28]
40
   .tex_x1  equ [ebp+28]
35
 
41
 
36
   .z3	    equ [ebp+26]
42
   .z3      equ [ebp+26]
Line 37... Line 43...
37
   .col3b   equ [ebp+24]
43
   .col3b   equ [ebp+24]
38
   .col3g   equ [ebp+22]
44
   .col3g   equ [ebp+22]
39
   .col3r   equ [ebp+20]
45
   .col3r   equ [ebp+20]
40
 
46
 
Line 41... Line 47...
41
   .z2	    equ [ebp+18]
47
   .z2      equ [ebp+18]
42
   .col2b   equ [ebp+16]
48
   .col2b   equ [ebp+16]
43
   .col2g   equ [ebp+14]
49
   .col2g   equ [ebp+14]
44
   .col2r   equ [ebp+12]
50
   .col2r   equ [ebp+12]
Line 45... Line 51...
45
 
51
 
46
   .z1	    equ [ebp+10]
52
   .z1      equ [ebp+10]
47
   .col1b   equ [ebp+8]
53
   .col1b   equ [ebp+8]
48
   .col1g   equ [ebp+6]
54
   .col1g   equ [ebp+6]
Line 49... Line 55...
49
   .col1r   equ [ebp+4]
55
   .col1r   equ [ebp+4]
Line 50... Line 56...
50
 
56
 
51
; local variables:
57
; local variables:
52
 
58
 
Line 53... Line 59...
53
   .tex_ptr   equ dword[ebp-4]
59
   .tex_ptr   equ dword[ebp-4]
54
   .z_ptr     equ dword[ebp-8]
60
   .z_ptr     equ dword[ebp-8]
55
   .scr_buff  equ dword[ebp-12]
61
   .scr_buff  equ dword[ebp-12]
56
 
62
 
57
   .x1	      equ  word[ebp-14] ;dw ? ;equ word[ebp-10]
63
   .x1        equ  word[ebp-14] ;dw ? ;equ word[ebp-10]
58
   .y1	      equ  word[ebp-16] ;dw ? ;equ word[ebp-12]
64
   .y1        equ  word[ebp-16] ;dw ? ;equ word[ebp-12]
Line 59... Line 65...
59
   .x2	      equ  word[ebp-18] ;dw ? ;equ word[ebp-14]
65
   .x2        equ  word[ebp-18] ;dw ? ;equ word[ebp-14]
60
   .y2	      equ  word[ebp-20] ;dw ? ;equ word[ebp-16]
66
   .y2        equ  word[ebp-20] ;dw ? ;equ word[ebp-16]
61
   .x3	      equ  word[ebp-22] ;dw ? ;equ word[ebp-18]
67
   .x3        equ  word[ebp-22] ;dw ? ;equ word[ebp-18]
62
   .y3	      equ  word[ebp-24] ;dw ? ;equ word[ebp-20]
68
   .y3        equ  word[ebp-24] ;dw ? ;equ word[ebp-20]
63
 
69
 
64
   .dx12      equ  dword[ebp-28] ;dd ?
70
   .dx12      equ  dword[ebp-28] ;dd ?
65
   .tex_dx12  equ  dword[ebp-32] ;dd ?
71
   .tex_dy12  equ       [ebp-32] ;dd ?
Line 66... Line 72...
66
   .tex_dy12  equ	[ebp-36] ;dd ?
72
   .tex_dx12  equ       [ebp-36] ;dd ?
67
   .dz12      equ  dword[ebp-40] ;dd ?
73
   .dz12      equ  dword[ebp-40] ;dd ?
68
   .dc12r     equ	[ebp-44] ;dd ?
74
   .dc12r     equ       [ebp-44] ;dd ?
69
   .dc12g     equ  dword[ebp-48] ;dd ?
75
   .dc12g     equ  dword[ebp-48] ;dd ?
70
   .dc12b     equ	[ebp-52] ;dd ?
76
   .dc12b     equ       [ebp-52] ;dd ?
71
 
77
 
72
   .dx23      equ  dword[ebp-56] ;dd ?
78
   .dx23      equ  dword[ebp-56] ;dd ?
Line 73... Line 79...
73
   .tex_dx23  equ  dword[ebp-60] ;dd ?
79
   .tex_dy23  equ       [ebp-60] ;dd ?
74
   .tex_dy23  equ	[ebp-64] ;dd ?
80
   .tex_dx23  equ       [ebp-64] ;dd ?
75
   .dz23      equ  dword[ebp-68] ;dd ?
81
   .dz23      equ  dword[ebp-68] ;dd ?
76
   .dc23r     equ	[ebp-72] ;dd ?
82
   .dc23r     equ       [ebp-72] ;dd ?
77
   .dc23g     equ  dword[ebp-76] ;dd ?
83
   .dc23g     equ  dword[ebp-76] ;dd ?
78
   .dc23b     equ	[ebp-80] ;dword[ebp-8]dd ?
84
   .dc23b     equ       [ebp-80] ;dword[ebp-8]dd ?
79
 
85
 
Line 80... Line 86...
80
   .dx13      equ  dword[ebp-84] ;dd ?
86
   .dx13      equ  dword[ebp-84] ;dd ?
81
   .tex_dx13  equ  dword[ebp-88] ;dd ?
87
   .tex_dy13  equ       [ebp-88] ;dd ?
82
   .tex_dy13  equ	[ebp-92] ;dd ?
88
   .tex_dx13  equ       [ebp-92] ;dd ?
83
   .dz13      equ  dword[ebp-96] ;dd ?
89
   .dz13      equ  dword[ebp-96] ;dd ?
84
   .dc13r     equ	[ebp-100] ;dd ?
90
   .dc13r     equ       [ebp-100] ;dd ?
85
   .dc13g     equ  dword[ebp-104] ;dd ?
91
   .dc13g     equ  dword[ebp-104] ;dd ?
86
   .dc13b     equ	[ebp-108] ;dd ?
92
   .dc13b     equ       [ebp-108] ;dd ?
87
 
93
 
88
   .scan_x1   equ  dword[ebp-112] ;dd ?
94
   .scan_y1   equ       [ebp-112] ;dd ?
89
   .scan_y1   equ	[ebp-116] ;dd ?
95
   .scan_x1   equ       [ebp-116] ;dd ?
90
   .zz1       equ  dword[ebp-120] ;dw ?
96
   .zz1       equ  dword[ebp-120] ;dw ?
91
   .cur1r     equ	[ebp-124] ;dw ?
97
   .cur1r     equ       [ebp-124] ;dw ?
92
   .cur1g     equ  dword[ebp-128] ;dw ?
98
   .cur1g     equ       [ebp-128] ;dw ?
Line 93... Line 99...
93
   .cur1b     equ	[ebp-132] ;dw ?
99
   .cur1b     equ       [ebp-132] ;dw ?
Line 94... Line -...
94
 
-
 
95
   .scan_x2   equ  dword[ebp-136] ;dd ?
-
 
96
   .scan_y2   equ	[ebp-140] ;dd ?
-
 
97
   .zz2       equ  dword[ebp-144] ;dw ?
-
 
98
   .cur2r     equ	[ebp-148] ;dw ?
100
 
99
   .cur2g     equ  dword[ebp-152] ;dw ?
-
 
-
 
101
   .scan_y2   equ       [ebp-136] ;dd ?
100
   .cur2b     equ	[ebp-156] ;dw ?
102
   .scan_x2   equ       [ebp-140] ;dd ?
101
 
103
   .zz2       equ       [ebp-144] ;dw ?
102
 
104
   .cur2r     equ       [ebp-148] ;dw ?
103
       mov    ebp,esp
105
   .cur2g     equ       [ebp-152] ;dw ?
104
 
106
   .cur2b     equ       [ebp-156] ;dw ?
105
   ;    mov     .tex_ptr,edx
107
 
Line 106... Line 108...
106
   ;    mov     .z_ptr,esi
108
 
107
   ;    mov     .scr_buff,edi
109
       mov    ebp,esp
108
	 push	 edx esi edi
110
 
109
;         push    esi
111
         push    edx esi edi
110
;         push    edi
112
 
111
	 mov	  edx,80008000h  ; eax,ebx,ecx are ANDd together into edx which means that
113
         mov      edx,80008000h  ; eax,ebx,ecx are ANDd together into edx which means that
112
	 and	  edx,ebx	 ; if *all* of them are negative a sign flag is raised
114
         and      edx,ebx        ; if *all* of them are negative a sign flag is raised
113
	 and	  edx,ecx
115
         and      edx,ecx
114
	 and	  edx,eax
116
         and      edx,eax
115
	 test	  edx,80008000h  ; Check both X&Y at once
117
         test     edx,80008000h  ; Check both X&Y at once
116
	 jne	  .loop2_end
118
         jne      .loop2_end
Line 139... Line 141...
139
       mov     dword .tex_x1 ,edx
141
       mov     dword .tex_x1 ,edx
140
 
142
 
141
 .sort1:
143
 .sort1:
Line 142... Line 144...
142
       cmp	bx,cx
144
       cmp      bx,cx
143
       jle	.sort2
145
       jle      .sort2
144
       xchg    ebx,ecx
146
       xchg    ebx,ecx
145
 
147
 
Line 146... Line 148...
146
if Ext>=MMX
148
if Ext>=MMX
147
       movq    mm0, .col2r	 ; exchange r, g, b, z
149
       movq    mm0, .col2r       ; exchange r, g, b, z
148
       movq    mm1, .col3r
150
       movq    mm1, .col3r
149
       movq    .col3r ,mm0
151
       movq    .col3r ,mm0
150
       movq    .col2r ,mm1
152
       movq    .col2r ,mm1
151
else
153
else
Line 167... Line 169...
167
 
169
 
Line 168... Line 170...
168
 .sort2:
170
 .sort2:
Line 169... Line 171...
169
 
171
 
170
       push	eax ebx ecx	    ; store in variables
172
       push     eax ebx ecx         ; store in variables
171
  ;     push     ebx
173
  ;     push     ebx
Line 172... Line 174...
172
  ;     push     ecx
174
  ;     push     ecx
173
 
175
 
174
;****************** delta computng zone **************
176
;****************** delta computng zone **************
175
;+++++++++ first zone
177
;+++++++++ first zone
176
       mov	bx,.y2	     ; calc delta12
178
       mov      bx,.y2       ; calc delta12
177
       sub	bx,.y1
179
       sub      bx,.y1
178
       jnz	.dx12_make
180
       jnz      .dx12_make
179
       mov	ecx,7
181
       mov      ecx,7
180
     @@:
182
     @@:
181
       push	dword 0
183
       push     dword 0
182
       loop	@b
184
       loop     @b
-
 
185
       jmp      .dx12_done
Line 183... Line -...
183
       jmp	.dx12_done
-
 
184
  .dx12_make:
-
 
185
 
-
 
186
 
-
 
187
       mov	ax,.x2
186
  .dx12_make:
188
       sub	ax,.x1
-
 
189
       cwde
-
 
190
       movsx	ebx,bx
-
 
191
       shl	eax,ROUND
187
     ;  sub      esp,7*4
192
       cdq
-
 
193
       idiv	ebx
-
 
194
 ;      mov      .dx12,eax
-
 
195
       push	 eax
-
 
196
 
-
 
197
if  0  ; Ext=SSE
-
 
198
       movd	 mm0,.col1r    ; 2 words  r, g
-
 
199
       pxor	 mm1,mm1
-
 
200
       punpcklwd mm0,mm1
-
 
201
       cvtpi2ps  xmm0,mm0
-
 
202
       movlhps	 xmm0,xmm0
-
 
203
       movd	 mm0,.col1g    ; 2 words  b, z
-
 
204
       punpcklwd mm0,mm1
-
 
205
       cvtpi2ps  xmm0,mm0
-
 
206
       ; xmm0=four float double words
-
 
207
       divss	 xmm0,.pack3
-
 
208
       ;convert and insert mm0 to lower xmm1     ..
-
 
209
end if
-
 
210
 
-
 
211
       mov	ax,word .tex_x2
-
 
212
       sub	ax,word .tex_x1
-
 
213
       cwde
-
 
214
       shl	eax,ROUND
-
 
215
       cdq
-
 
216
       idiv	ebx
-
 
217
;       mov      .tex_dx12r,eax
-
 
218
       push	  eax
-
 
219
 
-
 
220
       mov	  ax,word .tex_y2
-
 
221
       sub	  ax,word .tex_y1
-
 
222
       cwde
-
 
223
       shl	eax,ROUND
-
 
224
       cdq
-
 
225
       idiv	ebx
-
 
226
;       mov      .tex_dx12,eax
-
 
227
       push	eax
-
 
228
 
-
 
229
       mov	ax,word .z2
-
 
230
       sub	ax,word .z1
188
 
231
       cwde
189
       movsx    ebx,bx
-
 
190
       mov      eax,1 shl 15
232
       shl	eax,CATMULL_SHIFT
191
       cdq
-
 
192
       idiv     ebx
-
 
193
    ;   push     eax
-
 
194
       mov      ebx,eax
-
 
195
 
-
 
196
 
-
 
197
       mov      ax,.x2
-
 
198
       sub      ax,.x1
233
       cdq
199
       cwde
-
 
200
       imul     ebx
-
 
201
       sar      eax,15 - ROUND
-
 
202
       push     eax
-
 
203
    ;   mov      .dx12,eax
-
 
204
 
-
 
205
       sub       esp,6*4
-
 
206
       movd      xmm0,ebx
-
 
207
       pshuflw   xmm0,xmm0,0
-
 
208
    ;   pshufd    xmm0,xmm0,0
-
 
209
       movlhps   xmm0,xmm0
-
 
210
       movq      xmm1,.col1r
-
 
211
       movq      xmm2,.col2r
-
 
212
       movhps    xmm1,.tex_x1
-
 
213
       movhps    xmm2,.tex_x2
-
 
214
       psubw     xmm2,xmm1
-
 
215
       movdqa    xmm3,xmm2
-
 
216
       pmullw    xmm2,xmm0
-
 
217
       pmulhw    xmm3,xmm0
-
 
218
       movhlps   xmm4,xmm2
-
 
219
       movhlps   xmm5,xmm3
-
 
220
       punpcklwd xmm2,xmm3
-
 
221
       punpcklwd xmm4,xmm5
-
 
222
       psrad     xmm2,15 - ROUND
-
 
223
       psrad     xmm4,15 - ROUND
-
 
224
       pshufd    xmm2,xmm2,11000110b
-
 
225
       movdqu    .dc12b,xmm2
Line 234... Line -...
234
       idiv	ebx
-
 
235
 ;      mov      .dz12,eax
-
 
236
       push	eax	  ; .dza12
-
 
237
 
-
 
238
       mov	ax,word .col2r
-
 
239
       sub	ax,word .col1r
-
 
240
       cwde
-
 
241
       shl	eax,ROUND
-
 
242
       cdq
-
 
243
       idiv	ebx
-
 
244
 ;      mov      .dc12r,eax
-
 
245
       push	  eax
-
 
246
 
-
 
247
       mov	  ax,word .col2g
-
 
248
       sub	  ax,word .col1g
-
 
249
       cwde
-
 
250
       shl	eax,ROUND
-
 
251
       cdq
-
 
252
       idiv	ebx
-
 
253
 ;      mov      .dc12g,eax
-
 
254
       push	eax
-
 
255
 
-
 
256
       mov	ax,word .col2b	       ;;---
-
 
257
       sub	ax,word .col1b
-
 
258
       cwde
-
 
259
       shl	eax,ROUND
-
 
Line 260... Line 226...
260
       cdq
226
   ;    punpcklwd xmm4,xmm5
261
       idiv	ebx
227
    ;   psrad     xmm4,15 - ROUND
Line 262... Line 228...
262
;       mov      .dc12b,eax
228
       movq      .tex_dx12,xmm4
263
       push	eax
229
 
264
 
230
 
265
;+++++++++++++++++ second zone +++++++++++++
231
;+++++++++++++++++ second zone +++++++++++++
266
   .dx12_done:
232
   .dx12_done:
267
 
233
 
268
       mov	bx,.y3	     ; calc delta23
234
       mov      bx,.y3       ; calc delta23
269
       sub	bx,.y2
235
       sub      bx,.y2
Line 270... Line 236...
270
       jnz	.dx23_make
236
       jnz      .dx23_make
271
       mov	ecx,7
-
 
272
    @@:
-
 
273
       push	dword 0
-
 
274
       loop	@b
237
       mov      ecx,7
275
       jmp	.dx23_done
238
    @@:
276
 
239
       push     dword 0
277
  .dx23_make:
240
       loop     @b
278
       mov	ax,.x3
241
       jmp      .dx23_done
279
       sub	ax,.x2
-
 
Line 280... Line -...
280
       cwde
-
 
281
       movsx	ebx,bx
-
 
282
       shl	eax,ROUND
-
 
283
       cdq
-
 
284
       idiv	ebx
-
 
285
 ;      mov      .dx23,eax
-
 
286
       push	 eax
-
 
287
 
-
 
Line 288... Line 242...
288
       mov	ax,word .tex_x3
242
 
289
       sub	ax,word .tex_x2
243
  .dx23_make:
290
       cwde
244
       movsx    ebx,bx
291
       shl	eax,ROUND
-
 
292
       cdq
-
 
293
       idiv	ebx
245
       mov      eax,1 shl 15
294
;       mov      .tex_dx23,eax
246
       cdq
295
       push	  eax
247
       idiv     ebx
296
 
248
       mov      ebx,eax
297
       mov	  ax,word .tex_y3
249
 
298
       sub	  ax,word .tex_y2
250
 
299
       cwde
251
       mov      ax,.x3
300
       shl	eax,ROUND
252
       sub      ax,.x2
301
       cdq
253
       cwde
302
       idiv	ebx
254
       imul     ebx
303
;       mov      .tex_dy23,eax
255
       sar      eax,15 - ROUND
304
       push	eax
256
       push     eax
305
 
257
 
306
       mov	ax,word .z3
258
       sub       esp,6*4
307
       sub	ax,word .z2
259
       movd      xmm0,ebx
308
       cwde				   ;
260
       pshuflw   xmm0,xmm0,0
309
       shl	eax,CATMULL_SHIFT	   ;  2222222
261
       movlhps   xmm0,xmm0
310
       cdq				   ;  2     2
262
       movq      xmm1,.col2r
-
 
263
       movq      xmm2,.col3r
311
       idiv	ebx			   ;        2
264
       movhps    xmm1,.tex_x2
-
 
265
       movhps    xmm2,.tex_x3
-
 
266
       psubw     xmm2,xmm1
-
 
267
       movdqa    xmm3,xmm2
312
;       mov      .dz23,eax                 ;       2
268
       pmullw    xmm2,xmm0
313
       push	eax	  ; .dza12         ;      2
269
       pmulhw    xmm3,xmm0
Line 314... Line -...
314
					   ;     2
-
 
315
       mov	ax,word .col3r		   ;    2
-
 
316
       sub	ax,word .col2r		   ;   2222222
-
 
317
       cwde				   ;  second delta
-
 
318
       shl	eax,ROUND		   ;
-
 
319
       cdq				   ;
-
 
320
       idiv	ebx			   ;
-
 
321
;       mov      .dc23r,eax                 ;
-
 
322
       push	  eax
-
 
323
 
-
 
324
       mov	  ax,word .col3g
-
 
325
       sub	  ax,word .col2g
-
 
326
       cwde
-
 
327
       shl	eax,ROUND
-
 
328
       cdq
-
 
329
       idiv	ebx
-
 
330
;       mov      .dc23g,eax
-
 
Line 331... Line 270...
331
       push	eax
270
       movhlps   xmm4,xmm2
332
 
271
       movhlps   xmm5,xmm3
333
       mov	ax,word .col3b	       ;;---
272
       punpcklwd xmm2,xmm3
334
       sub	ax,word .col2b
273
       punpcklwd xmm4,xmm5
335
       cwde
274
       psrad     xmm2,15 - ROUND
336
       shl	eax,ROUND
275
       psrad     xmm4,15 - ROUND
337
       cdq
276
       pshufd    xmm2,xmm2,11000110b
338
       idiv	ebx
277
       movdqu    .dc23b,xmm2
339
;       mov      .dc23b,eax
278
       movq      .tex_dx23,xmm4
340
       push	eax
279
 
341
 
280
 
342
   .dx23_done:
-
 
343
;++++++++++++++++++third zone++++++++++++++++++++++++
-
 
344
       mov	bx,.y3	     ; calc delta13
-
 
345
       sub	bx,.y1
281
   .dx23_done:
346
       jnz	.dx13_make
282
;++++++++++++++++++third zone++++++++++++++++++++++++
347
       mov	ecx,7
283
       mov      bx,.y3       ; calc delta13
348
     @@:
284
       sub      bx,.y1
349
       push	dword 0
285
       jnz      .dx13_make
350
       loop	@b
-
 
Line 351... Line -...
351
       jmp	.dx13_done
-
 
352
  .dx13_make:
-
 
353
       mov	ax,.x3
-
 
354
       sub	ax,.x1
-
 
355
       cwde
-
 
356
       movsx	ebx,bx
-
 
357
       shl	eax,ROUND
-
 
358
       cdq
-
 
359
       idiv	ebx
-
 
360
;       mov      .dx13,eax
-
 
361
       push	 eax
-
 
362
 
-
 
363
       mov	ax,word .tex_x3 	   ; triangle b
-
 
364
       sub	ax,word .tex_x1
-
 
365
       cwde
-
 
366
       shl	eax,ROUND
-
 
367
       cdq
-
 
368
       idiv	ebx
-
 
369
;       mov      .tex_dx13r,eax
-
 
370
       push	  eax
-
 
371
 
-
 
372
       mov	  ax,word .tex_y3
-
 
373
       sub	  ax,word .tex_y1
-
 
374
       cwde
-
 
375
       shl	eax,ROUND
-
 
376
       cdq
-
 
377
       idiv	ebx
-
 
378
;       mov      .tex_dy13,eax
-
 
379
       push	eax
-
 
380
 
-
 
381
       mov	ax,word .z3
-
 
382
       sub	ax,word .z1	       ;    333333333
-
 
383
       cwde			       ;   3        3
-
 
384
       shl	eax,CATMULL_SHIFT      ;            3
-
 
385
       cdq			       ;            3
-
 
386
       idiv	ebx		       ;            3
-
 
387
;       mov      .dz13,eax             ;            3
-
 
388
       push	eax	  ; .dza12     ;            3
-
 
389
				       ;            3
-
 
390
       mov	ax,word .col3r	       ;    3333333333
-
 
391
       sub	ax,word .col1r	       ;            3
-
 
392
       cwde			       ;            3
-
 
393
       shl	eax,ROUND	       ;            3
-
 
394
       cdq			       ;            3
-
 
395
       idiv	ebx		       ;            3
-
 
396
  ;    mov      .dc13r,eax             ;    3       3
-
 
397
       push	  eax		      ;     33333333
-
 
398
 
-
 
399
       mov	  ax,word .col3g
-
 
400
       sub	  ax,word .col1g
-
 
401
       cwde
-
 
402
       shl	eax,ROUND
-
 
403
       cdq
-
 
Line -... Line 286...
-
 
286
       mov      ecx,7
-
 
287
     @@:
-
 
288
       push     dword 0
-
 
289
       loop     @b
-
 
290
       jmp      .dx13_done
-
 
291
  .dx13_make:
-
 
292
       movsx    ebx,bx
-
 
293
       mov      eax,1 shl 15
-
 
294
       cdq
-
 
295
       idiv     ebx
-
 
296
       mov      ebx,eax
-
 
297
 
-
 
298
 
-
 
299
       mov      ax,.x3
-
 
300
       sub      ax,.x1
-
 
301
       cwde
-
 
302
       imul     ebx
-
 
303
       sar      eax,15 - ROUND
-
 
304
       push     eax
-
 
305
 
-
 
306
       sub       esp,6*4
-
 
307
       movd      xmm0,ebx
-
 
308
       pshuflw   xmm0,xmm0,0
-
 
309
       movlhps   xmm0,xmm0
-
 
310
       movq      xmm1,.col1r
-
 
311
       movq      xmm2,.col3r
-
 
312
       movhps    xmm1,.tex_x1
-
 
313
       movhps    xmm2,.tex_x3
404
       idiv	ebx
314
       psubw     xmm2,xmm1
Line 405... Line 315...
405
 ;      mov      .dc13g,eax
315
       movdqa    xmm3,xmm2
406
       push	eax
-
 
Line -... Line 316...
-
 
316
       pmullw    xmm2,xmm0
-
 
317
       pmulhw    xmm3,xmm0
407
 
318
       movhlps   xmm4,xmm2
408
       mov	ax,word .col3b	       ;;---
319
       movhlps   xmm5,xmm3
409
       sub	ax,word .col1b
320
       punpcklwd xmm2,xmm3
-
 
321
       punpcklwd xmm4,xmm5
-
 
322
       psrad     xmm2,15 - ROUND
410
       cwde
323
       psrad     xmm4,15 - ROUND
411
       shl	eax,ROUND
324
       pshufd    xmm2,xmm2,11000110b
412
       cdq
325
       movdqu    .dc13b,xmm2
413
       idiv	ebx
326
       movq      .tex_dx13,xmm4
414
;       mov      .dc13b,eax
-
 
-
 
327
   .dx13_done:
-
 
328
 
415
       push	eax
329
; <<<<<<<  ::delta zone end+++++++++++++++++++++ >>>>>>>>
416
 
330
 
-
 
331
       sub      esp,(12*4)
-
 
332
 
417
   .dx13_done:
333
       movsx    eax,.x1                    ; eax - cur x1
418
 
334
       shl      eax,ROUND                  ; ebx - cur x2
-
 
335
       mov      ebx,eax
419
; <<<<<<<  ::delta zone end+++++++++++++++++++++ >>>>>>>>
336
 
-
 
337
 
-
 
338
       movzx    edi,word .tex_x1
420
       sub	esp,55	 ;(12*4)
339
       shl      edi,ROUND
421
 
340
       mov      .scan_x1,edi
422
       movsx	eax,.x1 		   ; eax - cur x1
341
       mov      .scan_x2,edi
-
 
342
    ;   push     edi
423
       shl	eax,ROUND		   ; ebx - cur x2
343
    ;   push     edi
424
       mov	ebx,eax
344
       movzx    edx,word .tex_y1
425
       movsx	edx,word .z1
345
       shl      edx,ROUND
426
       shl	edx,CATMULL_SHIFT
346
  ;     push     edx
427
       mov	.zz1,edx
-
 
428
       mov	.zz2,edx
347
  ;     push     edx
429
 
348
       mov      .scan_y1,edx
430
       movzx	edi,word .col1r
349
       mov      .scan_y2,edx
431
       shl	edi,ROUND
350
 
432
       mov	.cur1r,edi
351
       movsx    edx,word .z1
433
       mov	.cur2r,edi
352
       shl      edx,CATMULL_SHIFT
434
       movzx	esi,word .col1g
353
   ;    push     edx
435
       shl	esi,ROUND
354
   ;    push     edx
-
 
355
       mov      .zz1,edx
436
       mov	.cur1g,esi
356
       mov      .zz2,edx
437
       mov	.cur2g,esi
357
 
438
       movzx	edx,word .col1b
358
       movzx    edi,word .col1r
439
       shl	edx,ROUND
359
       shl      edi,ROUND
440
       mov	.cur1b,edx
360
       mov      .cur1r,edi
441
       mov	.cur2b,edx
-
 
-
 
361
       mov      .cur2r,edi
442
 
362
       movzx    esi,word .col1g
Line 443... Line 363...
443
       movzx	edi,word .tex_x1
363
       shl      esi,ROUND
444
       shl	edi,ROUND
364
       mov      .cur1g,esi
445
       mov	.scan_x1,edi
365
       mov      .cur2g,esi
446
       mov	.scan_x2,edi
366
       movzx    edx,word .col1b
447
       movzx	edx,word .tex_y1
367
       shl      edx,ROUND
448
       shl	edx,ROUND
368
       mov      .cur1b,edx
449
       mov	.scan_y1,edx
369
       mov      .cur2b,edx
450
       mov	.scan_y2,edx
370
 
451
 
371
 
452
       mov	cx,.y1
372
       mov      cx,.y1
453
       cmp	cx,.y2
373
       cmp      cx,.y2
454
       jge	.loop1_end
374
       jge      .loop1_end
455
    .loop_1:
375
    .loop_1:
456
    ;   push     eax ebx ebp
376
 
457
       pushad
377
       pushad
458
 
378
 
459
       push	.tex_ptr
379
       push     .tex_ptr
460
       push	.scr_buff
380
       push     .scr_buff
461
       push	.z_ptr
381
       push     .z_ptr
462
       push	cx
382
       push     cx
463
 
383
 
464
       push	.zz2
384
       push     dword .zz2
465
 
385
 
466
       push	.scan_x2
386
       push     dword .cur2b
-
 
387
       push     dword .cur2g
Line 467... Line -...
467
       push	dword .scan_y2
-
 
468
       push	dword .cur2r
388
       push     dword .cur2r
Line 469... Line -...
469
       push	.cur2g
-
 
470
       push	dword .cur2b
-
 
471
 
-
 
472
       push	.zz1
-
 
473
 
-
 
474
       push	.scan_x1
-
 
475
       push	dword .scan_y1
-
 
476
       push	dword .cur1r
-
 
477
       push	.cur1g
-
 
478
       push	dword .cur1b
-
 
479
 
-
 
480
       sar	eax,ROUND
-
 
481
       sar	ebx,ROUND
-
 
482
       call	horizontal_tex_grd_line
-
 
483
 
-
 
484
      ; pop      ebp ebx eax
-
 
485
       popad
-
 
486
 
-
 
487
if (Ext = MMX)|(Ext=SSE)
-
 
488
       movq	mm0,.cur1b
-
 
489
       movq	mm1,.cur1r
-
 
490
       movq	mm2,.scan_y1
-
 
491
       movq	mm3,.cur2b
-
 
492
       movq	mm4,.cur2r
-
 
493
       movq	mm5,.scan_y2
-
 
494
       paddd	mm0,.dc13b
-
 
495
       paddd	mm1,.dc13r
-
 
496
       paddd	mm2,.tex_dy13
-
 
497
       paddd	mm3,.dc12b
-
 
498
       paddd	mm4,.dc12r
-
 
499
       paddd	mm5,.tex_dy12
-
 
500
       movq	.cur1b,mm0
-
 
501
       movq	.cur1r,mm1
-
 
502
       movq	.scan_y1,mm2
-
 
503
       movq	.cur2b,mm3
-
 
504
       movq	.cur2r,mm4
-
 
Line 505... Line -...
505
       movq	.scan_y2,mm5
-
 
506
end if
389
       push     dword .scan_x2
507
if Ext >= SSE2
-
 
508
       movups	xmm0,.cur1b
390
       push     dword .scan_y2
509
       movups	xmm1,.dc13b
-
 
510
       movups	xmm2,.cur2b
391
 
511
       movups	xmm3,.dc12b
-
 
512
       movq	mm2,.scan_y1
392
       push      .zz1
513
       movq	mm5,.scan_y2
-
 
514
       paddd	xmm0,xmm1
393
 
515
       paddd	xmm2,xmm3
-
 
516
       paddd	mm2,.tex_dy13
-
 
517
       paddd	mm5,.tex_dy12
-
 
518
       movq	.scan_y1,mm2
-
 
519
       movq	.scan_y2,mm5
394
       push     dword .cur1b
520
       movups	.cur1b,xmm0
395
       push     dword .cur1g
521
       movups	.cur2b,xmm2
-
 
522
end if
396
       push     dword .cur1r
523
 
-
 
524
if Ext = NON
397
       push     dword .scan_x1
525
       mov	edx,.dc13b
398
       push     dword .scan_y1
526
       add	.cur1b,edx
399
 
527
       mov	esi,.dc13g
-
 
528
       add	.cur1g,esi
400
       sar      eax,ROUND
529
       mov	edi,.dc13r
401
       sar      ebx,ROUND
530
       add	.cur1r,edi
402
       call     horizontal_tex_grd_line
-
 
403
 
531
       mov	edx,.dz13
404
 
532
       add	.zz1,edx
405
       popad
533
       mov	edx,.tex_dx13
406
 
534
       add	.scan_x1,edx
407
 
535
       mov	esi,.tex_dy13
408
       movups   xmm0,.cur1b
536
       add	.scan_y1,esi
409
       movups   xmm1,.dc13b
537
 
410
       movups   xmm2,.cur2b
538
       mov	edi,.dc12b
411
       movups   xmm3,.dc12b
539
       add	.cur2b,edi
412
       movq     mm2,.scan_x1
540
       mov	esi,.dc12g
413
       movq     mm5,.scan_x2
Line 541... Line 414...
541
       add	.cur2g,esi
414
       paddd    xmm0,xmm1
542
       mov	edx,.dc12r
415
       paddd    xmm2,xmm3
Line 543... Line 416...
543
       add	.cur2r,edx
416
       paddd    mm2,.tex_dx13
544
       mov	edi,.tex_dx12
417
       paddd    mm5,.tex_dx12
545
       add	.scan_x2,edi
418
       movq     .scan_x1,mm2
546
       mov	esi,.tex_dy12
419
       movq     .scan_x2,mm5
Line 547... Line 420...
547
       add	.scan_y2,esi
420
       movups   .cur1b,xmm0
548
       mov	edx,.dz12
421
       movups   .cur2b,xmm2
549
       add	.zz2,edx
422
 
550
end if
423
 
551
       add	eax,.dx13
424
       add      eax,.dx13
552
       add	ebx,.dx12
425
       add      ebx,.dx12
553
       inc	cx
426
       inc      cx
554
       cmp	cx,.y2
427
       cmp      cx,.y2
555
       jl      .loop_1
428
       jl      .loop_1
556
 .loop1_end:
429
 .loop1_end:
557
       movzx	ecx,.y2
430
       movzx    ecx,.y2
558
       cmp	cx,.y3
431
       cmp      cx,.y3
Line 559... Line 432...
559
       jge	.loop2_end
432
       jge      .loop2_end
560
 
433
 
561
       movsx	ebx,.x2 		   ; eax - cur x1
434
       movsx    ebx,.x2                    ; eax - cur x1
562
       shl	ebx,ROUND		   ; ebx - cur x2
435
       shl      ebx,ROUND                  ; ebx - cur x2
563
 
436
 
564
       movsx	edx,word .z2
437
       movsx    edx,word .z2
565
       shl	edx,CATMULL_SHIFT
438
       shl      edx,CATMULL_SHIFT
566
;       mov      .zz1,edx
439
;       mov      .zz1,edx
Line 567... Line 440...
567
       mov	.zz2,edx
440
       mov      .zz2,edx
568
 
441
 
Line 569... Line 442...
569
       movzx	edi,word .col2r
442
       movzx    edi,word .col2r
570
       shl	edi,ROUND
443
       shl      edi,ROUND
571
   ;    mov      .cur1r,edi
444
   ;    mov      .cur1r,edi
572
       mov	.cur2r,edi
445
       mov      .cur2r,edi
573
       movzx	esi,word .col2g
446
       movzx    esi,word .col2g
574
       shl	esi,ROUND
447
       shl      esi,ROUND
575
   ;    mov      .cur1g,esi
448
   ;    mov      .cur1g,esi
576
       mov	.cur2g,esi
449
       mov      .cur2g,esi
577
       movzx	edx,word .col2b
450
       movzx    edx,word .col2b
578
       shl	edx,ROUND
451
       shl      edx,ROUND
579
   ;    mov      .cur1b,edx
452
   ;    mov      .cur1b,edx
580
       mov	.cur2b,edx
453
       mov      .cur2b,edx
581
 
454
 
582
       movzx	edi,word .tex_x2
455
       movzx    edi,word .tex_x2
583
       shl	edi,ROUND
456
       shl      edi,ROUND
584
 ;      mov      .scan_x1,edi
457
 ;      mov      .scan_x1,edi
585
       mov	.scan_x2,edi
458
       mov      .scan_x2,edi
586
       movzx	edx,word .tex_y2
459
       movzx    edx,word .tex_y2
587
       shl	edx,ROUND
460
       shl      edx,ROUND
588
 ;      mov      .scan_y1,edx
461
 ;      mov      .scan_y1,edx
589
       mov	.scan_y2,edx
462
       mov      .scan_y2,edx
590
 
463
 
591
  .loop_2:
464
  .loop_2:
592
       pushad
465
       pushad
Line 593... Line 466...
593
 
466
 
Line 594... Line -...
594
       push	.tex_ptr
-
 
595
       push	.scr_buff
-
 
596
       push	.z_ptr
-
 
597
       push	cx
-
 
598
 
-
 
599
       push	.zz2
-
 
600
 
-
 
601
       push	.scan_x2
-
 
602
       push	dword .scan_y2
-
 
603
       push	dword .cur2r
-
 
604
       push	.cur2g
-
 
605
       push	dword .cur2b
-
 
606
 
-
 
607
       push	.zz1
-
 
608
 
-
 
609
       push	.scan_x1
-
 
610
       push	dword .scan_y1
-
 
611
       push	dword .cur1r
-
 
612
       push	.cur1g
-
 
613
       push	dword .cur1b
467
       push     .tex_ptr
614
 
-
 
615
       sar	eax,ROUND
468
       push     .scr_buff
616
       sar	ebx,ROUND
469
       push     .z_ptr
617
       call	horizontal_tex_grd_line
470
       push     cx
618
 
471
 
619
       popad
472
       push     dword .zz2
620
 
473
 
621
if (Ext = MMX)|(Ext=SSE)
474
       push     dword .cur2b
622
       movq	mm0,.cur1b
475
       push     dword .cur2g
623
       movq	mm1,.cur1r
476
       push     dword .cur2r
624
       movq	mm2,.scan_y1
477
       push     dword .scan_x2
625
       movq	mm3,.cur2b
478
       push     dword .scan_y2
626
       movq	mm4,.cur2r
479
 
627
       movq	mm5,.scan_y2
480
       push      .zz1
628
       paddd	mm0,.dc13b
481
 
629
       paddd	mm1,.dc13r
-
 
630
       paddd	mm2,.tex_dy13
-
 
631
       paddd	mm3,.dc23b
-
 
632
       paddd	mm4,.dc23r
-
 
633
       paddd	mm5,.tex_dy23
-
 
634
       movq	.cur1b,mm0
-
 
635
       movq	.cur1r,mm1
-
 
636
       movq	.scan_y1,mm2
-
 
637
       movq	.cur2b,mm3
-
 
638
       movq	.cur2r,mm4
-
 
639
       movq	.scan_y2,mm5
-
 
640
end if
-
 
641
if Ext >= SSE2
-
 
642
       movups	xmm0,.cur1b
-
 
643
       movups	xmm1,.dc13b
482
       push     dword .cur1b
644
       movups	xmm2,.cur2b
-
 
645
       movups	xmm3,.dc23b
-
 
646
       movq	mm2,.scan_y1
-
 
647
       movq	mm5,.scan_y2
-
 
648
       paddd	xmm0,xmm1
-
 
649
       paddd	xmm2,xmm3
-
 
650
       paddd	mm2,.tex_dy13
-
 
651
       paddd	mm5,.tex_dy23
-
 
652
       movq	.scan_y1,mm2
-
 
653
       movq	.scan_y2,mm5
-
 
654
       movups	.cur1b,xmm0
-
 
655
       movups	.cur2b,xmm2
-
 
656
end if
-
 
657
if Ext = NON
483
       push     dword .cur1g
658
       mov	edx,.dc13b
484
       push     dword .cur1r
659
       add	.cur1b,edx
485
       push     dword .scan_x1
660
       mov	esi,.dc13g
486
       push     dword .scan_y1
661
       add	.cur1g,esi
487
 
Line 662... Line 488...
662
       mov	edi,.dc13r
488
       sar      eax,ROUND
663
       add	.cur1r,edi
489
       sar      ebx,ROUND
664
       mov	edx,.tex_dx13
490
       call     horizontal_tex_grd_line
665
       add	.scan_x1,edx
491
 
666
       mov	esi,.tex_dy13
492
       popad
667
       add	.scan_y1,esi
493
 
Line 668... Line 494...
668
       mov	edx,.dz13
494
 
669
       add	.zz1,edx
495
       movups   xmm0,.cur1b
670
 
496
       movups   xmm1,.dc13b
671
       mov	edi,.dc23b
497
       movups   xmm2,.cur2b
-
 
498
       movups   xmm3,.dc23b
-
 
499
       movq     mm2,.scan_x1
-
 
500
       movq     mm5,.scan_x2
-
 
501
       paddd    xmm0,xmm1
-
 
502
       paddd    xmm2,xmm3
-
 
503
       paddd    mm2,.tex_dx13
-
 
504
       paddd    mm5,.tex_dx23
-
 
505
       movq     .scan_x1,mm2
-
 
506
       movq     .scan_x2,mm5
-
 
507
       movups   .cur1b,xmm0
-
 
508
       movups   .cur2b,xmm2
-
 
509
 
-
 
510
       add      eax,.dx13
-
 
511
       add      ebx,.dx23
-
 
512
       inc      cx
Line 672... Line -...
672
       add	.cur2b,edi
-
 
673
       mov	esi,.dc23g
-
 
674
       add	.cur2g,esi
-
 
675
       mov	edx,.dc23r
-
 
676
       add	.cur2r,edx
-
 
677
       mov	edi,.tex_dx23
-
 
678
       add	.scan_x2,edi
-
 
679
       mov	esi,.tex_dy23
-
 
680
       add	.scan_y2,esi
-
 
681
       mov	edx,.dz23
-
 
682
       add	.zz2,edx
-
 
683
end if
-
 
684
       add	eax,.dx13
-
 
Line 685... Line 513...
685
       add	ebx,.dx23
513
       cmp      cx,.y3
686
       inc	cx
514
       jl       .loop_2
687
       cmp	cx,.y3
515
 
688
       jl	.loop_2
516
.loop2_end:
689
 
517
       mov      esp,ebp
690
.loop2_end:
518
ret 36
691
       mov	esp,ebp
519
horizontal_tex_grd_line:
692
ret 36
520
;in:
Line 693... Line -...
693
horizontal_tex_grd_line:
-
 
694
;in:
-
 
695
; eax : x1, ebx : x2
-
 
696
 
521
; eax : x1, ebx : x2
697
.tex_ptr  equ [ebp+62]
-
 
698
.screen   equ [ebp+58]
-
 
699
.z_buffer equ [ebp+54]
522
 
700
.y	  equ [ebp+52]
-
 
701
 
-
 
702
.z2	equ [ebp+48]
-
 
703
.tex_x2 equ [ebp+44]
523
.tex_ptr  equ [ebp+62]
704
.tex_y2 equ [ebp+40]
-
 
705
.r2	equ [ebp+36]
524
.screen   equ [ebp+58]
706
.g2	equ [ebp+32]
-
 
707
.b2	equ [ebp+28]
-
 
708
 
525
.z_buffer equ [ebp+54]
709
.z1	equ [ebp+24]
526
.y        equ [ebp+52]
710
.tex_x1 equ [ebp+20]
527
 
711
.tex_y1 equ [ebp+16]
528
.z2     equ [ebp+48]
712
.r1	equ [ebp+12]
529
.b2     equ [ebp+44]
713
.g1	equ [ebp+8]
530
.g2     equ [ebp+40]
714
.b1	equ [ebp+4]
531
.r2     equ [ebp+36]
715
 
532
.tex_x2 equ [ebp+32]
716
.x1 equ  word[ebp-2]
533
.tex_y2 equ [ebp+28]
717
.x2 equ  word[ebp-4]
534
 
718
.dz equ dword[ebp-8]
535
 
719
.db equ dword[ebp-12]
-
 
720
.dg equ dword[ebp-16]
-
 
721
.dr equ dword[ebp-20]
-
 
722
.dtex_x equ dword[ebp-24]
-
 
723
.dtex_y equ dword[ebp-28]
-
 
724
 
-
 
725
.c_ty equ [ebp-32]
-
 
726
.c_tx equ [ebp-36]
-
 
727
.cb  equ  [ebp-40]
-
 
728
.cg  equ  [ebp-44]
536
.z1     equ [ebp+24]
729
.cr  equ  [ebp-48]
-
 
730
.t_col equ [ebp-52]
-
 
731
 
-
 
732
.dtex_yM equ qword[ebp-28]
537
.b1     equ [ebp+20]
733
.drM equ qword[ebp-20]
538
.g1     equ [ebp+16]
734
.dbM equ qword[ebp-12]
539
.r1     equ [ebp+12]
735
 
540
.tex_x1 equ [ebp+8]
736
	mov	ebp,esp
-
 
737
  ;      sub     esp,30
-
 
738
 
-
 
739
	mov	cx,word .y
541
.tex_y1 equ [ebp+4]
740
	or	cx,cx
-
 
741
	jl	.quit_l
-
 
742
 
-
 
743
	cmp	cx,word[size_y_var]  ;SIZE_Y
-
 
744
	jge	.quit_l
-
 
745
 
-
 
746
	cmp	ax,bx
542
 
747
	je	.quit_l
543
 
748
	jl	@f
544
.x1 equ  word[ebp-2]
749
 
545
.x2 equ  word[ebp-4]
750
	xchg	eax,ebx
-
 
751
 
-
 
752
if Ext=NON
-
 
753
	mov	ecx,dword .r1
-
 
754
	xchg	ecx, .r2
-
 
755
	mov	dword .r1, ecx
-
 
756
 
-
 
757
	mov	ecx,dword .g1
-
 
Line 758... Line -...
758
	xchg	ecx, .g2
-
 
759
	mov	dword .g1, ecx
-
 
760
 
-
 
761
	mov	ecx,dword .b1
-
 
762
	xchg	ecx, .b2
-
 
763
	mov	dword .b1, ecx
-
 
764
 
-
 
765
	mov	ecx,dword .tex_x1
-
 
766
	xchg	ecx, .tex_x2
-
 
767
	mov	dword .tex_x1, ecx
-
 
768
 
-
 
Line 769... Line 546...
769
	mov	ecx,dword .tex_y1
546
.dz equ dword[ebp-8]
770
	xchg	ecx, .tex_y2
547
.db equ [ebp-12]
771
	mov	dword .tex_y1, ecx
548
.dg equ dword[ebp-16]
772
 
549
.dr equ [ebp-20]
773
	mov	ecx,dword .z1
550
.dtex_x equ dword[ebp-24]
774
	xchg	ecx, .z2
551
.dtex_y equ [ebp-28]
775
	mov	dword .z1, ecx
552
 
776
end if
553
        mov     ebp,esp
-
 
554
 
-
 
555
 
-
 
556
        mov     cx,word .y
777
if (Ext=MMX)
557
        or      cx,cx
778
	movq	mm0,.b1        ; b, g
558
        jl      .quit_l
779
	movq	mm1,.b2
559
 
780
	movq	.b1, mm1
560
        cmp     cx,word[size_y_var]  ;SIZE_Y
-
 
561
        jge     .quit_l
781
	movq	.b2, mm0
562
 
-
 
563
        cmp     ax,bx
-
 
564
        je      .quit_l
-
 
565
        jl      @f
782
	movq	mm2,.r1        ; r, y
566
 
783
	movq	mm3,.r2
567
        xchg    eax,ebx
784
	movq	.r1,mm3
568
 
785
	movq	.r2,mm2
569
 
786
	movq	mm4,.tex_x1    ; x, z
570
       movdqu  xmm0,.tex_y1
787
	movq	mm5,.tex_x2
571
       movdqu  xmm1,.tex_y2
788
	movq	.tex_x1,mm5
572
       movdqu  .tex_y1,xmm1
789
	movq	.tex_x2,mm4
-
 
790
 
573
       movdqu  .tex_y2,xmm0
-
 
574
       movq    xmm4,.b1    ; x, z
791
end if
575
       movq    xmm5,.b2
792
if Ext>=SSE
576
       movq    .b1,xmm5
793
       movups  xmm0,.b1
577
       movq    .b2,xmm4
794
       movups  xmm1,.b2
578
 
795
       movups  .b1,xmm1
-
 
796
       movups  .b2,xmm0
579
 
-
 
580
    @@:
797
       movq    mm4,.tex_x1    ; x, z
581
        or      bx,bx
798
       movq    mm5,.tex_x2
582
        jle     .quit_l
799
       movq    .tex_x1,mm5
583
        cmp     ax,word[size_x_var]  ;SIZE_X
800
       movq    .tex_x2,mm4
584
        jge     .quit_l
801
end if
-
 
802
 
585
 
-
 
586
        push    ax
803
    @@:
587
        push    bx
804
	or	bx,bx
588
if 1
805
	jle	.quit_l
589
        mov     bx,.x2
806
	cmp	ax,word[size_x_var]  ;SIZE_X
590
        sub     bx,.x1
807
	jge	.quit_l
-
 
808
 
591
 
809
	push	ax
592
        movsx    ebx,bx
-
 
593
        mov      eax,1 shl 15
810
	push	bx
594
        cdq
811
 
595
        idiv     ebx
812
	mov	eax,.z2 	   ; delta zone************
596
        mov      ebx,eax
-
 
597
 
-
 
598
 
-
 
599
        mov     eax,.z2            ; delta zone************
-
 
600
        sub     eax,.z1
-
 
601
        imul    ebx
813
	sub	eax,.z1
602
        sar     eax,15
814
	cdq
603
        push    eax  ; .dz
-
 
604
 
-
 
605
        mov     eax,.b2
-
 
606
        sub     eax,.b1
-
 
607
        imul    ebx
-
 
608
        sar     eax,15
-
 
609
        push    eax
-
 
610
 
-
 
611
        mov     eax,.g2
-
 
612
        sub     eax,.g1
-
 
613
        imul    ebx
-
 
614
        sar     eax,15
-
 
615
        push    eax  ; .dz
-
 
616
 
-
 
617
        mov     eax,.r2
-
 
618
        sub     eax,.r1
-
 
619
        imul    ebx
-
 
620
        sar     eax,15
-
 
621
        push    eax
-
 
622
 
-
 
623
        mov     eax,.tex_x2
-
 
624
        sub     eax,.tex_x1
-
 
625
        imul    ebx
-
 
626
        sar     eax,15
-
 
627
        push    eax
-
 
628
 
-
 
629
        mov     eax,.tex_y2
815
	mov	bx,.x2
630
        sub     eax,.tex_y1
-
 
631
        imul    ebx
-
 
632
        sar     eax,15
-
 
633
        push    eax
-
 
634
 
816
	sub	bx,.x1
635
 
817
	movsx	ebx,bx
636
end if
818
	idiv	ebx
637
if 0
819
	push	eax  ; .dz
638
       sub       esp,6*4
820
 
639
       movd      xmm0,ebx
821
	mov	eax,.b2
640
       pshuflw   xmm0,xmm0,0
822
	sub	eax,.b1
641
       movlhps   xmm0,xmm0
823
	cdq
642
       movdqu    xmm1,.tex_y1
824
	idiv	ebx
643
       movdqu    xmm2,.tex_y2
825
	push	eax  ; .db
644
       movq      xmm3,.b1
826
 
645
       movq      xmm4,.b2
827
	mov	eax,.g2
646
       psubd     xmm4,xmm3
828
	sub	eax,.g1
647
       psubd     xmm2,xmm1
829
	cdq
648
       packssdw  xmm2,xmm4
830
	idiv	ebx
649
  ;     packlssdw  xmm2,xmm2
831
	push	eax  ; .dg
650
   ;    movlhps   xmm2,xmm4
832
 
651
 
833
	mov	eax,.r2
652
 
834
	sub	eax,.r1
653
   ;    psubw     xmm2,xmm1
835
	cdq
654
       movdqa    xmm3,xmm2
836
	idiv	ebx
655
       pmullw    xmm2,xmm0
837
	push	eax  ; .dr
656
       pmulhw    xmm3,xmm0
838
 
657
       movhlps   xmm4,xmm2
839
	mov	eax,.tex_x2
658
       movhlps   xmm5,xmm3
840
	sub	eax,.tex_x1
659
       punpcklwd xmm2,xmm3
841
	cdq
660
       punpcklwd xmm4,xmm5
842
	idiv	ebx
661
       psrad     xmm2,15 - ROUND
843
	push	eax  ; .dtex_x
662
       psrad     xmm4,15 - ROUND
844
 
663
   ;    pshufd    xmm2,xmm2,11000110b
845
	mov	eax,.tex_y2
664
       movdqu    .dtex_y,xmm2
846
	sub	eax,.tex_y1
665
       movq      .db,xmm4
847
	cdq
666
 
848
	idiv	ebx
667
 
849
	push	eax  ; .dtey_x
668
end if
850
 
669
 
851
	cmp	.x1,0
670
        cmp     .x1,0
852
	jg	@f
671
        jg      @f
853
 
672
 
854
	mov	eax,.dz     ; clipping
673
        mov     eax,.dz     ; clipping
855
	movsx	ebx,.x1
674
        movsx   ebx,.x1
856
	neg	ebx
675
        neg     ebx
857
	imul	ebx
676
        imul    ebx
858
	add	.z1,eax
677
        add     .z1,eax
859
	mov	.x1,0
678
        mov     .x1,0
860
 
679
 
861
	mov    eax,.dr
680
        mov    eax,.dr
862
	imul   ebx
681
        imul   ebx
863
	add    .r1,eax
682
        add    .r1,eax
864
;if  Ext=NON
683
;if  Ext=NON
865
	mov    eax,.dg
684
        mov    eax,.dg
866
	imul   ebx
685
        imul   ebx
867
	add    .g1,eax
686
        add    .g1,eax
868
 
687
 
Line 869... Line 688...
869
	mov    eax,.db
688
        mov    eax,.db
870
	imul   ebx
689
        imul   ebx
871
	add    .b1,eax
690
        add    .b1,eax
-
 
691
 
-
 
692
        mov    eax,.dtex_x
872
 
693
        imul   ebx
Line 873... Line -...
873
	mov    eax,.dtex_x
-
 
874
	imul   ebx
-
 
875
	add    .tex_x1,eax
-
 
876
 
-
 
877
	mov    eax,.dtex_y
-
 
878
	imul   ebx
-
 
879
	add    .tex_y1,eax
-
 
880
   @@:
-
 
881
	movsx	  edx,word[size_x_var]	;SIZE_X
-
 
882
	cmp	  .x2,dx
694
        add    .tex_x1,eax
883
	jl	  @f
695
 
884
	mov	  .x2,dx
696
        mov    eax,.dtex_y
885
    @@:
697
        imul   ebx
886
; calc line addres begin in screen and Z buffer
698
        add    .tex_y1,eax
887
	movsx	  eax,word .y
699
   @@:
888
	mul	  edx
700
        movsx     edx,word[size_x_var]  ;SIZE_X
889
	movsx	  edx,.x1
-
 
890
	add	  eax,edx
701
        cmp       .x2,dx
891
 
702
        jl        @f
892
	mov	  esi,eax
-
 
893
	shl	  esi,2
-
 
894
	add	  esi,.z_buffer
703
        mov       .x2,dx
-
 
704
    @@:
895
 
705
; calc line addres begin in screen and Z buffer
896
	lea	  eax,[eax*3]
706
        movsx     eax,word .y
897
	mov	  edi,.screen
707
        mul       edx
898
	add	  edi,eax
708
        movsx     edx,.x1
899
 
709
        add       eax,edx
900
	mov	  cx,.x2
710
 
901
	sub	  cx,.x1
-
 
902
	movzx	  ecx,cx
-
 
903
 
-
 
904
; init current variables
-
 
905
	push	  dword .tex_y1
-
 
906
;if  Ext=NON
-
 
907
	push	  dword .tex_x1
-
 
908
 
-
 
909
	push	  dword .b1
-
 
910
	push	  dword .g1
-
 
911
	push	  dword .r1
-
 
912
 
-
 
913
if Ext>=MMX
-
 
914
	movq	  mm4,.cr  ; lo -> r,g
-
 
915
	movq	  mm6,.cb  ; hi -> b, tex_x
-
 
916
	pxor	  mm0,mm0
-
 
917
end if
-
 
918
	mov	  ebx,.z1
-
 
919
      .ddraw:
-
 
920
	cmp	  ebx,dword[esi]
-
 
921
	jge	  @f
-
 
922
	mov	  eax,.c_ty
-
 
923
;  if ROUND
-
 
924
;        shl        eax,TEX_SHIFT-ROUND
-
 
925
;  end if
-
 
926
;  if ROUND>TEX_SHIFT
-
 
927
;        shr        eax,ROUND-TEX_SHIFT
-
 
928
;  end if
-
 
929
	shr	  eax,ROUND
-
 
930
	shl	  Eax,TEX_SHIFT
-
 
931
	mov	  edx,.c_tx   ; calc texture pixel mem addres
-
 
932
	shr	  edx,ROUND
-
 
933
	add	  eax,edx
-
 
934
	and	  eax,TEXTURE_SIZE   ; cutting
-
 
935
	lea	  eax,[3*eax]
-
 
936
	add	  eax,.tex_ptr
-
 
937
	mov	  dword[esi],ebx
-
 
938
if    Ext = NON
-
 
939
	mov	  eax,dword[eax]
-
 
940
 ;      mov        .tex_col,eax
-
 
941
	push	  ax
711
        mov       esi,eax
942
	shl	  eax,8
-
 
943
	pop	  ax
-
 
944
	mov	  edx,.cr
-
 
945
	sar	  edx,ROUND
-
 
946
	mul	  dl	     ; al*dl
-
 
947
	shr	  ax,8
-
 
948
	stosb
-
 
949
	ror	  eax,16
-
 
950
	push	  ax
712
        shl       esi,2
951
	mov	  edx,.cg
713
        add       esi,.z_buffer
952
	sar	  edx,ROUND
714
 
953
	mul	  dl
715
        lea       eax,[eax*3]
954
	shr	  ax,8
716
        mov       edi,.screen
955
	stosb
-
 
956
	pop	  ax
717
        add       edi,eax
957
	shr	  ax,8
718
 
958
	mov	  edx,.cb
719
        mov       cx,.x2
959
	sar	  edx,ROUND
720
        sub       cx,.x1
960
	mul	  dl
721
        movzx     ecx,cx
961
	shr	  ax,8
-
 
Line 962... Line 722...
962
	stosb
722
 
963
	jmp	  .no_skip
723
; init current variables
964
else
724
        movdqu    xmm0,.r1
965
	movd	  mm1,[eax]
725
        movdqu    xmm1,.dr
966
	punpcklbw mm1,mm0
726
        pxor      xmm2,xmm2
967
	movq	  mm3,mm4  ;.cr     ; lo -> r,g
727
        movq      xmm4,.dtex_y
968
	movq	  mm5,mm6  ;.cb     ; lo -> b,tex_x
728
        movq      xmm5,.tex_y1
Line 969... Line -...
969
	psrld	  mm3,ROUND  ;
-
 
970
	psrld	  mm5,ROUND  ;
729
 
Line 971... Line 730...
971
	packssdw  mm3,mm5
730
        mov       ebx,.z1
Line 972... Line 731...
972
	pmullw	  mm1,mm3
731
      .ddraw:
973
	psrlw	  mm1,8
732
        cmp       ebx,dword[esi]
-
 
733
        jge       @f
-
 
734
        movdqa    xmm6,xmm5
-
 
735
        psrld     xmm6,ROUND