Subversion Repositories Kolibri OS

Rev

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

Rev 1635 Rev 2434
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: 1420 $
20
$Revision: 2434 $
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 mouse area for putpixel
-
 
57
        test    ecx, 0x04000000  ; don't load to mouseunder area
-
 
58
        jnz     .no_mouseunder
-
 
59
        call    [_display.check_m_pixel]
-
 
60
        test    ecx, ecx        ;0xff000000
50
Vesa20_getpixel24:
61
        jnz     @f
51
; eax = x
62
.no_mouseunder:
52
; ebx = y
63
;--------------------------------------
53
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
64
        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
-
 
65
        lea     edi, [eax+eax*2]; edi = x*3
-
 
66
        add     edi, ebx      ; edi = x*3+(y*y multiplier)
-
 
67
        mov     ecx, [LFB_BASE+edi]
54
     lea     edi, [eax+eax*2] ; edi = x*3
68
;--------------------------------------
55
     add     edi, ebx         ; edi = x*3+(y*y multiplier)
69
align 4
-
 
70
@@:
56
     mov     ecx, [LFB_BASE+edi]
71
        and     ecx, 0xffffff
57
     and     ecx, 0xffffff
72
        ret
-
 
73
;-----------------------------------------------------------------------------
-
 
74
align 4
-
 
75
Vesa20_getpixel32:
-
 
76
;--------------------------------------
-
 
77
; check mouse area for putpixel
-
 
78
        test    ecx, 0x04000000  ; don't load to mouseunder area
-
 
79
        jnz     .no_mouseunder
-
 
80
        call    [_display.check_m_pixel]
-
 
81
        test    ecx, ecx        ;0xff000000
58
     ret
82
        jnz     @f
59
 
83
.no_mouseunder:
60
Vesa20_getpixel32:
84
;--------------------------------------
-
 
85
        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
-
 
86
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
-
 
87
        mov     ecx, [LFB_BASE+edi]
61
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
88
;--------------------------------------
62
     lea     edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
89
align 4
63
     mov     ecx, [LFB_BASE+edi]
-
 
64
     and     ecx, 0xffffff
90
@@:
65
     ret
-
 
66
 
91
        and     ecx, 0xffffff
67
;*************************************************
92
        ret
68
 
93
;-----------------------------------------------------------------------------
69
virtual at esp
94
virtual at esp
70
 putimg:
95
 putimg:
Line 78... Line 103...
78
   .abs_cx         dd ?
103
   .abs_cx         dd ?
79
   .abs_cy         dd ?
104
   .abs_cy         dd ?
80
   .line_increment dd ?
105
   .line_increment dd ?
81
   .winmap_newline dd ?
106
   .winmap_newline dd ?
82
   .screen_newline dd ?
107
   .screen_newline dd ?
-
 
108
   .real_sx_and_abs_cx dd ?
-
 
109
   .real_sy_and_abs_cy dd ?
83
   .stack_data = 4*12
110
   .stack_data = 4*14
84
   .edi         dd      ?
111
   .edi         dd      ?
85
   .esi         dd      ?
112
   .esi         dd      ?
86
   .ebp         dd      ?
113
   .ebp         dd      ?
87
   .esp         dd      ?
114
   .esp         dd      ?
88
   .ebx         dd      ?
115
   .ebx         dd      ?
Line 90... Line 117...
90
   .ecx         dd      ?
117
   .ecx         dd      ?
91
   .eax         dd      ?
118
   .eax         dd      ?
92
   .ret_addr    dd      ?
119
   .ret_addr    dd      ?
93
   .arg_0       dd      ?
120
   .arg_0       dd      ?
94
end virtual
121
end virtual
95
 
-
 
-
 
122
;-----------------------------------------------------------------------------
96
align 16
123
align 16
97
; ebx = pointer
124
; ebx = pointer
98
; ecx = size [x|y]
125
; ecx = size [x|y]
99
; edx = coordinates [x|y]
126
; edx = coordinates [x|y]
100
; ebp = pointer to 'get' function
127
; ebp = pointer to 'get' function
101
; esi = pointer to 'init' function
128
; esi = pointer to 'init' function
102
; edi = parameter for 'get' function
129
; edi = parameter for 'get' function
103
 
-
 
104
vesa20_putimage:
130
vesa20_putimage:
105
     pushad
131
        pushad
106
     call    [_display.disable_mouse]
-
 
107
     sub     esp, putimg.stack_data
132
        sub     esp, putimg.stack_data
108
; save pointer to image
133
; save pointer to image
109
     mov     [putimg.pti], ebx
134
        mov     [putimg.pti], ebx
110
; unpack the size
135
; unpack the size
111
     mov     eax, ecx
136
        mov     eax, ecx
Line 136... Line 161...
136
     sub     ebx, [putimg.image_cx]
161
        sub     ebx, [putimg.image_cx]
137
     ja      @f
162
        ja      @f
138
     add     esp, putimg.stack_data
163
        add     esp, putimg.stack_data
139
     popad
164
        popad
140
     ret
165
        ret
-
 
166
;--------------------------------------
-
 
167
align 4
141
@@:
168
@@:
142
     cmp     ebx, [putimg.image_sx]
169
        cmp     ebx, [putimg.image_sx]
143
     jbe     .end_x
170
        jbe     .end_x
144
     mov     ebx, [putimg.image_sx]
171
        mov     ebx, [putimg.image_sx]
-
 
172
;--------------------------------------
-
 
173
align 4
145
.end_x:
174
.end_x:
146
     mov     [putimg.real_sx], ebx
175
        mov     [putimg.real_sx], ebx
147
; init real_sy
176
; init real_sy
148
     mov     ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy
177
        mov     ebx, [eax-twdw + WDATA.box.height]; ebx = wnd_sy
149
; \begin{diamond}[20.08.2006]
178
; \begin{diamond}[20.08.2006]
Line 152... Line 181...
152
     sub     ebx, [putimg.image_cy]
181
        sub     ebx, [putimg.image_cy]
153
     ja      @f
182
        ja      @f
154
     add     esp, putimg.stack_data
183
        add     esp, putimg.stack_data
155
     popad
184
        popad
156
     ret
185
        ret
-
 
186
;--------------------------------------
-
 
187
align 4
157
@@:
188
@@:
158
     cmp     ebx, [putimg.image_sy]
189
        cmp     ebx, [putimg.image_sy]
159
     jbe     .end_y
190
        jbe     .end_y
160
     mov     ebx, [putimg.image_sy]
191
        mov     ebx, [putimg.image_sy]
-
 
192
;--------------------------------------
-
 
193
align 4
161
.end_y:
194
.end_y:
162
     mov     [putimg.real_sy], ebx
195
        mov     [putimg.real_sy], ebx
163
; line increment
196
; line increment
164
     mov     eax, [putimg.image_sx]
197
        mov     eax, [putimg.image_sx]
165
     mov     ecx, [putimg.real_sx]
198
        mov     ecx, [putimg.real_sx]
Line 196... Line 229...
196
     imul    eax, [Screen_Max_X]
229
        imul    eax, [Screen_Max_X]
197
     add     eax, [putimg.abs_cy]
230
        add     eax, [putimg.abs_cy]
198
     add     eax, [putimg.abs_cx]
231
        add     eax, [putimg.abs_cx]
199
     add     eax, [_WinMapAddress]
232
        add     eax, [_WinMapAddress]
200
     xchg    eax, ebp
233
        xchg    eax, ebp
-
 
234
;--------------------------------------
-
 
235
        mov     ecx, [putimg.real_sx]
-
 
236
        add     ecx, [putimg.abs_cx]
-
 
237
        mov     [putimg.real_sx_and_abs_cx], ecx
-
 
238
        mov     ecx, [putimg.real_sy]
-
 
239
        add     ecx, [putimg.abs_cy]
-
 
240
        mov     [putimg.real_sy_and_abs_cy], ecx
-
 
241
;--------------------------------------
201
; get process number
242
; get process number
202
     mov     ebx, [CURRENT_TASK]
243
        mov     ebx, [CURRENT_TASK]
203
     cmp     byte [ScreenBPP], 32
244
        cmp     byte [ScreenBPP], 32
204
     je      put_image_end_32
245
        je      put_image_end_32
205
;put_image_end_24:
246
;put_image_end_24:
206
     mov     edi, [putimg.real_sy]
247
        mov     edi, [putimg.real_sy]
-
 
248
;--------------------------------------
207
align   4
249
align 4
208
.new_line:
250
.new_line:
209
     mov     ecx, [putimg.real_sx]
251
        mov     ecx, [putimg.real_sx]
