Subversion Repositories Kolibri OS

Rev

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

Rev 2423 Rev 2430
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: 2423 $
20
$Revision: 2430 $
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
Line 321... Line 405...
321
        add     eax, [_WinMapAddress]
405
        add     eax, [_WinMapAddress]
322
        movzx   edx, byte [eax+edx]
406
        movzx   edx, byte [eax+edx]
323
        cmp     edx, [CURRENT_TASK]
407
        cmp     edx, [CURRENT_TASK]
324
        pop     eax
408
        pop     eax
325
        jne     .exit
409
        jne     .exit
-
 
410
;--------------------------------------
326
 
411
align 4
327
.forced:
412
.forced:
328
; check if negation
413
; check if negation
329
        test    ecx, 0x01000000
414
        test    ecx, 0x01000000
330
        jz      .noneg
415
        jz      .noneg
-
 
416
 
331
        call    getpixel
417
        call    getpixel
332
        not     ecx
418
        not     ecx
-
 
419
 
-
 
420
        rol     ecx, 8
-
 
421
        mov     cl, [esp+32-8+3]
-
 
422
        ror     ecx, 8
333
        mov     [esp+32-8], ecx
423
        mov     [esp+32-8], ecx
-
 
424
;--------------------------------------
-
 
425
align 4
334
.noneg:
426
.noneg:
335
; OK to set pixel
427
; OK to set pixel
336
        call    dword [PUTPIXEL]; call the real put_pixel function
428
        call    dword [PUTPIXEL]; call the real put_pixel function
-
 
429
;--------------------------------------
-
 
430
align 4
337
.exit:
431
.exit:
338
        popad
432
        popad
339
        ret
433
        ret
340
 
-
 
-
 
434
;-----------------------------------------------------------------------------
341
align 4
435
align 4
342
Vesa20_putpixel24:
436
Vesa20_putpixel24:
343
; eax = x
437
; eax = x
344
; ebx = y
438
; ebx = y
-
 
439
        mov     ecx, eax
-
 
440
        shl     ecx, 16
-
 
441
        mov     cx, bx
-
 
442
 
345
        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
443
        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
346
        lea     edi, [eax+eax*2]; edi = x*3
444
        lea     edi, [eax+eax*2]; edi = x*3
347
        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
348
        mov     [LFB_BASE+ebx+edi], ax
455
        mov     [LFB_BASE+ebx+edi], ax
349
        shr     eax, 16
456
        shr     eax, 16
350
        mov     [LFB_BASE+ebx+edi+2], al
457
        mov     [LFB_BASE+ebx+edi+2], al
-
 
458
;--------------------------------------
351
        ret
459
        ret
352
 
-
 
353
 
-
 
-
 
460
;-----------------------------------------------------------------------------
354
align 4
461
align 4
355
Vesa20_putpixel32:
462
Vesa20_putpixel32:
356
; eax = x
463
; eax = x
357
; ebx = y
464
; ebx = y
-
 
465
        mov     ecx, eax
-
 
466
        shl     ecx, 16
-
 
467
        mov     cx, bx
-
 
468
 
358
        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
469
        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
359
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
470
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
360
        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
361
        mov     [LFB_BASE+edi], eax
482
        mov     [LFB_BASE+edi], eax
-
 
483
;--------------------------------------
362
        ret
484
        ret
363
 
-
 
364
;*************************************************
485
;-----------------------------------------------------------------------------
365
 
-
 
366
;align 4
486
align 4
367
calculate_edi:
487
calculate_edi:
368
        mov     edi, ebx
488
        mov     edi, ebx
369
        imul    edi, [Screen_Max_X]
489
        imul    edi, [Screen_Max_X]
370
        add     edi, ebx
490
        add     edi, ebx
371
        add     edi, eax
491
        add     edi, eax
372
        ret
492
        ret
373
 
-
 
374
;*************************************************
493
;-----------------------------------------------------------------------------
375
 
-
 
376
; DRAWLINE
494
; DRAWLINE
377
 
-
 
-
 
495
;-----------------------------------------------------------------------------
378
align 4
496
align 4
379
__sys_draw_line:
497
__sys_draw_line:
380
;     inc   [mouse_pause]
-
 
381
        call    [_display.disable_mouse]
-
 
382
 
-
 
383
; draw a line
498
; draw a line
384
; eax = HIWORD = x1
499
; eax = HIWORD = x1
385
;       LOWORD = x2
500
;       LOWORD = x2
386
; ebx = HIWORD = y1
501
; ebx = HIWORD = y1
387
;       LOWORD = y2
502
;       LOWORD = y2
Line 414... Line 529...
414
        jg      .no_vline  ; x1 > x2 ?
529
        jg      .no_vline  ; x1 > x2 ?
415
        mov     edx, ebp   ; else (if x1=x2)
530
        mov     edx, ebp   ; else (if x1=x2)
416
        call    vline
531
        call    vline
417
        push    edx ; necessary to rightly restore stack frame at .exit
532
        push    edx ; necessary to rightly restore stack frame at .exit
418
        jmp     .exit
533
        jmp     .exit
-
 
534
;--------------------------------------
-
 
535
align 4
419
.x2lx1:
536
.x2lx1:
420
        neg     esi         ; get esi absolute value
537
        neg     esi         ; get esi absolute value
-
 
538
;--------------------------------------
-
 
539
align 4
421
.no_vline:
540
.no_vline:
422
; checking y-axis...
541
; checking y-axis...
423
        sub     ebp, ebx    ; ebp = y2-y1
542
        sub     ebp, ebx    ; ebp = y2-y1
