Subversion Repositories Kolibri OS

Rev

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

Rev 1245 Rev 1776
Line 20... Line 20...
20
.x2    equ word[ebp-6]
20
.x2    equ word[ebp-6]
21
.y2    equ word[ebp-8]
21
.y2    equ word[ebp-8]
22
.x3    equ word[ebp-10]
22
.x3    equ word[ebp-10]
23
.y3    equ word[ebp-12]
23
.y3    equ word[ebp-12]
Line 24... Line 24...
24
 
24
 
25
.dc12r equ dword[ebp-16]
25
.dx12  equ dword[ebp-16]
26
.dc12g equ dword[ebp-20]
26
.dc12r equ dword[ebp-20]
27
.dc12b equ dword[ebp-24]
27
.dc12g equ [ebp-24]
28
.dc13r equ dword[ebp-28]
28
.dc12b equ dword[ebp-28]
29
.dc13g equ dword[ebp-32]
29
.dx13  equ dword[ebp-32]
30
.dc13b equ dword[ebp-36]
30
.dc13r equ dword[ebp-36]
31
.dc23r equ dword[ebp-40]
31
.dc13g equ [ebp-40]
32
.dc23g equ dword[ebp-44]
32
.dc13b equ dword[ebp-44]
33
.dc23b equ dword[ebp-48]
-
 
34
 
33
.dx23  equ dword[ebp-48]
35
.c1r   equ dword[ebp-52]
34
.dc23r equ dword[ebp-52]
36
.c1g   equ dword[ebp-56]
35
.dc23g equ [ebp-56]
-
 
36
.dc23b equ dword[ebp-60]
37
.c1b   equ dword[ebp-60]
37
 
38
.c2r   equ dword[ebp-64]
38
.c1r   equ dword[ebp-64]
39
.c2g   equ dword[ebp-68]
39
.c1g   equ [ebp-68]
40
.c2b   equ dword[ebp-72]
-
 
41
 
40
.c1b   equ dword[ebp-72]
42
.dx12  equ dword[ebp-76]
41
.c2r   equ dword[ebp-76]
43
.dx13  equ dword[ebp-80]
42
.c2g   equ [ebp-80]
44
.dx23  equ dword[ebp-84]
-
 
Line 45... Line 43...
45
 
43
.c2b   equ dword[ebp-84]
46
 
44
 
Line 71... Line 69...
71
       jmp .sort3
69
       jmp .sort3
72
 .sort2:
70
 .sort2:
73
       push eax   ;store triangle coordinates in user friendly variables
71
       push eax   ;store triangle coordinates in user friendly variables
74
       push ebx
72
       push ebx
75
       push ecx
73
       push ecx
76
       sub esp,72 ; set correctly value of esp
74
    ;   sub esp,72 ; set correctly value of esp
Line 77... Line 75...
77
 
75
 
78
       mov edx,eax    ; check only X triangle coordinate
76
       mov edx,eax    ; check only X triangle coordinate
79
       or edx,ebx
77
       or edx,ebx
80
       or edx,ecx
78
       or edx,ecx
Line 92... Line 90...
92
 
90
 
93
 
91
 
94
       mov bx,.y2	; calc deltas
92
       mov bx,.y2	; calc deltas
-
 
93
       sub bx,.y1
-
 
94
       jnz .gt_dx12_make
-
 
95
       xor edx,edx
-
 
96
       mov ecx,4
-
 
97
     @@:
95
       sub bx,.y1
98
       push edx
96
       jnz .gt_dx12_make
99
       loop @b
97
       mov .dx12,0
100
     ;  mov .dx12,0
98
       mov .dc12r,0
101
     ;  mov .dc12r,0
99
       mov .dc12g,0
102
     ;  mov .dc12g,0
100
       mov .dc12b,0
103
     ;  mov .dc12b,0
Line 101... Line 104...
101
       jmp .gt_dx12_done
104
       jmp .gt_dx12_done
102
  .gt_dx12_make:
105
  .gt_dx12_make:
103
 
106
 
104
       mov ax,.x2
107
       mov ax,.x2
105
       sub ax,.x1
108
       sub ax,.x1
106
       cwde
109
       cwde
107
       movsx ebx,bx
110
       movsx ebx,bx