210
;     push    ebp edx
252
;     push    ebp edx
-
 
253
;--------------------------------------
211
align   4
254
align 4
212
.new_x:
255
.new_x:
213
     push    [putimg.edi]
256
        push    [putimg.edi]
214
     mov     eax, [putimg.ebp+4]
257
        mov     eax, [putimg.ebp+4]
215
     call    eax
258
        call    eax
216
     cmp     [ebp], bl
259
        cmp     [ebp], bl
217
     jne     .skip
260
        jne     .skip
-
 
261
;--------------------------------------
-
 
262
        push    ecx
-
 
263
 
-
 
264
        neg     ecx
218
;     mov     eax, [esi]        ; eax = RRBBGGRR
265
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
-
 
266
        shl     ecx, 16
-
 
267
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
-
 
268
        sub     ecx, edi
-
 
269
 
-
 
270
; check mouse area for putpixel
-
 
271
        call    [_display.check_mouse]
-
 
272
        pop     ecx
-
 
273
; store to real LFB
219
     mov     [LFB_BASE+edx], ax
274
        mov     [LFB_BASE+edx], ax
220
     shr     eax, 16
275
        shr     eax, 16
221
     mov     [LFB_BASE+edx+2], al
276
        mov     [LFB_BASE+edx+2], al
-
 
277
;--------------------------------------
-
 
278
align 4
222
.skip:
279
.skip:
223
;     add     esi, 3 ;[putimg.source_bpp]
280
;     add     esi, 3 ;[putimg.source_bpp]
224
     add     edx, 3
281
        add     edx, 3
225
     inc     ebp
282
        inc     ebp
226
     dec     ecx
283
        dec     ecx
Line 234... Line 291...
234
     jz      .correct
291
        jz      .correct
235
     cmp     [putimg.ebp], putimage_get2bpp
292
        cmp     [putimg.ebp], putimage_get2bpp
236
     jz      .correct
293
        jz      .correct
237
     cmp     [putimg.ebp], putimage_get4bpp
294
        cmp     [putimg.ebp], putimage_get4bpp
238
     jnz     @f
295
        jnz     @f
-
 
296
;--------------------------------------
-
 
297
align 4
239
.correct:
298
.correct:
240
     mov     eax, [putimg.edi]
299
        mov     eax, [putimg.edi]
241
     mov     byte [eax], 80h
300
        mov     byte [eax], 80h
-
 
301
;--------------------------------------
-
 
302
align 4
242
@@:
303
@@:
243
     dec     edi
304
        dec     edi
244
     jnz     .new_line
305
        jnz     .new_line
-
 
306
;--------------------------------------
-
 
307
align 4
245
.finish:
308
.finish:
246
     add     esp, putimg.stack_data
309
        add     esp, putimg.stack_data
247
     popad
310
        popad
248
     ret
311
        ret
-
 
312
;------------------------------------------------------------------------------
249
 
313
align 4
250
put_image_end_32:
314
put_image_end_32:
251
     mov     edi, [putimg.real_sy]
315
        mov     edi, [putimg.real_sy]
-
 
316
;--------------------------------------
252
align   4
317
align 4
253
.new_line:
318
.new_line:
254
     mov     ecx, [putimg.real_sx]
319
        mov     ecx, [putimg.real_sx]
255
;     push    ebp edx
320
;     push    ebp edx
-
 
321
;--------------------------------------
256
align   4
322
align 4
257
.new_x:
323
.new_x:
258
     push    [putimg.edi]
324
        push    [putimg.edi]
259
     mov     eax, [putimg.ebp+4]
325
        mov     eax, [putimg.ebp+4]
260
     call    eax
326
        call    eax
261
     cmp     [ebp], bl
327
        cmp     [ebp], bl
262
     jne     .skip
328
        jne     .skip
-
 
329
;--------------------------------------
-
 
330
        push    ecx
-
 
331
 
-
 
332
        neg     ecx
263
;     mov     eax, [esi]        ; ecx = RRBBGGRR
333
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
-
 
334
        shl     ecx, 16
-
 
335
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
-
 
336
        sub     ecx, edi
-
 
337
 
-
 
338
; check mouse area for putpixel
-
 
339
        call    [_display.check_mouse]
-
 
340
        pop     ecx
-
 
341
; store to real LFB
264
     mov     [LFB_BASE+edx], eax
342
        mov     [LFB_BASE+edx], eax
-
 
343
;--------------------------------------
-
 
344
align 4
265
.skip:
345
.skip:
266
;     add     esi, [putimg.source_bpp]
346
;     add     esi, [putimg.source_bpp]
267
     add     edx, 4
347
        add     edx, 4
268
     inc     ebp
348
        inc     ebp
269
     dec     ecx
349
        dec     ecx
Line 277... Line 357...
277
     jz      .correct
357
        jz      .correct
278
     cmp     [putimg.ebp], putimage_get2bpp
358
        cmp     [putimg.ebp], putimage_get2bpp
279
     jz      .correct
359
        jz      .correct
280
     cmp     [putimg.ebp], putimage_get4bpp
360
        cmp     [putimg.ebp], putimage_get4bpp
281
     jnz     @f
361
        jnz     @f
-
 
362
;--------------------------------------
-
 
363
align 4
282
.correct:
364
.correct:
283
     mov     eax, [putimg.edi]
365
        mov     eax, [putimg.edi]
284
     mov     byte [eax], 80h
366
        mov     byte [eax], 80h
-
 
367
;--------------------------------------
-
 
368
align 4
285
@@:
369
@@:
286
     dec     edi
370
        dec     edi
287
     jnz     .new_line
371
        jnz     .new_line
-
 
372
;--------------------------------------
-
 
373
align 4
288
.finish:
374
.finish:
289
     add     esp, putimg.stack_data
375
        add     esp, putimg.stack_data
290
     popad
376
        popad
291
     call   VGA__putimage
377
        call    VGA__putimage
292
     mov     [EGA_counter],1
378
        mov     [EGA_counter], 1
293
     ret
379
        ret
294
 
-
 
295
 
-
 
296
;*************************************************
380
;------------------------------------------------------------------------------
297
align 4
381
align 4
298
__sys_putpixel:
382
__sys_putpixel:
Line 299... Line 383...
299
 
383
 
300
; eax = x coordinate
384
; eax = x coordinate
301
; ebx = y coordinate
385
; ebx = y coordinate
-
 
386
; ecx = ?? RR GG BB    ; 0x01000000 negation
-
 
387
                       ; 0x02000000 used for draw_rectangle without top line
302
; ecx = ?? RR GG BB    ; 0x01000000 negation
388
                       ;            for example drawwindow_III and drawwindow_IV
Line 303... Line 389...
303
; edi = 0x00000001 force
389
; edi = 0x00000001 force
304
 
390
 
305
;;;        mov  [novesachecksum], dword 0
391
;;;        mov  [novesachecksum], dword 0
Line 319... Line 405...
319
     add  eax, [_WinMapAddress]
405
        add     eax, [_WinMapAddress]
320
     movzx  edx, byte [eax+edx]
406
        movzx   edx, byte [eax+edx]
321
     cmp edx, [CURRENT_TASK]
407
        cmp     edx, [CURRENT_TASK]
322
     pop eax
408
        pop     eax
323
     jne .exit
409
        jne     .exit
-
 
410
;--------------------------------------
324
 
411
align 4
325
.forced:
412
.forced:
326
; check if negation
413
; check if negation
327
     test  ecx,0x01000000
414
        test    ecx, 0x01000000
328
     jz    .noneg
415
        jz      .noneg
-
 
416
 
329
     call  getpixel
417
        call    getpixel
330
     not   ecx
418
        not     ecx
-
 
419
 
-
 
420
        rol     ecx, 8
-
 
421
        mov     cl, [esp+32-8+3]
-
 
422
        ror     ecx, 8
331
     mov   [esp+32-8],ecx
423
        mov     [esp+32-8], ecx
-
 
424
;--------------------------------------
-
 
425
align 4
332
.noneg:
426
.noneg:
333
; OK to set pixel
427
; OK to set pixel
334
     call  dword [PUTPIXEL]    ; call the real put_pixel function
428
        call    dword [PUTPIXEL]; call the real put_pixel function
-
 
429
;--------------------------------------
-
 
430
align 4
335
.exit:
431
.exit:
336
     popad
432
        popad
337
     ret
433
        ret
338
 
-
 
-
 
434
;-----------------------------------------------------------------------------
339
align 4
435
align 4
340
Vesa20_putpixel24:
436
Vesa20_putpixel24:
341
; eax = x
437
; eax = x
342
; ebx = y
438
; ebx = y
-
 