424
        push    ebp         ; save y2-y1
543
        push    ebp         ; save y2-y1
425
        jl      .y2ly1      ; is y2 less than y1 ?
544
        jl      .y2ly1      ; is y2 less than y1 ?
426
        jg      .no_hline   ; y1 > y2 ?
545
        jg      .no_hline   ; y1 > y2 ?
427
        mov     edx, [dl_x2]; else (if y1=y2)
546
        mov     edx, [dl_x2]; else (if y1=y2)
428
        call    hline
547
        call    hline
429
        jmp     .exit
548
        jmp     .exit
-
 
549
;--------------------------------------
430
 
550
align 4
431
.y2ly1:
551
.y2ly1:
432
        neg     ebp         ; get ebp absolute value
552
        neg     ebp         ; get ebp absolute value
-
 
553
;--------------------------------------
-
 
554
align 4
433
.no_hline:
555
.no_hline:
434
        cmp     ebp, esi
556
        cmp     ebp, esi
435
        jle     .x_rules    ; |y2-y1| < |x2-x1|  ?
557
        jle     .x_rules    ; |y2-y1| < |x2-x1|  ?
436
        cmp     [dl_y2], ebx; make sure y1 is at the begining
558
        cmp     [dl_y2], ebx; make sure y1 is at the begining
437
        jge     .no_reverse1
559
        jge     .no_reverse1
Line 440... Line 562...
440
        mov     [dl_x2], eax
562
        mov     [dl_x2], eax
441
        mov     [dl_x1], edx
563
        mov     [dl_x1], edx
442
        mov     edx, [dl_y2]
564
        mov     edx, [dl_y2]
443
        mov     [dl_y2], ebx
565
        mov     [dl_y2], ebx
444
        mov     [dl_y1], edx
566
        mov     [dl_y1], edx
-
 
567
;--------------------------------------
-
 
568
align 4
445
.no_reverse1:
569
.no_reverse1:
446
        mov     eax, [dl_dx]
570
        mov     eax, [dl_dx]
447
        cdq                 ; extend eax sing to edx
571
        cdq                 ; extend eax sing to edx
448
        shl     eax, 16     ; using 16bit fix-point maths
572
        shl     eax, 16     ; using 16bit fix-point maths
449
        idiv    ebp         ; eax = ((x2-x1)*65536)/(y2-y1)
573
        idiv    ebp         ; eax = ((x2-x1)*65536)/(y2-y1)
Line 451... Line 575...
451
; correction for the remainder of the division
575
; correction for the remainder of the division
452
        shl     edx, 1
576
        shl     edx, 1
453
        cmp     ebp, edx
577
        cmp     ebp, edx
454
        jb      @f
578
        jb      @f
455
        inc     eax
579
        inc     eax
-
 
580
;--------------------------------------
-
 
581
align 4
456
@@:
582
@@:
457
;--------------------------------------
583
;--------------------------------------
458
        mov     edx, ebp    ; edx = counter (number of pixels to draw)
584
        mov     edx, ebp    ; edx = counter (number of pixels to draw)
459
        mov     ebp, 1 *65536; <<16   ; ebp = dy = 1.0
585
        mov     ebp, 1 *65536; <<16   ; ebp = dy = 1.0
460
        mov     esi, eax    ; esi = dx
586
        mov     esi, eax    ; esi = dx
461
        jmp     .y_rules
587
        jmp     .y_rules
-
 
588
;--------------------------------------
462
 
589
align 4
463
.x_rules:
590
.x_rules:
464
        cmp     [dl_x2], eax ; make sure x1 is at the begining
591
        cmp     [dl_x2], eax ; make sure x1 is at the begining
465
        jge     .no_reverse2
592
        jge     .no_reverse2
466
        neg     dword [dl_dy]
593
        neg     dword [dl_dy]
467
        mov     edx, [dl_x2]
594
        mov     edx, [dl_x2]
468
        mov     [dl_x2], eax
595
        mov     [dl_x2], eax
469
        mov     [dl_x1], edx
596
        mov     [dl_x1], edx
470
        mov     edx, [dl_y2]
597
        mov     edx, [dl_y2]
471
        mov     [dl_y2], ebx
598
        mov     [dl_y2], ebx
472
        mov     [dl_y1], edx
599
        mov     [dl_y1], edx
-
 
600
;--------------------------------------
-
 
601
align 4
473
.no_reverse2:
602
.no_reverse2:
474
        xor     edx, edx
603
        xor     edx, edx
475
        mov     eax, [dl_dy]
604
        mov     eax, [dl_dy]
476
        cdq                 ; extend eax sing to edx
605
        cdq                 ; extend eax sing to edx
477
        shl     eax, 16     ; using 16bit fix-point maths
606
        shl     eax, 16     ; using 16bit fix-point maths
Line 480... Line 609...
480
; correction for the remainder of the division
609
; correction for the remainder of the division
481
        shl     edx, 1
610
        shl     edx, 1
482
        cmp     esi, edx
611
        cmp     esi, edx
483
        jb      @f
612
        jb      @f
484
        inc     eax
613
        inc     eax
-
 
614
;--------------------------------------
-
 
615
align 4
485
@@:
616
@@:
486
;--------------------------------------
617
;--------------------------------------
487
        mov     edx, esi    ; edx = counter (number of pixels to draw)
618
        mov     edx, esi    ; edx = counter (number of pixels to draw)
488
        mov     esi, 1 *65536;<< 16   ; esi = dx = 1.0
619
        mov     esi, 1 *65536;<< 16   ; esi = dx = 1.0