108
       shl eax,ROUND
111
       shl eax,ROUND
-
 
112
       cdq
Line 109... Line 113...
109
       cdq
113
       idiv ebx
110
       idiv ebx
114
     ;  mov .dx12,eax
111
       mov .dx12,eax
115
       push eax
112
 
116
 
113
       mov ax,word[.col2r]
117
       mov ax,word[.col2r]
114
       sub ax,word[.col1r]
118
       sub ax,word[.col1r]
115
       cwde
119
       cwde
-
 
120
       shl eax,ROUND
-
 
121
       cdq
116
       shl eax,ROUND
122
       idiv ebx
117
       cdq
123
      ; mov .dc12r,eax
118
       idiv ebx
124
       push eax
119
       mov .dc12r,eax
125
 
120
       mov ax,word[.col2g]
126
       mov ax,word[.col2g]
121
       sub ax,word[.col1g]
127
       sub ax,word[.col1g]
122
       cwde
128
       cwde
-
 
129
       shl eax,ROUND
-
 
130
       cdq
123
       shl eax,ROUND
131
       idiv ebx
124
       cdq
132
     ;  mov .dc12g,eax
125
       idiv ebx
133
       push eax
126
       mov .dc12g,eax
134
 
127
       mov ax,word[.col2b]
135
       mov ax,word[.col2b]
128
       sub ax,word[.col1b]
136
       sub ax,word[.col1b]
129
       cwde
137
       cwde
-
 
138
       shl eax,ROUND
130
       shl eax,ROUND
139
       cdq
131
       cdq
-
 
132
       idiv ebx
140
       idiv ebx
133
       mov .dc12b,eax
141
     ;  mov .dc12b,eax
134
.gt_dx12_done:
142
       push eax
-
 
143
.gt_dx12_done:
-
 
144
       mov bx,.y3
-
 
145
       sub bx,.y1
-
 
146
       jnz .gt_dx13_make
-
 
147
       xor edx,edx
135
 
148
       mov ecx,4
136
       mov bx,.y3
149
     @@:
137
       sub bx,.y1
150
       push edx
138
       jnz .gt_dx13_make
151
       loop @b
139
       mov .dx13,0
152
   ;    mov .dx13,0
140
       mov .dc13r,0
153
   ;    mov .dc13r,0
141
       mov .dc13g,0
154
   ;    mov .dc13g,0
142
       mov .dc13b,0
155
   ;    mov .dc13b,0
143
       jmp .gt_dx13_done
156
       jmp .gt_dx13_done
144
.gt_dx13_make:
157
.gt_dx13_make:
145
       mov ax,.x3
158
       mov ax,.x3
146
       sub ax,.x1
159
       sub ax,.x1
147
       cwde
160
       cwde
148
       movsx ebx,bx
161
       movsx ebx,bx
-
 
162
       shl eax,ROUND
Line 149... Line 163...
149
       shl eax,ROUND
163
       cdq
150
       cdq
164
       idiv ebx
151
       idiv ebx
165
   ;    mov .dx13,eax
152
       mov .dx13,eax
166
       push eax
153
 
167
 
154
       mov ax,word[.col3r]
168
       mov ax,word[.col3r]
155
       sub ax,word[.col1r]
169
       sub ax,word[.col1r]
-
 
170
       cwde
-
 
171
       shl eax,ROUND
156
       cwde
172
       cdq
157
       shl eax,ROUND
173
       idiv ebx
158
       cdq
174
    ;   mov .dc13r,eax
159
       idiv ebx
175
       push eax
160
       mov .dc13r,eax
176
 
161
       mov ax,word[.col3g]
177
       mov ax,word[.col3g]
162
       sub ax,word[.col1g]
178
       sub ax,word[.col1g]
-
 
179
       cwde
163
       cwde
180
       shl eax,ROUND
164
       shl eax,ROUND
181
       cdq
165
       cdq
182
       idiv ebx
166
       idiv ebx
183
     ;  mov .dc13g,eax
167
       mov .dc13g,eax
184
       push eax
168
       mov ax,word[.col3b]
185
       mov ax,word[.col3b]
169
       sub ax,word[.col1b]
186
       sub ax,word[.col1b]
-
 
187
       cwde
170
       cwde