439
        mov     ecx, eax
-
 
440
        shl     ecx, 16
-
 
441
        mov     cx, bx
-
 
442
 
343
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
443
        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
344
     lea     edi, [eax+eax*2]  ; edi = x*3
444
        lea     edi, [eax+eax*2]; edi = x*3
345
     mov     eax, [esp+32-8+4]
445
        mov     eax, [esp+32-8+4]
-
 
446
;--------------------------------------
-
 
447
; check mouse area for putpixel
-
 
448
        test    eax, 0x04000000
-
 
449
        jnz     @f
-
 
450
        call    [_display.check_mouse]
-
 
451
;--------------------------------------
-
 
452
align 4
-
 
453
@@:
-
 
454
; store to real LFB
346
     mov     [LFB_BASE+ebx+edi], ax
455
        mov     [LFB_BASE+ebx+edi], ax
347
     shr     eax, 16
456
        shr     eax, 16
348
     mov     [LFB_BASE+ebx+edi+2], al
457
        mov     [LFB_BASE+ebx+edi+2], al
-
 
458
;--------------------------------------
349
     ret
459
        ret
350
 
-
 
351
 
-
 
-
 
460
;-----------------------------------------------------------------------------
352
align 4
461
align 4
353
Vesa20_putpixel32:
462
Vesa20_putpixel32:
354
; eax = x
463
; eax = x
355
; ebx = y
464
; ebx = y
-
 
465
        mov     ecx, eax
-
 
466
        shl     ecx, 16
-
 
467
        mov     cx, bx
-
 
468
 
356
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
469
        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
357
     lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
470
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
358
     mov     eax, [esp+32-8+4] ; eax = color
471
        mov     eax, [esp+32-8+4]; eax = color
-
 
472
;--------------------------------------
-
 
473
; check mouse area for putpixel
-
 
474
        test    eax, 0x04000000
-
 
475
        jnz     @f
-
 
476
        call    [_display.check_mouse]
-
 
477
;--------------------------------------
-
 
478
align 4
-
 
479
@@:
-
 
480
        and     eax, 0xffffff
-
 
481
; store to real LFB
359
     mov     [LFB_BASE+edi], eax
482
        mov     [LFB_BASE+edi], eax
-
 
483
;--------------------------------------
360
     ret
484
        ret
361
 
-
 
362
;*************************************************
485
;-----------------------------------------------------------------------------
363
 
-
 
364
;align 4
486
align 4
365
calculate_edi:
487
calculate_edi:
366
     mov     edi, ebx
488
        mov     edi, ebx
367
     imul    edi, [Screen_Max_X]
489
        imul    edi, [Screen_Max_X]
368
     add     edi, ebx
490
        add     edi, ebx
369
     add     edi, eax
491
        add     edi, eax
370
     ret
492
        ret
371
 
-
 
372
;*************************************************
493
;-----------------------------------------------------------------------------
373
 
-
 
374
; DRAWLINE
494
; DRAWLINE
375
 
-
 
-
 
495
;-----------------------------------------------------------------------------
376
align 4
496
align 4
377
__sys_draw_line:
497
__sys_draw_line:
378
;     inc   [mouse_pause]
-
 
379
     call    [_display.disable_mouse]
-
 
380
 
-
 
381
; draw a line
498
; draw a line
382
; eax = HIWORD = x1
499
; eax = HIWORD = x1
383
;       LOWORD = x2
500
;       LOWORD = x2
384
; ebx = HIWORD = y1
501
; ebx = HIWORD = y1
385
;       LOWORD = y2
502
;       LOWORD = y2
Line 412... Line 529...
412
     jg      .no_vline     ; x1 > x2 ?
529
        jg      .no_vline  ; x1 > x2 ?
413
     mov     edx, ebp      ; else (if x1=x2)
530
        mov     edx, ebp   ; else (if x1=x2)
414
     call    vline
531
        call    vline
415
     push    edx    ; necessary to rightly restore stack frame at .exit
532
        push    edx ; necessary to rightly restore stack frame at .exit
416
     jmp     .exit
533
        jmp     .exit
-
 
534
;--------------------------------------
-
 
535
align 4
417
.x2lx1:
536
.x2lx1:
418
     neg     esi            ; get esi absolute value
537
        neg     esi         ; get esi absolute value
-
 
538
;--------------------------------------
-
 
539
align 4
419
.no_vline:
540
.no_vline:
420
; checking y-axis...
541
; checking y-axis...
421
     sub     ebp, ebx       ; ebp = y2-y1
542
        sub     ebp, ebx    ; ebp = y2-y1
422
     push    ebp            ; save y2-y1
543
        push    ebp         ; save y2-y1
423
     jl      .y2ly1         ; is y2 less than y1 ?
544
        jl      .y2ly1      ; is y2 less than y1 ?
424
     jg      .no_hline      ; y1 > y2 ?
545
        jg      .no_hline   ; y1 > y2 ?
425
     mov     edx, [dl_x2]   ; else (if y1=y2)
546
        mov     edx, [dl_x2]; else (if y1=y2)
426
     call    hline
547
        call    hline
427
     jmp     .exit
548
        jmp     .exit
-
 
549
;--------------------------------------
428
 
550
align 4
429
.y2ly1:
551
.y2ly1:
430
     neg     ebp            ; get ebp absolute value
552
        neg     ebp         ; get ebp absolute value
-
 
553
;--------------------------------------
-
 
554
align 4
431
.no_hline:
555
.no_hline:
432
     cmp     ebp, esi
556
        cmp     ebp, esi
433
     jle     .x_rules       ; |y2-y1| < |x2-x1|  ?
557
        jle     .x_rules    ; |y2-y1| < |x2-x1|  ?
434
     cmp     [dl_y2], ebx   ; make sure y1 is at the begining
558
        cmp     [dl_y2], ebx; make sure y1 is at the begining
435
     jge     .no_reverse1
559
        jge     .no_reverse1
Line 438... Line 562...
438
     mov     [dl_x2], eax
562
        mov     [dl_x2], eax
439
     mov     [dl_x1], edx
563
        mov     [dl_x1], edx
440
     mov     edx, [dl_y2]
564
        mov     edx, [dl_y2]
441
     mov     [dl_y2], ebx
565
        mov     [dl_y2], ebx
442
     mov     [dl_y1], edx
566
        mov     [dl_y1], edx
-
 
567
;--------------------------------------
-
 
568
align 4
443
.no_reverse1:
569
.no_reverse1:
444
     mov     eax, [dl_dx]
570
        mov     eax, [dl_dx]
445
     cdq                    ; extend eax sing to edx
571
        cdq                 ; extend eax sing to edx
446
     shl     eax, 16        ; using 16bit fix-point maths
572
        shl     eax, 16     ; using 16bit fix-point maths
447
     idiv    ebp            ; eax = ((x2-x1)*65536)/(y2-y1)
573
        idiv    ebp         ; eax = ((x2-x1)*65536)/(y2-y1)
-
 
574
;--------------------------------------
-
 
575
; correction for the remainder of the division
-
 
576
        shl     edx, 1
-
 
577
        cmp     ebp, edx
-
 
578
        jb      @f
-
 
579
        inc     eax
-
 
580
;--------------------------------------
-
 
581
align 4
-
 
582
@@:
-
 
583
;--------------------------------------
448
     mov     edx, ebp       ; edx = counter (number of pixels to draw)
584
        mov     edx, ebp    ; edx = counter (number of pixels to draw)
449
     mov     ebp, 1 *65536  ; <<16   ; ebp = dy = 1.0
585
        mov     ebp, 1 *65536; <<16   ; ebp = dy = 1.0
450
     mov     esi, eax       ; esi = dx
586
        mov     esi, eax    ; esi = dx
451
     jmp     .y_rules
587
        jmp     .y_rules
-
 
588
;--------------------------------------
452
 
589
align 4
453
.x_rules:
590
.x_rules:
454
     cmp     [dl_x2], eax    ; make sure x1 is at the begining
591
        cmp     [dl_x2], eax ; make sure x1 is at the begining
455
     jge     .no_reverse2
592
        jge     .no_reverse2
456
     neg     dword [dl_dy]
593
        neg     dword [dl_dy]
457
     mov     edx, [dl_x2]
594
        mov     edx, [dl_x2]
458
     mov     [dl_x2], eax
595
        mov     [dl_x2], eax
459
     mov     [dl_x1], edx
596
        mov     [dl_x1], edx
460
     mov     edx, [dl_y2]
597
        mov     edx, [dl_y2]
461
     mov     [dl_y2], ebx
598
        mov     [dl_y2], ebx