489
        mov     ebp, eax    ; ebp = dy
620
        mov     ebp, eax    ; ebp = dy
-
 
621
;--------------------------------------
-
 
622
align 4
490
.y_rules:
623
.y_rules:
491
        mov     eax, [dl_x1]
624
        mov     eax, [dl_x1]
492
        mov     ebx, [dl_y1]
625
        mov     ebx, [dl_y1]
493
        shl     eax, 16
626
        shl     eax, 16
494
        shl     ebx, 16
627
        shl     ebx, 16
Line 499... Line 632...
499
;--------------------------------------
632
;--------------------------------------
500
; correction for the remainder of the division
633
; correction for the remainder of the division
501
        test    ah, 0x80
634
        test    ah, 0x80
502
        jz      @f
635
        jz      @f
503
        add     eax, 1 shl 16
636
        add     eax, 1 shl 16
-
 
637
;--------------------------------------
-
 
638
align 4
504
@@:
639
@@:
505
;--------------------------------------
640
;--------------------------------------
506
        shr     eax, 16
641
        shr     eax, 16
507
;--------------------------------------
642
;--------------------------------------
508
; correction for the remainder of the division
643
; correction for the remainder of the division
509
        test    bh, 0x80
644
        test    bh, 0x80
510
        jz      @f
645
        jz      @f
511
        add     ebx, 1 shl 16
646
        add     ebx, 1 shl 16
-
 
647
;--------------------------------------
-
 
648
align 4
512
@@:
649
@@:
513
;--------------------------------------
650
;--------------------------------------
514
        shr     ebx, 16
651
        shr     ebx, 16
-
 
652
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
515
        call    [putpixel]
653
        call    [putpixel]
516
        pop     ebx eax
654
        pop     ebx eax
517
        add     ebx, ebp     ; y = y+dy
655
        add     ebx, ebp     ; y = y+dy
518
        add     eax, esi     ; x = x+dx
656
        add     eax, esi     ; x = x+dx
519
        dec     edx
657
        dec     edx
520
        jnz     .draw
658
        jnz     .draw
521
; force last drawn pixel to be at (x2,y2)
659
; force last drawn pixel to be at (x2,y2)
522
        mov     eax, [dl_x2]
660
        mov     eax, [dl_x2]
523
        mov     ebx, [dl_y2]
661
        mov     ebx, [dl_y2]
-
 
662
        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
524
        call    [putpixel]
663
        call    [putpixel]
-
 
664
;--------------------------------------
-
 
665
align 4
525
.exit:
666
.exit:
526
        add     esp, 6*4
667
        add     esp, 6*4
527
        popa
668
        popa
528
;     dec   [mouse_pause]
-
 
529
        call    [draw_pointer]
669
;        call    [draw_pointer]
530
        ret
670
        ret
531
 
-
 
-
 
671
;------------------------------------------------------------------------------
532
 
672
align 4
533
hline:
673
hline:
534
; draw an horizontal line
674
; draw an horizontal line
535
; eax = x1
675
; eax = x1
536
; edx = x2
676
; edx = x2
537
; ebx = y
677
; ebx = y
Line 539... Line 679...
539
; edi = force ?
679
; edi = force ?
540
        push    eax edx
680
        push    eax edx
541
        cmp     edx, eax   ; make sure x2 is above x1
681
        cmp     edx, eax   ; make sure x2 is above x1
542
        jge     @f
682
        jge     @f
543
        xchg    eax, edx
683
        xchg    eax, edx
-
 
684
;--------------------------------------
544
align   4
685
align 4
545
@@:
686
@@:
-
 
687
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
546
        call    [putpixel]
688
        call    [putpixel]
547
        inc     eax
689
        inc     eax
548
        cmp     eax, edx
690
        cmp     eax, edx
549
        jle     @b
691
        jle     @b
550
        pop     edx eax
692
        pop     edx eax
551
        ret
693
        ret
552
 
-
 
-
 
694
;------------------------------------------------------------------------------
553
 
695
align 4
554
vline:
696
vline:
555
; draw a vertical line
697
; draw a vertical line
556
; eax = x
698
; eax = x
557
; ebx = y1
699
; ebx = y1
558
; edx = y2
700
; edx = y2
Line 560... Line 702...
560
; edi = force ?
702
; edi = force ?
561
        push    ebx edx
703
        push    ebx edx
562
        cmp     edx, ebx   ; make sure y2 is above y1
704
        cmp     edx, ebx   ; make sure y2 is above y1
563
        jge     @f
705
        jge     @f
564
        xchg    ebx, edx
706
        xchg    ebx, edx
-
 
707
;--------------------------------------
565
align   4
708
align 4
566
@@:
709
@@:
-
 
710
        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
567
        call    [putpixel]
711
        call    [putpixel]
568
        inc     ebx
712
        inc     ebx
569
        cmp     ebx, edx
713
        cmp     ebx, edx
570
        jle     @b
714
        jle     @b
571
        pop     edx ebx
715
        pop     edx ebx
572
        ret
716
        ret
573
 
-
 
574
 
-
 
575
;*************************************************
717
;------------------------------------------------------------------------------
576
 
-
 
577
 
718
align 4
578
virtual at esp
719
virtual at esp
579
drbar:
720
drbar:
580
     .bar_sx       dd ?
721
     .bar_sx       dd ?
581
     .bar_sy       dd ?
722
     .bar_sy       dd ?
582
     .bar_cx       dd ?
723
     .bar_cx       dd ?
Line 586... Line 727...
586
     .real_sx      dd ?
