Subversion Repositories Kolibri OS

Rev

Rev 2382 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2382 Rev 2540
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;  VESA20.INC                                                  ;;
6
;;  VESA20.INC                                                  ;;
7
;;                                                              ;;
7
;;                                                              ;;
8
;;  Vesa 2.0 functions for MenuetOS                             ;;
8
;;  Vesa 2.0 functions for MenuetOS                             ;;
Line 15... Line 15...
15
;;                                                              ;;
15
;;                                                              ;;
16
;;  See file COPYING for details                                ;;
16
;;  See file COPYING for details                                ;;
17
;;                                                              ;;
17
;;                                                              ;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 19... Line 19...
19
 
19
 
Line 20... Line 20...
20
$Revision: 2382 $
20
$Revision $
21
 
21
 
Line 29... Line 29...
29
;LFBAddress              equ     0xfe80
29
;LFBAddress              equ     0xfe80
30
;ScreenBPP               equ     0xfbf1
30
;ScreenBPP               equ     0xfbf1
Line 31... Line 31...
31
 
31
 
32
 
32
 
33
 
33
 
34
;*************************************************
34
;-----------------------------------------------------------------------------
35
; getpixel
35
; getpixel
36
;
36
;
37
; in:
37
; in:
38
; eax = x coordinate
38
; eax = x coordinate
39
; ebx = y coordinate
39
; ebx = y coordinate
-
 
40
;
40
;
41
; ret:
41
; ret:
42
; ecx = 00 RR GG BB
42
; ecx = 00 RR GG BB
43
;-----------------------------------------------------------------------------
43
 
44
align 4
44
getpixel:
45
getpixel:
45
        push    eax ebx edx edi
46
        push    eax ebx edx edi
-
 
47
        call    dword [GETPIXEL]
46
        call    dword [GETPIXEL]
48
        pop     edi edx ebx eax
47
        pop     edi edx ebx eax
49
        ret
48
        ret
50
;-----------------------------------------------------------------------------
49
 
51
align 4
-
 
52
Vesa20_getpixel24:
-
 
53
; eax = x
-
 
54
; ebx = y
-
 
55
;--------------------------------------
-
 
56
; check for hardware cursor
-
 
57
        cmp     [_display.select_cursor], select_cursor
-
 
58
        je      @f
-
 
59
        cmp     [_display.select_cursor], 0
-
 
60
        jne     .no_mouseunder
-
 
61
;--------------------------------------
-
 
62
align 4
-
 
63
@@:
-
 
64
; check mouse area for putpixel
-
 
65
        test    ecx, 0x04000000  ; don't load to mouseunder area
-
 
66
        jnz     .no_mouseunder
-
 
67
        call    [_display.check_m_pixel]
-
 
68
        test    ecx, ecx        ;0xff000000
-
 
69
        jnz     @f
-
 
70
;--------------------------------------
50
Vesa20_getpixel24:
71
align 4
-
 
72
.no_mouseunder:
51
; eax = x
73
;--------------------------------------
52
; ebx = y
74
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
53
        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
75
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
76
        lea     edi, [eax+eax*2]; edi = x*3
-
 
77
        add     edi, ebx      ; edi = x*3+(y*y multiplier)
-
 
78
        mov     ecx, [LFB_BASE+edi]
54
        lea     edi, [eax+eax*2]; edi = x*3
79
;--------------------------------------
55
        add     edi, ebx      ; edi = x*3+(y*y multiplier)
80
align 4
-
 
81
@@:
56
        mov     ecx, [LFB_BASE+edi]
82
        and     ecx, 0xffffff
57
        and     ecx, 0xffffff
83
        ret
-
 
84
;-----------------------------------------------------------------------------
-
 
85
align 4
-
 
86
Vesa20_getpixel32:
-
 
87
;--------------------------------------
-
 
88
; check for hardware cursor
-
 
89
        cmp     [_display.select_cursor], select_cursor
-
 
90
        je      @f
-
 
91
        cmp     [_display.select_cursor], 0
-
 
92
        jne     .no_mouseunder
-
 
93
;--------------------------------------
-
 
94
align 4
-
 
95
@@:
-
 
96
; check mouse area for putpixel
-
 
97
        test    ecx, 0x04000000  ; don't load to mouseunder area
-
 
98
        jnz     .no_mouseunder
-
 
99
        call    [_display.check_m_pixel]
-
 
100
        test    ecx, ecx        ;0xff000000
-
 
101
        jnz     @f
-
 
102
;--------------------------------------
58
        ret
103
align 4
-
 
104
.no_mouseunder:
59
 
105
;--------------------------------------
60
Vesa20_getpixel32:
106
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
-
 
107
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
108
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
-
 
109
        mov     ecx, [LFB_BASE+edi]
61
        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
110
;--------------------------------------
62
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
111
align 4
63
        mov     ecx, [LFB_BASE+edi]
-
 
64
        and     ecx, 0xffffff
112
@@:
65
        ret
-
 
66
 
113
        and     ecx, 0xffffff
67
;*************************************************
114
        ret
68
 
115
;-----------------------------------------------------------------------------
69
virtual at esp
116
virtual at esp
70
 putimg:
117
 putimg:
Line 78... Line 125...
78
   .abs_cx         dd ?
125
   .abs_cx         dd ?
79
   .abs_cy         dd ?
126
   .abs_cy         dd ?
80
   .line_increment dd ?
127
   .line_increment dd ?
81
   .winmap_newline dd ?
128
   .winmap_newline dd ?
82
   .screen_newline dd ?
129
   .screen_newline dd ?
-
 
130
   .real_sx_and_abs_cx dd ?
-
 
131
   .real_sy_and_abs_cy dd ?
83
   .stack_data = 4*12
132
   .stack_data = 4*14
84
   .edi         dd      ?
133
   .edi         dd      ?
85
   .esi         dd      ?
134
   .esi         dd      ?
86
   .ebp         dd      ?
135
   .ebp         dd      ?
87
   .esp         dd      ?
136
   .esp         dd      ?
88
   .ebx         dd      ?
137
   .ebx         dd      ?
Line 90... Line 139...
90
   .ecx         dd      ?
139
   .ecx         dd      ?
91
   .eax         dd      ?
140
   .eax         dd      ?
92
   .ret_addr    dd      ?
141
   .ret_addr    dd      ?
93
   .arg_0       dd      ?
142
   .arg_0       dd      ?
94
end virtual
143
end virtual
95
 
-
 
-
 
144
;-----------------------------------------------------------------------------
96
align 16
145
align 16
97
; ebx = pointer
146
; ebx = pointer
98
; ecx = size [x|y]
147
; ecx = size [x|y]
99
; edx = coordinates [x|y]
148
; edx = coordinates [x|y]
100
; ebp = pointer to 'get' function
149
; ebp = pointer to 'get' function
101
; esi = pointer to 'init' function
150
; esi = pointer to 'init' function
102
; edi = parameter for 'get' function
151
; edi = parameter for 'get' function
103
 
-
 
104
vesa20_putimage:
152
vesa20_putimage:
105
        pushad
153
        pushad
106
        call    [_display.disable_mouse]
-
 
107
        sub     esp, putimg.stack_data
154
        sub     esp, putimg.stack_data
108
; save pointer to image
155
; save pointer to image
109
        mov     [putimg.pti], ebx
156
        mov     [putimg.pti], ebx
110
; unpack the size
157
; unpack the size
111
        mov     eax, ecx
158
        mov     eax, ecx
Line 136... Line 183...
136
        sub     ebx, [putimg.image_cx]
183
        sub     ebx, [putimg.image_cx]
137
        ja      @f
184
        ja      @f
138
        add     esp, putimg.stack_data
185
        add     esp, putimg.stack_data
139
        popad
186
        popad
140
        ret
187
        ret
-
 
188
;--------------------------------------
-
 
189
align 4
141
@@:
190
@@:
142
        cmp     ebx, [putimg.image_sx]
191
        cmp     ebx, [putimg.image_sx]
143
        jbe     .end_x
192
        jbe     .end_x
144
        mov     ebx, [putimg.image_sx]
193
        mov     ebx, [putimg.image_sx]
-
 
194
;--------------------------------------
-
 
195
align 4
145
.end_x:
196
.end_x:
146
        mov     [putimg.real_sx], ebx
197
        mov     [putimg.real_sx], ebx
147
; init real_sy
198
; init real_sy
148
        mov     ebx, [eax-twdw + WDATA.box.height]; ebx = wnd_sy
199
        mov     ebx, [eax-twdw + WDATA.box.height]; ebx = wnd_sy
149
; \begin{diamond}[20.08.2006]
200
; \begin{diamond}[20.08.2006]
Line 152... Line 203...
152
        sub     ebx, [putimg.image_cy]
203
        sub     ebx, [putimg.image_cy]
153
        ja      @f
204
        ja      @f
154
        add     esp, putimg.stack_data
205
        add     esp, putimg.stack_data
155
        popad
206
        popad
156
        ret
207
        ret
-
 
208
;--------------------------------------
-
 
209
align 4
157
@@:
210
@@:
158
        cmp     ebx, [putimg.image_sy]
211
        cmp     ebx, [putimg.image_sy]
159
        jbe     .end_y
212
        jbe     .end_y
160
        mov     ebx, [putimg.image_sy]
213
        mov     ebx, [putimg.image_sy]
-
 
214
;--------------------------------------
-
 
215
align 4
161
.end_y:
216
.end_y:
162
        mov     [putimg.real_sy], ebx
217
        mov     [putimg.real_sy], ebx
163
; line increment
218
; line increment
164
        mov     eax, [putimg.image_sx]
219
        mov     eax, [putimg.image_sx]
165
        mov     ecx, [putimg.real_sx]
220
        mov     ecx, [putimg.real_sx]
Line 183... Line 238...
183
        mov     [putimg.screen_newline], eax
238
        mov     [putimg.screen_newline], eax
184
; pointer to image
239
; pointer to image
185
        mov     esi, [putimg.pti]
240
        mov     esi, [putimg.pti]
186
; pointer to screen
241
; pointer to screen
187
        mov     edx, [putimg.abs_cy]
242
        mov     edx, [putimg.abs_cy]
188
        imul    edx, [BytesPerScanLine]
243
;        imul    edx, [BytesPerScanLine]
-
 
244
        mov     edx, [BPSLine_calc_area+edx*4]
189
        mov     eax, [putimg.abs_cx]
245
        mov     eax, [putimg.abs_cx]
190
        movzx   ebx, byte [ScreenBPP]
246
;        movzx   ebx, byte [ScreenBPP]
191
        shr     ebx, 3
247
;        shr     ebx, 3
192
        imul    eax, ebx
248
        imul    eax, ebx
193
        add     edx, eax
249
        add     edx, eax
194
; pointer to pixel map
250
; pointer to pixel map
195
        mov     eax, [putimg.abs_cy]
251
        mov     eax, [putimg.abs_cy]
196
        imul    eax, [Screen_Max_X]
252
;        imul    eax, [Screen_Max_X]
197
        add     eax, [putimg.abs_cy]
253
;        add     eax, [putimg.abs_cy]
-
 
254
        mov     eax, [d_width_calc_area + eax*4]
-
 
255
 
198
        add     eax, [putimg.abs_cx]
256
        add     eax, [putimg.abs_cx]
199
        add     eax, [_WinMapAddress]
257
        add     eax, [_WinMapAddress]
200
        xchg    eax, ebp
258
        xchg    eax, ebp
-
 
259
;--------------------------------------
-
 
260
        mov     ecx, [putimg.real_sx]
-
 
261
        add     ecx, [putimg.abs_cx]
-
 
262
        mov     [putimg.real_sx_and_abs_cx], ecx
-
 
263
        mov     ecx, [putimg.real_sy]
-
 
264
        add     ecx, [putimg.abs_cy]
-
 
265
        mov     [putimg.real_sy_and_abs_cy], ecx
-
 
266
;--------------------------------------
201
; get process number
267
; get process number
202
        mov     ebx, [CURRENT_TASK]
268
        mov     ebx, [CURRENT_TASK]
203
        cmp     byte [ScreenBPP], 32