462
     mov     [dl_y1], edx
599
        mov     [dl_y1], edx
-
 
600
;--------------------------------------
-
 
601
align 4
463
.no_reverse2:
602
.no_reverse2:
464
     xor     edx, edx
603
        xor     edx, edx
465
     mov     eax, [dl_dy]
604
        mov     eax, [dl_dy]
466
     cdq                    ; extend eax sing to edx
605
        cdq                 ; extend eax sing to edx
467
     shl     eax, 16        ; using 16bit fix-point maths
606
        shl     eax, 16     ; using 16bit fix-point maths
468
     idiv    esi            ; eax = ((y2-y1)*65536)/(x2-x1)
607
        idiv    esi         ; eax = ((y2-y1)*65536)/(x2-x1)
-
 
608
;--------------------------------------
-
 
609
; correction for the remainder of the division
-
 
610
        shl     edx, 1
-
 
611
        cmp     esi, edx
-
 
612
        jb      @f
-
 
613
        inc     eax
-
 
614
;--------------------------------------
-
 
615
align 4
-
 
616
@@:
-
 
617
;--------------------------------------
469
     mov     edx, esi       ; edx = counter (number of pixels to draw)
618
        mov     edx, esi    ; edx = counter (number of pixels to draw)
470
     mov     esi, 1 *65536  ;<< 16   ; esi = dx = 1.0
619
        mov     esi, 1 *65536;<< 16   ; esi = dx = 1.0
471
     mov     ebp, eax       ; ebp = dy
620
        mov     ebp, eax    ; ebp = dy
-
 
621
;--------------------------------------
-
 
622
align 4
472
.y_rules:
623
.y_rules:
473
     mov     eax, [dl_x1]
624
        mov     eax, [dl_x1]
474
     mov     ebx, [dl_y1]
625
        mov     ebx, [dl_y1]
475
     shl     eax, 16
626
        shl     eax, 16
476
     shl     ebx, 16
627
        shl     ebx, 16
-
 
628
;-----------------------------------------------------------------------------
477
align 4
629
align 4
478
.draw:
630
.draw:
479
     push    eax ebx
631
        push    eax ebx
-
 
632
;--------------------------------------
-
 
633
; correction for the remainder of the division
-
 
634
        test    ah, 0x80
-
 
635
        jz      @f
-
 
636
        add     eax, 1 shl 16
-
 
637
;--------------------------------------
-
 
638
align 4
-
 
639
@@:
-
 
640
;--------------------------------------
480
     shr     eax, 16
641
        shr     eax, 16
-
 
642
;--------------------------------------
-
 
643
; correction for the remainder of the division
-
 
644
        test    bh, 0x80
-
 
645
        jz      @f
-
 
646
        add     ebx, 1 shl 16
-
 
647
;--------------------------------------
-
 
648
align 4
-
 
649
@@:
-
 
650
;--------------------------------------
481
     shr     ebx, 16
651
        shr     ebx, 16
-
 
652
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
482
     call    [putpixel]
653
        call    [putpixel]
483
     pop     ebx eax
654
        pop     ebx eax
484
     add     ebx, ebp        ; y = y+dy
655
        add     ebx, ebp     ; y = y+dy
485
     add     eax, esi        ; x = x+dx
656
        add     eax, esi     ; x = x+dx
486
     dec     edx
657
        dec     edx
487
     jnz     .draw
658
        jnz     .draw
488
; force last drawn pixel to be at (x2,y2)
659
; force last drawn pixel to be at (x2,y2)
489
     mov     eax, [dl_x2]
660
        mov     eax, [dl_x2]
490
     mov     ebx, [dl_y2]
661
        mov     ebx, [dl_y2]
-
 
662
        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
491
     call    [putpixel]
663
        call    [putpixel]
-
 
664
;--------------------------------------
-
 
665
align 4
492
.exit:
666
.exit:
493
     add     esp, 6*4
667
        add     esp, 6*4
494
     popa
668
        popa
495
;     dec   [mouse_pause]
-
 
496
     call   [draw_pointer]
669
;        call    [draw_pointer]
497
     ret
670
        ret
498
 
-
 
-
 
671
;------------------------------------------------------------------------------
499
 
672
align 4
500
hline:
673
hline:
501
; draw an horizontal line
674
; draw an horizontal line
502
; eax = x1
675
; eax = x1
503
; edx = x2
676
; edx = x2
504
; ebx = y
677
; ebx = y
Line 506... Line 679...
506
; edi = force ?
679
; edi = force ?
507
     push    eax edx
680
        push    eax edx
508
     cmp     edx, eax      ; make sure x2 is above x1
681
        cmp     edx, eax   ; make sure x2 is above x1
509
     jge     @f
682
        jge     @f
510
     xchg    eax, edx
683
        xchg    eax, edx
-
 
684
;--------------------------------------
511
align   4
685
align 4
512
@@:
686
@@:
-
 
687
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
513
     call    [putpixel]
688
        call    [putpixel]
514
     inc     eax
689
        inc     eax
515
     cmp     eax, edx
690
        cmp     eax, edx
516
     jle     @b
691
        jle     @b
517
     pop     edx eax
692
        pop     edx eax
518
     ret
693
        ret
519
 
-
 
-
 
694
;------------------------------------------------------------------------------
520
 
695
align 4
521
vline:
696
vline:
522
; draw a vertical line
697
; draw a vertical line
523
; eax = x
698
; eax = x
524
; ebx = y1
699
; ebx = y1
525
; edx = y2
700
; edx = y2
Line 527... Line 702...
527
; edi = force ?
702
; edi = force ?
528
     push    ebx edx
703
        push    ebx edx
529
     cmp     edx, ebx      ; make sure y2 is above y1
704
        cmp     edx, ebx   ; make sure y2 is above y1
530
     jge     @f
705
        jge     @f
531
     xchg    ebx, edx
706
        xchg    ebx, edx
-
 
707
;--------------------------------------
532
align   4
708
align 4
533
@@:
709
@@:
-
 
710
        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
534
     call    [putpixel]
711
        call    [putpixel]
535
     inc     ebx
712
        inc     ebx
536
     cmp     ebx, edx
713
        cmp     ebx, edx
537
     jle     @b
714
        jle     @b
538
     pop     edx ebx
715
        pop     edx ebx
539
     ret
716
        ret
540
 
-
 
541
 
-
 
542
;*************************************************
717
;------------------------------------------------------------------------------
543
 
-
 
544
 
718
align 4
545
virtual at esp
719
virtual at esp
546
drbar:
720
drbar:
547
     .bar_sx       dd ?
721
     .bar_sx       dd ?
548
     .bar_sy       dd ?
722
     .bar_sy       dd ?
549
     .bar_cx       dd ?
723
     .bar_cx       dd ?
Line 553... Line 727...
553
     .real_sx      dd ?
727
     .real_sx      dd ?
554
     .real_sy      dd ?
728
     .real_sy      dd ?
555
     .color        dd ?
729
     .color        dd ?
556
     .line_inc_scr dd ?
730
     .line_inc_scr dd ?
557
     .line_inc_map dd ?
731
     .line_inc_map dd ?
-
 
732
     .real_sx_and_abs_cx dd ?
-
 
733
     .real_sy_and_abs_cy dd ?
558
     .stack_data = 4*11
734
     .stack_data = 4*13
559
end virtual
735
end virtual
560
 
-
 
-
 
736
;--------------------------------------
561
align 4
737
align 4
562
; eax   cx
738
; eax   cx
563
; ebx   cy
739
; ebx   cy
564
; ecx   xe
740
; ecx   xe
565
; edx   ye
741
; edx   ye
566
; edi   color
742
; edi   color
567
vesa20_drawbar:
743
vesa20_drawbar:
568
     pushad
744
        pushad
569
     call    [_display.disable_mouse]
-
 
570
     sub     esp, drbar.stack_data
745
        sub     esp, drbar.stack_data
571
     mov     [drbar.color], edi
746
        mov     [drbar.color], edi
572
     sub     edx, ebx
747
        sub     edx, ebx
573
     jle     .exit          ;// mike.dld, 2005-01-29
748
        jle     .exit       ;// mike.dld, 2005-01-29
574
     sub     ecx, eax
749
        sub     ecx, eax
Line 588... Line 763...
588
; note that WDATA.box.width is one pixel less than real window x-size
763
; note that WDATA.box.width is one pixel less than real window x-size
589
     inc     ebx
764
        inc     ebx
590
; \end{diamond}[20.08.2006]
765
; \end{diamond}[20.08.2006]
591
     sub     ebx, [drbar.bar_cx]
766
        sub     ebx, [drbar.bar_cx]