727
     .real_sx      dd ?
587
     .real_sy      dd ?
728
     .real_sy      dd ?
588
     .color        dd ?
729
     .color        dd ?
589
     .line_inc_scr dd ?
730
     .line_inc_scr dd ?
590
     .line_inc_map dd ?
731
     .line_inc_map dd ?
-
 
732
     .real_sx_and_abs_cx dd ?
-
 
733
     .real_sy_and_abs_cy dd ?
591
     .stack_data = 4*11
734
     .stack_data = 4*13
592
end virtual
735
end virtual
593
 
-
 
-
 
736
;--------------------------------------
594
align 4
737
align 4
595
; eax   cx
738
; eax   cx
596
; ebx   cy
739
; ebx   cy
597
; ecx   xe
740
; ecx   xe
598
; edx   ye
741
; edx   ye
599
; edi   color
742
; edi   color
600
vesa20_drawbar:
743
vesa20_drawbar:
601
        pushad
744
        pushad
602
        call    [_display.disable_mouse]
-
 
603
        sub     esp, drbar.stack_data
745
        sub     esp, drbar.stack_data
604
        mov     [drbar.color], edi
746
        mov     [drbar.color], edi
605
        sub     edx, ebx
747
        sub     edx, ebx
606
        jle     .exit       ;// mike.dld, 2005-01-29
748
        jle     .exit       ;// mike.dld, 2005-01-29
607
        sub     ecx, eax
749
        sub     ecx, eax
Line 621... Line 763...
621
; 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
622
        inc     ebx
764
        inc     ebx
623
; \end{diamond}[20.08.2006]
765
; \end{diamond}[20.08.2006]
624
        sub     ebx, [drbar.bar_cx]
766
        sub     ebx, [drbar.bar_cx]
625
        ja      @f
767
        ja      @f
-
 
768
;--------------------------------------
-
 
769
align 4
626
.exit:                       ;// mike.dld, 2005-01-29
770
.exit:                       ;// mike.dld, 2005-01-29
627
        add     esp, drbar.stack_data
771
        add     esp, drbar.stack_data
628
        popad
772
        popad
629
        xor     eax, eax
773
        xor     eax, eax
630
        inc     eax
774
        inc     eax
631
        ret
775
        ret
-
 
776
;--------------------------------------
-
 
777
align 4
632
@@:
778
@@:
633
        cmp     ebx, [drbar.bar_sx]
779
        cmp     ebx, [drbar.bar_sx]
634
        jbe     .end_x
780
        jbe     .end_x
635
        mov     ebx, [drbar.bar_sx]
781
        mov     ebx, [drbar.bar_sx]
-
 
782
;--------------------------------------
-
 
783
align 4
636
.end_x:
784
.end_x:
637
        mov     [drbar.real_sx], ebx
785
        mov     [drbar.real_sx], ebx
638
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
786
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
639
        mov     ebx, [edi-twdw + WDATA.box.height]; ebx = wnd_sy
787
        mov     ebx, [edi-twdw + WDATA.box.height]; ebx = wnd_sy
640
; \begin{diamond}[20.08.2006]
788
; \begin{diamond}[20.08.2006]
Line 645... Line 793...
645
        add     esp, drbar.stack_data
793
        add     esp, drbar.stack_data
646
        popad
794
        popad
647
        xor     eax, eax
795
        xor     eax, eax
648
        inc     eax
796
        inc     eax
649
        ret
797
        ret
-
 
798
;--------------------------------------
-
 
799
align 4
650
@@:
800
@@:
651
        cmp     ebx, [drbar.bar_sy]
801
        cmp     ebx, [drbar.bar_sy]
652
        jbe     .end_y
802
        jbe     .end_y
653
        mov     ebx, [drbar.bar_sy]
803
        mov     ebx, [drbar.bar_sy]
-
 
804
;--------------------------------------
-
 
805
align 4
654
.end_y:
806
.end_y:
655
        mov     [drbar.real_sy], ebx
807
        mov     [drbar.real_sy], ebx
656
; line_inc_map
808
; line_inc_map
657
        mov     eax, [Screen_Max_X]
809
        mov     eax, [Screen_Max_X]
658
        sub     eax, [drbar.real_sx]
810
        sub     eax, [drbar.real_sx]
Line 679... Line 831...
679
        imul    eax, [Screen_Max_X]
831
        imul    eax, [Screen_Max_X]
680
        add     eax, [drbar.abs_cy]
832
        add     eax, [drbar.abs_cy]
681
        add     eax, [drbar.abs_cx]
833
        add     eax, [drbar.abs_cx]
682
        add     eax, [_WinMapAddress]
834
        add     eax, [_WinMapAddress]
683
        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
;--------------------------------------
684
; get process number
846
; get process number
685
        mov     ebx, [CURRENT_TASK]
847
        mov     ebx, [CURRENT_TASK]
686
        cmp     byte [ScreenBPP], 24
848
        cmp     byte [ScreenBPP], 24
687
        jne     draw_bar_end_32
849
        jne     draw_bar_end_32
-
 
850
;--------------------------------------
-
 
851
align 4
688
draw_bar_end_24:
852
draw_bar_end_24:
689
        mov     eax, [drbar.color] ;; BBGGRR00
853
        mov     eax, [drbar.color] ;; BBGGRR00
690
        mov     bh, al             ;; bh  = BB
854
        mov     bh, al             ;; bh  = BB
691
        shr     eax, 8             ;; eax = RRGG
855
        shr     eax, 8             ;; eax = RRGG