188
       shl eax,ROUND
171
       shl eax,ROUND
-
 
172
       cdq
189
       cdq
173
       idiv ebx
190
       idiv ebx
174
       mov .dc13b,eax
191
    ;   mov .dc13b,eax
-
 
192
       push eax
-
 
193
.gt_dx13_done:
-
 
194
       mov bx,.y3
-
 
195
       sub bx,.y2
-
 
196
       jnz .gt_dx23_make
175
.gt_dx13_done:
197
       xor edx,edx
176
 
198
       mov ecx,4
177
       mov bx,.y3
199
     @@:
178
       sub bx,.y2
200
       push edx
179
       jnz .gt_dx23_make
201
       loop @b
180
       mov .dx23,0
202
   ;    mov .dx23,0
181
       mov .dc23r,0
203
   ;    mov .dc23r,0
182
       mov .dc23g,0
204
   ;    mov .dc23g,0
183
       mov .dc23b,0
205
   ;    mov .dc23b,0
184
       jmp .gt_dx23_done
206
       jmp .gt_dx23_done
185
.gt_dx23_make:
207
.gt_dx23_make:
186
       mov ax,.x3
208
       mov ax,.x3
187
       sub ax,.x2
209
       sub ax,.x2
188
       cwde
210
       cwde
-
 
211
       movsx ebx,bx
Line 189... Line 212...
189
       movsx ebx,bx
212
       shl eax,ROUND
190
       shl eax,ROUND
213
       cdq
191
       cdq
214
       idiv ebx
192
       idiv ebx
215
     ; mov .dx23,eax
193
       mov .dx23,eax
216
       push eax
194
 
217
 
195
       mov ax,word[.col3r]
218
       mov ax,word[.col3r]
-
 
219
       sub ax,word[.col2r]
-
 
220
       cwde
-
 
221
       shl eax,ROUND
196
       sub ax,word[.col2r]
222
       cdq
197
       cwde
223
       idiv ebx
198
       shl eax,ROUND
224
      ; mov .dc23r,eax
199
       cdq
225
       push eax
200
       idiv ebx
226
 
201
       mov .dc23r,eax
227
 
202
       mov ax,word[.col3g]
228
       mov ax,word[.col3g]
-
 
229
       sub ax,word[.col2g]
-
 
230
       cwde
203
       sub ax,word[.col2g]
231
       shl eax,ROUND
204
       cwde
232
       cdq
205
       shl eax,ROUND
233
       idiv ebx
206
       cdq
234
     ;  mov .dc23g,eax
207
       idiv ebx
235
       push eax
208
       mov .dc23g,eax
236
 
209
       mov ax,word[.col3b]
237
       mov ax,word[.col3b]
210
       sub ax,word[.col2b]
238
       sub ax,word[.col2b]
Line -... Line 239...
-
 
239
       cwde
-
 
240
       shl eax,ROUND
211
       cwde
241
       cdq
212
       shl eax,ROUND
242
       idiv ebx
213
       cdq
243
    ;   mov .dc23b,eax
214
       idiv ebx
244
       push eax
215
       mov .dc23b,eax
245
 
Line 238... Line 268...
238
       push ebx 		      ; ebx - cur x2
268
       push ebx 		      ; ebx - cur x2
239
       push cx			      ; cx  - cur y
269
       push cx			      ; cx  - cur y
240
       push edi
270
       push edi
241
       push ebp
271
       push ebp
Line -... Line 272...
-
 
272
 
-
 
273
       sar ebx,ROUND
242
 
274
       push bx
243
       mov edx,.c2r		 ; c2r,c2g,c2b,c1r,c1g,c1b - current colors
275
       mov edx,.c2r		 ; c2r,c2g,c2b,c1r,c1g,c1b - current colors
244
       sar edx,ROUND
276
       sar edx,ROUND
245
       push dx
277
       push dx
246
       mov edx,.c2g
278
       mov edx,.c2g
247
       sar edx,ROUND
279
       sar edx,ROUND
248
       push dx
280
       push dx
249
       mov edx,.c2b
281
       mov edx,.c2b
250
       sar edx,ROUND
282
       sar edx,ROUND
-
 
283
       push dx
-
 
284
 
-
 
285
       sar eax,ROUND