592
     ja      @f
767
        ja      @f
-
 
768
;--------------------------------------
-
 
769
align 4
593
.exit:                       ;// mike.dld, 2005-01-29
770
.exit:                       ;// mike.dld, 2005-01-29
594
     add     esp, drbar.stack_data
771
        add     esp, drbar.stack_data
595
     popad
772
        popad
596
     xor     eax, eax
773
        xor     eax, eax
597
     inc     eax
774
        inc     eax
598
     ret
775
        ret
-
 
776
;--------------------------------------
-
 
777
align 4
599
@@:
778
@@:
600
     cmp     ebx, [drbar.bar_sx]
779
        cmp     ebx, [drbar.bar_sx]
601
     jbe     .end_x
780
        jbe     .end_x
602
     mov     ebx, [drbar.bar_sx]
781
        mov     ebx, [drbar.bar_sx]
-
 
782
;--------------------------------------
-
 
783
align 4
603
.end_x:
784
.end_x:
604
     mov     [drbar.real_sx], ebx
785
        mov     [drbar.real_sx], ebx
605
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
786
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
606
     mov     ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy
787
        mov     ebx, [edi-twdw + WDATA.box.height]; ebx = wnd_sy
607
; \begin{diamond}[20.08.2006]
788
; \begin{diamond}[20.08.2006]
Line 612... Line 793...
612
     add     esp, drbar.stack_data
793
        add     esp, drbar.stack_data
613
     popad
794
        popad
614
     xor     eax, eax
795
        xor     eax, eax
615
     inc     eax
796
        inc     eax
616
     ret
797
        ret
-
 
798
;--------------------------------------
-
 
799
align 4
617
@@:
800
@@:
618
     cmp     ebx, [drbar.bar_sy]
801
        cmp     ebx, [drbar.bar_sy]
619
     jbe     .end_y
802
        jbe     .end_y
620
     mov     ebx, [drbar.bar_sy]
803
        mov     ebx, [drbar.bar_sy]
-
 
804
;--------------------------------------
-
 
805
align 4
621
.end_y:
806
.end_y:
622
     mov     [drbar.real_sy], ebx
807
        mov     [drbar.real_sy], ebx
623
; line_inc_map
808
; line_inc_map
624
     mov     eax, [Screen_Max_X]
809
        mov     eax, [Screen_Max_X]
625
     sub     eax, [drbar.real_sx]
810
        sub     eax, [drbar.real_sx]
Line 646... Line 831...
646
     imul    eax, [Screen_Max_X]
831
        imul    eax, [Screen_Max_X]
647
     add     eax, [drbar.abs_cy]
832
        add     eax, [drbar.abs_cy]
648
     add     eax, [drbar.abs_cx]
833
        add     eax, [drbar.abs_cx]
649
     add     eax, [_WinMapAddress]
834
        add     eax, [_WinMapAddress]
650
     xchg    eax, ebp
835
        xchg    eax, ebp
-
 
836
;--------------------------------------
-
 
837
        mov     ebx, [drbar.real_sx]
-
 
838
        add     ebx, [drbar.abs_cx]
-
 
839
        mov     [drbar.real_sx_and_abs_cx], ebx
-
 
840
        mov     ebx, [drbar.real_sy]
-
 
841
        add     ebx, [drbar.abs_cy]
-
 
842
        mov     [drbar.real_sy_and_abs_cy], ebx
-
 
843
 
-
 
844
        add     edx, LFB_BASE
-
 
845
;--------------------------------------
651
; get process number
846
; get process number
652
     mov     ebx, [CURRENT_TASK]
847
        mov     ebx, [CURRENT_TASK]
653
     cmp     byte [ScreenBPP], 24
848
        cmp     byte [ScreenBPP], 24
654
     jne     draw_bar_end_32
849
        jne     draw_bar_end_32
-
 
850
;--------------------------------------
-
 
851
align 4
655
draw_bar_end_24:
852
draw_bar_end_24:
656
     mov     eax, [drbar.color]    ;; BBGGRR00
853
        mov     eax, [drbar.color] ;; BBGGRR00
657
     mov     bh, al                ;; bh  = BB
854
        mov     bh, al             ;; bh  = BB
658
     shr     eax, 8                ;; eax = RRGG
855
        shr     eax, 8             ;; eax = RRGG
659
; eax - color high   RRGG
856
; eax - color high   RRGG
Line 662... Line 859...
662
; ecx - temp
859
; ecx - temp
663
; edx - pointer to screen
860
; edx - pointer to screen
664
; esi - counter
861
; esi - counter
665
; edi - counter
862
; edi - counter
666
     mov     esi, [drbar.real_sy]
863
        mov     esi, [drbar.real_sy]
-
 
864
        cmp     [_display.select_cursor], 0
-
 
865
        jne     draw_bar_end_24_new
-
 
866
;--------------------------------------
667
align   4
867
align 4
668
.new_y:
868
.new_y:
669
     mov     edi, [drbar.real_sx]
869
        mov     edi, [drbar.real_sx]
-
 
870
;--------------------------------------
670
align   4
871
align 4
671
.new_x:
872
.new_x:
672
     cmp     byte [ebp], bl
873
        cmp     byte [ebp], bl
673
     jne     .skip
874
        jne     .skip
-
 
875
;--------------------------------------
-
 
876
        push    eax
Line -... Line 877...
-
 
877
 
-
 
878
        mov     ecx, [drbar.real_sx_and_abs_cx + 4]
-
 
879
        sub     ecx, edi
-
 
880
        shl     ecx, 16
-
 
881
        add     ecx, [drbar.real_sy_and_abs_cy + 4]
-
 
882
        sub     ecx, esi
-
 
883
 
-
 
884
        shl     eax, 8
-
 
885
        mov     al, bh
-
 
886
; check mouse area for putpixel
-
 
887
        call    check_mouse_area_for_putpixel
674
 
888
; store to real LFB
-
 
889
        mov     [edx], ax
675
     mov     [LFB_BASE+edx], bh
890
        shr     eax, 16
-
 
891
        mov     [edx + 2], al
-
 
892
        pop     eax
-
 
893
;--------------------------------------
676
     mov     [LFB_BASE+edx + 1], ax
894
align 4
677
.skip:
895
.skip:
678
; add pixel
896
; add pixel
679
     add     edx, 3
897
        add     edx, 3
680
     inc     ebp
898
        inc     ebp
Line 687... Line 905...
687
     test    eax, 0x00800000
905
        test    eax, 0x00800000
688
     jz      @f
906
        jz      @f
689
     test    bh, bh
907
        test    bh, bh
690
     jz      @f
908
        jz      @f
691
     dec     bh
909
        dec     bh
-
 
910
;--------------------------------------
-
 
911
align 4
692
@@:
912
@@:
693
; 
913
; 
694
     dec     esi
914
        dec     esi
695
     jnz     .new_y
915
        jnz     .new_y
-
 
916
;--------------------------------------
-
 
917
align 4
-
 
918
.end:
696
     add     esp, drbar.stack_data
919
        add     esp, drbar.stack_data
697
     popad
920
        popad
698
     xor     eax, eax
921
        xor     eax, eax
699
     ret
922
        ret
-
 
923
;--------------------------------------
-
 
924
align 4
-
 
925
draw_bar_end_24_new:
-
 
926
;--------------------------------------
-
 
927
align 4
-
 
928
.new_y:
-
 
929
        mov     edi, [drbar.real_sx]
-
 
930
;--------------------------------------
-
 
931
align 4
-
 
932
.new_x:
-
 
933
        cmp     byte [ebp], bl
-
 
934
        jne     .skip
-
 
935
;--------------------------------------
-
 
936
        mov     ecx, [drbar.real_sy_and_abs_cy]
-
 
937
        sub     ecx, esi
-
 
938
;--------------------------------------
-
 
939
; check for Y
-
 
940
        cmp     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
941
        jb      .no_mouse_area
-
 
942
 
-
 
943
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
944
        jae     .no_mouse_area
-
 
945
 
-
 
946
        rol     ecx, 16
-
 
947
        add     ecx, [drbar.real_sx_and_abs_cx]
-
 
948
        sub     ecx, edi
-
 
949
;--------------------------------------
-
 
950
; check for X
-
 
951
        cmp     cx, [X_UNDER_subtraction_CUR_hot_x]
-
 
952
        jb      .no_mouse_area
-
 
953
 
-
 
954
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
955
        jae     .no_mouse_area
-
 
956
;--------------------------------------
-
 
957
; check mouse area for putpixel
-
 
958
        push    eax
-
 
959
 
-
 
960
        shl     eax, 8
-
 