692
; eax - color high   RRGG
856
; eax - color high   RRGG
Line 695... Line 859...
695
; ecx - temp
859
; ecx - temp
696
; edx - pointer to screen
860
; edx - pointer to screen
697
; esi - counter
861
; esi - counter
698
; edi - counter
862
; edi - counter
699
        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
;--------------------------------------
700
align   4
867
align 4
701
.new_y:
868
.new_y:
702
        mov     edi, [drbar.real_sx]
869
        mov     edi, [drbar.real_sx]
-
 
870
;--------------------------------------
703
align   4
871
align 4
704
.new_x:
872
.new_x:
705
        cmp     byte [ebp], bl
873
        cmp     byte [ebp], bl
706
        jne     .skip
874
        jne     .skip
-
 
875
;--------------------------------------
-
 
876
        push    eax
-
 
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
Line -... Line 883...
-
 
883
 
-
 
884
        shl     eax, 8
-
 
885
        mov     al, bh
-
 
886
; check mouse area for putpixel
-
 
887
        call    check_mouse_area_for_putpixel
707
 
888
; store to real LFB
-
 
889
        mov     [edx], ax
708
        mov     [LFB_BASE+edx], bh
890
        shr     eax, 16
-
 
891
        mov     [edx + 2], al
-
 
892
        pop     eax
-
 
893
;--------------------------------------
709
        mov     [LFB_BASE+edx + 1], ax
894
align 4
710
.skip:
895
.skip:
711
; add pixel
896
; add pixel
712
        add     edx, 3
897
        add     edx, 3
713
        inc     ebp
898
        inc     ebp
Line 720... Line 905...
720
        test    eax, 0x00800000
905
        test    eax, 0x00800000
721
        jz      @f
906
        jz      @f
722
        test    bh, bh
907
        test    bh, bh
723
        jz      @f
908
        jz      @f
724
        dec     bh
909
        dec     bh
-
 
910
;--------------------------------------
-
 
911
align 4
725
@@:
912
@@:
726
; 
913
; 
727
        dec     esi
914
        dec     esi
728
        jnz     .new_y
915
        jnz     .new_y
-
 
916
;--------------------------------------
-
 
917
align 4
-
 
918
.end:
729
        add     esp, drbar.stack_data
919
        add     esp, drbar.stack_data
730
        popad
920
        popad
731
        xor     eax, eax
921
        xor     eax, eax
732
        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
;--------------------------------------
733
 
1001
align 4
734
draw_bar_end_32:
1002
draw_bar_end_32:
735
        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
736
        mov     esi, [drbar.real_sy]
1007
;--------------------------------------
737
align   4
1008
align 4
738
.new_y:
1009
.new_y:
-
 
1010
        mov     edi, [drbar.real_sx]
739
        mov     edi, [drbar.real_sx]
1011
;--------------------------------------
740
align   4
1012
align 4
741
.new_x:
1013
.new_x:
742
        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
743
        jne     .skip
1026
        call    check_mouse_area_for_putpixel
-
 
1027
; store to real LFB
-
 
1028
        mov     [edx], eax
-
 
1029
        pop     eax
744
 
1030
;--------------------------------------
745
        mov     [LFB_BASE+edx], eax
1031
align 4
746
.skip:
1032
.skip:
747
; add pixel
1033
; add pixel
748
        add     edx, 4
1034
        add     edx, 4
Line 756... Line 1042...
756
        test    eax, 0x80000000
1042
        test    eax, 0x80000000
757
        jz      @f
1043
        jz      @f
758
        test    al, al
1044
        test    al, al
759
        jz      @f
1045
        jz      @f
760
        dec     al
1046
        dec     al
-
 
1047
;--------------------------------------
-
 
1048
align 4
761
@@:
1049
@@:
762
; 
1050
; 
763
        dec     esi
1051
        dec     esi
764
        jnz     .new_y
1052
        jnz     .new_y
-
 
1053
;--------------------------------------
-
 
1054
align 4
-
 
1055
.end:
765
        add     esp, drbar.stack_data
1056
        add     esp, drbar.stack_data
766
        popad
1057
        popad
767
        call    VGA_draw_bar
1058
        call    VGA_draw_bar
768
        xor     eax, eax
1059
        xor     eax, eax
769
        mov     [EGA_counter], 1
1060
        mov     [EGA_counter], 1
770
        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
-
 
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
Line -... Line 1092...
-
 
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
771
 
1131
;------------------------------------------------------------------------------
772
align 4
1132
align 4
773
vesa20_drawbackground_tiled:
-
 
774
        call    [_display.disable_mouse]
1133
vesa20_drawbackground_tiled:
775
        pushad
1134
        pushad
776
; External loop for all y from start to end
1135
; External loop for all y from start to end
-
 
1136
        mov     ebx, [draw_data+32+RECT.top]    ; y start
-
 
1137
;--------------------------------------
777
        mov     ebx, [draw_data+32+RECT.top]    ; y start
1138
align 4
778
dp2:
1139
dp2:
779
        mov     ebp, [draw_data+32+RECT.left]   ; x start
1140
        mov     ebp, [draw_data+32+RECT.left]   ; x start
780
; 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]
781
;                       and LFB data (output for our function) [edi]
1142
;                       and LFB data (output for our function) [edi]
Line 786... Line 1147...
786
        add     ebp, eax
1147
        add     ebp, eax
787
        add     ebp, eax
1148
        add     ebp, eax
788
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
1149
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
789
        jz      @f
1150
        jz      @f
790
        add     ebp, eax
1151
        add     ebp, eax
-
 