269
        cmp     byte [ScreenBPP], 32
204
        je      put_image_end_32
270
        je      put_image_end_32
-
 
271
;--------------------------------------
205
;put_image_end_24:
272
put_image_end_24:
206
        mov     edi, [putimg.real_sy]
273
        mov     edi, [putimg.real_sy]
-
 
274
;--------------------------------------
-
 
275
; check for hardware cursor
-
 
276
        mov     ecx, [_display.select_cursor]
-
 
277
        cmp     ecx, select_cursor
-
 
278
        je      put_image_end_24_new
-
 
279
        cmp     ecx, 0
-
 
280
        je      put_image_end_24_old
-
 
281
;--------------------------------------
207
align   4
282
align 4
208
.new_line:
283
.new_line:
209
        mov     ecx, [putimg.real_sx]
284
        mov     ecx, [putimg.real_sx]
210
;     push    ebp edx
285
;--------------------------------------
211
align   4
286
align 4
212
.new_x:
287
.new_x:
213
        push    [putimg.edi]
288
        push    [putimg.edi]
214
        mov     eax, [putimg.ebp+4]
289
        mov     eax, [putimg.ebp+4]
215
        call    eax
290
        call    eax
216
        cmp     [ebp], bl
291
        cmp     [ebp], bl
217
        jne     .skip
292
        jne     .skip
218
;     mov     eax, [esi]        ; eax = RRBBGGRR
293
;--------------------------------------
-
 
294
; store to real LFB
219
        mov     [LFB_BASE+edx], ax
295
        mov     [LFB_BASE+edx], ax
220
        shr     eax, 16
296
        shr     eax, 16
221
        mov     [LFB_BASE+edx+2], al
297
        mov     [LFB_BASE+edx+2], al
-
 
298
;--------------------------------------
-
 
299
align 4
222
.skip:
300
.skip:
223
;     add     esi, 3 ;[putimg.source_bpp]
-
 
224
        add     edx, 3
301
        add     edx, 3
225
        inc     ebp
302
        inc     ebp
226
        dec     ecx
303
        dec     ecx
227
        jnz     .new_x
304
        jnz     .new_x
228
;     pop     edx ebp
-
 
-
 
305
 
229
        add     esi, [putimg.line_increment]
306
        add     esi, [putimg.line_increment]
230
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
307
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
231
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
308
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
232
;     inc     ebp
-
 
-
 
309
 
233
        cmp     [putimg.ebp], putimage_get1bpp
310
        cmp     [putimg.ebp], putimage_get1bpp
234
        jz      .correct
311
        jz      .correct
235
        cmp     [putimg.ebp], putimage_get2bpp
312
        cmp     [putimg.ebp], putimage_get2bpp
236
        jz      .correct
313
        jz      .correct
237
        cmp     [putimg.ebp], putimage_get4bpp
314
        cmp     [putimg.ebp], putimage_get4bpp
238
        jnz     @f
315
        jnz     @f
-
 
316
;--------------------------------------
-
 
317
align 4
239
.correct:
318
.correct:
240
        mov     eax, [putimg.edi]
319
        mov     eax, [putimg.edi]
241
        mov     byte [eax], 80h
320
        mov     byte [eax], 80h
-
 
321
;--------------------------------------
-
 
322
align 4
242
@@:
323
@@:
243
        dec     edi
324
        dec     edi
244
        jnz     .new_line
325
        jnz     .new_line
-
 
326
;--------------------------------------
-
 
327
align 4
245
.finish:
328
.finish:
246
        add     esp, putimg.stack_data
329
        add     esp, putimg.stack_data
247
        popad
330
        popad
248
        ret
331
        ret
-
 
332
;------------------------------------------------------------------------------
-
 
333
align 4
-
 
334
put_image_end_24_old:
-
 
335
;--------------------------------------
-
 
336
align 4
-
 
337
.new_line:
-
 
338
        mov     ecx, [putimg.real_sx]
-
 
339
;--------------------------------------
-
 
340
align 4
-
 
341
.new_x:
-
 
342
        push    [putimg.edi]
-
 
343
        mov     eax, [putimg.ebp+4]
-
 
344
        call    eax
-
 
345
        cmp     [ebp], bl
-
 
346
        jne     .skip
-
 
347
;--------------------------------------
-
 
348
        push    ecx
-
 
349
 
-
 
350
        neg     ecx
-
 
351
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
-
 
352
        shl     ecx, 16
-
 
353
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
-
 
354
        sub     ecx, edi
-
 
355
 
-
 
356
; check mouse area for putpixel
-
 
357
        call    check_mouse_area_for_putpixel
-
 
358
        pop     ecx
-
 
359
; store to real LFB
-
 
360
        mov     [LFB_BASE+edx], ax
-
 
361
        shr     eax, 16
-
 
362
        mov     [LFB_BASE+edx+2], al
-
 
363
;--------------------------------------
-
 
364
align 4
-
 
365
.skip:
-
 
366
        add     edx, 3
-
 
367
        inc     ebp
-
 
368
        dec     ecx
-
 
369
        jnz     .new_x
-
 
370
 
-
 
371
        add     esi, [putimg.line_increment]
-
 
372
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
-
 
373
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
Line -... Line 374...
-
 
374
 
-
 
375
        cmp     [putimg.ebp], putimage_get1bpp
-
 
376
        jz      .correct
-
 
377
        cmp     [putimg.ebp], putimage_get2bpp
-
 
378
        jz      .correct
-
 
379
        cmp     [putimg.ebp], putimage_get4bpp
-
 
380
        jnz     @f
-
 
381
;--------------------------------------
-
 
382
align 4
-
 
383
.correct:
-
 
384
        mov     eax, [putimg.edi]
-
 
385
        mov     byte [eax], 80h
-
 
386
;--------------------------------------
-
 
387
align 4
-
 
388
@@:
-
 
389
        dec     edi
-
 
390
        jnz     .new_line
-
 
391
        jmp     put_image_end_24.finish
-
 
392
;------------------------------------------------------------------------------
-
 
393
align 4
-
 
394
put_image_end_24_new:
-
 
395
;--------------------------------------
-
 
396
align 4
-
 
397
.new_line:
-
 
398
        mov     ecx, [putimg.real_sx]
-
 
399
;--------------------------------------
-
 
400
align 4
-
 
401
.new_x:
-
 
402
        push    [putimg.edi]
-
 
403
        mov     eax, [putimg.ebp+4]
-
 
404
        call    eax
-
 
405
        cmp     [ebp], bl
-
 
406
        jne     .skip
-
 
407
;--------------------------------------
-
 
408
        push    ecx
-
 
409
        mov     ecx, [putimg.real_sy_and_abs_cy + 4]
-
 
410
        sub     ecx, edi
-
 
411
;--------------------------------------
-
 
412
; check for Y
-
 
413
        cmp     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
414
        jb      .no_mouse_area
-
 
415
 
-
 
416
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
417
        jae     .no_mouse_area
-
 
418
 
-
 
419
        rol     ecx, 16
-
 
420
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
-
 
421
        sub     ecx, [esp]
-
 
422
;--------------------------------------
-
 
423
; check for X
-
 
424
        cmp     cx, [X_UNDER_subtraction_CUR_hot_x]
-
 
425
        jb      .no_mouse_area
-
 
426
 
-
 
427
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
428
        jae     .no_mouse_area
-
 
429
;--------------------------------------
-
 
430
; check mouse area for putpixel
-
 
431
        call    check_mouse_area_for_putpixel_new.1
-
 
432
;--------------------------------------
-
 
433
align 4
-
 
434
.no_mouse_area:
-
 
435
        pop     ecx
-
 
436
; store to real LFB
-
 
437
        mov     [LFB_BASE+edx], ax
-
 
438
        shr     eax, 16
-
 
439
        mov     [LFB_BASE+edx+2], al
-
 
440
;--------------------------------------
-
 
441
align 4
-
 
442
.skip:
-
 
443
        add     edx, 3
-
 
444
        inc     ebp
-
 
445
        dec     ecx
-
 
446
        jnz     .new_x
-
 
447
 
-
 
448
        add     esi, [putimg.line_increment]
-
 
449
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
-
 
450
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
-
 
451
 
-
 
452
        cmp     [putimg.ebp], putimage_get1bpp
-
 
453
        jz      .correct
-
 
454
        cmp     [putimg.ebp], putimage_get2bpp
-
 
455
        jz      .correct
-
 
456
        cmp     [putimg.ebp], putimage_get4bpp
-
 
457
        jnz     @f
-
 
458
;--------------------------------------
-
 
459
align 4
-
 
460
.correct:
-
 
461
        mov     eax, [putimg.edi]
-
 
462
        mov     byte [eax], 80h
-
 
463
;--------------------------------------
-
 
464
align 4
-
 
465
@@:
-
 
466
        dec     edi
-
 
467
        jnz     .new_line
-
 
468
        jmp     put_image_end_24.finish
-
 
469
;------------------------------------------------------------------------------
249
 
470
align 4
250
put_image_end_32:
471
put_image_end_32:
-
 
472
        mov     edi, [putimg.real_sy]
-
 
473
;--------------------------------------
-
 
474
; check for hardware cursor
-
 
475
        mov     ecx, [_display.select_cursor]
-
 
476
        cmp     ecx, select_cursor
-
 
477
        je      put_image_end_32_new
-
 
478
        cmp     ecx, 0
-
 
479
        je      put_image_end_32_old
251
        mov     edi, [putimg.real_sy]
480
;--------------------------------------
252
align   4
481
align 4
253
.new_line:
482
.new_line:
254
        mov     ecx, [putimg.real_sx]
483
        mov     ecx, [putimg.real_sx]
255
;     push    ebp edx
484
;--------------------------------------
256
align   4
485
align 4
257
.new_x:
486
.new_x:
258
        push    [putimg.edi]
487
        push    [putimg.edi]
259
        mov     eax, [putimg.ebp+4]
488
        mov     eax, [putimg.ebp+4]
260
        call    eax
489
        call    eax
261
        cmp     [ebp], bl
490
        cmp     [ebp], bl
262
        jne     .skip
491
        jne     .skip
-
 
492
;--------------------------------------
263
;     mov     eax, [esi]        ; ecx = RRBBGGRR
493
; store to real LFB
-
 
494
        mov     [LFB_BASE+edx], eax
-
 
495
;--------------------------------------
264
        mov     [LFB_BASE+edx], eax
496
align 4
265
.skip:
-
 
266
;     add     esi, [putimg.source_bpp]
497
.skip:
267
        add     edx, 4
498
        add     edx, 4
268
        inc     ebp
499
        inc     ebp
269
        dec     ecx
500
        dec     ecx
270
        jnz     .new_x
-
 
-
 
501
        jnz     .new_x
271
;     pop     edx ebp
502
 
272
        add     esi, [putimg.line_increment]
503
        add     esi, [putimg.line_increment]
273
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
504
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
274
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
-
 
-
 
505
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
275
;     inc     ebp
506
 
276
        cmp     [putimg.ebp], putimage_get1bpp
507
        cmp     [putimg.ebp], putimage_get1bpp
277
        jz      .correct
508
        jz      .correct
278
        cmp     [putimg.ebp], putimage_get2bpp
509
        cmp     [putimg.ebp], putimage_get2bpp
279
        jz      .correct
510
        jz      .correct
280
        cmp     [putimg.ebp], putimage_get4bpp
511
        cmp     [putimg.ebp], putimage_get4bpp
-
 
512
        jnz     @f
-
 
513
;--------------------------------------
281
        jnz     @f
514
align 4
282
.correct:
515
.correct:
283
        mov     eax, [putimg.edi]
516
        mov     eax, [putimg.edi]
-
 
517
        mov     byte [eax], 80h
-
 
518
;--------------------------------------
284
        mov     byte [eax], 80h
519
align 4
285
@@:
520
@@:
286
        dec     edi
521
        dec     edi
-
 
522
        jnz     .new_line
-
 
523
;--------------------------------------
287
        jnz     .new_line
524
align 4
288
.finish:
525
.finish:
289
        add     esp, putimg.stack_data
526
        add     esp, putimg.stack_data
-
 
527
        popad
-
 