961
        mov     al, bh
Line -... Line 962...
-
 
962
 
-
 
963
        call    check_mouse_area_for_putpixel_new.1
-
 
964
; store to real LFB
-
 
965
        mov     [edx], ax
-
 
966
        shr     eax, 16
-
 
967
        mov     [edx + 2], al
-
 
968
        pop     eax
-
 
969
        jmp     .skip
-
 
970
; store to real LFB
-
 
971
;--------------------------------------
-
 
972
align 4
-
 
973
.no_mouse_area:
-
 
974
        mov     [edx], bh
-
 
975
        mov     [edx + 1], ax
-
 
976
;--------------------------------------
-
 
977
align 4
-
 
978
.skip:
-
 
979
; add pixel
-
 
980
        add     edx, 3
-
 
981
        inc     ebp
-
 
982
        dec     edi
-
 
983
        jnz     .new_x
-
 
984
; add line
-
 
985
        add     edx, [drbar.line_inc_scr]
-
 
986
        add     ebp, [drbar.line_inc_map]
-
 
987
;  drawing gradient bars
-
 
988
        test    eax, 0x00800000
-
 
989
        jz      @f
-
 
990
        test    bh, bh
-
 
991
        jz      @f
-
 
992
        dec     bh
-
 
993
;--------------------------------------
-
 
994
align 4
-
 
995
@@:
-
 
996
; 
-
 
997
        dec     esi
-
 
998
        jnz     .new_y
-
 
999
        jmp     draw_bar_end_24.end
-
 
1000
;--------------------------------------
700
 
1001
align 4
701
draw_bar_end_32:
1002
draw_bar_end_32:
702
     mov     eax, [drbar.color]    ;; BBGGRR00
1003
        mov     eax, [drbar.color] ;; BBGGRR00
-
 
1004
        mov     esi, [drbar.real_sy]
-
 
1005
        cmp     [_display.select_cursor], 0
-
 
1006
        jne     draw_bar_end_32_new
703
     mov     esi, [drbar.real_sy]
1007
;--------------------------------------
704
align   4
1008
align 4
705
.new_y:
1009
.new_y:
-
 
1010
        mov     edi, [drbar.real_sx]
706
     mov     edi, [drbar.real_sx]
1011
;--------------------------------------
707
align   4
1012
align 4
708
.new_x:
1013
.new_x:
709
     cmp     byte [ebp], bl
1014
        cmp     byte [ebp], bl
-
 
1015
        jne     .skip
-
 
1016
;--------------------------------------
Line -... Line 1017...
-
 
1017
        push    eax
-
 
1018
 
-
 
1019
        mov     ecx, [drbar.real_sx_and_abs_cx + 4]
-
 
1020
        sub     ecx, edi
-
 
1021
        shl     ecx, 16
-
 
1022
        add     ecx, [drbar.real_sy_and_abs_cy + 4]
-
 
1023
        sub     ecx, esi
-
 
1024
 
-
 
1025
; check mouse area for putpixel
710
     jne     .skip
1026
        call    check_mouse_area_for_putpixel
-
 
1027
; store to real LFB
-
 
1028
        mov     [edx], eax
-
 
1029
        pop     eax
711
 
1030
;--------------------------------------
712
     mov     [LFB_BASE+edx], eax
1031
align 4
713
.skip:
1032
.skip:
714
; add pixel
1033
; add pixel
715
     add     edx, 4
1034
        add     edx, 4
Line 723... Line 1042...
723
     test    eax, 0x80000000
1042
        test    eax, 0x80000000
724
     jz      @f
1043
        jz      @f
725
     test    al, al
1044
        test    al, al
726
     jz      @f
1045
        jz      @f
727
     dec     al
1046
        dec     al
-
 
1047
;--------------------------------------
-
 
1048
align 4
728
@@:
1049
@@:
729
; 
1050
; 
730
     dec     esi
1051
        dec     esi
731
     jnz     .new_y
1052
        jnz     .new_y
-
 
1053
;--------------------------------------
-
 
1054
align 4
-
 
1055
.end:
732
     add     esp, drbar.stack_data
1056
        add     esp, drbar.stack_data
733
     popad
1057
        popad
734
     call    VGA_draw_bar
1058
        call    VGA_draw_bar
735
     xor     eax, eax
1059
        xor     eax, eax
736
     mov     [EGA_counter],1
1060
        mov     [EGA_counter], 1
737
     ret
1061
        ret
-
 
1062
;--------------------------------------
-
 
1063
align 4
-
 
1064
draw_bar_end_32_new:
-
 
1065
;--------------------------------------
-
 
1066
align 4
-
 
1067
.new_y:
-
 
1068
        mov     edi, [drbar.real_sx]
-
 
1069
;--------------------------------------
-
 
1070
align 4
-
 
1071
.new_x:
-
 
1072
        cmp     byte [ebp], bl
-
 
1073
        jne     .skip
-
 
1074
;--------------------------------------
-
 
1075
        mov     ecx, [drbar.real_sy_and_abs_cy]
-
 
1076
        sub     ecx, esi
-
 
1077
;--------------------------------------
-
 
1078
; check for Y
-
 
1079
        cmp     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
1080
        jb      .no_mouse_area
738
 
1081
 
-
 
1082
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
1083
        jae     .no_mouse_area
-
 
1084
 
-
 
1085
        rol     ecx, 16
-
 
1086
        add     ecx, [drbar.real_sx_and_abs_cx]
-
 
1087
        sub     ecx, edi
-
 
1088
;--------------------------------------
-
 
1089
; check for X
-
 
1090
        cmp     cx, [X_UNDER_subtraction_CUR_hot_x]
-
 
1091
        jb      .no_mouse_area
-
 
1092
 
-
 
1093
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
1094
        jae     .no_mouse_area
-
 
1095
;--------------------------------------
-
 
1096
; check mouse area for putpixel
-
 
1097
        push    eax
-
 
1098
        call    check_mouse_area_for_putpixel_new.1
-
 
1099
        mov     [edx], eax
-
 
1100
        pop     eax
-
 
1101
        jmp     .skip
-
 
1102
; store to real LFB
-
 
1103
;--------------------------------------
-
 
1104
align 4
-
 
1105
.no_mouse_area:
-
 
1106
        mov     [edx], eax
-
 
1107
;--------------------------------------
-
 
1108
align 4
-
 
1109
.skip:
-
 
1110
; add pixel
-
 
1111
        add     edx, 4
-
 
1112
        inc     ebp
-
 
1113
        dec     edi
-
 
1114
        jnz     .new_x
-
 
1115
; add line
-
 
1116
        add     edx, [drbar.line_inc_scr]
-
 
1117
        add     ebp, [drbar.line_inc_map]
-
 
1118
;  drawing gradient bars
-
 
1119
        test    eax, 0x80000000
-
 
1120
        jz      @f
-
 
1121
        test    al, al
-
 
1122
        jz      @f
-
 
1123
        dec     al
-
 
1124
;--------------------------------------
-
 
1125
align 4
-
 
1126
@@:
-
 
1127
; 
-
 
1128
        dec     esi
-
 
1129
        jnz     .new_y
-
 
1130
        jmp     draw_bar_end_32.end
-
 
1131
;------------------------------------------------------------------------------
739
align 4
1132
align 4
740
vesa20_drawbackground_tiled:
1133
vesa20_drawbackground_tiled:
741
        call    [_display.disable_mouse]
-
 
742
        pushad
1134
        pushad
743
; External loop for all y from start to end
1135
; External loop for all y from start to end
744
        mov     ebx, [draw_data+32+RECT.top]    ; y start
1136
        mov     ebx, [draw_data+32+RECT.top]    ; y start
-
 
1137
;--------------------------------------
-
 
1138
align 4
745
dp2:
1139
dp2:
746
        mov     ebp, [draw_data+32+RECT.left]   ; x start
1140
        mov     ebp, [draw_data+32+RECT.left]   ; x start
747
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
1141
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
748
;                       and LFB data (output for our function) [edi]
1142
;                       and LFB data (output for our function) [edi]
749
        mov     eax, [BytesPerScanLine]
1143
        mov     eax, [BytesPerScanLine]
Line 753... Line 1147...
753
        add     ebp, eax
1147
        add     ebp, eax
754
        add     ebp, eax
1148
        add     ebp, eax
755
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
1149
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
756
        jz      @f
1150
        jz      @f
757
        add     ebp, eax
1151
        add     ebp, eax
-
 
1152
;--------------------------------------
-
 
1153
align 4
758
@@:
1154
@@:
759
        add     ebp, LFB_BASE
1155
        add     ebp, LFB_BASE