251
       push dx
286
       push ax
252
       mov edx,.c1r
287
       mov edx,.c1r
253
       sar edx,ROUND
288
       sar edx,ROUND
254
       push dx
289
       push dx
255
       mov edx,.c1g
290
       mov edx,.c1g
256
       sar edx,ROUND
291
       sar edx,ROUND
257
       push dx
292
       push dx
258
       mov edx,.c1b
293
       mov edx,.c1b
259
       sar edx,ROUND
294
       sar edx,ROUND
260
       push dx
295
       push dx
261
       push cx
-
 
262
       sar ebx,ROUND
-
 
263
       push bx
-
 
264
       sar eax,ROUND
-
 
265
       push ax
296
       push cx
Line 266... Line 297...
266
       call gouraud_line
297
       call gouraud_line
267
 
298
 
268
       pop ebp
299
       pop ebp
269
       pop edi
300
       pop edi
270
       pop cx
301
       pop cx
Line -... Line 302...
-
 
302
       pop ebx
-
 
303
       pop eax
-
 
304
 
-
 
305
if Ext >= MMX
-
 
306
       movq mm0,.c1g
271
       pop ebx
307
       paddd mm0,.dc13g
272
       pop eax
308
       movq .c1g,mm0
273
 
309
else
274
       mov edx,.dc13r
310
       mov edx,.dc13r
-
 
311
       add .c1r,edx
275
       add .c1r,edx
312
       mov edx,.dc13g
276
       mov edx,.dc13g
313
       add .c1g,edx
-
 
314
end if
-
 
315
       mov edx,.dc13b
-
 
316
       add .c1b,edx
-
 
317
if Ext >= MMX
-
 
318
       movq mm0,.c2g
277
       add .c1g,edx
319
       paddd mm0,.dc12g
278
       mov edx,.dc13b
320
       movq .c2g,mm0
279
       add .c1b,edx
321
else
280
       mov edx,.dc12r
322
       mov edx,.dc12r
-
 
323
       add .c2r,edx
281
       add .c2r,edx
324
       mov edx,.dc12g
282
       mov edx,.dc12g
325
       add .c2g,edx
Line 283... Line 326...
283
       add .c2g,edx
326
end if
284
       mov edx,.dc12b
327
       mov edx,.dc12b
Line 311... Line 354...
311
       push ebx 		      ; ebx - cur x2
354
       push ebx 		      ; ebx - cur x2
312
       push cx
355
       push cx
313
       push edi
356
       push edi
314
       push ebp
357
       push ebp
Line -... Line 358...
-
 
358
 
-
 
359
       sar ebx,ROUND
315
 
360
       push bx
316
       mov edx,.c2r
361
       mov edx,.c2r
317
       sar edx,ROUND
362
       sar edx,ROUND
318
       push dx
363
       push dx
319
       mov edx,.c2g
364
       mov edx,.c2g
320
       sar edx,ROUND
365
       sar edx,ROUND
321
       push dx
366
       push dx
322
       mov edx,.c2b
367
       mov edx,.c2b
323
       sar edx,ROUND
368
       sar edx,ROUND
-
 
369
       push dx
-
 
370
 
-
 
371
       sar eax,ROUND
324
       push dx
372
       push ax
325
       mov edx,.c1r
373
       mov edx,.c1r
326
       sar edx,ROUND
374
       sar edx,ROUND
327
       push dx
375
       push dx
328
       mov edx,.c1g
376
       mov edx,.c1g
329
       sar edx,ROUND
377
       sar edx,ROUND
330
       push dx
378
       push dx
331
       mov edx,.c1b
379
       mov edx,.c1b
332
       sar edx,ROUND
380
       sar edx,ROUND
333
       push dx
381
       push dx
334
       push cx
-
 
335
       sar ebx,ROUND
-
 
336
       push bx
-
 
337
       sar eax,ROUND
-
 
338
       push ax
382
       push cx
Line 339... Line 383...
339
       call gouraud_line
383
       call gouraud_line
340
 
384
 
341
       pop ebp
385
       pop ebp
342
       pop edi
386
       pop edi
343
       pop cx
387
       pop cx
Line -... Line 388...
-
 
388
       pop ebx
-
 
389
       pop eax
-
 
390
 