1152
;--------------------------------------
-
 
1153
align 4
791
@@:
1154
@@:
792
        add     ebp, LFB_BASE
1155
        add     ebp, LFB_BASE
793
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1156
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
794
        call    calculate_edi
1157
        call    calculate_edi
795
        xchg    edi, ebp
1158
        xchg    edi, ebp
Line 819... Line 1182...
819
; eax = x, ebx = y (screen coordinates)
1182
; eax = x, ebx = y (screen coordinates)
820
; ecx = deltax - number of pixels left in current tile block
1183
; ecx = deltax - number of pixels left in current tile block
821
; edx = 1
1184
; edx = 1
822
; esi -> bgr memory, edi -> output
1185
; esi -> bgr memory, edi -> output
823
; ebp = offset in WinMapAddress
1186
; ebp = offset in WinMapAddress
-
 
1187
;--------------------------------------
-
 
1188
align 4
824
dp3:
1189
dp3:
825
        cmp     [ebp], dl
1190
        cmp     [ebp], dl
826
        jnz     nbgp
1191
        jnz     nbgp
-
 
1192
;--------------------------------------
-
 
1193
        push    eax ecx
-
 
1194
 
827
        movsb
1195
        mov     ecx, eax
-
 
1196
        shl     ecx, 16
-
 
1197
        add     ecx, ebx
-
 
1198
 
828
        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
829
        movsb
1204
        mov     [edi], ax
-
 
1205
        shr     eax, 16
-
 
1206
        mov     [edi+2], al
-
 
1207
 
830
        jmp     @f
1208
        pop     ecx eax
-
 
1209
;--------------------------------------
-
 
1210
align 4
831
nbgp:
1211
nbgp:
832
        add     esi, 3
1212
        add     esi, 3
833
        add     edi, 3
1213
        add     edi, 3
-
 
1214
;--------------------------------------
-
 
1215
align 4
834
@@:
1216
@@:
835
        cmp     [ScreenBPP], byte 25    ; 24 or 32 bpp?
1217
        cmp     [ScreenBPP], byte 25    ; 24 or 32 bpp?
836
        sbb     edi, -1         ; +1 for 32 bpp
1218
        sbb     edi, -1         ; +1 for 32 bpp
837
; 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'
838
        add     ebp, edx
1220
        add     ebp, edx
Line 845... Line 1227...
845
        mov     ecx, [BgrDataWidth]
1227
        mov     ecx, [BgrDataWidth]
846
        sub     esi, ecx
1228
        sub     esi, ecx
847
        sub     esi, ecx
1229
        sub     esi, ecx
848
        sub     esi, ecx
1230
        sub     esi, ecx
849
        jmp     dp3
1231
        jmp     dp3
-
 
1232
;--------------------------------------
-
 
1233
align 4
850
dp4:
1234
dp4:
851
; next scan line
1235
; next scan line
852
        inc     ebx
1236
        inc     ebx
853
        cmp     ebx, [draw_data+32+RECT.bottom]
1237
        cmp     ebx, [draw_data+32+RECT.bottom]
854
        jbe     dp2
1238
        jbe     dp2
855
        popad
1239
        popad
856
        mov     [EGA_counter], 1
1240
        mov     [EGA_counter], 1
857
        call    VGA_drawbackground
1241
        call    VGA_drawbackground
858
        ret
1242
        ret
859
 
-
 
-
 
1243
;------------------------------------------------------------------------------
860
; ----------
1244
align 4
861
 
-
 
862
 
-
 
863
vesa20_drawbackground_stretch:
1245
vesa20_drawbackground_stretch:
864
        call    [_display.disable_mouse]
-
 
865
        pushad
1246
        pushad
866
; Helper variables
1247
; Helper variables
867
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
1248
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
868
        mov     eax, [BgrDataWidth]
1249
        mov     eax, [BgrDataWidth]
869
        dec     eax
1250
        dec     eax
Line 894... Line 1275...
894
        add     ebp, eax
1275
        add     ebp, eax
895
        add     ebp, eax
1276
        add     ebp, eax
896
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
1277
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
897
        jz      @f
1278
        jz      @f
898
        add     ebp, eax
1279
        add     ebp, eax
-
 
1280
;--------------------------------------
-
 
1281
align 4
899
@@:
1282
@@:
900
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1283
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
901
        call    calculate_edi
1284
        call    calculate_edi
902
        xchg    edi, ebp
1285
        xchg    edi, ebp
903
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
1286
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
Line 924... Line 1307...
924
        add     esi, [img_background]
1307
        add     esi, [img_background]
925
        push    eax
1308
        push    eax
926
        push    edx
1309
        push    edx
927
        push    esi
1310
        push    esi
928
; 3) Smooth horizontal
1311
; 3) Smooth horizontal
-
 
1312
;--------------------------------------
-
 
1313
align 4
929
bgr_resmooth0:
1314
bgr_resmooth0:
930
        mov     ecx, [esp+8]
1315
        mov     ecx, [esp+8]
931
        mov     edx, [esp+4]
1316
        mov     edx, [esp+4]
932
        mov     esi, [esp]
1317
        mov     esi, [esp]
933
        push    edi
1318
        push    edi
934
        mov     edi, bgr_cur_line
1319
        mov     edi, bgr_cur_line
935
        call    smooth_line
1320
        call    smooth_line
-
 
1321
;--------------------------------------
-
 
1322
align 4
936
bgr_resmooth1:
1323
bgr_resmooth1:
937
        mov     eax, [esp+16+4]
1324
        mov     eax, [esp+16+4]
938
        inc     eax