528
        cmp     [SCR_MODE], dword 0x12
290
        popad
529
        jne     @f
-
 
530
        call    VGA__putimage
-
 
531
;--------------------------------------
-
 
532
align 4
291
        call    VGA__putimage
533
@@:
292
        mov     [EGA_counter], 1
534
        mov     [EGA_counter], 1
-
 
535
        ret
-
 
536
;------------------------------------------------------------------------------
-
 
537
align 4
-
 
538
put_image_end_32_old:
-
 
539
;--------------------------------------
-
 
540
align 4
-
 
541
.new_line:
-
 
542
        mov     ecx, [putimg.real_sx]
-
 
543
;--------------------------------------
-
 
544
align 4
-
 
545
.new_x:
-
 
546
        push    [putimg.edi]
-
 
547
        mov     eax, [putimg.ebp+4]
-
 
548
        call    eax
-
 
549
        cmp     [ebp], bl
-
 
550
        jne     .skip
-
 
551
;--------------------------------------
-
 
552
        push    ecx
-
 
553
 
-
 
554
        neg     ecx
-
 
555
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
-
 
556
        shl     ecx, 16
-
 
557
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
-
 
558
        sub     ecx, edi
-
 
559
 
-
 
560
; check mouse area for putpixel
-
 
561
        call    check_mouse_area_for_putpixel
-
 
562
        pop     ecx
-
 
563
; store to real LFB
-
 
564
        mov     [LFB_BASE+edx], eax
-
 
565
;--------------------------------------
-
 
566
align 4
-
 
567
.skip:
-
 
568
        add     edx, 4
-
 
569
        inc     ebp
-
 
570
        dec     ecx
-
 
571
        jnz     .new_x
-
 
572
 
-
 
573
        add     esi, [putimg.line_increment]
-
 
574
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
-
 
575
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
-
 
576
 
-
 
577
        cmp     [putimg.ebp], putimage_get1bpp
-
 
578
        jz      .correct
-
 
579
        cmp     [putimg.ebp], putimage_get2bpp
-
 
580
        jz      .correct
-
 
581
        cmp     [putimg.ebp], putimage_get4bpp
-
 
582
        jnz     @f
-
 
583
;--------------------------------------
-
 
584
align 4
-
 
585
.correct:
-
 
586
        mov     eax, [putimg.edi]
-
 
587
        mov     byte [eax], 80h
-
 
588
;--------------------------------------
-
 
589
align 4
-
 
590
@@:
-
 
591
        dec     edi
-
 
592
        jnz     .new_line
-
 
593
        jmp     put_image_end_32.finish
-
 
594
;------------------------------------------------------------------------------
-
 
595
align 4
-
 
596
put_image_end_32_new:
-
 
597
;--------------------------------------
-
 
598
align 4
-
 
599
.new_line:
-
 
600
        mov     ecx, [putimg.real_sx]
-
 
601
;--------------------------------------
-
 
602
align 4
-
 
603
.new_x:
-
 
604
        push    [putimg.edi]
-
 
605
        mov     eax, [putimg.ebp+4]
-
 
606
        call    eax
-
 
607
        cmp     [ebp], bl
-
 
608
        jne     .skip
-
 
609
;--------------------------------------
-
 
610
        push    ecx
-
 
611
        mov     ecx, [putimg.real_sy_and_abs_cy + 4]
-
 
612
        sub     ecx, edi
-
 
613
;--------------------------------------
-
 
614
; check for Y
-
 
615
        cmp     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
616
        jb      .no_mouse_area
-
 
617
 
-
 
618
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
619
        jae     .no_mouse_area
-
 
620
 
-
 
621
        rol     ecx, 16
-
 
622
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
-
 
623
        sub     ecx, [esp]
-
 
624
;--------------------------------------
-
 
625
; check for X
-
 
626
        cmp     cx, [X_UNDER_subtraction_CUR_hot_x]
-
 
627
        jb      .no_mouse_area
-
 
628
 
-
 
629
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
630
        jae     .no_mouse_area
-
 
631
;--------------------------------------
-
 
632
; check mouse area for putpixel
-
 
633
        call    check_mouse_area_for_putpixel_new.1
-
 
634
;--------------------------------------
-
 
635
align 4
-
 
636
.no_mouse_area:
-
 
637
        pop     ecx
-
 
638
; store to real LFB
-
 
639
        mov     [LFB_BASE+edx], eax
-
 
640
;--------------------------------------
-
 
641
align 4
-
 
642
.skip:
-
 
643
        add     edx, 4
-
 
644
        inc     ebp
-
 
645
        dec     ecx
Line -... Line 646...
-
 
646
        jnz     .new_x
-
 
647
 
-
 
648
        add     esi, [putimg.line_increment]
Line -... Line 649...
-
 
649
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
-
 
650
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
-
 
651
 
-
 
652
        cmp     [putimg.ebp], putimage_get1bpp
293
        ret
653
        jz      .correct
-
 
654
        cmp     [putimg.ebp], putimage_get2bpp
-
 
655
        jz      .correct
-
 
656
        cmp     [putimg.ebp], putimage_get4bpp
-
 
657
        jnz     @f
-
 
658
;--------------------------------------
-
 
659
align 4
-
 
660
.correct:
-
 
661
        mov     eax, [putimg.edi]
-
 
662
        mov     byte [eax], 80h
-
 
663
;--------------------------------------
-
 
664
align 4
-
 
665
@@:
-
 
666
        dec     edi
294
 
667
        jnz     .new_line
295
 
668
        jmp     put_image_end_32.finish
Line 296... Line 669...
296
;*************************************************
669
;------------------------------------------------------------------------------
297
align 4
670
align 4
298
__sys_putpixel:
671
__sys_putpixel:
-
 
672
 
-
 
673
; eax = x coordinate
299
 
674
; ebx = y coordinate
Line 300... Line 675...
300
; eax = x coordinate
675
; ecx = ?? RR GG BB    ; 0x01000000 negation
301
; ebx = y coordinate
676
                       ; 0x02000000 used for draw_rectangle without top line
302
; ecx = ?? RR GG BB    ; 0x01000000 negation
677
                       ;            for example drawwindow_III and drawwindow_IV
Line 310... Line 685...
310
        jb      .exit
685
        jb      .exit
311
        test    edi, 1           ; force ?
686
        test    edi, 1           ; force ?
312
        jnz     .forced
687
        jnz     .forced
Line 313... Line 688...
313
 
688
 
314
; not forced:
-
 
315
 
-
 
316
        push    eax
689
; not forced:
317
        mov     edx, [_display.width]; screen x size
-
 
318
        imul    edx, ebx
690
        mov     edx, [d_width_calc_area + ebx*4]
319
        add     eax, [_WinMapAddress]
691
        add     edx, [_WinMapAddress]
320
        movzx   edx, byte [eax+edx]
692
        movzx   edx, byte [eax+edx]
321
        cmp     edx, [CURRENT_TASK]
-
 
322
        pop     eax
693
        cmp     edx, [CURRENT_TASK]
-
 
694
        jne     .exit
323
        jne     .exit
695
;--------------------------------------
324
 
696
align 4
325
.forced:
697
.forced:
326
; check if negation
698
; check if negation
327
        test    ecx, 0x01000000
699
        test    ecx, 0x01000000
-
 
700
        jz      .noneg
328
        jz      .noneg
701
 
329
        call    getpixel
702
        call    getpixel
-
 
703
        not     ecx
-
 
704
 
-
 
705
        rol     ecx, 8
-
 
706
        mov     cl, [esp+32-8+3]
330
        not     ecx
707
        ror     ecx, 8
-
 
708
        mov     [esp+32-8], ecx
-
 
709
;--------------------------------------
331
        mov     [esp+32-8], ecx
710
align 4
332
.noneg:
711
.noneg:
333
; OK to set pixel
712
; OK to set pixel
-
 
713
        call    dword [PUTPIXEL]; call the real put_pixel function
-
 
714
;--------------------------------------
334
        call    dword [PUTPIXEL]; call the real put_pixel function
715
align 4
335
.exit:
716
.exit:
336
        popad
717
        popad
337
        ret
-
 
-
 
718
        ret
338
 
719
;-----------------------------------------------------------------------------
339
align 4
720
align 4
340
Vesa20_putpixel24:
721
Vesa20_putpixel24:
341
; eax = x
722
; eax = x
-
 
723
; ebx = y
-
 
724
        mov     ecx, eax
-
 
725
        shl     ecx, 16
-
 
726
        mov     cx, bx
342
; ebx = y
727
 
-
 
728
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
343
        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
729
        mov     ebx, [BPSLine_calc_area+ebx*4]
344
        lea     edi, [eax+eax*2]; edi = x*3
730
        lea     edi, [eax+eax*2]; edi = x*3
-
 
731
        mov     eax, [esp+32-8+4]
-
 
732
;--------------------------------------
-
 
733
; check for hardware cursor
-
 
734
        cmp     [_display.select_cursor], 0
-
 
735
        jne     @f
-
 
736
; check mouse area for putpixel
-
 
737
        test    eax, 0x04000000
-
 
738
        jnz     @f
-
 
739
        call    check_mouse_area_for_putpixel
-
 
740
;--------------------------------------
-
 
741
align 4
-
 
742
@@:
345
        mov     eax, [esp+32-8+4]
743
; store to real LFB
346
        mov     [LFB_BASE+ebx+edi], ax
744
        mov     [LFB_BASE+ebx+edi], ax
347
        shr     eax, 16
745
        shr     eax, 16
348
        mov     [LFB_BASE+ebx+edi+2], al
746
        mov     [LFB_BASE+ebx+edi+2], al
-
 
747
        ret
-
 
748
;-----------------------------------------------------------------------------
-
 
749
align 4
-
 
750
Vesa20_putpixel24_new:
-
 
751
; eax = x
-
 
752
; ebx = y
-
 
753
        mov     ecx, eax
-
 
754
        shl     ecx, 16
Line -... Line 755...
-
 
755
        mov     cx, bx
-
 
756
 
-
 
757
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
-
 
758
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
759
        lea     edi, [eax+eax*2]; edi = x*3
-
 
760
        mov     eax, [esp+32-8+4]
-
 
761
;--------------------------------------
-
 
762
; check for hardware cursor
-
 
763
        cmp     [_display.select_cursor], select_cursor
-
 
764
        jne     @f
-
 
765
; check mouse area for putpixel
-
 
766
        test    eax, 0x04000000
-
 
767
        jnz     @f
-
 
768
;--------------------------------------
-
 
769
; check for Y
-
 
770
        cmp     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
771
        jb      @f
-
 
772
 
-
 
773
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
774
        jae     @f
-
 
775
 
-
 
776
        rol     ecx, 16
-
 
777
;--------------------------------------
-
 
778
; check for X
-
 
779
        cmp     cx, [X_UNDER_subtraction_CUR_hot_x]
-
 
780
        jb      @f
-
 
781
 
Line -... Line 782...
-
 
782
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
783
        jae     @f
-
 
784
 
-
 
785
        call    check_mouse_area_for_putpixel_new.1
-
 
786
;--------------------------------------
-
 
787
align 4
-
 
788
@@:
-
 
789
; store to real LFB
-
 
790
        mov     [LFB_BASE+ebx+edi], ax
-
 
791
        shr     eax, 16
349
        ret
792
        mov     [LFB_BASE+ebx+edi+2], al
350
 
793
        ret
351
 
794
;-----------------------------------------------------------------------------
352
align 4
795
align 4
-
 
796
Vesa20_putpixel32:
-
 
797
; eax = x
-
 
798
; ebx = y
-
 
799
        mov     ecx, eax
353
Vesa20_putpixel32:
800
        shl     ecx, 16
-
 
801
        mov     cx, bx
354
; eax = x
802
 
355
; ebx = y
803
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
-
 
804
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
805
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
-
 
806
        mov     eax, [esp+32-8+4]; eax = color
-
 
807
;--------------------------------------
-
 
808
; check for hardware cursor
-
 
809
        cmp     [_display.select_cursor], 0
-
 
810
        jne     @f
-
 
811
; check mouse area for putpixel
-
 
812
        test    eax, 0x04000000