760
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1156
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
761
        call    calculate_edi
1157
        call    calculate_edi
762
        xchg    edi, ebp
1158
        xchg    edi, ebp
Line 786... Line 1182...
786
; eax = x, ebx = y (screen coordinates)
1182
; eax = x, ebx = y (screen coordinates)
787
; ecx = deltax - number of pixels left in current tile block
1183
; ecx = deltax - number of pixels left in current tile block
788
; edx = 1
1184
; edx = 1
789
; esi -> bgr memory, edi -> output
1185
; esi -> bgr memory, edi -> output
790
; ebp = offset in WinMapAddress
1186
; ebp = offset in WinMapAddress
-
 
1187
;--------------------------------------
-
 
1188
align 4
791
dp3:
1189
dp3:
792
        cmp     [ebp], dl
1190
        cmp     [ebp], dl
793
        jnz     nbgp
1191
        jnz     nbgp
-
 
1192
;--------------------------------------
-
 
1193
        push    eax ecx
-
 
1194
 
794
        movsb
1195
        mov     ecx, eax
-
 
1196
        shl     ecx, 16
-
 
1197
        add     ecx, ebx
-
 
1198
 
795
        movsb
1199
        mov     eax, [esi]
-
 
1200
        and     eax, 0xffffff
-
 
1201
; check mouse area for putpixel
-
 
1202
        call    [_display.check_mouse]
-
 
1203
; store to real LFB
796
        movsb
1204
        mov     [edi], ax
-
 
1205
        shr     eax, 16
-
 
1206
        mov     [edi+2], al
-
 
1207
 
797
        jmp     @f
1208
        pop     ecx eax
-
 
1209
;--------------------------------------
-
 
1210
align 4
798
nbgp:
1211
nbgp:
799
        add     esi, 3
1212
        add     esi, 3
800
        add     edi, 3
1213
        add     edi, 3
-
 
1214
;--------------------------------------
-
 
1215
align 4
801
@@:
1216
@@:
802
        cmp     [ScreenBPP], byte 25    ; 24 or 32 bpp?
1217
        cmp     [ScreenBPP], byte 25    ; 24 or 32 bpp?
803
        sbb     edi, -1         ; +1 for 32 bpp
1218
        sbb     edi, -1         ; +1 for 32 bpp
804
; I do not use 'inc eax' because this is slightly slower then 'add eax,1'
1219
; I do not use 'inc eax' because this is slightly slower then 'add eax,1'
805
        add     ebp, edx
1220
        add     ebp, edx
Line 812... Line 1227...
812
        mov     ecx, [BgrDataWidth]
1227
        mov     ecx, [BgrDataWidth]
813
        sub     esi, ecx
1228
        sub     esi, ecx
814
        sub     esi, ecx
1229
        sub     esi, ecx
815
        sub     esi, ecx
1230
        sub     esi, ecx
816
        jmp     dp3
1231
        jmp     dp3
-
 
1232
;--------------------------------------
-
 
1233
align 4
817
dp4:
1234
dp4:
818
; next scan line
1235
; next scan line
819
        inc     ebx
1236
        inc     ebx
820
        cmp     ebx, [draw_data+32+RECT.bottom]
1237
        cmp     ebx, [draw_data+32+RECT.bottom]
821
        jbe     dp2
1238
        jbe     dp2
822
        popad
1239
        popad
823
        mov     [EGA_counter], 1
1240
        mov     [EGA_counter], 1
824
        call    VGA_drawbackground
1241
        call    VGA_drawbackground
825
        ret
1242
        ret
826
 
-
 
-
 
1243
;------------------------------------------------------------------------------
827
; ----------
1244
align 4
828
 
-
 
829
 
-
 
830
vesa20_drawbackground_stretch:
1245
vesa20_drawbackground_stretch:
831
        call    [_display.disable_mouse]
-
 
832
        pushad
1246
        pushad
833
; Helper variables
1247
; Helper variables
834
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
1248
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
835
        mov     eax, [BgrDataWidth]
1249
        mov     eax, [BgrDataWidth]
836
        dec     eax
1250
        dec     eax
Line 861... Line 1275...
861
        add     ebp, eax
1275
        add     ebp, eax
862
        add     ebp, eax
1276
        add     ebp, eax
863
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
1277
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
864
        jz      @f
1278
        jz      @f
865
        add     ebp, eax
1279
        add     ebp, eax
-
 
1280
;--------------------------------------
-
 
1281
align 4
866
@@:
1282
@@:
867
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1283
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
868
        call    calculate_edi
1284
        call    calculate_edi
869
        xchg    edi, ebp
1285
        xchg    edi, ebp
870
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
1286
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
Line 891... Line 1307...
891
        add     esi, [img_background]
1307
        add     esi, [img_background]
892
        push    eax
1308
        push    eax
893
        push    edx
1309
        push    edx
894
        push    esi
1310
        push    esi
895
; 3) Smooth horizontal
1311
; 3) Smooth horizontal
-
 
1312
;--------------------------------------
-
 
1313
align 4
896
bgr_resmooth0:
1314
bgr_resmooth0:
897
        mov     ecx, [esp+8]
1315
        mov     ecx, [esp+8]
898
        mov     edx, [esp+4]
1316
        mov     edx, [esp+4]
899
        mov     esi, [esp]
1317
        mov     esi, [esp]
900
        push    edi
1318
        push    edi
901
        mov     edi, bgr_cur_line
1319
        mov     edi, bgr_cur_line
902
        call    smooth_line
1320
        call    smooth_line
-
 
1321
;--------------------------------------
-
 
1322
align 4
903
bgr_resmooth1:
1323
bgr_resmooth1:
904
        mov     eax, [esp+16+4]
1324
        mov     eax, [esp+16+4]
905
        inc     eax
1325
        inc     eax
906
        cmp     eax, [BgrDataHeight]
1326
        cmp     eax, [BgrDataHeight]
907
        jae     bgr.no2nd
1327
        jae     bgr.no2nd
Line 911... Line 1331...
911
        add     esi, [BgrDataWidth]
1331
        add     esi, [BgrDataWidth]
912
        add     esi, [BgrDataWidth]
1332
        add     esi, [BgrDataWidth]
913
        add     esi, [BgrDataWidth]
1333
        add     esi, [BgrDataWidth]
914
        mov     edi, bgr_next_line
1334
        mov     edi, bgr_next_line
915
        call    smooth_line
1335
        call    smooth_line
-
 
1336
;--------------------------------------
-
 
1337
align 4
916
bgr.no2nd:
1338
bgr.no2nd:
917
        pop     edi
1339
        pop     edi
-
 
1340
;--------------------------------------
-
 
1341
align 4
918
sdp3:
1342
sdp3:
919
        xor     esi, esi
1343
        xor     esi, esi
920
        mov     ecx, [esp+12]
1344
        mov     ecx, [esp+12]
921
; 4) Loop through redraw rectangle and copy background data
1345
; 4) Loop through redraw rectangle and copy background data
922
; Registers meaning:
1346
; Registers meaning:
Line 928... Line 1352...
928
; dword [esp+20] = x
1352
; dword [esp+20] = x
929
; dword [esp+24] = y
1353
; dword [esp+24] = y
930
; precalculated constants:
1354
; precalculated constants:
931
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
1355
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
932
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
1356
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
-
 
1357
;--------------------------------------
-
 
1358
align 4
933
sdp3a:
1359
sdp3a:
934
        mov eax, [_WinMapAddress]
1360
        mov     eax, [_WinMapAddress]
935
        cmp     [ebp+eax], byte 1
1361
        cmp     [ebp+eax], byte 1
936
        jnz     snbgp
1362
        jnz     snbgp
937
        mov     eax, [bgr_cur_line+esi]
1363
        mov     eax, [bgr_cur_line+esi]
938
        test    ecx, ecx
1364
        test    ecx, ecx
939
        jz      .novert
1365
        jz      .novert
940
        mov     ebx, [bgr_next_line+esi]
1366
        mov     ebx, [bgr_next_line+esi]
941
        call    [overlapping_of_points_ptr]
1367
        call    [overlapping_of_points_ptr]
-
 
1368
;--------------------------------------
-
 
1369
align 4
942
.novert:
1370
.novert:
-
 
1371
        push    ecx
-
 
1372
        mov     ecx, [esp+20+4]        ;x
-
 
1373
        shl     ecx, 16
-
 
1374
        add     ecx, [esp+24+4]        ;y
-
 
1375
; check mouse area for putpixel
-
 
1376
        call    [_display.check_mouse]
943
 
-
 
-
 
1377
; store to real LFB
944
        mov     [LFB_BASE+edi], ax