1325
        inc     eax
939
        cmp     eax, [BgrDataHeight]
1326
        cmp     eax, [BgrDataHeight]
940
        jae     bgr.no2nd
1327
        jae     bgr.no2nd
Line 944... Line 1331...
944
        add     esi, [BgrDataWidth]
1331
        add     esi, [BgrDataWidth]
945
        add     esi, [BgrDataWidth]
1332
        add     esi, [BgrDataWidth]
946
        add     esi, [BgrDataWidth]
1333
        add     esi, [BgrDataWidth]
947
        mov     edi, bgr_next_line
1334
        mov     edi, bgr_next_line
948
        call    smooth_line
1335
        call    smooth_line
-
 
1336
;--------------------------------------
-
 
1337
align 4
949
bgr.no2nd:
1338
bgr.no2nd:
950
        pop     edi
1339
        pop     edi
-
 
1340
;--------------------------------------
-
 
1341
align 4
951
sdp3:
1342
sdp3:
952
        xor     esi, esi
1343
        xor     esi, esi
953
        mov     ecx, [esp+12]
1344
        mov     ecx, [esp+12]
954
; 4) Loop through redraw rectangle and copy background data
1345
; 4) Loop through redraw rectangle and copy background data
955
; Registers meaning:
1346
; Registers meaning:
Line 961... Line 1352...
961
; dword [esp+20] = x
1352
; dword [esp+20] = x
962
; dword [esp+24] = y
1353
; dword [esp+24] = y
963
; precalculated constants:
1354
; precalculated constants:
964
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
1355
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
965
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
1356
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
-
 
1357
;--------------------------------------
-
 
1358
align 4
966
sdp3a:
1359
sdp3a:
967
        mov     eax, [_WinMapAddress]
1360
        mov     eax, [_WinMapAddress]
968
        cmp     [ebp+eax], byte 1
1361
        cmp     [ebp+eax], byte 1
969
        jnz     snbgp
1362
        jnz     snbgp
970
        mov     eax, [bgr_cur_line+esi]
1363
        mov     eax, [bgr_cur_line+esi]
971
        test    ecx, ecx
1364
        test    ecx, ecx
972
        jz      .novert
1365
        jz      .novert
973
        mov     ebx, [bgr_next_line+esi]
1366
        mov     ebx, [bgr_next_line+esi]
974
        call    [overlapping_of_points_ptr]
1367
        call    [overlapping_of_points_ptr]
-
 
1368
;--------------------------------------
-
 
1369
align 4
975
.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]
976
 
-
 
-
 
1377
; store to real LFB
977
        mov     [LFB_BASE+edi], ax
1378
        mov     [LFB_BASE+edi], ax
978
        shr     eax, 16
1379
        shr     eax, 16
979
 
-
 
980
        mov     [LFB_BASE+edi+2], al
1380
        mov     [LFB_BASE+edi+2], al
-
 
1381
        pop     ecx
-
 
1382
;--------------------------------------
-
 
1383
align 4
981
snbgp:
1384
snbgp:
982
        cmp     [ScreenBPP], byte 25
1385
        cmp     [ScreenBPP], byte 25
983
        sbb     edi, -4
1386
        sbb     edi, -4
984
        add     ebp, 1
1387
        add     ebp, 1
985
        mov     eax, [esp+20]
1388
        mov     eax, [esp+20]
986
        add     eax, 1
1389
        add     eax, 1
987
        mov     [esp+20], eax
1390
        mov     [esp+20], eax
988
        add     esi, 4
1391
        add     esi, 4
989
        cmp     eax, [draw_data+32+RECT.right]
1392
        cmp     eax, [draw_data+32+RECT.right]
990
        jbe     sdp3a
1393
        jbe     sdp3a
-
 
1394
;--------------------------------------
-
 
1395
align 4
991
sdp4:
1396
sdp4:
992
; next y
1397
; next y
993
        mov     ebx, [esp+24]
1398
        mov     ebx, [esp+24]
994
        add     ebx, 1
1399
        add     ebx, 1
995
        mov     [esp+24], ebx
1400
        mov     [esp+24], ebx
Line 1004... Line 1409...
1004
        sub     edi, eax
1409
        sub     edi, eax
1005
        sub     edi, eax
1410
        sub     edi, eax
1006
        cmp     [ScreenBPP], byte 24
1411
        cmp     [ScreenBPP], byte 24
1007
        jz      @f
1412
        jz      @f
1008
        sub     edi, eax
1413
        sub     edi, eax
-
 
1414
;--------------------------------------
-
 
1415
align 4
1009
@@:
1416
@@:
1010
        add     edi, [BytesPerScanLine]
1417
        add     edi, [BytesPerScanLine]
1011
; restore ecx,edx; advance esi to next background line
1418
; restore ecx,edx; advance esi to next background line
1012
        mov     eax, [esp+28]
1419
        mov     eax, [esp+28]
1013
        mov     ebx, [esp+32]
1420
        mov     ebx, [esp+32]
Line 1030... Line 1437...
1030
        mov     edi, bgr_cur_line
1437
        mov     edi, bgr_cur_line
1031
        mov     ecx, [Screen_Max_X]
1438
        mov     ecx, [Screen_Max_X]
1032
        inc     ecx
1439
        inc     ecx
1033
        rep movsd
1440
        rep movsd
1034
        jmp     bgr_resmooth1
1441
        jmp     bgr_resmooth1
-
 
1442
;--------------------------------------
-
 
1443
align 4
1035
sdpdone:
1444
sdpdone:
1036
        add     esp, 44