-
 
813
        jnz     @f
-
 
814
        call    check_mouse_area_for_putpixel
-
 
815
;--------------------------------------
-
 
816
align 4
356
        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
817
@@:
357
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
818
        and     eax, 0xffffff
-
 
819
; store to real LFB
-
 
820
        mov     [LFB_BASE+edi], eax
-
 
821
        ret
-
 
822
;-----------------------------------------------------------------------------
-
 
823
align 4
-
 
824
Vesa20_putpixel32_new:
-
 
825
; eax = x
-
 
826
; ebx = y
Line -... Line 827...
-
 
827
        mov     ecx, eax
-
 
828
        shl     ecx, 16
-
 
829
        mov     cx, bx
-
 
830
 
-
 
831
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
-
 
832
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
833
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
-
 
834
        mov     eax, [esp+32-8+4]; eax = color
-
 
835
;--------------------------------------
-
 
836
; check for hardware cursor
-
 
837
        cmp     [_display.select_cursor], select_cursor
-
 
838
        jne     @f
-
 
839
; check mouse area for putpixel
358
        mov     eax, [esp+32-8+4]; eax = color
840
        test    eax, 0x04000000
-
 
841
        jnz     @f
-
 
842
;--------------------------------------
-
 
843
; check for Y
-
 
844
        cmp     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
845
        jb      @f
-
 
846
 
-
 
847
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
848
        jae     @f
-
 
849
 
-
 
850
        rol     ecx, 16
-
 
851
;--------------------------------------
-
 
852
; check for X
-
 
853
        cmp     cx, [X_UNDER_subtraction_CUR_hot_x]
Line -... Line 854...
-
 
854
        jb      @f
-
 
855
 
359
        mov     [LFB_BASE+edi], eax
856
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
857
        jae     @f
-
 
858
 
-
 
859
        call    check_mouse_area_for_putpixel_new.1
-
 
860
;--------------------------------------
-
 
861
align 4
-
 
862
@@:
-
 
863
        and     eax, 0xffffff
360
        ret
864
; store to real LFB
361
 
865
        mov     [LFB_BASE+edi], eax
362
;*************************************************
866
        ret
363
 
867
;-----------------------------------------------------------------------------
-
 
868
align 4
364
;align 4
869
calculate_edi:
365
calculate_edi:
870
;        mov     edi, ebx
366
        mov     edi, ebx
-
 
367
        imul    edi, [Screen_Max_X]
871
;        imul    edi, [Screen_Max_X]
368
        add     edi, ebx
-
 
369
        add     edi, eax
872
;        add     edi, ebx
370
        ret
-
 
-
 
873
        mov     edi, [d_width_calc_area + ebx*4]
371
 
874
        add     edi, eax
372
;*************************************************
875
        ret
373
 
-
 
374
; DRAWLINE
-
 
375
 
-
 
376
align 4
876
;-----------------------------------------------------------------------------
377
__sys_draw_line:
877
; DRAWLINE
378
;     inc   [mouse_pause]
878
;-----------------------------------------------------------------------------
379
        call    [_display.disable_mouse]
879
align 4
380
 
880
__sys_draw_line:
Line 412... Line 912...
412
        jg      .no_vline  ; x1 > x2 ?
912
        jg      .no_vline  ; x1 > x2 ?
413
        mov     edx, ebp   ; else (if x1=x2)
913
        mov     edx, ebp   ; else (if x1=x2)
414
        call    vline
914
        call    vline
415
        push    edx ; necessary to rightly restore stack frame at .exit
915
        push    edx ; necessary to rightly restore stack frame at .exit
416
        jmp     .exit
916
        jmp     .exit
-
 
917
;--------------------------------------
-
 
918
align 4
417
.x2lx1:
919
.x2lx1:
418
        neg     esi         ; get esi absolute value
920
        neg     esi         ; get esi absolute value
-
 
921
;--------------------------------------
-
 
922
align 4
419
.no_vline:
923
.no_vline:
420
; checking y-axis...
924
; checking y-axis...
421
        sub     ebp, ebx    ; ebp = y2-y1
925
        sub     ebp, ebx    ; ebp = y2-y1
422
        push    ebp         ; save y2-y1
926
        push    ebp         ; save y2-y1
423
        jl      .y2ly1      ; is y2 less than y1 ?
927
        jl      .y2ly1      ; is y2 less than y1 ?
424
        jg      .no_hline   ; y1 > y2 ?
928
        jg      .no_hline   ; y1 > y2 ?
425
        mov     edx, [dl_x2]; else (if y1=y2)
929
        mov     edx, [dl_x2]; else (if y1=y2)
426
        call    hline
930
        call    hline
427
        jmp     .exit
931
        jmp     .exit
-
 
932
;--------------------------------------
428
 
933
align 4
429
.y2ly1:
934
.y2ly1:
430
        neg     ebp         ; get ebp absolute value
935
        neg     ebp         ; get ebp absolute value
-
 
936
;--------------------------------------
-
 
937
align 4
431
.no_hline:
938
.no_hline:
432
        cmp     ebp, esi
939
        cmp     ebp, esi
433
        jle     .x_rules    ; |y2-y1| < |x2-x1|  ?
940
        jle     .x_rules    ; |y2-y1| < |x2-x1|  ?
434
        cmp     [dl_y2], ebx; make sure y1 is at the begining
941
        cmp     [dl_y2], ebx; make sure y1 is at the begining
435
        jge     .no_reverse1
942
        jge     .no_reverse1
Line 438... Line 945...
438
        mov     [dl_x2], eax
945
        mov     [dl_x2], eax
439
        mov     [dl_x1], edx
946
        mov     [dl_x1], edx
440
        mov     edx, [dl_y2]
947
        mov     edx, [dl_y2]
441
        mov     [dl_y2], ebx
948
        mov     [dl_y2], ebx
442
        mov     [dl_y1], edx
949
        mov     [dl_y1], edx
-
 
950
;--------------------------------------
-
 
951
align 4
443
.no_reverse1:
952
.no_reverse1:
444
        mov     eax, [dl_dx]
953
        mov     eax, [dl_dx]
445
        cdq                 ; extend eax sing to edx
954
        cdq                 ; extend eax sing to edx
446
        shl     eax, 16     ; using 16bit fix-point maths
955
        shl     eax, 16     ; using 16bit fix-point maths
447
        idiv    ebp         ; eax = ((x2-x1)*65536)/(y2-y1)
956
        idiv    ebp         ; eax = ((x2-x1)*65536)/(y2-y1)
Line 449... Line 958...
449
; correction for the remainder of the division
958
; correction for the remainder of the division
450
        shl     edx, 1
959
        shl     edx, 1
451
        cmp     ebp, edx
960
        cmp     ebp, edx
452
        jb      @f
961
        jb      @f
453
        inc     eax
962
        inc     eax
-
 
963
;--------------------------------------
-
 
964
align 4
454
@@:
965
@@:
455
;--------------------------------------
966
;--------------------------------------
456
        mov     edx, ebp    ; edx = counter (number of pixels to draw)
967
        mov     edx, ebp    ; edx = counter (number of pixels to draw)
457
        mov     ebp, 1 *65536; <<16   ; ebp = dy = 1.0
968
        mov     ebp, 1 *65536; <<16   ; ebp = dy = 1.0
458
        mov     esi, eax    ; esi = dx
969
        mov     esi, eax    ; esi = dx
459
        jmp     .y_rules
970
        jmp     .y_rules
-
 
971
;--------------------------------------
460
 
972
align 4
461
.x_rules:
973
.x_rules:
462
        cmp     [dl_x2], eax ; make sure x1 is at the begining
974
        cmp     [dl_x2], eax ; make sure x1 is at the begining
463
        jge     .no_reverse2
975
        jge     .no_reverse2
464
        neg     dword [dl_dy]
976
        neg     dword [dl_dy]
465
        mov     edx, [dl_x2]
977
        mov     edx, [dl_x2]
466
        mov     [dl_x2], eax
978
        mov     [dl_x2], eax
467
        mov     [dl_x1], edx
979
        mov     [dl_x1], edx
468
        mov     edx, [dl_y2]
980
        mov     edx, [dl_y2]
469
        mov     [dl_y2], ebx
981
        mov     [dl_y2], ebx
470
        mov     [dl_y1], edx
982
        mov     [dl_y1], edx
-
 
983
;--------------------------------------
-
 
984
align 4
471
.no_reverse2:
985
.no_reverse2:
472
        xor     edx, edx
986
        xor     edx, edx
473
        mov     eax, [dl_dy]
987
        mov     eax, [dl_dy]
474
        cdq                 ; extend eax sing to edx
988
        cdq                 ; extend eax sing to edx
475
        shl     eax, 16     ; using 16bit fix-point maths
989
        shl     eax, 16     ; using 16bit fix-point maths
Line 478... Line 992...
478
; correction for the remainder of the division
992
; correction for the remainder of the division
479
        shl     edx, 1
993
        shl     edx, 1
480
        cmp     esi, edx
994
        cmp     esi, edx
481
        jb      @f
995
        jb      @f
482
        inc     eax
996
        inc     eax
-
 
997
;--------------------------------------
-
 
998
align 4
483
@@:
999
@@:
484
;--------------------------------------
1000
;--------------------------------------
485
        mov     edx, esi    ; edx = counter (number of pixels to draw)
1001
        mov     edx, esi    ; edx = counter (number of pixels to draw)
486
        mov     esi, 1 *65536;<< 16   ; esi = dx = 1.0
1002
        mov     esi, 1 *65536;<< 16   ; esi = dx = 1.0
487
        mov     ebp, eax    ; ebp = dy
1003
        mov     ebp, eax    ; ebp = dy
-
 
1004
;--------------------------------------
-
 
1005
align 4
488
.y_rules:
1006
.y_rules:
489
        mov     eax, [dl_x1]
1007
        mov     eax, [dl_x1]
490
        mov     ebx, [dl_y1]
1008
        mov     ebx, [dl_y1]
491
        shl     eax, 16
1009
        shl     eax, 16
492
        shl     ebx, 16
1010
        shl     ebx, 16
-
 
1011
 
-
 
1012
        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
493
;-----------------------------------------------------------------------------
1013
;-----------------------------------------------------------------------------
494
align 4
1014
align 4
495
.draw:
1015
.draw:
496
        push    eax ebx
1016
        push    eax ebx
497
;--------------------------------------
1017
;--------------------------------------
498
; correction for the remainder of the division
1018
; correction for the remainder of the division
499
        test    ah, 0x80
1019
        test    ah, 0x80
500
        jz      @f
1020
        jz      @f
501
        add     eax, 1 shl 16
1021
        add     eax, 1 shl 16
-
 
1022
;--------------------------------------
-
 
1023
align 4
502
@@:
1024
@@:
503
;--------------------------------------
1025
;--------------------------------------
504
        shr     eax, 16
1026
        shr     eax, 16
505
;--------------------------------------
1027
;--------------------------------------
506
; correction for the remainder of the division
1028
; correction for the remainder of the division
507
        test    bh, 0x80
1029
        test    bh, 0x80
508
        jz      @f
1030
        jz      @f
509
        add     ebx, 1 shl 16
1031
        add     ebx, 1 shl 16
-
 
1032
;--------------------------------------
-
 
1033
align 4
510
@@:
1034
@@:
511
;--------------------------------------
1035
;--------------------------------------
512
        shr     ebx, 16
1036
        shr     ebx, 16
-
 
1037
;        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
513
        call    [putpixel]
1038
;        call    [putpixel]
-
 
1039
        call    __sys_putpixel
514
        pop     ebx eax
1040
        pop     ebx eax
515
        add     ebx, ebp     ; y = y+dy
1041
        add     ebx, ebp     ; y = y+dy
516
        add     eax, esi     ; x = x+dx
1042
        add     eax, esi     ; x = x+dx
517
        dec     edx
1043
        dec     edx
518
        jnz     .draw
1044
        jnz     .draw
519
; force last drawn pixel to be at (x2,y2)
1045
; force last drawn pixel to be at (x2,y2)
520
        mov     eax, [dl_x2]
1046
        mov     eax, [dl_x2]