1378
        mov     [LFB_BASE+edi], ax
945
        shr     eax, 16
1379
        shr     eax, 16
946
 
-
 
947
        mov     [LFB_BASE+edi+2], al
1380
        mov     [LFB_BASE+edi+2], al
-
 
1381
        pop     ecx
-
 
1382
;--------------------------------------
-
 
1383
align 4
948
snbgp:
1384
snbgp:
949
        cmp     [ScreenBPP], byte 25
1385
        cmp     [ScreenBPP], byte 25
950
        sbb     edi, -4
1386
        sbb     edi, -4
951
        add     ebp, 1
1387
        add     ebp, 1
952
        mov     eax, [esp+20]
1388
        mov     eax, [esp+20]
953
        add     eax, 1
1389
        add     eax, 1
954
        mov     [esp+20], eax
1390
        mov     [esp+20], eax
955
        add     esi, 4
1391
        add     esi, 4
956
        cmp     eax, [draw_data+32+RECT.right]
1392
        cmp     eax, [draw_data+32+RECT.right]
957
        jbe     sdp3a
1393
        jbe     sdp3a
-
 
1394
;--------------------------------------
-
 
1395
align 4
958
sdp4:
1396
sdp4:
959
; next y
1397
; next y
960
        mov     ebx, [esp+24]
1398
        mov     ebx, [esp+24]
961
        add     ebx, 1
1399
        add     ebx, 1
962
        mov     [esp+24], ebx
1400
        mov     [esp+24], ebx
Line 971... Line 1409...
971
        sub     edi, eax
1409
        sub     edi, eax
972
        sub     edi, eax
1410
        sub     edi, eax
973
        cmp     [ScreenBPP], byte 24
1411
        cmp     [ScreenBPP], byte 24
974
        jz      @f
1412
        jz      @f
975
        sub     edi, eax
1413
        sub     edi, eax
-
 
1414
;--------------------------------------
-
 
1415
align 4
976
@@:
1416
@@:
977
        add     edi, [BytesPerScanLine]
1417
        add     edi, [BytesPerScanLine]
978
; restore ecx,edx; advance esi to next background line
1418
; restore ecx,edx; advance esi to next background line
979
        mov     eax, [esp+28]
1419
        mov     eax, [esp+28]
980
        mov     ebx, [esp+32]
1420
        mov     ebx, [esp+32]
Line 997... Line 1437...
997
        mov     edi, bgr_cur_line
1437
        mov     edi, bgr_cur_line
998
        mov     ecx, [Screen_Max_X]
1438
        mov     ecx, [Screen_Max_X]
999
        inc     ecx
1439
        inc     ecx
1000
        rep     movsd
1440
        rep movsd
1001
        jmp     bgr_resmooth1
1441
        jmp     bgr_resmooth1
-
 
1442
;--------------------------------------
-
 
1443
align 4
1002
sdpdone:
1444
sdpdone:
1003
        add     esp, 44
1445
        add     esp, 44
1004
        popad
1446
        popad
1005
        mov     [EGA_counter],1
1447
        mov     [EGA_counter], 1
1006
        call    VGA_drawbackground
1448
        call    VGA_drawbackground
1007
        ret
1449
        ret
Line 1008... Line 1450...
1008
 
1450
 
-
 
1451
uglobal
1009
uglobal
1452
;--------------------------------------
1010
align 4
1453
align 4
1011
bgr_cur_line    rd      1920    ; maximum width of screen
1454
bgr_cur_line    rd      1920    ; maximum width of screen
-
 
1455
bgr_next_line   rd      1920
1012
bgr_next_line   rd      1920
1456
;--------------------------------------
-
 
1457
endg
1013
endg
1458
;--------------------------------------
1014
 
1459
align 4
1015
smooth_line:
1460
smooth_line:
1016
        mov     al, [esi+2]
1461
        mov     al, [esi+2]
1017
        shl     eax, 16
1462
        shl     eax, 16
1018
        mov     ax, [esi]
1463
        mov     ax, [esi]
1019
        test    ecx, ecx
1464
        test    ecx, ecx
1020
        jz      @f
1465
        jz      @f
1021
        mov     ebx, [esi+2]
1466
        mov     ebx, [esi+2]
1022
        shr     ebx, 8
1467
        shr     ebx, 8
-
 
1468
        call    [overlapping_of_points_ptr]
-
 
1469
;--------------------------------------
1023
        call    [overlapping_of_points_ptr]
1470
align 4
1024
@@:
1471
@@:
1025
        stosd
1472
        stosd
1026
        mov     eax, [esp+20+8]
1473
        mov     eax, [esp+20+8]
1027
        add     eax, 1
1474
        add     eax, 1
Line 1033... Line 1480...
1033
        adc     edx, [esp+40+8]
1480
        adc     edx, [esp+40+8]
1034
        sub     eax, edx
1481
        sub     eax, edx
1035
        lea     eax, [eax*3]
1482
        lea     eax, [eax*3]
1036
        sub     esi, eax
1483
        sub     esi, eax
1037
        jmp     smooth_line
1484
        jmp     smooth_line
-
 
1485
;--------------------------------------
-
 
1486
align 4
1038
@@:
1487
@@:
1039
        mov     eax, [draw_data+32+RECT.left]
1488
        mov     eax, [draw_data+32+RECT.left]
1040
        mov     [esp+20+8], eax
1489
        mov     [esp+20+8], eax
1041
        ret
1490
        ret
1042
 
-
 
-
 
1491
;------------------------------------------------------------------------------
1043
align 16
1492
align 16
1044
overlapping_of_points:
1493
overlapping_of_points:
1045
if 0
1494
if 0
1046
; this version of procedure works, but is slower than next version
1495
; this version of procedure works, but is slower than next version
1047
        push    ecx edx
1496
        push    ecx edx
Line 1102... Line 1551...
1102
        pop     ecx
1551
        pop     ecx
1103
        ret
1552
        ret
1104
end if
1553
end if
Line 1105... Line 1554...
1105
 
1554
 
-
 
1555
iglobal
1106
iglobal
1556
;--------------------------------------
1107
align 4
1557
align 4
-
 
1558
overlapping_of_points_ptr       dd      overlapping_of_points
1108
overlapping_of_points_ptr       dd      overlapping_of_points
1559
;--------------------------------------
-
 
1560
endg
1109
endg
1561
;------------------------------------------------------------------------------
1110
 
1562
align 4
1111
init_background:
1563
init_background:
1112
        mov     edi, BgrAuxTable
1564
        mov     edi, BgrAuxTable
-
 
1565
        xor     edx, edx
-
 
1566
;--------------------------------------
1113
        xor     edx, edx
1567
align 4
1114
.loop2:
1568
.loop2:
1115
        mov     eax, edx
1569
        mov     eax, edx
1116
        shl     eax, 8
1570
        shl     eax, 8
1117
        neg     eax
1571
        neg     eax
-
 
1572
        mov     ecx, 0x200
-
 
1573
;--------------------------------------
1118
        mov     ecx, 0x200
1574
align 4
1119
.loop1:
1575
.loop1:
1120
        mov     byte [edi], ah
1576
        mov     byte [edi], ah
1121
        inc     edi
1577
        inc     edi
1122
        add     eax, edx
1578
        add     eax, edx
1123
        loop    .loop1
1579
        loop    .loop1
1124
        add     dl, 4
1580
        add     dl, 4
1125
        jnz     .loop2
1581
        jnz     .loop2
1126
        test    byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
1582
        test    byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
1127
        jz      @f
1583
        jz      @f
-
 
1584
        mov     [overlapping_of_points_ptr], overlapping_of_points_mmx
-
 
1585
;--------------------------------------
1128
        mov     [overlapping_of_points_ptr], overlapping_of_points_mmx
1586
align 4
1129
@@:
1587
@@:
1130
        ret
-
 
-
 
1588
        ret
1131
 
1589
;------------------------------------------------------------------------------
1132
align 16
1590
align 16
1133
overlapping_of_points_mmx:
1591
overlapping_of_points_mmx:
1134
        movd    mm0, eax
1592
        movd    mm0, eax
1135
        movd    mm4, eax
1593
        movd    mm4, eax
Line 1146... Line 1604...
1146
        psrlw   mm1, 8
1604
        psrlw   mm1, 8
1147
        packuswb mm1, mm2
1605
        packuswb mm1, mm2
1148
        paddb   mm4, mm1
1606
        paddb   mm4, mm1
1149
        movd    eax, mm4
1607
        movd    eax, mm4
1150
        ret
1608
        ret
-
 
1609
;------------------------------------------------------------------------------