1445
        add     esp, 44
1037
        popad
1446
        popad
1038
        mov     [EGA_counter], 1
1447
        mov     [EGA_counter], 1
1039
        call    VGA_drawbackground
1448
        call    VGA_drawbackground
1040
        ret
1449
        ret
Line 1041... Line 1450...
1041
 
1450
 
-
 
1451
uglobal
1042
uglobal
1452
;--------------------------------------
1043
align 4
1453
align 4
1044
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
1045
bgr_next_line   rd      1920
1456
;--------------------------------------
-
 
1457
endg
1046
endg
1458
;--------------------------------------
1047
 
1459
align 4
1048
smooth_line:
1460
smooth_line:
1049
        mov     al, [esi+2]
1461
        mov     al, [esi+2]
1050
        shl     eax, 16
1462
        shl     eax, 16
1051
        mov     ax, [esi]
1463
        mov     ax, [esi]
1052
        test    ecx, ecx
1464
        test    ecx, ecx
1053
        jz      @f
1465
        jz      @f
1054
        mov     ebx, [esi+2]
1466
        mov     ebx, [esi+2]
1055
        shr     ebx, 8
1467
        shr     ebx, 8
-
 
1468
        call    [overlapping_of_points_ptr]
-
 
1469
;--------------------------------------
1056
        call    [overlapping_of_points_ptr]
1470
align 4
1057
@@:
1471
@@:
1058
        stosd
1472
        stosd
1059
        mov     eax, [esp+20+8]
1473
        mov     eax, [esp+20+8]
1060
        add     eax, 1
1474
        add     eax, 1
Line 1066... Line 1480...
1066
        adc     edx, [esp+40+8]
1480
        adc     edx, [esp+40+8]
1067
        sub     eax, edx
1481
        sub     eax, edx
1068
        lea     eax, [eax*3]
1482
        lea     eax, [eax*3]
1069
        sub     esi, eax
1483
        sub     esi, eax
1070
        jmp     smooth_line
1484
        jmp     smooth_line
-
 
1485
;--------------------------------------
-
 
1486
align 4
1071
@@:
1487
@@:
1072
        mov     eax, [draw_data+32+RECT.left]
1488
        mov     eax, [draw_data+32+RECT.left]
1073
        mov     [esp+20+8], eax
1489
        mov     [esp+20+8], eax
1074
        ret
1490
        ret
1075
 
-
 
-
 
1491
;------------------------------------------------------------------------------
1076
align 16
1492
align 16
1077
overlapping_of_points:
1493
overlapping_of_points:
1078
if 0
1494
if 0
1079
; this version of procedure works, but is slower than next version
1495
; this version of procedure works, but is slower than next version
1080
        push    ecx edx
1496
        push    ecx edx
Line 1135... Line 1551...
1135
        pop     ecx
1551
        pop     ecx
1136
        ret
1552
        ret
1137
end if
1553
end if
Line 1138... Line 1554...
1138
 
1554
 
-
 
1555
iglobal
1139
iglobal
1556
;--------------------------------------
1140
align 4
1557
align 4
-
 
1558
overlapping_of_points_ptr       dd      overlapping_of_points
1141
overlapping_of_points_ptr       dd      overlapping_of_points
1559
;--------------------------------------
-
 
1560
endg
1142
endg
1561
;------------------------------------------------------------------------------
1143
 
1562
align 4
1144
init_background:
1563
init_background:
1145
        mov     edi, BgrAuxTable
1564
        mov     edi, BgrAuxTable
-
 
1565
        xor     edx, edx
-
 
1566
;--------------------------------------
1146
        xor     edx, edx
1567
align 4
1147
.loop2:
1568
.loop2:
1148
        mov     eax, edx
1569
        mov     eax, edx
1149
        shl     eax, 8
1570
        shl     eax, 8
1150
        neg     eax
1571
        neg     eax
-
 
1572
        mov     ecx, 0x200
-
 
1573
;--------------------------------------
1151
        mov     ecx, 0x200
1574
align 4
1152
.loop1:
1575
.loop1:
1153
        mov     byte [edi], ah
1576
        mov     byte [edi], ah
1154
        inc     edi
1577
        inc     edi
1155
        add     eax, edx
1578
        add     eax, edx
1156
        loop    .loop1
1579
        loop    .loop1
1157
        add     dl, 4
1580
        add     dl, 4
1158
        jnz     .loop2
1581
        jnz     .loop2
1159
        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)
1160
        jz      @f
1583
        jz      @f
-
 
1584
        mov     [overlapping_of_points_ptr], overlapping_of_points_mmx
-
 
1585
;--------------------------------------
1161
        mov     [overlapping_of_points_ptr], overlapping_of_points_mmx
1586
align 4
1162
@@:
1587
@@:
1163
        ret
-
 
-
 
1588
        ret
1164
 
1589
;------------------------------------------------------------------------------
1165
align 16
1590
align 16
1166
overlapping_of_points_mmx:
1591
overlapping_of_points_mmx:
1167
        movd    mm0, eax
1592
        movd    mm0, eax
1168
        movd    mm4, eax
1593
        movd    mm4, eax
Line 1179... Line 1604...
1179
        psrlw   mm1, 8
1604
        psrlw   mm1, 8
1180
        packuswb mm1, mm2
1605
        packuswb mm1, mm2
1181
        paddb   mm4, mm1
1606
        paddb   mm4, mm1
1182
        movd    eax, mm4
1607
        movd    eax, mm4
1183
        ret
1608
        ret
-
 
1609
;------------------------------------------------------------------------------