521
        mov     ebx, [dl_y2]
1047
        mov     ebx, [dl_y2]
-
 
1048
;        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
522
        call    [putpixel]
1049
;        call    [putpixel]
-
 
1050
        call    __sys_putpixel
-
 
1051
;--------------------------------------
-
 
1052
align 4
523
.exit:
1053
.exit:
524
        add     esp, 6*4
1054
        add     esp, 6*4
525
        popa
1055
        popa
526
;     dec   [mouse_pause]
-
 
527
        call    [draw_pointer]
1056
;        call    [draw_pointer]
528
        ret
1057
        ret
529
 
-
 
-
 
1058
;------------------------------------------------------------------------------
530
 
1059
align 4
531
hline:
1060
hline:
532
; draw an horizontal line
1061
; draw an horizontal line
533
; eax = x1
1062
; eax = x1
534
; edx = x2
1063
; edx = x2
535
; ebx = y
1064
; ebx = y
Line 537... Line 1066...
537
; edi = force ?
1066
; edi = force ?
538
        push    eax edx
1067
        push    eax edx
539
        cmp     edx, eax   ; make sure x2 is above x1
1068
        cmp     edx, eax   ; make sure x2 is above x1
540
        jge     @f
1069
        jge     @f
541
        xchg    eax, edx
1070
        xchg    eax, edx
-
 
1071
;--------------------------------------
542
align   4
1072
align 4
543
@@:
1073
@@:
-
 
1074
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
-
 
1075
;--------------------------------------
-
 
1076
align 4
-
 
1077
@@:
544
        call    [putpixel]
1078
;        call    [putpixel]
-
 
1079
        call    __sys_putpixel
545
        inc     eax
1080
        inc     eax
546
        cmp     eax, edx
1081
        cmp     eax, edx
547
        jle     @b
1082
        jle     @b
548
        pop     edx eax
1083
        pop     edx eax
549
        ret
1084
        ret
550
 
-
 
-
 
1085
;------------------------------------------------------------------------------
551
 
1086
align 4
552
vline:
1087
vline:
553
; draw a vertical line
1088
; draw a vertical line
554
; eax = x
1089
; eax = x
555
; ebx = y1
1090
; ebx = y1
556
; edx = y2
1091
; edx = y2
Line 558... Line 1093...
558
; edi = force ?
1093
; edi = force ?
559
        push    ebx edx
1094
        push    ebx edx
560
        cmp     edx, ebx   ; make sure y2 is above y1
1095
        cmp     edx, ebx   ; make sure y2 is above y1
561
        jge     @f
1096
        jge     @f
562
        xchg    ebx, edx
1097
        xchg    ebx, edx
-
 
1098
;--------------------------------------
563
align   4
1099
align 4
564
@@:
1100
@@:
-
 
1101
        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
-
 
1102
;--------------------------------------
-
 
1103
align 4
-
 
1104
@@:
565
        call    [putpixel]
1105
;        call    [putpixel]
-
 
1106
        call    __sys_putpixel
566
        inc     ebx
1107
        inc     ebx
567
        cmp     ebx, edx
1108
        cmp     ebx, edx
568
        jle     @b
1109
        jle     @b
569
        pop     edx ebx
1110
        pop     edx ebx
570
        ret
1111
        ret
571
 
-
 
572
 
-
 
573
;*************************************************
1112
;------------------------------------------------------------------------------
574
 
-
 
575
 
1113
align 4
576
virtual at esp
1114
virtual at esp
577
drbar:
1115
drbar:
578
     .bar_sx       dd ?
1116
     .bar_sx       dd ?
579
     .bar_sy       dd ?
1117
     .bar_sy       dd ?
580
     .bar_cx       dd ?
1118
     .bar_cx       dd ?
Line 584... Line 1122...
584
     .real_sx      dd ?
1122
     .real_sx      dd ?
585
     .real_sy      dd ?
1123
     .real_sy      dd ?
586
     .color        dd ?
1124
     .color        dd ?
587
     .line_inc_scr dd ?
1125
     .line_inc_scr dd ?
588
     .line_inc_map dd ?
1126
     .line_inc_map dd ?
-
 
1127
     .real_sx_and_abs_cx dd ?
-
 
1128
     .real_sy_and_abs_cy dd ?
589
     .stack_data = 4*11
1129
     .stack_data = 4*13
590
end virtual
1130
end virtual
591
 
-
 
-
 
1131
;--------------------------------------
592
align 4
1132
align 4
593
; eax   cx
1133
; eax   cx
594
; ebx   cy
1134
; ebx   cy
595
; ecx   xe
1135
; ecx   xe
596
; edx   ye
1136
; edx   ye
597
; edi   color
1137
; edi   color
598
vesa20_drawbar:
1138
vesa20_drawbar:
599
        pushad
1139
        pushad
600
        call    [_display.disable_mouse]
-
 
601
        sub     esp, drbar.stack_data
1140
        sub     esp, drbar.stack_data
602
        mov     [drbar.color], edi
1141
        mov     [drbar.color], edi
603
        sub     edx, ebx
1142
        sub     edx, ebx
604
        jle     .exit       ;// mike.dld, 2005-01-29
1143
        jle     .exit       ;// mike.dld, 2005-01-29
605
        sub     ecx, eax
1144
        sub     ecx, eax
Line 619... Line 1158...
619
; note that WDATA.box.width is one pixel less than real window x-size
1158
; note that WDATA.box.width is one pixel less than real window x-size
620
        inc     ebx
1159
        inc     ebx
621
; \end{diamond}[20.08.2006]
1160
; \end{diamond}[20.08.2006]
622
        sub     ebx, [drbar.bar_cx]
1161
        sub     ebx, [drbar.bar_cx]
623
        ja      @f
1162
        ja      @f
-
 
1163
;--------------------------------------
-
 
1164
align 4
624
.exit:                       ;// mike.dld, 2005-01-29
1165
.exit:                       ;// mike.dld, 2005-01-29
625
        add     esp, drbar.stack_data
1166
        add     esp, drbar.stack_data
626
        popad
1167
        popad
627
        xor     eax, eax
1168
        xor     eax, eax
628
        inc     eax
1169
        inc     eax
629
        ret
1170
        ret
-
 
1171
;--------------------------------------
-
 
1172
align 4
630
@@:
1173
@@:
631
        cmp     ebx, [drbar.bar_sx]
1174
        cmp     ebx, [drbar.bar_sx]
632
        jbe     .end_x
1175
        jbe     .end_x
633
        mov     ebx, [drbar.bar_sx]
1176
        mov     ebx, [drbar.bar_sx]
-
 
1177
;--------------------------------------
-
 
1178
align 4
634
.end_x:
1179
.end_x:
635
        mov     [drbar.real_sx], ebx
1180
        mov     [drbar.real_sx], ebx
636
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
1181
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
637
        mov     ebx, [edi-twdw + WDATA.box.height]; ebx = wnd_sy
1182
        mov     ebx, [edi-twdw + WDATA.box.height]; ebx = wnd_sy
638
; \begin{diamond}[20.08.2006]
1183
; \begin{diamond}[20.08.2006]
Line 643... Line 1188...
643
        add     esp, drbar.stack_data
1188
        add     esp, drbar.stack_data
644
        popad
1189
        popad
645
        xor     eax, eax
1190
        xor     eax, eax
646
        inc     eax
1191
        inc     eax
647
        ret
1192
        ret
-
 
1193
;--------------------------------------
-
 
1194
align 4
648
@@:
1195
@@:
649
        cmp     ebx, [drbar.bar_sy]
1196
        cmp     ebx, [drbar.bar_sy]
650
        jbe     .end_y
1197
        jbe     .end_y
651
        mov     ebx, [drbar.bar_sy]
1198
        mov     ebx, [drbar.bar_sy]
-
 
1199
;--------------------------------------
-
 
1200
align 4
652
.end_y:
1201
.end_y:
653
        mov     [drbar.real_sy], ebx
1202
        mov     [drbar.real_sy], ebx
654
; line_inc_map
1203
; line_inc_map
655
        mov     eax, [Screen_Max_X]
1204
        mov     eax, [Screen_Max_X]
656
        sub     eax, [drbar.real_sx]
1205
        sub     eax, [drbar.real_sx]
Line 664... Line 1213...
664
        neg     eax
1213
        neg     eax
665
        add     eax, [BytesPerScanLine]
1214
        add     eax, [BytesPerScanLine]
666
        mov     [drbar.line_inc_scr], eax
1215
        mov     [drbar.line_inc_scr], eax
667
; pointer to screen
1216
; pointer to screen
668
        mov     edx, [drbar.abs_cy]
1217
        mov     edx, [drbar.abs_cy]
669
        imul    edx, [BytesPerScanLine]
1218
;        imul    edx, [BytesPerScanLine]
-
 
1219
        mov     edx, [BPSLine_calc_area+edx*4]
670
        mov     eax, [drbar.abs_cx]
1220
        mov     eax, [drbar.abs_cx]
671
;     movzx   ebx, byte [ScreenBPP]
-
 
672
;     shr     ebx, 3
-
 
673
        imul    eax, ebx
1221
        imul    eax, ebx
674
        add     edx, eax
1222
        add     edx, eax
675
; pointer to pixel map
1223
; pointer to pixel map
676
        mov     eax, [drbar.abs_cy]
1224
        mov     eax, [drbar.abs_cy]
677
        imul    eax, [Screen_Max_X]
1225
;        imul    eax, [Screen_Max_X]
678
        add     eax, [drbar.abs_cy]
1226
;        add     eax, [drbar.abs_cy]
-
 
1227
        mov     eax, [d_width_calc_area + eax*4]
-
 
1228
 
679
        add     eax, [drbar.abs_cx]
1229
        add     eax, [drbar.abs_cx]
680
        add     eax, [_WinMapAddress]
1230
        add     eax, [_WinMapAddress]
681
        xchg    eax, ebp
1231
        xchg    eax, ebp
-
 
1232
;--------------------------------------
-
 
1233
        mov     ebx, [drbar.real_sx]
-
 
1234
        add     ebx, [drbar.abs_cx]
-
 
1235
        mov     [drbar.real_sx_and_abs_cx], ebx
-
 
1236
        mov     ebx, [drbar.real_sy]
-
 
1237
        add     ebx, [drbar.abs_cy]
-
 
1238
        mov     [drbar.real_sy_and_abs_cy], ebx
-
 
1239
 
-
 
1240
        add     edx, LFB_BASE
-
 
1241
;--------------------------------------
682
; get process number
1242
; get process number
-
 
1243
        mov     ebx, [CURRENT_TASK]  ; bl - process num
683
        mov     ebx, [CURRENT_TASK]
1244
        mov     esi, [drbar.real_sy]
-
 
1245
        mov     eax, [drbar.color] ; BBGGRR00
-
 
1246
        rol     eax, 8
-
 
1247
        mov     bh, al  ; 0x80 drawing gradient bars
-
 
1248
        ror     eax, 8
684
        cmp     byte [ScreenBPP], 24
1249
        cmp     byte [ScreenBPP], 24
685
        jne     draw_bar_end_32
1250
        jne     draw_bar_end_32
-
 
1251
;--------------------------------------
-
 
1252
align 4
686
draw_bar_end_24:
1253
draw_bar_end_24:
687
        mov     eax, [drbar.color] ;; BBGGRR00
-
 
688
        mov     bh, al             ;; bh  = BB
-
 
689
        shr     eax, 8             ;; eax = RRGG
-
 
690
; eax - color high   RRGG
1254
; eax - color high   RRGGBB
691
; bl - process num
1255
; bl - process num
692
; bh - color low    BB
-
 
693
; ecx - temp
1256
; ecx - temp
694
; edx - pointer to screen
1257
; edx - pointer to screen
695
; esi - counter
1258
; esi - counter
696
; edi - counter
1259
; edi - counter
-
 
1260
;--------------------------------------
-
 
1261
; check for hardware cursor
697
        mov     esi, [drbar.real_sy]
1262
        mov     ecx, [_display.select_cursor]
-
 
1263
        cmp     ecx, select_cursor
-
 
1264
        je      draw_bar_end_24_new
-
 