-
 
391
if Ext >= MMX
-
 
392
       movq mm0,.c1g
344
       pop ebx
393
       paddd mm0,.dc13g
345
       pop eax
394
       movq .c1g,mm0
346
 
395
else
347
       mov edx,.dc13r
396
       mov edx,.dc13r
-
 
397
       add .c1r,edx
348
       add .c1r,edx
398
       mov edx,.dc13g
349
       mov edx,.dc13g
399
       add .c1g,edx
-
 
400
end if
-
 
401
       mov edx,.dc13b
-
 
402
       add .c1b,edx
-
 
403
if Ext >= MMX
-
 
404
       movq mm0,.c2g
350
       add .c1g,edx
405
       paddd mm0,.dc23g
351
       mov edx,.dc13b
406
       movq .c2g,mm0
352
       add .c1b,edx
407
else
353
       mov edx,.dc23r
408
       mov edx,.dc23r
-
 
409
       add .c2r,edx
354
       add .c2r,edx
410
       mov edx,.dc23g
355
       mov edx,.dc23g
411
       add .c2g,edx
Line 356... Line 412...
356
       add .c2g,edx
412
end if
357
       mov edx,.dc23b
413
       mov edx,.dc23b
Line 368... Line 424...
368
      mov esp,ebp
424
      mov esp,ebp
369
ret 18
425
ret 18
370
gouraud_line:
426
gouraud_line:
371
;-------------in - edi - pointer to screen buffer
427
;-------------in - edi - pointer to screen buffer
372
;----------------- stack - another parameters
428
;----------------- stack - another parameters
373
.x1 equ word [ebp+4]
429
.y equ word [ebp+4]
-
 
430
.col1b equ ebp+6
-
 
431
.col1g equ ebp+8
-
 
432
.col1r equ ebp+10
-
 
433
.x1    equ [ebp+12]
-
 
434
.col2b equ ebp+14
-
 
435
.col2g equ ebp+16
-
 
436
.col2r equ ebp+18
-
 
437
.x2    equ [ebp+20]
-
 
438
.dc_r equ dword[ebp-4]
374
.x2 equ word [ebp+6]
439
.dc_g equ dword[ebp-8]
-
 
440
.dc_b equ dword[ebp-12]
-
 
441
       mov ebp,esp
-
 
442
 
-
 
443
       mov ax,.y
-
 
444
       or ax,ax
-
 
445
       jl .gl_quit
-
 
446
       cmp ax,SIZE_Y-1
-
 
447
       jg .gl_quit
-
 
448
 
-
 
449
       mov ax,.x1
-
 
450
       cmp ax,.x2
-
 
451
       je .gl_quit
-
 
452
       jl .gl_ok
-
 
453
 
-
 
454
if Ext >= MMX
-
 
455
       movq mm0,[.col1b]
-
 
456
       movq mm1,[.col2b]
-
 
457
       movq [.col1b],mm1
-
 
458
       movq [.col2b],mm0
-
 
459
else
-
 
460
       mov eax,[.col1b]
-
 
461
       xchg eax,[.col2b]
-
 
462
       mov  [.col1b],eax
-
 
463
       mov eax,[.col1r]
-
 
464
       xchg eax,[.col2r]
-
 
465
       mov [.col1r],eax
-
 
466
end if
-
 
467
.gl_ok:
-
 
468
  ;     cmp .x1,SIZE_X-1  ;check
-
 
469
  ;     jg .gl_quit
-
 
470
  ;     cmp .x2,SIZE_X-1
-
 
471
  ;     jl @f
-
 
472
  ;     mov .x2,SIZE_X-1
-
 
473
  ;  @@:
-
 
474
  ;     cmp .x1,0
-
 
475
  ;     jg @f
-
 
476
  ;     mov .x1,0
-
 
477
  ;  @@:
-
 
478
  ;     cmp .x2,0
-
 
479
  ;     jl .gl_quit
-
 
480
 
-
 
481
       movsx ecx,.y
-
 
482
       mov eax,SIZE_X*3
-
 
483
       mul ecx
-
 
484
       movsx ebx,word .x1
-
 
485
       lea ecx,[ebx*2+eax]
-
 
486
       add edi,ecx
-
 
487
       add edi,ebx
-
 