1265
        cmp     ecx, 0
-
 
1266
        je      draw_bar_end_24_old
-
 
1267
;--------------------------------------
698
align   4
1268
align 4
699
.new_y:
1269
.new_y:
700
        mov     edi, [drbar.real_sx]
1270
        mov     edi, [drbar.real_sx]
-
 
1271
;--------------------------------------
701
align   4
1272
align 4
702
.new_x:
1273
.new_x:
703
        cmp     byte [ebp], bl
1274
        cmp     byte [ebp], bl
704
        jne     .skip
1275
        jne     .skip
705
 
-
 
-
 
1276
;--------------------------------------
-
 
1277
; store to real LFB
706
        mov     [LFB_BASE+edx], bh
1278
        mov     [edx], ax
-
 
1279
        shr     eax, 16
707
        mov     [LFB_BASE+edx + 1], ax
1280
        mov     [edx + 2], al
-
 
1281
;--------------------------------------
-
 
1282
align 4
708
.skip:
1283
.skip:
709
; add pixel
1284
; add pixel
710
        add     edx, 3
1285
        add     edx, 3
711
        inc     ebp
1286
        inc     ebp
712
        dec     edi
1287
        dec     edi
713
        jnz     .new_x
1288
        jnz     .new_x
714
; add line
1289
; add line
715
        add     edx, [drbar.line_inc_scr]
1290
        add     edx, [drbar.line_inc_scr]
716
        add     ebp, [drbar.line_inc_map]
1291
        add     ebp, [drbar.line_inc_map]
717
;  drawing gradient bars
1292
; drawing gradient bars
718
        test    eax, 0x00800000
1293
        test    bh, 0x80
719
        jz      @f
1294
        jz      @f
720
        test    bh, bh
1295
        test    al, al
721
        jz      @f
1296
        jz      @f
722
        dec     bh
1297
        dec     al
-
 
1298
;--------------------------------------
-
 
1299
align 4
723
@@:
1300
@@:
724
; 
-
 
725
        dec     esi
1301
        dec     esi
726
        jnz     .new_y
1302
        jnz     .new_y
-
 
1303
;--------------------------------------
-
 
1304
align 4
-
 
1305
.end:
727
        add     esp, drbar.stack_data
1306
        add     esp, drbar.stack_data
728
        popad
1307
        popad
729
        xor     eax, eax
1308
        xor     eax, eax
730
        ret
1309
        ret
-
 
1310
;------------------------------------------------------------------------------
-
 
1311
align 4
-
 
1312
draw_bar_end_24_old:
-
 
1313
;--------------------------------------
-
 
1314
align 4
-
 
1315
.new_y:
-
 
1316
        mov     edi, [drbar.real_sx]
-
 
1317
;--------------------------------------
-
 
1318
align 4
-
 
1319
.new_x:
-
 
1320
        cmp     byte [ebp], bl
-
 
1321
        jne     .skip
-
 
1322
;--------------------------------------
-
 
1323
        mov     ecx, [drbar.real_sx_and_abs_cx]
-
 
1324
        sub     ecx, edi
-
 
1325
        shl     ecx, 16
-
 
1326
        add     ecx, [drbar.real_sy_and_abs_cy]
-
 
1327
        sub     ecx, esi
-
 
1328
; check mouse area for putpixel
-
 
1329
        call    check_mouse_area_for_putpixel
-
 
1330
; store to real LFB
-
 
1331
        mov     [edx], ax
-
 
1332
        shr     eax, 16
-
 
1333
        mov     [edx + 2], al
-
 
1334
        mov     eax, [drbar.color]
-
 
1335
;--------------------------------------
-
 
1336
align 4
-
 
1337
.skip:
-
 
1338
; add pixel
-
 
1339
        add     edx, 3
-
 
1340
        inc     ebp
-
 
1341
        dec     edi
-
 
1342
        jnz     .new_x
-
 
1343
; add line
-
 
1344
        add     edx, [drbar.line_inc_scr]
-
 
1345
        add     ebp, [drbar.line_inc_map]
-
 
1346
; drawing gradient bars
-
 
1347
        test    bh, 0x80
-
 
1348
        jz      @f
-
 
1349
        test    al, al
-
 
1350
        jz      @f
-
 
1351
        dec     al
-
 
1352
;--------------------------------------
-
 
1353
align 4
-
 
1354
@@:
-
 
1355
        dec     esi
-
 
1356
        jnz     .new_y
-
 
1357
        jmp     draw_bar_end_24.end
-
 
1358
;------------------------------------------------------------------------------
-
 
1359
align 4
-
 
1360
draw_bar_end_24_new:
-
 
1361
;--------------------------------------
-
 
1362
align 4
-
 
1363
.new_y:
-
 
1364
        mov     edi, [drbar.real_sx]
-
 
1365
;--------------------------------------
-
 
1366
align 4
-
 
1367
.new_x:
-
 
1368
        cmp     byte [ebp], bl
-
 
1369
        jne     .skip
-
 
1370
;--------------------------------------
-
 
1371
        mov     ecx, [drbar.real_sy_and_abs_cy]
-
 
1372
        sub     ecx, esi
-
 
1373
;--------------------------------------
-
 
1374
; check for Y
-
 
1375
        cmp     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
1376
        jb      .no_mouse_area
-
 
1377
 
-
 
1378
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
1379
        jae     .no_mouse_area
-
 
1380
 
-
 
1381
        rol     ecx, 16
-
 
1382
        add     ecx, [drbar.real_sx_and_abs_cx]
-
 
1383
        sub     ecx, edi
-
 
1384
;--------------------------------------
-
 
1385
; check for X
-
 
1386
        cmp     cx, [X_UNDER_subtraction_CUR_hot_x]
-
 
1387
        jb      .no_mouse_area
Line -... Line 1388...
-
 
1388
 
-
 
1389
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
1390
        jae     .no_mouse_area
-
 
1391
;--------------------------------------
-
 
1392
; check mouse area for putpixel
-
 
1393
        push    eax
-
 
1394
        call    check_mouse_area_for_putpixel_new.1
-
 
1395
        mov     [edx], ax
-
 
1396
        shr     eax, 16
-
 
1397
        mov     [edx + 2], al
-
 
1398
        pop     eax
-
 
1399
        jmp     .skip
-
 
1400
; store to real LFB
-
 
1401
;--------------------------------------
-
 
1402
align 4
-
 
1403
.no_mouse_area:
-
 
1404
        mov     [edx], ax
-
 
1405
        ror     eax, 16
-
 
1406
        mov     [edx + 2], al
-
 
1407
        rol     eax, 16
-
 
1408
;--------------------------------------
-
 
1409
align 4
-
 
1410
.skip:
-
 
1411
; add pixel
-
 
1412
        add     edx, 3
-
 
1413
        inc     ebp
-
 
1414
        dec     edi
-
 
1415
        jnz     .new_x
-
 
1416
; add line
-
 
1417
        add     edx, [drbar.line_inc_scr]
-
 
1418
        add     ebp, [drbar.line_inc_map]
-
 
1419
; drawing gradient bars
-
 
1420
        test    bh, 0x80
-
 
1421
        jz      @f
-
 
1422
        test    al, al
-
 
1423
        jz      @f
-
 
1424
        dec     al
-
 
1425
;--------------------------------------
-
 
1426
align 4
-
 
1427
@@:
-
 
1428
        dec     esi
-
 
1429
        jnz     .new_y
-
 
1430
        jmp     draw_bar_end_24.end
-
 
1431
;------------------------------------------------------------------------------
731
 
1432
align 4
-
 
1433
draw_bar_end_32:
-
 
1434
; eax - color high   RRGGBB
-
 
1435
; bl - process num
-
 
1436
; ecx - temp
-
 
1437
; edx - pointer to screen
-
 
1438
; esi - counter
-
 
1439
; edi - counter
-
 
1440
;--------------------------------------
732
draw_bar_end_32:
1441
; check for hardware cursor
733
        mov     eax, [drbar.color] ;; BBGGRR00
1442
        mov     ecx, [_display.select_cursor]
-
 
1443
        cmp     ecx, select_cursor
-
 
1444
        je      draw_bar_end_32_new
-
 
1445
        cmp     ecx, 0
-
 
1446
        je      draw_bar_end_32_old
734
        mov     esi, [drbar.real_sy]
1447
;--------------------------------------
735
align   4
1448
align 4
736
.new_y:
1449
.new_y:
-
 
1450
        mov     edi, [drbar.real_sx]
737
        mov     edi, [drbar.real_sx]
1451
;--------------------------------------
738
align   4
1452
align 4
739
.new_x:
1453
.new_x:
740
        cmp     byte [ebp], bl
1454
        cmp     byte [ebp], bl
741
        jne     .skip
-
 
-
 
1455
        jne     .skip
-
 
1456
;--------------------------------------
742
 
1457
; store to real LFB
-
 
1458
        mov     [edx], eax
-
 
1459
        mov     eax, [drbar.color]
-
 
1460
;--------------------------------------
743
        mov     [LFB_BASE+edx], eax
1461
align 4
744
.skip:
1462
.skip:
745
; add pixel
1463
; add pixel
746
        add     edx, 4
1464
        add     edx, 4
747
        inc     ebp
1465
        inc     ebp
748
        dec     edi
1466
        dec     edi
749
        jnz     .new_x
1467
        jnz     .new_x
750
; add line
1468
; add line
751
        add     edx, [drbar.line_inc_scr]
1469
        add     edx, [drbar.line_inc_scr]
752
        add     ebp, [drbar.line_inc_map]
1470
        add     ebp, [drbar.line_inc_map]
753
;  drawing gradient bars
1471
; drawing gradient bars
754
        test    eax, 0x80000000
1472
        test    bh, 0x80
755
        jz      @f
1473
        jz      @f
756
        test    al, al
1474
        test    al, al
757
        jz      @f
1475
        jz      @f
-
 
1476
        dec     al
-
 
1477
;--------------------------------------
758
        dec     al
1478
align 4
759
@@:
-
 
760
; 
1479
@@:
761
        dec     esi
1480
        dec     esi
-
 
1481
        jnz     .new_y
-
 
1482
;--------------------------------------
-
 
1483
align 4
762
        jnz     .new_y
1484
.end:
763
        add     esp, drbar.stack_data
1485
        add     esp, drbar.stack_data
-
 
1486
        popad
-
 
1487
        cmp     [SCR_MODE], dword 0x12
764
        popad
1488
        jne     @f
-
 
1489
        call    VGA_draw_bar
-
 
1490
;--------------------------------------
-
 
1491
align 4
765
        call    VGA_draw_bar
1492
@@:
766
        xor     eax, eax
1493
        xor     eax, eax
767
        mov     [EGA_counter], 1
1494
        mov     [EGA_counter], 1
-
 
1495
        ret
-
 
1496
;------------------------------------------------------------------------------
-
 
1497
align 4
-
 
1498
draw_bar_end_32_old:
-
 
1499
;--------------------------------------
-
 
1500
align 4
-
 
1501
.new_y:
-
 
1502
        mov     edi, [drbar.real_sx]
-
 
1503
;--------------------------------------
-
 
1504
align 4
-
 
1505
.new_x:
-
 
1506
        cmp     byte [ebp], bl
-
 
1507
        jne     .skip
-
 
1508
;--------------------------------------
-
 
1509
        mov     ecx, [drbar.real_sx_and_abs_cx]
-
 
1510
        sub     ecx, edi
-
 
1511
        shl     ecx, 16
-
 
1512
        add     ecx, [drbar.real_sy_and_abs_cy]
-
 
1513
        sub     ecx, esi
-
 
1514
 
-
 
1515
; check mouse area for putpixel
-
 
1516
        call    check_mouse_area_for_putpixel
-
 
1517
; store to real LFB
-
 
1518
        mov     [edx], eax
-
 
1519
        mov     eax, [drbar.color]
-
 
1520
;--------------------------------------
-
 
1521
align 4
-
 
1522
.skip:
-
 
1523
; add pixel
-
 
1524
        add     edx, 4
-
 
1525
        inc     ebp
-
 
1526
        dec     edi
-
 
1527
        jnz     .new_x
-
 
1528
; add line
-
 
1529
        add     edx, [drbar.line_inc_scr]
-
 
1530
        add     ebp, [drbar.line_inc_map]
-
 
1531
; drawing gradient bars
-
 
1532
        test    bh, 0x80
-
 
1533
        jz      @f
-
 
1534
        test    al, al
-
 
1535
        jz      @f
-
 
1536
        dec     al
-
 
1537
;--------------------------------------
-
 
1538
align 4
-
 
1539
@@:
-
 
1540
        dec     esi
-
 
1541
        jnz     .new_y
-
 
1542
        jmp     draw_bar_end_32.end
-
 
1543
;------------------------------------------------------------------------------
-
 
1544
align 4
-
 
1545
draw_bar_end_32_new:
-
 
1546
;--------------------------------------
-
 
1547
align 4
-
 
1548
.new_y:
-
 
1549
        mov     edi, [drbar.real_sx]
-
 
1550
;--------------------------------------
-
 
1551
align 4
-
 
1552
.new_x:
-
 
1553
        cmp     byte [ebp], bl
-
 
1554
        jne     .skip
-
 
1555
;--------------------------------------
-
 
1556
        mov     ecx, [drbar.real_sy_and_abs_cy]
-
 
1557
        sub     ecx, esi
-
 
1558
;--------------------------------------
-
 
1559
; check for Y
-
 
1560
        cmp     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
1561
        jb      .no_mouse_area
-
 
1562
 
-
 
1563
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
1564
        jae     .no_mouse_area
-
 
1565
 
-
 
1566
        rol     ecx, 16
-
 
1567
        add     ecx, [drbar.real_sx_and_abs_cx]
-
 
1568
        sub     ecx, edi
-
 
1569
;--------------------------------------
-
 
1570
; check for X
-
 
1571
        cmp     cx, [X_UNDER_subtraction_CUR_hot_x]
Line -... Line 1572...
-
 
1572
        jb      .no_mouse_area
-
 
1573
 
-
 
1574
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
1575
        jae     .no_mouse_area
-
 
1576
;--------------------------------------
-
 
1577
; check mouse area for putpixel
-
 
1578
        push    eax
-
 
1579
        call    check_mouse_area_for_putpixel_new.1
-
 
1580
        mov     [edx], eax
-
 
1581
        pop     eax
-
 
1582
        jmp     .skip
-
 
1583
; store to real LFB
-
 
1584
;--------------------------------------
-
 
1585
align 4
-
 
1586
.no_mouse_area:
-
 
1587
        mov     [edx], eax
-
 
1588
;--------------------------------------
-
 
1589
align 4
-
 
1590
.skip:
-
 
1591
; add pixel
-
 
1592
        add     edx, 4
-
 
1593
        inc     ebp
-
 
1594
        dec     edi
-
 
1595
        jnz     .new_x
-
 
1596
; add line
-
 
1597
        add     edx, [drbar.line_inc_scr]
-
 
1598
        add     ebp, [drbar.line_inc_map]
-
 
1599
; drawing gradient bars
-
 
1600
        test    bh, 0x80
-
 
1601
        jz      @f
-
 
1602
        test    al, al
-
 
1603
        jz      @f
-
 
1604
        dec     al
-
 
1605
;--------------------------------------
-
 
1606
align 4
-
 
1607
@@:
-
 
1608
        dec     esi
-
 
1609
        jnz     .new_y
768
        ret
1610
        jmp     draw_bar_end_32.end
769
 
1611
;------------------------------------------------------------------------------
770
align 4
-
 
771
vesa20_drawbackground_tiled:
1612
align 4
772
        call    [_display.disable_mouse]
1613
vesa20_drawbackground_tiled:
773
        pushad
1614
        pushad
-
 
1615
; External loop for all y from start to end
-
 
1616
        mov     ebx, [draw_data+32+RECT.top]    ; y start
774
; External loop for all y from start to end
1617
;--------------------------------------
775
        mov     ebx, [draw_data+32+RECT.top]    ; y start
1618
align 4
776
dp2:
1619
dp2:
777
        mov     ebp, [draw_data+32+RECT.left]   ; x start
1620
        mov     ebp, [draw_data+32+RECT.left]   ; x start
778
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
1621
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
779
;                       and LFB data (output for our function) [edi]
1622
;                       and LFB data (output for our function) [edi]
-
 
1623
;        mov     eax, [BytesPerScanLine]
780
        mov     eax, [BytesPerScanLine]
1624
;        mul     ebx
781
        mul     ebx
1625
        mov     eax, [BPSLine_calc_area+ebx*4]
782
        xchg    ebp, eax
1626
        xchg    ebp, eax
783
        add     ebp, eax
1627
        add     ebp, eax
784
        add     ebp, eax
1628
        add     ebp, eax
785
        add     ebp, eax
1629
        add     ebp, eax
786
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
1630
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
-
 
1631
        jz      @f
-
 
1632
        add     ebp, eax
787
        jz      @f
1633
;--------------------------------------
788
        add     ebp, eax
1634
align 4
789
@@:
1635
@@:
790
        add     ebp, LFB_BASE
1636
        add     ebp, LFB_BASE
791
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1637
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
Line 817... Line 1663...
817
; eax = x, ebx = y (screen coordinates)
1663
; eax = x, ebx = y (screen coordinates)
818
; ecx = deltax - number of pixels left in current tile block
1664
; ecx = deltax - number of pixels left in current tile block
819
; edx = 1
1665
; edx = 1
820
; esi -> bgr memory, edi -> output
1666
; esi -> bgr memory, edi -> output
821
; ebp = offset in WinMapAddress
1667
; ebp = offset in WinMapAddress
-
 
1668
;--------------------------------------
-
 
1669
align 4
822
dp3:
1670
dp3:
823
        cmp     [ebp], dl
1671
        cmp     [ebp], dl
824
        jnz     nbgp
1672
        jnz     nbgp
-
 
1673
;--------------------------------------
-
 
1674
        push    eax ecx
-
 
1675
 
825
        movsb
1676
        mov     ecx, eax
-
 
1677
        shl     ecx, 16
826
        movsb
1678
        add     ecx, ebx
-
 
1679
 
827
        movsb
1680
        mov     eax, [esi]
-
 
1681
 
-
 
1682
; check for hardware cursor
-
 
1683
        cmp     [_display.select_cursor], select_cursor
828
        jmp     @f
1684
        je      @f
-
 
1685
        cmp     [_display.select_cursor], 0
-
 
1686
        jne     .no_mouseunder
-
 
1687
;--------------------------------------
-
 
1688
align 4
-
 
1689
@@:
-
 
1690
        and     eax, 0xffffff
-
 
1691
; check mouse area for putpixel
-
 
1692
        call    [_display.check_mouse]
-
 
1693
;--------------------------------------
-
 
1694
align 4
-
 
1695
.no_mouseunder:
-
 
1696
; store to real LFB
-
 
1697
        mov     [edi], ax
-
 
1698
        shr     eax, 16
-
 
1699
        mov     [edi+2], al
-
 
1700
 
-
 
1701
        pop     ecx eax
-
 
1702
;--------------------------------------
-
 
1703
align 4
829
nbgp:
1704
nbgp:
830
        add     esi, 3
1705
        add     esi, 3
831
        add     edi, 3
1706
        add     edi, 3
-
 
1707
;--------------------------------------
-
 
1708
align 4
832
@@:
1709
@@:
833
        cmp     [ScreenBPP], byte 25    ; 24 or 32 bpp?
1710
        cmp     [ScreenBPP], byte 25    ; 24 or 32 bpp?
834
        sbb     edi, -1         ; +1 for 32 bpp
1711
        sbb     edi, -1         ; +1 for 32 bpp
835
; I do not use 'inc eax' because this is slightly slower then 'add eax,1'
1712
; I do not use 'inc eax' because this is slightly slower then 'add eax,1'
836
        add     ebp, edx
1713
        add     ebp, edx
Line 843... Line 1720...
843
        mov     ecx, [BgrDataWidth]
1720
        mov     ecx, [BgrDataWidth]
844
        sub     esi, ecx
1721
        sub     esi, ecx
845
        sub     esi, ecx
1722
        sub     esi, ecx
846
        sub     esi, ecx
1723
        sub     esi, ecx
847
        jmp     dp3
1724
        jmp     dp3
-
 
1725
;--------------------------------------
-
 
1726
align 4
848
dp4:
1727
dp4:
849
; next scan line
1728
; next scan line
850
        inc     ebx
1729
        inc     ebx
851
        cmp     ebx, [draw_data+32+RECT.bottom]
1730
        cmp     ebx, [draw_data+32+RECT.bottom]
852
        jbe     dp2
1731
        jbe     dp2
853
        popad
1732
        popad
854
        mov     [EGA_counter], 1
1733
        mov     [EGA_counter], 1
-
 
1734
        cmp     [SCR_MODE], dword 0x12
-
 
1735
        jne     @f
855
        call    VGA_drawbackground
1736
        call    VGA_drawbackground
-
 
1737
;--------------------------------------
-
 
1738
align 4
-
 
1739
@@:
856
        ret
1740
        ret
857
 
-
 
-
 
1741
;------------------------------------------------------------------------------
858
; ----------
1742
align 4
859
 
-
 
860
 
-
 
861
vesa20_drawbackground_stretch:
1743
vesa20_drawbackground_stretch:
862
        call    [_display.disable_mouse]
-
 
863
        pushad
1744
        pushad
864
; Helper variables
1745
; Helper variables
865
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
1746
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
866
        mov     eax, [BgrDataWidth]
1747
        mov     eax, [BgrDataWidth]
867
        dec     eax
1748
        dec     eax
Line 883... Line 1764...
883
; External loop for all y from start to end
1764
; External loop for all y from start to end
884
        mov     ebx, [draw_data+32+RECT.top]    ; y start
1765
        mov     ebx, [draw_data+32+RECT.top]    ; y start
885
        mov     ebp, [draw_data+32+RECT.left]   ; x start
1766
        mov     ebp, [draw_data+32+RECT.left]   ; x start
886
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
1767
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
887
;                       and LFB data (output for our function) [edi]
1768
;                       and LFB data (output for our function) [edi]
888
        mov     eax, [BytesPerScanLine]
1769
;        mov     eax, [BytesPerScanLine]
889
        mul     ebx
1770
;        mul     ebx
-
 
1771
        mov     eax, [BPSLine_calc_area+ebx*4]
890
        xchg    ebp, eax
1772
        xchg    ebp, eax
891
        add     ebp, eax
1773
        add     ebp, eax
892
        add     ebp, eax
1774
        add     ebp, eax
893
        add     ebp, eax
1775
        add     ebp, eax
894
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
1776
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
895
        jz      @f
1777
        jz      @f
896
        add     ebp, eax
1778
        add     ebp, eax
-
 
1779
;--------------------------------------
-
 
1780
align 4
897
@@:
1781
@@:
898
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1782
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
899
        call    calculate_edi
1783
        call    calculate_edi
900
        xchg    edi, ebp
1784
        xchg    edi, ebp
901
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
1785
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
Line 922... Line 1806...
922
        add     esi, [img_background]
1806
        add     esi, [img_background]
923
        push    eax
1807
        push    eax
924
        push    edx
1808
        push    edx
925
        push    esi
1809
        push    esi
926
; 3) Smooth horizontal
1810
; 3) Smooth horizontal
-
 
1811
;--------------------------------------
-
 
1812
align 4
927
bgr_resmooth0:
1813
bgr_resmooth0:
928
        mov     ecx, [esp+8]
1814
        mov     ecx, [esp+8]
929
        mov     edx, [esp+4]
1815
        mov     edx, [esp+4]
930
        mov     esi, [esp]
1816
        mov     esi, [esp]
931
        push    edi
1817
        push    edi
932
        mov     edi, bgr_cur_line
1818
        mov     edi, bgr_cur_line
933
        call    smooth_line
1819
        call    smooth_line
-
 
1820
;--------------------------------------
-
 
1821
align 4
934
bgr_resmooth1:
1822
bgr_resmooth1:
935
        mov     eax, [esp+16+4]
1823
        mov     eax, [esp+16+4]