488
 
-
 
489
       mov ax,word[.col2r]
-
 
490
       sub ax,word[.col1r]
-
 
491
       cwde
-
 
492
       shl eax,ROUND
-
 
493
       cdq
-
 
494
       mov cx,.x2
-
 
495
       sub cx,.x1
-
 
496
       movsx ecx,cx
-
 
497
       idiv ecx
-
 
498
       ;mov .dc_r,eax           ;first delta
-
 
499
       push eax
-
 
500
 
-
 
501
       mov ax,word[.col2g]
-
 
502
       sub ax,word[.col1g]
-
 
503
       cwde
-
 
504
       shl eax,ROUND
-
 
505
       cdq
-
 
506
       idiv ecx
-
 
507
       ;mov .dc_g,eax
-
 
508
       push eax
-
 
509
 
-
 
510
       mov ax,word[.col2b]
-
 
511
       sub ax,word[.col1b]
-
 
512
       cwde
-
 
513
       shl eax,ROUND
-
 
514
       cdq
-
 
515
       idiv ecx
-
 
516
      ; mov .dc_b,eax
-
 
517
       push eax
-
 
518
 
-
 
519
       movsx ebx,word[.col1r]
-
 
520
       shl ebx,ROUND
-
 
521
       movsx edx,word[.col1g]
-
 
522
       shl edx,ROUND
-
 
523
       movsx esi,word[.col1b]
-
 
524
       shl esi,ROUND
-
 
525
.gl_draw:
-
 
526
       mov eax,ebx
-
 
527
       sar eax,ROUND
-
 
528
       stosb
-
 
529
       mov eax,edx
-
 
530
       sar eax,ROUND
-
 
531
       stosb
-
 
532
       mov eax,esi
-
 
533
       sar eax,ROUND
-
 
534
       stosb
-
 
535
       add ebx,.dc_r
-
 
536
       add edx,.dc_g
-
 
537
       add esi,.dc_b
-
 
538
       loop .gl_draw
-
 
539
.gl_quit:
-
 
540
      ; add esp,12
-
 
541
       mov esp,ebp
-
 
542
ret 18
-
 
543
if 0
-
 
544
gouraud_line_SSE:	 ; new
-
 
545
;-------------in - edi - pointer to screen buffer
-
 
546
;----------------- stack - another parameters
375
.y equ word [ebp+8]
547
.y equ word [ebp+4]
376
.col1b equ ebp+10
548
.col1b equ ebp+6
377
.col1g equ ebp+12
549
.col1g equ ebp+8
378
.col1r equ ebp+14
550
.col1r equ ebp+10
-
 
551
.x1    equ [ebp+12]
379
.col2b equ ebp+16
552
.col2b equ ebp+14
380
.col2g equ ebp+18
553
.col2g equ ebp+16
381
.col2r equ ebp+20
554
.col2r equ ebp+18
-
 
555
.x2    equ [ebp+20]
382
.dc_r equ dword[ebp-4]
556
.dc_r equ dword[ebp-4]
383
.dc_g equ dword[ebp-8]
557
.dc_g equ dword[ebp-8]
384
.dc_b equ dword[ebp-12]
558
.dc_b equ dword[ebp-12]
-
 
559
.lenght equ [ebp-16]
-
 
560
.factor equ [ebp-24]   ;new
385
       mov ebp,esp
561
       mov ebp,esp
Line 386... Line 562...
386
 
562
 
387
       mov ax,.y
563
       mov ax,.y
388
       or ax,ax
564
       or ax,ax
Line 393... Line 569...
393
       mov ax,.x1
569
       mov ax,.x1
394
       cmp ax,.x2
570
       cmp ax,.x2
395
       je .gl_quit
571
       je .gl_quit
396
       jl .gl_ok
572
       jl .gl_ok
Line -... Line 573...
-
 
573
 
-
 
574
if Ext >= MMX
397
 
575
       movq mm0,[.col1b]
398
       xchg ax,.x2
576
       movq mm1,[.col2b]
-
 
577
       movq [.col1b],mm1
-
 
578
       movq [.col2b],mm0
399
       mov .x1,ax
579
else
400
       mov eax,dword[.col1b]
580
       mov eax,[.col1b]
401
       xchg eax,dword[.col2b]