936
        inc     eax
1824
        inc     eax
937
        cmp     eax, [BgrDataHeight]
1825
        cmp     eax, [BgrDataHeight]
938
        jae     bgr.no2nd
1826
        jae     bgr.no2nd
Line 942... Line 1830...
942
        add     esi, [BgrDataWidth]
1830
        add     esi, [BgrDataWidth]
943
        add     esi, [BgrDataWidth]
1831
        add     esi, [BgrDataWidth]
944
        add     esi, [BgrDataWidth]
1832
        add     esi, [BgrDataWidth]
945
        mov     edi, bgr_next_line
1833
        mov     edi, bgr_next_line
946
        call    smooth_line
1834
        call    smooth_line
-
 
1835
;--------------------------------------
-
 
1836
align 4
947
bgr.no2nd:
1837
bgr.no2nd:
948
        pop     edi
1838
        pop     edi
-
 
1839
;--------------------------------------
-
 
1840
align 4
949
sdp3:
1841
sdp3:
950
        xor     esi, esi
1842
        xor     esi, esi
951
        mov     ecx, [esp+12]
1843
        mov     ecx, [esp+12]
952
; 4) Loop through redraw rectangle and copy background data
1844
; 4) Loop through redraw rectangle and copy background data
953
; Registers meaning:
1845
; Registers meaning:
Line 959... Line 1851...
959
; dword [esp+20] = x
1851
; dword [esp+20] = x
960
; dword [esp+24] = y
1852
; dword [esp+24] = y
961
; precalculated constants:
1853
; precalculated constants:
962
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
1854
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
963
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
1855
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
-
 
1856
;--------------------------------------
-
 
1857
align 4
964
sdp3a:
1858
sdp3a:
965
        mov     eax, [_WinMapAddress]
1859
        mov     eax, [_WinMapAddress]
966
        cmp     [ebp+eax], byte 1
1860
        cmp     [ebp+eax], byte 1
967
        jnz     snbgp
1861
        jnz     snbgp
968
        mov     eax, [bgr_cur_line+esi]
1862
        mov     eax, [bgr_cur_line+esi]
969
        test    ecx, ecx
1863
        test    ecx, ecx
970
        jz      .novert
1864
        jz      .novert
971
        mov     ebx, [bgr_next_line+esi]
1865
        mov     ebx, [bgr_next_line+esi]
972
        call    [overlapping_of_points_ptr]
1866
        call    [overlapping_of_points_ptr]
-
 
1867
;--------------------------------------
-
 
1868
align 4
973
.novert:
1869
.novert:
-
 
1870
        push    ecx
-
 
1871
; check for hardware cursor
-
 
1872
        cmp     [_display.select_cursor], select_cursor
-
 
1873
        je      @f
-
 
1874
        cmp     [_display.select_cursor], 0
-
 
1875
        jne     .no_mouseunder
-
 
1876
;--------------------------------------
-
 
1877
align 4
974
 
1878
@@:
-
 
1879
        mov     ecx, [esp+20+4]        ;x
-
 
1880
        shl     ecx, 16
-
 
1881
        add     ecx, [esp+24+4]        ;y
-
 
1882
; check mouse area for putpixel
-
 
1883
        call    [_display.check_mouse]
-
 
1884
;--------------------------------------
-
 
1885
align 4
-
 
1886
.no_mouseunder:
-
 
1887
; store to real LFB
975
        mov     [LFB_BASE+edi], ax
1888
        mov     [LFB_BASE+edi], ax
976
        shr     eax, 16
1889
        shr     eax, 16
977
 
-
 
978
        mov     [LFB_BASE+edi+2], al
1890
        mov     [LFB_BASE+edi+2], al
-
 
1891
        pop     ecx
-
 
1892
;--------------------------------------
-
 
1893
align 4
979
snbgp:
1894
snbgp:
980
        cmp     [ScreenBPP], byte 25
1895
        cmp     [ScreenBPP], byte 25
981
        sbb     edi, -4
1896
        sbb     edi, -4
982
        add     ebp, 1
1897
        add     ebp, 1
983
        mov     eax, [esp+20]
1898
        mov     eax, [esp+20]
984
        add     eax, 1
1899
        add     eax, 1
985
        mov     [esp+20], eax
1900
        mov     [esp+20], eax
986
        add     esi, 4
1901
        add     esi, 4
987
        cmp     eax, [draw_data+32+RECT.right]
1902
        cmp     eax, [draw_data+32+RECT.right]
988
        jbe     sdp3a
1903
        jbe     sdp3a
-
 
1904
;--------------------------------------
-
 
1905
align 4
989
sdp4:
1906
sdp4:
990
; next y
1907
; next y
991
        mov     ebx, [esp+24]
1908
        mov     ebx, [esp+24]
992
        add     ebx, 1
1909
        add     ebx, 1
993
        mov     [esp+24], ebx
1910
        mov     [esp+24], ebx
Line 1002... Line 1919...
1002
        sub     edi, eax
1919
        sub     edi, eax
1003
        sub     edi, eax
1920
        sub     edi, eax
1004
        cmp     [ScreenBPP], byte 24
1921
        cmp     [ScreenBPP], byte 24
1005
        jz      @f
1922
        jz      @f
1006
        sub     edi, eax
1923
        sub     edi, eax
-
 
1924
;--------------------------------------
-
 
1925
align 4
1007
@@:
1926
@@:
1008
        add     edi, [BytesPerScanLine]
1927
        add     edi, [BytesPerScanLine]
1009
; restore ecx,edx; advance esi to next background line
1928
; restore ecx,edx; advance esi to next background line
1010
        mov     eax, [esp+28]
1929
        mov     eax, [esp+28]
1011
        mov     ebx, [esp+32]
1930
        mov     ebx, [esp+32]
Line 1028... Line 1947...
1028
        mov     edi, bgr_cur_line
1947
        mov     edi, bgr_cur_line
1029
        mov     ecx, [Screen_Max_X]
1948
        mov     ecx, [Screen_Max_X]
1030
        inc     ecx
1949
        inc     ecx
1031
        rep movsd
1950
        rep movsd
1032
        jmp     bgr_resmooth1
1951
        jmp     bgr_resmooth1
-
 
1952
;--------------------------------------
-
 
1953
align 4
1033
sdpdone:
1954
sdpdone:
1034
        add     esp, 44
1955
        add     esp, 44
1035
        popad
1956
        popad
1036
        mov     [EGA_counter], 1
1957
        mov     [EGA_counter], 1
-
 
1958
        cmp     [SCR_MODE], dword 0x12
-
 
1959
        jne     @f
1037
        call    VGA_drawbackground
1960
        call    VGA_drawbackground
-
 
1961
;--------------------------------------
-
 
1962
align 4
-
 
1963
@@:
1038
        ret
1964
        ret
Line 1039... Line 1965...
1039
 
1965
 
-
 
1966
uglobal
1040
uglobal
1967
;--------------------------------------
1041
align 4
1968
align 4
1042
bgr_cur_line    rd      1920    ; maximum width of screen
1969
bgr_cur_line    rd      1920    ; maximum width of screen
-
 
1970
bgr_next_line   rd      1920
1043
bgr_next_line   rd      1920
1971
;--------------------------------------
-
 
1972
endg
1044
endg
1973
;--------------------------------------
1045
 
1974
align 4
1046
smooth_line:
1975
smooth_line:
1047
        mov     al, [esi+2]
1976
        mov     al, [esi+2]
1048
        shl     eax, 16
1977
        shl     eax, 16
1049
        mov     ax, [esi]
1978
        mov     ax, [esi]
1050
        test    ecx, ecx
1979
        test    ecx, ecx
1051
        jz      @f
1980
        jz      @f
1052
        mov     ebx, [esi+2]
1981
        mov     ebx, [esi+2]
1053
        shr     ebx, 8
1982
        shr     ebx, 8
-
 
1983
        call    [overlapping_of_points_ptr]
-
 
1984
;--------------------------------------
1054
        call    [overlapping_of_points_ptr]
1985
align 4
1055
@@:
1986
@@:
1056
        stosd
1987
        stosd
1057
        mov     eax, [esp+20+8]
1988
        mov     eax, [esp+20+8]
1058
        add     eax, 1
1989
        add     eax, 1
Line 1064... Line 1995...
1064
        adc     edx, [esp+40+8]
1995
        adc     edx, [esp+40+8]
1065
        sub     eax, edx
1996
        sub     eax, edx
1066
        lea     eax, [eax*3]
1997
        lea     eax, [eax*3]
1067
        sub     esi, eax
1998
        sub     esi, eax
1068
        jmp     smooth_line
1999
        jmp     smooth_line
-
 
2000
;--------------------------------------
-
 
2001
align 4
1069
@@:
2002
@@:
1070
        mov     eax, [draw_data+32+RECT.left]
2003
        mov     eax, [draw_data+32+RECT.left]
1071
        mov     [esp+20+8], eax
2004
        mov     [esp+20+8], eax
1072
        ret
2005
        ret
1073
 
-
 
-
 
2006
;------------------------------------------------------------------------------
1074
align 16
2007
align 16
1075
overlapping_of_points:
2008
overlapping_of_points:
1076
if 0
2009
if 0
1077
; this version of procedure works, but is slower than next version
2010
; this version of procedure works, but is slower than next version
1078
        push    ecx edx
2011
        push    ecx edx
Line 1133... Line 2066...
1133
        pop     ecx
2066
        pop     ecx
1134
        ret
2067
        ret
1135
end if
2068
end if
Line 1136... Line 2069...
1136
 
2069
 
-
 
2070
iglobal
1137
iglobal
2071
;--------------------------------------
1138
align 4
2072
align 4
-
 
2073
overlapping_of_points_ptr       dd      overlapping_of_points
1139
overlapping_of_points_ptr       dd      overlapping_of_points
2074
;--------------------------------------
-
 
2075
endg
1140
endg
2076
;------------------------------------------------------------------------------
1141
 
2077
align 4
1142
init_background:
2078
init_background:
1143
        mov     edi, BgrAuxTable
2079
        mov     edi, BgrAuxTable
-
 
2080
        xor     edx, edx
-
 
2081
;--------------------------------------
1144
        xor     edx, edx
2082
align 4
1145
.loop2:
2083
.loop2:
1146
        mov     eax, edx
2084
        mov     eax, edx
1147
        shl     eax, 8
2085
        shl     eax, 8
1148
        neg     eax
2086
        neg     eax
-
 
2087
        mov     ecx, 0x200
-
 
2088
;--------------------------------------
1149
        mov     ecx, 0x200
2089
align 4
1150
.loop1:
2090
.loop1:
1151
        mov     byte [edi], ah
2091
        mov     byte [edi], ah
1152
        inc     edi
2092
        inc     edi
1153
        add     eax, edx
2093
        add     eax, edx
1154
        loop    .loop1
2094
        loop    .loop1
1155
        add     dl, 4
2095
        add     dl, 4
1156
        jnz     .loop2
2096
        jnz     .loop2
1157
        test    byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
2097
        test    byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
1158
        jz      @f
2098
        jz      @f
-
 
2099
        mov     [overlapping_of_points_ptr], overlapping_of_points_mmx
-
 
2100
;--------------------------------------
1159
        mov     [overlapping_of_points_ptr], overlapping_of_points_mmx
2101
align 4
1160
@@:
2102
@@:
1161
        ret
-
 
-
 
2103
        ret
1162
 
2104
;------------------------------------------------------------------------------
1163
align 16
2105
align 16
1164
overlapping_of_points_mmx:
2106
overlapping_of_points_mmx:
1165
        movd    mm0, eax
2107
        movd    mm0, eax
1166
        movd    mm4, eax
2108
        movd    mm4, eax
Line 1177... Line 2119...
1177
        psrlw   mm1, 8
2119
        psrlw   mm1, 8
1178
        packuswb mm1, mm2
2120
        packuswb mm1, mm2
1179
        paddb   mm4, mm1
2121
        paddb   mm4, mm1
1180
        movd    eax, mm4
2122
        movd    eax, mm4
1181
        ret
2123
        ret
-
 
2124
;------------------------------------------------------------------------------