581
       xchg eax,[.col2b]
402
       mov  dword[.col1b],eax
582
       mov  [.col1b],eax
403
       mov ax,word[.col1r]
583
       mov eax,[.col1r]
404
       xchg ax,word[.col2r]
584
       xchg eax,[.col2r]
-
 
585
       mov [.col1r],eax
405
       mov word[.col1r],ax
586
end if
406
.gl_ok:
587
.gl_ok:
407
  ;     cmp .x1,SIZE_X-1  ;check
588
  ;     cmp .x1,SIZE_X-1  ;check
408
  ;     jg .gl_quit
589
  ;     jg .gl_quit
409
  ;     cmp .x2,SIZE_X-1
590
  ;     cmp .x2,SIZE_X-1
Line 418... Line 599...
418
  ;     jl .gl_quit
599
  ;     jl .gl_quit
Line 419... Line 600...
419
 
600
 
420
       movsx ecx,.y
601
       movsx ecx,.y
421
       mov eax,SIZE_X*3
602
       mov eax,SIZE_X*3
422
       mul ecx
603
       mul ecx
423
       movsx ebx,.x1
604
       movsx ebx,word .x1
424
       lea ecx,[ebx*2+eax]
605
       lea ecx,[ebx*2+eax]
425
       add edi,ecx
606
       add edi,ecx
Line 426... Line 607...
426
       add edi,ebx
607
       add edi,ebx
Line 459... Line 640...
459
       shl ebx,ROUND
640
       shl ebx,ROUND
460
       movsx edx,word[.col1g]
641
       movsx edx,word[.col1g]
461
       shl edx,ROUND
642
       shl edx,ROUND
462
       movsx esi,word[.col1b]
643
       movsx esi,word[.col1b]
463
       shl esi,ROUND
644
       shl esi,ROUND
-
 
645
 
-
 
646
       push	 ecx	     ; store line lenght
-
 
647
       movd	 mm3,.dc_r
-
 
648
       psrlq	 mm3,16      ; load dr to lowest word of mm3
-
 
649
       pxor	 mm2,mm2     ; clear mm2
-
 
650
       movd	 mm4,.dc_g
-
 
651
       punpcklwd mm3,mm3     ; unpack dr to lower 2 words in in mm3
-
 
652
       psrlq	 mm4,16      ; load dg to lowest word of mm4
-
 
653
       movd	 mm5,.dc_b
-
 
654
       psrlq	 mm5,16      ; load db to lowest word of mm5
-
 
655
       punpcklwd mm4,mm4     ; unpack dg to lower 2 words in in mm3
-
 
656
       lea	 ecx,[factor]
-
 
657
       punpckldq mm3,mm3
-
 
658
       punpcklwd mm5,mm5     ; unpack db to lower 2 words in in mm5
-
 
659
       movq	 mm6,[.col1b]
-
 
660
       xor	 eax,eax
-
 
661
       pinsrw	 mm6,eax,3     ; clear the highest word in mm6
-
 
662
       mov	 eax,010000h
-
 
663
       punpckldq mm4,mm4     ; unpack dg to 4 words in mm4
-
 
664
       mov	 [ecx],eax
-
 
665
       mov	 eax,030002h
-
 
666
       punpckldq mm5,mm5    ; unpack db to 4 words in mm5
-
 
667
       movq	 mm7,mm6    ; load r1r1,g1g1,b1b1 to the first three
-
 
668
			    ; words of mm7
-
 
669
       pxor	 mm1,mm1    ; clear mm1
-
 
670
 
-
 
671
 
464
.gl_draw:
672
.gl_draw:
465
       mov eax,ebx
673
       mov eax,ebx
466
       sar eax,ROUND
674
       sar eax,ROUND
467
       stosb
675
       stosb
468
       mov eax,edx
676
       mov eax,edx
Line 476... Line 684...
476
       add esi,.dc_b
684
       add esi,.dc_b
477
       loop .gl_draw
685
       loop .gl_draw
478
.gl_quit:
686
.gl_quit:
479
      ; add esp,12
687
      ; add esp,12
480
       mov esp,ebp
688
       mov esp,ebp
481
ret 18
-
 
482
689
ret 18
-
 
690
end if
-
 
691