Subversion Repositories Kolibri OS

Rev

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

Rev 4423 Rev 5201
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;  VESA20.INC                                                  ;;
6
;;  VESA20.INC                                                  ;;
7
;;                                                              ;;
7
;;                                                              ;;
8
;;  Vesa 2.0 functions for MenuetOS                             ;;
8
;;  Vesa 2.0 functions for MenuetOS                             ;;
Line 15... Line 15...
15
;;                                                              ;;
15
;;                                                              ;;
16
;;  See file COPYING for details                                ;;
16
;;  See file COPYING for details                                ;;
17
;;                                                              ;;
17
;;                                                              ;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 19... Line 19...
19
 
19
 
Line -... Line 20...
-
 
20
$Revision: 5201 $
-
 
21
 
-
 
22
uglobal
-
 
23
align 4
-
 
24
        bgr_cur_line    rd 1920         ; maximum width of screen
Line -... Line 25...
-
 
25
        bgr_next_line   rd 1920
-
 
26
endg
20
$Revision: 4423 $
27
 
21
 
-
 
-
 
28
iglobal
Line 22... Line 29...
22
 
29
align 4
23
; If you're planning to write your own video driver I suggest
30
        overlapping_of_points_ptr       dd overlapping_of_points
24
; you replace the VESA12.INC file and see those instructions.
-
 
25
 
-
 
26
 
-
 
27
;-----------------------------------------------------------------------------
31
endg
28
; getpixel
32
 
29
;
-
 
30
; in:
-
 
31
; eax = x coordinate
-
 
32
; ebx = y coordinate
33
 
33
;
34
;-----------------------------------------------------------------------------
-
 
35
; eax = x
-
 
36
; ebx = y
-
 
37
 
-
 
38
align 4
-
 
39
Vesa20_getpixel16:
34
; ret:
40
 
-
 
41
        ; check for hardware cursor
-
 
42
        cmp     [_display.select_cursor], select_cursor
-
 
43
        je      @f
-
 
44
        cmp     [_display.select_cursor], 0
35
; ecx = 00 RR GG BB
45
        jne     .no_mouseunder
-
 
46
  @@:
-
 
47
 
-
 
48
        ; check mouse area for putpixel
-
 
49
        test    ecx, 0x04000000         ; don't load to mouseunder area
-
 
50
        jnz     .no_mouseunder
-
 
51
        call    [_display.check_m_pixel]
-
 
52
        test    ecx, ecx                ; 0xff000000
-
 
53
        jnz     @f
-
 
54
 
-
 
55
  .no_mouseunder:
-
 
56
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
-
 
57
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
58
        lea     edi, [eax*2]            ; edi = x*2
-
 
59
        add     edi, ebx                ; edi = x*2+(y*y multiplier)
-
 
60
 
-
 
61
        movzx   ecx, word[LFB_BASE+edi]
36
;-----------------------------------------------------------------------------
62
        shl     ecx, 3
-
 
63
        ror     ecx, 8
-
 
64
        shl     cx, 2
37
align 4
65
        ror     ecx, 8
-
 
66
        shl     cl, 3
38
getpixel:
67
        rol     ecx, 16
39
        push    eax ebx edx edi
-
 
40
        call    dword [GETPIXEL]
-
 
41
        pop     edi edx ebx eax
68
  @@:
42
        ret
69
        and     ecx, 0x00ffffff
-
 
70
        ret
-
 
71
 
43
;-----------------------------------------------------------------------------
72
;-----------------------------------------------------------------------------
-
 
73
; eax = x
44
align 4
74
; ebx = y
45
Vesa20_getpixel24:
75
 
46
; eax = x
76
align 4
47
; ebx = y
77
Vesa20_getpixel24:
48
;--------------------------------------
78
 
49
; check for hardware cursor
-
 
50
        cmp     [_display.select_cursor], select_cursor
-
 
51
        je      @f
79
        ; check for hardware cursor
-
 
80
        cmp     [_display.select_cursor], select_cursor
52
        cmp     [_display.select_cursor], 0
81
        je      @f
53
        jne     .no_mouseunder
82
        cmp     [_display.select_cursor], 0
54
;--------------------------------------
83
        jne     .no_mouseunder
55
align 4
84
  @@:
56
@@:
85
 
57
; check mouse area for putpixel
86
        ; check mouse area for putpixel
58
        test    ecx, 0x04000000  ; don't load to mouseunder area
-
 
59
        jnz     .no_mouseunder
87
        test    ecx, 0x04000000  ; don't load to mouseunder area
60
        call    [_display.check_m_pixel]
88
        jnz     .no_mouseunder
61
        test    ecx, ecx        ;0xff000000
-
 
62
        jnz     @f
89
        call    [_display.check_m_pixel]
63
;--------------------------------------
90
        test    ecx, ecx                ; 0xff000000
64
align 4
91
        jnz     @f
65
.no_mouseunder:
92
 
-
 
93
  .no_mouseunder:
66
;--------------------------------------
94
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
67
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
-
 
68
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
69
        lea     edi, [eax+eax*2]; edi = x*3
95
        mov     ebx, [BPSLine_calc_area+ebx*4]
70
        add     edi, ebx      ; edi = x*3+(y*y multiplier)
96
        lea     edi, [eax+eax*2]        ; edi = x*3
71
        mov     ecx, [LFB_BASE+edi]
97
        add     edi, ebx      ; edi = x*3+(y*y multiplier)
-
 
98
 
72
;--------------------------------------
99
        mov     ecx, [LFB_BASE+edi]
-
 
100
  @@:
-
 
101
        and     ecx, 0x00ffffff
-
 
102
        ret
73
align 4
103
 
74
@@:
104
;-----------------------------------------------------------------------------
75
        and     ecx, 0xffffff
-
 
-
 
105
; eax = x
76
        ret
106
; ebx = y
77
;-----------------------------------------------------------------------------
107
 
78
align 4
108
align 4
79
Vesa20_getpixel32:
109
Vesa20_getpixel32:
80
;--------------------------------------
110
 
81
; check for hardware cursor
-
 
82
        cmp     [_display.select_cursor], select_cursor
-
 
83
        je      @f
111
        ; check for hardware cursor
-
 
112
        cmp     [_display.select_cursor], select_cursor
84
        cmp     [_display.select_cursor], 0
113
        je      @f
85
        jne     .no_mouseunder
114
        cmp     [_display.select_cursor], 0
86
;--------------------------------------
115
        jne     .no_mouseunder
87
align 4
116
  @@:
88
@@:
117
 
89
; check mouse area for putpixel
118
        ; check mouse area for putpixel
90
        test    ecx, 0x04000000  ; don't load to mouseunder area
-
 
91
        jnz     .no_mouseunder
119
        test    ecx, 0x04000000  ; don't load to mouseunder area
92
        call    [_display.check_m_pixel]
120
        jnz     .no_mouseunder
93
        test    ecx, ecx        ;0xff000000
-
 
94
        jnz     @f
121
        call    [_display.check_m_pixel]
95
;--------------------------------------
122
        test    ecx, ecx                ; 0xff000000
96
align 4
123
        jnz     @f
-
 
124
 
97
.no_mouseunder:
125
  .no_mouseunder:
98
;--------------------------------------
-
 
99
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
-
 
100
        mov     ebx, [BPSLine_calc_area+ebx*4]
126
;        imul    ebx, [BytesPerScanLine] ; ebx = y * y multiplier
101
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
127
        mov     ebx, [BPSLine_calc_area+ebx*4]
102
        mov     ecx, [LFB_BASE+edi]
128
        lea     edi, [ebx+eax*4]        ; edi = x*4+(y*y multiplier)
-
 
129
 
103
;--------------------------------------
130
        mov     ecx, [LFB_BASE+edi]
-
 
131
  @@:
-
 
132
        and     ecx, 0x00ffffff
-
 
133
        ret
-
 
134
 
-
 
135
;-----------------------------------------------------------------------------
-
 
136
; ebx = pointer
-
 
137
; ecx = size [x|y]
-
 
138
; edx = coordinates [x|y]
-
 
139
; ebp = pointer to 'get' function
-
 
140
; esi = pointer to 'init' function
104
align 4
141
; edi = parameter for 'get' function
105
@@:
142
 
106
        and     ecx, 0xffffff
143
align 16
107
        ret
144
vesa20_putimage:
108
;-----------------------------------------------------------------------------
145
 
Line 132... Line 169...
132
   .ecx         dd      ?
169
   .ecx         dd      ?
133
   .eax         dd      ?
170
   .eax         dd      ?
134
   .ret_addr    dd      ?
171
   .ret_addr    dd      ?
135
   .arg_0       dd      ?
172
   .arg_0       dd      ?
136
end virtual
173
end virtual
137
;-----------------------------------------------------------------------------
-
 
138
align 16
174
 
139
; ebx = pointer
-
 
140
; ecx = size [x|y]
-
 
141
; edx = coordinates [x|y]
-
 
142
; ebp = pointer to 'get' function
-
 
143
; esi = pointer to 'init' function
-
 
144
; edi = parameter for 'get' function
-
 
145
vesa20_putimage:
-
 
146
        pushad
175
        pushad
147
        sub     esp, putimg.stack_data
176
        sub     esp, putimg.stack_data
148
; save pointer to image
177
; save pointer to image
149
        mov     [putimg.pti], ebx
178
        mov     [putimg.pti], ebx
150
; unpack the size
179
; unpack the size
Line 167... Line 196...
167
        mov     ebx, [eax-twdw + WDATA.box.top]
196
        mov     ebx, [eax-twdw + WDATA.box.top]
168
        add     ebx, [putimg.image_cy]
197
        add     ebx, [putimg.image_cy]
169
        mov     [putimg.abs_cy], ebx
198
        mov     [putimg.abs_cy], ebx
170
; real_sx = MIN(wnd_sx-image_cx, image_sx);
199
; real_sx = MIN(wnd_sx-image_cx, image_sx);
171
        mov     ebx, [eax-twdw + WDATA.box.width]; ebx = wnd_sx
200
        mov     ebx, [eax-twdw + WDATA.box.width]       ; ebx = wnd_sx
172
; \begin{diamond}[20.08.2006]
-
 
173
; note that WDATA.box.width is one pixel less than real window x-size
201
        inc     ebx                                     ; WDATA.box.width is one pixel less than real window x-size
174
        inc     ebx
-
 
175
; \end{diamond}[20.08.2006]
-
 
176
        sub     ebx, [putimg.image_cx]
202
        sub     ebx, [putimg.image_cx]
177
        ja      @f
203
        ja      @f
178
        add     esp, putimg.stack_data
204
        add     esp, putimg.stack_data
179
        popad
205
        popad
180
        ret
206
        ret
181
;--------------------------------------
-
 
182
align 4
207
 
183
@@:
208
  @@:
184
        cmp     ebx, [putimg.image_sx]
209
        cmp     ebx, [putimg.image_sx]
185
        jbe     .end_x
210
        jbe     .end_x
186
        mov     ebx, [putimg.image_sx]
211
        mov     ebx, [putimg.image_sx]
187
;--------------------------------------
-
 
188
align 4
-
 
189
.end_x:
212
  .end_x:
190
        mov     [putimg.real_sx], ebx
213
        mov     [putimg.real_sx], ebx
191
; init real_sy
214
; init real_sy
192
        mov     ebx, [eax-twdw + WDATA.box.height]; ebx = wnd_sy
215
        mov     ebx, [eax-twdw + WDATA.box.height]      ; ebx = wnd_sy
193
; \begin{diamond}[20.08.2006]
-
 
194
        inc     ebx
216
        inc     ebx
195
; \end{diamond}[20.08.2006]
-
 
196
        sub     ebx, [putimg.image_cy]
217
        sub     ebx, [putimg.image_cy]
197
        ja      @f
218
        ja      @f
198
        add     esp, putimg.stack_data
219
        add     esp, putimg.stack_data
199
        popad
220
        popad
200
        ret
221
        ret
201
;--------------------------------------
-
 
202
align 4
222
 
203
@@:
223
  @@:
204
        cmp     ebx, [putimg.image_sy]
224
        cmp     ebx, [putimg.image_sy]
205
        jbe     .end_y
225
        jbe     .end_y
206
        mov     ebx, [putimg.image_sy]
226
        mov     ebx, [putimg.image_sy]
207
;--------------------------------------
-
 
208
align 4
-
 
209
.end_y:
227
  .end_y:
210
        mov     [putimg.real_sy], ebx
228
        mov     [putimg.real_sy], ebx
211
; line increment
229
; line increment
212
        mov     eax, [putimg.image_sx]
230
        mov     eax, [putimg.image_sx]
213
        mov     ecx, [putimg.real_sx]
231
        mov     ecx, [putimg.real_sx]
Line 216... Line 234...
216
;     lea     eax, [eax + eax * 2]
234
;     lea     eax, [eax + eax * 2]
217
        call    esi
235
        call    esi
218
        add     eax, [putimg.arg_0]
236
        add     eax, [putimg.arg_0]
219
        mov     [putimg.line_increment], eax
237
        mov     [putimg.line_increment], eax
220
; winmap new line increment
238
; winmap new line increment
221
        mov     eax, [_display.width]
239
        mov     eax, [Screen_Max_X]
-
 
240
        inc     eax
222
        sub     eax, [putimg.real_sx]
241
        sub     eax, [putimg.real_sx]
223
        mov     [putimg.winmap_newline], eax
242
        mov     [putimg.winmap_newline], eax
224
; screen new line increment
243
; screen new line increment
225
        mov     eax, [_display.pitch]
244
        mov     eax, [_display.pitch]
226
        mov     ebx, [_display.bpp]
245
        mov     ebx, [_display.bytes_per_pixel]
227
        shr     ebx, 3
-
 
228
        imul    ecx, ebx
246
        imul    ecx, ebx
229
        sub     eax, ecx
247
        sub     eax, ecx
230
        mov     [putimg.screen_newline], eax
248
        mov     [putimg.screen_newline], eax
231
; pointer to image
249
; pointer to image
232
        mov     esi, [putimg.pti]
250
        mov     esi, [putimg.pti]
233
; pointer to screen
251
; pointer to screen
234
        mov     edx, [putimg.abs_cy]
252
        mov     edx, [putimg.abs_cy]
235
;        imul    edx, [BytesPerScanLine]
253
;        imul    edx, [BytesPerScanLine]
236
        mov     edx, [BPSLine_calc_area+edx*4]
254
        mov     edx, [BPSLine_calc_area+edx*4]
237
        mov     eax, [putimg.abs_cx]
255
        mov     eax, [putimg.abs_cx]
238
;        movzx   ebx, byte [ScreenBPP]
-
 
239
;        shr     ebx, 3
-
 
240
        imul    eax, ebx
256
        imul    eax, ebx
241
        add     edx, eax
257
        add     edx, eax
242
; pointer to pixel map
258
; pointer to pixel map
243
        mov     eax, [putimg.abs_cy]
259
        mov     eax, [putimg.abs_cy]
-
 
260
;        imul    eax, [Screen_Max_X]
-
 
261
;        add     eax, [putimg.abs_cy]
244
        mov     eax, [d_width_calc_area + eax*4]
262
        mov     eax, [d_width_calc_area + eax*4]
Line 245... Line 263...
245
 
263
 
246
        add     eax, [putimg.abs_cx]
264
        add     eax, [putimg.abs_cx]
247
        add     eax, [_WinMapAddress]
265
        add     eax, [_WinMapAddress]
248
        xchg    eax, ebp
-
 
-
 
266
        xchg    eax, ebp
249
;--------------------------------------
267
 
250
        mov     ecx, [putimg.real_sx]
268
        mov     ecx, [putimg.real_sx]
251
        add     ecx, [putimg.abs_cx]
269
        add     ecx, [putimg.abs_cx]
252
        mov     [putimg.real_sx_and_abs_cx], ecx
270
        mov     [putimg.real_sx_and_abs_cx], ecx
253
        mov     ecx, [putimg.real_sy]
271
        mov     ecx, [putimg.real_sy]
254
        add     ecx, [putimg.abs_cy]
272
        add     ecx, [putimg.abs_cy]
255
        mov     [putimg.real_sy_and_abs_cy], ecx
-
 
-
 
273
        mov     [putimg.real_sy_and_abs_cy], ecx
256
;--------------------------------------
274
 
257
; get process number
275
; get process number
-
 
276
        mov     ebx, [CURRENT_TASK]
-
 
277
 
-
 
278
        cmp     byte [_display.bits_per_pixel], 16
-
 
279
        je      put_image_end_16
-
 
280
        cmp     byte [_display.bits_per_pixel], 24
258
        mov     ebx, [CURRENT_TASK]
281
        je      put_image_end_24
259
        cmp     byte [_display.bpp], 32
282
        cmp     byte [_display.bits_per_pixel], 32
-
 
283
        je      put_image_end_32
-
 
284
 
-
 
285
;------------------------------------------------------------------------------
-
 
286
 
-
 
287
put_image_end_16:
-
 
288
 
-
 
289
        mov     edi, [putimg.real_sy]
-
 
290
 
-
 
291
; check for hardware cursor
-
 
292
        mov     ecx, [_display.select_cursor]
-
 
293
        cmp     ecx, select_cursor
-
 
294
        je      put_image_end_16_new
-
 
295
        cmp     ecx, 0
-
 
296
        je      put_image_end_16_old
-
 
297
  .new_line:
-
 
298
        mov     ecx, [putimg.real_sx]
-
 
299
  .new_x:
-
 
300
        push    [putimg.edi]
-
 
301
        mov     eax, [putimg.ebp+4]
-
 
302
        call    eax
-
 
303
        cmp     [ebp], bl
-
 
304
        jne     .skip
-
 
305
; convert to 16 bpp and store to LFB
-
 
306
        and     eax, 00000000111110001111110011111000b
-
 
307
        shr     ah, 2
-
 
308
        shr     ax, 3
-
 
309
        ror     eax, 8
-
 
310
        add     al, ah
-
 
311
        rol     eax, 8
-
 
312
        mov     [LFB_BASE+edx], ax
-
 
313
  .skip:
-
 
314
        add     edx, 2
-
 
315
        inc     ebp
-
 
316
        dec     ecx
-
 
317
        jnz     .new_x
-
 
318
 
-
 
319
        add     esi, [putimg.line_increment]
-
 
320
        add     edx, [putimg.screen_newline]
-
 
321
        add     ebp, [putimg.winmap_newline]
-
 
322
 
-
 
323
        cmp     [putimg.ebp], putimage_get1bpp
-
 
324
        jz      .correct
-
 
325
        cmp     [putimg.ebp], putimage_get2bpp
-
 
326
        jz      .correct
-
 
327
        cmp     [putimg.ebp], putimage_get4bpp
-
 
328
        jnz     @f
-
 
329
  .correct:
-
 
330
        mov     eax, [putimg.edi]
-
 
331
        mov     byte [eax], 80h
-
 
332
  @@:
-
 
333
        dec     edi
-
 
334
        jnz     .new_line
-
 
335
  .finish:
-
 
336
        add     esp, putimg.stack_data
-
 
337
        popad
-
 
338
        ret
-
 
339
 
-
 
340
;------------------------------------------------------------------------------
-
 
341
 
-
 
342
align 4
-
 
343
put_image_end_16_old:
-
 
344
 
-
 
345
  .new_line:
-
 
346
        mov     ecx, [putimg.real_sx]
-
 
347
  .new_x:
-
 
348
        push    [putimg.edi]
-
 
349
        mov     eax, [putimg.ebp+4]
-
 
350
        call    eax
-
 
351
        cmp     [ebp], bl
-
 
352
        jne     .skip
-
 
353
 
-
 
354
        push    ecx
-
 
355
        neg     ecx
-
 
356
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
-
 
357
        shl     ecx, 16
-
 
358
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
-
 
359
        sub     ecx, edi
-
 
360
 
-
 
361
; check mouse area for putpixel
-
 
362
        call    check_mouse_area_for_putpixel
-
 
363
        pop     ecx
-
 
364
 
-
 
365
; convert to 16 bpp and store to LFB
-
 
366
;;        and     eax, 00000000111110001111110011111000b
-
 
367
;;        shr     ah, 2
-
 
368
;;        shr     ax, 3
-
 
369
;;        ror     eax, 8
-
 
370
;;        add     al, ah
-
 
371
;;        rol     eax, 8
-
 
372
        mov     [LFB_BASE+edx], ax
-
 
373
  .skip:
-
 
374
        inc     edx
-
 
375
        inc     edx
-
 
376
        inc     ebp
-
 
377
        dec     ecx
-
 
378
        jnz     .new_x
-
 
379
 
-
 
380
        add     esi, [putimg.line_increment]
-
 
381
        add     edx, [putimg.screen_newline]
-
 
382
        add     ebp, [putimg.winmap_newline]
-
 
383
 
-
 
384
        cmp     [putimg.ebp], putimage_get1bpp
-
 
385
        jz      .correct
-
 
386
        cmp     [putimg.ebp], putimage_get2bpp
-
 
387
        jz      .correct
-
 
388
        cmp     [putimg.ebp], putimage_get4bpp
-
 
389
        jnz     @f
-
 
390
  .correct:
-
 
391
        mov     eax, [putimg.edi]
-
 
392
        mov     byte [eax], 80h
-
 
393
  @@:
-
 
394
        dec     edi
-
 
395
        jnz     .new_line
-
 
396
        jmp     put_image_end_16.finish
260
        je      put_image_end_32
397
 
-
 
398
;------------------------------------------------------------------------------
-
 
399
 
-
 
400
align 4
-
 
401
put_image_end_16_new:
-
 
402
 
-
 
403
  .new_line:
-
 
404
        mov     ecx, [putimg.real_sx]
-
 
405
 
-
 
406
  .new_x:
-
 
407
        push    [putimg.edi]
-
 
408
        mov     eax, [putimg.ebp+4]
-
 
409
        call    eax
-
 
410
 
-
 
411
        cmp     [ebp], bl
-
 
412
        jne     .skip
-
 
413
 
-
 
414
        push    ecx
-
 
415
  .sh:
-
 
416
        neg     ecx
-
 
417
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
-
 
418
 
-
 
419
; check for X
-
 
420
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
421
        jae     .no_mouse_area
-
 
422
 
-
 
423
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
-
 
424
        jb      .no_mouse_area
-
 
425
 
-
 
426
        shl     ecx, 16
-
 
427
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
-
 
428
        sub     ecx, edi
-
 
429
 
-
 
430
; check for Y
-
 
431
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
432
        jae     .no_mouse_area
-
 
433
 
-
 
434
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
435
        jb      .no_mouse_area
-
 
436
 
-
 
437
; check mouse area for putpixel
-
 
438
        call    check_mouse_area_for_putpixel_new.1
-
 
439
        cmp     ecx, -1                 ; SHIT HAPPENS?
-
 
440
        jne     .no_mouse_area
-
 
441
 
-
 
442
        mov     ecx, [esp]
-
 
443
        jmp     .sh
-
 
444
 
-
 
445
  .no_mouse_area:
-
 
446
        pop     ecx
-
 
447
; convert to 16 bpp and store to LFB
-
 
448
        and     eax, 00000000111110001111110011111000b
-
 
449
        shr     ah, 2
-
 
450
        shr     ax, 3
-
 
451
        ror     eax, 8
-
 
452
        add     al, ah
-
 
453
        rol     eax, 8
-
 
454
        mov     [LFB_BASE+edx], ax
-
 
455
 
-
 
456
  .skip:
-
 
457
        add     edx, 2
-
 
458
        inc     ebp
-
 
459
        dec     ecx
-
 
460
        jnz     .new_x
-
 
461
 
-
 
462
        add     esi, [putimg.line_increment]
-
 
463
        add     edx, [putimg.screen_newline]
-
 
464
        add     ebp, [putimg.winmap_newline]
-
 
465
 
-
 
466
        cmp     [putimg.ebp], putimage_get1bpp
-
 
467
        jz      .correct
-
 
468
        cmp     [putimg.ebp], putimage_get2bpp
-
 
469
        jz      .correct
-
 
470
        cmp     [putimg.ebp], putimage_get4bpp
-
 
471
        jnz     @f
-
 
472
 
-
 
473
  .correct:
-
 
474
        mov     eax, [putimg.edi]
-
 
475
        mov     byte [eax], 80h
-
 
476
 
-
 
477
  @@:
-
 
478
        dec     edi
-
 
479
        jnz     .new_line
-
 
480
        jmp     put_image_end_16.finish
-
 
481
 
-
 
482
;------------------------------------------------------------------------------
-
 
483
 
261
;--------------------------------------
484
align 4
-
 
485
put_image_end_24:
262
put_image_end_24:
486
 
263
        mov     edi, [putimg.real_sy]
-
 
-
 
487
        mov     edi, [putimg.real_sy]
264
;--------------------------------------
488
 
265
; check for hardware cursor
489
; check for hardware cursor
266
        mov     ecx, [_display.select_cursor]
490
        mov     ecx, [_display.select_cursor]
267
        cmp     ecx, select_cursor
491
        cmp     ecx, select_cursor
268
        je      put_image_end_24_new
492
        je      put_image_end_24_new
269
        cmp     ecx, 0
493
        cmp     ecx, 0
270
        je      put_image_end_24_old
-
 
271
;--------------------------------------
-
 
272
align 4
494
        je      put_image_end_24_old
273
.new_line:
495
  .new_line:
274
        mov     ecx, [putimg.real_sx]
-
 
275
;--------------------------------------
-
 
276
align 4
496
        mov     ecx, [putimg.real_sx]
277
.new_x:
497
  .new_x:
278
        push    [putimg.edi]
498
        push    [putimg.edi]
279
        mov     eax, [putimg.ebp+4]
499
        mov     eax, [putimg.ebp+4]
280
        call    eax
500
        call    eax
281
        cmp     [ebp], bl
501
        cmp     [ebp], bl
282
        jne     .skip
-
 
-
 
502
        jne     .skip
283
;--------------------------------------
503
 
284
; store to real LFB
504
; store to LFB
285
        mov     [LFB_BASE+edx], ax
505
        mov     [LFB_BASE+edx], ax
286
        shr     eax, 16
506
        shr     eax, 16
287
        mov     [LFB_BASE+edx+2], al
-
 
288
;--------------------------------------
507
        mov     [LFB_BASE+edx+2], al
289
align 4
508
 
290
.skip:
509
  .skip:
291
        add     edx, 3
510
        add     edx, 3
292
        inc     ebp
511
        inc     ebp
293
        dec     ecx
512
        dec     ecx
Line 294... Line 513...
294
        jnz     .new_x
513
        jnz     .new_x
295
 
514
 
296
        add     esi, [putimg.line_increment]
515
        add     esi, [putimg.line_increment]
Line 297... Line 516...
297
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
516
        add     edx, [putimg.screen_newline]
298
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
517
        add     ebp, [putimg.winmap_newline]
299
 
518
 
300
        cmp     [putimg.ebp], putimage_get1bpp
519
        cmp     [putimg.ebp], putimage_get1bpp
301
        jz      .correct
520
        jz      .correct
302
        cmp     [putimg.ebp], putimage_get2bpp
521
        cmp     [putimg.ebp], putimage_get2bpp
303
        jz      .correct
-
 
304
        cmp     [putimg.ebp], putimage_get4bpp
-
 
305
        jnz     @f
522
        jz      .correct
306
;--------------------------------------
523
        cmp     [putimg.ebp], putimage_get4bpp
307
align 4
524
        jnz     @f
308
.correct:
-
 
309
        mov     eax, [putimg.edi]
-
 
310
        mov     byte [eax], 80h
525
  .correct:
311
;--------------------------------------
526
        mov     eax, [putimg.edi]
312
align 4
527
        mov     byte [eax], 80h
313
@@:
-
 
314
        dec     edi
-
 
315
        jnz     .new_line
528
  @@:
316
;--------------------------------------
529
        dec     edi
317
align 4
530
        jnz     .new_line
318
.finish:
531
  .finish:
-
 
532
        add     esp, putimg.stack_data
319
        add     esp, putimg.stack_data
533
        popad
-
 
534
        ret
320
        popad
535
 
321
        ret
536
;------------------------------------------------------------------------------
322
;------------------------------------------------------------------------------
-
 
323
align 4
537
 
324
put_image_end_24_old:
538
align 4
325
;--------------------------------------
539
put_image_end_24_old:
326
align 4
540
 
327
.new_line:
541
  .new_line:
328
        mov     ecx, [putimg.real_sx]
542
        mov     ecx, [putimg.real_sx]
329
;--------------------------------------
543
;--------------------------------------
330
align 4
544
align 4
331
.new_x:
545
.new_x:
332
        push    [putimg.edi]
546
        push    [putimg.edi]
333
        mov     eax, [putimg.ebp+4]
547
        mov     eax, [putimg.ebp+4]
334
        call    eax
-
 
335
        cmp     [ebp], bl
-
 
Line -... Line 548...
-
 
548
        call    eax
336
        jne     .skip
549
        cmp     [ebp], bl
337
;--------------------------------------
550
        jne     .skip
338
        push    ecx
551
 
339
 
552
        push    ecx
340
        neg     ecx
553
        neg     ecx
Line 341... Line 554...
341
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
554
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
342
        shl     ecx, 16
555
        shl     ecx, 16
343
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
556
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
344
        sub     ecx, edi
557
        sub     ecx, edi
345
 
558
 
346
; check mouse area for putpixel
559
; check mouse area for putpixel
347
        call    check_mouse_area_for_putpixel
560
        call    check_mouse_area_for_putpixel
348
        pop     ecx
-
 
349
; store to real LFB
561
        pop     ecx
350
        mov     [LFB_BASE+edx], ax
562
; store to LFB
351
        shr     eax, 16
563
        mov     [LFB_BASE+edx], ax
352
        mov     [LFB_BASE+edx+2], al
564
        shr     eax, 16
353
;--------------------------------------
565
        mov     [LFB_BASE+edx+2], al
354
align 4
566
 
Line 355... Line 567...
355
.skip:
567
  .skip:
356
        add     edx, 3
568
        add     edx, 3
357
        inc     ebp
569
        inc     ebp
Line 358... Line 570...
358
        dec     ecx
570
        dec     ecx
359
        jnz     .new_x
571
        jnz     .new_x
360
 
572
 
361
        add     esi, [putimg.line_increment]
573
        add     esi, [putimg.line_increment]
362
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
574
        add     edx, [putimg.screen_newline]
363
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
575
        add     ebp, [putimg.winmap_newline]
364
 
-
 
365
        cmp     [putimg.ebp], putimage_get1bpp
576
 
366
        jz      .correct
577
        cmp     [putimg.ebp], putimage_get1bpp
367
        cmp     [putimg.ebp], putimage_get2bpp
578
        jz      .correct
368
        jz      .correct
579
        cmp     [putimg.ebp], putimage_get2bpp
369
        cmp     [putimg.ebp], putimage_get4bpp
-
 
370
        jnz     @f
580
        jz      .correct
371
;--------------------------------------
581
        cmp     [putimg.ebp], putimage_get4bpp
372
align 4
582
        jnz     @f
373
.correct:
583
 
374
        mov     eax, [putimg.edi]
584
  .correct:
-
 
585
        mov     eax, [putimg.edi]
375
        mov     byte [eax], 80h
586
        mov     byte [eax], 80h
-
 
587
 
376
;--------------------------------------
588
  @@:
377
align 4
589
        dec     edi
378
@@:
-
 
379
        dec     edi
590
        jnz     .new_line
380
        jnz     .new_line
591
        jmp     put_image_end_24.finish
381
        jmp     put_image_end_24.finish
592
 
382
;------------------------------------------------------------------------------
-
 
383
align 4
593
;------------------------------------------------------------------------------
384
put_image_end_24_new:
594
 
385
;--------------------------------------
595
align 4
386
align 4
596
put_image_end_24_new:
387
.new_line:
597
 
388
        mov     ecx, [putimg.real_sx]
598
  .new_line:
389
;--------------------------------------
599
        mov     ecx, [putimg.real_sx]
390
align 4
-
 
-
 
600
 
391
.new_x:
601
  .new_x:
392
        push    [putimg.edi]
-
 
393
        mov     eax, [putimg.ebp+4]
-
 
394
        call    eax
602
        push    [putimg.edi]
395
        cmp     [ebp], bl
603
        mov     eax, [putimg.ebp+4]
396
        jne     .skip
604
        call    eax
397
;--------------------------------------
-
 
-
 
605
        cmp     [ebp], bl
398
        push    ecx
606
        jne     .skip
399
;--------------------------------------
607
 
400
align 4
608
        push    ecx
Line 401... Line 609...
401
.sh:
609
  .sh:
Line 411... Line 619...
411
 
619
 
Line 412... Line 620...
412
        shl     ecx, 16
620
        shl     ecx, 16
413
 
621
 
414
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
-
 
-
 
622
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
415
        sub     ecx, edi
623
        sub     ecx, edi
416
;--------------------------------------
624
 
417
; check for Y
625
; check for Y
Line 418... Line 626...
418
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
626
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
419
        jae     .no_mouse_area
627
        jae     .no_mouse_area
420
 
-
 
-
 
628
 
421
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
629
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
422
        jb      .no_mouse_area
630
        jb      .no_mouse_area
423
;--------------------------------------
631
 
424
; check mouse area for putpixel
632
; check mouse area for putpixel
Line 425... Line 633...
425
        call    check_mouse_area_for_putpixel_new.1
633
        call    check_mouse_area_for_putpixel_new.1
426
        cmp     ecx, -1   ;SHIT HAPPENS?
634
        cmp     ecx, -1         ; SHIT HAPPENS?
427
        jne     .no_mouse_area
-
 
428
 
635
        jne     .no_mouse_area
429
        mov     ecx, [esp]
636
 
430
        jmp     .sh
637
        mov     ecx, [esp]
-
 
638
        jmp     .sh
431
;--------------------------------------
639
 
432
align 4
640
  .no_mouse_area:
433
.no_mouse_area:
641
        pop     ecx
434
        pop     ecx
642
 
435
; store to real LFB
-
 
436
        mov     [LFB_BASE+edx], ax
643
; store to LFB
437
        shr     eax, 16
644
        mov     [LFB_BASE+edx], ax
438
        mov     [LFB_BASE+edx+2], al
645
        shr     eax, 16
439
;--------------------------------------
646
        mov     [LFB_BASE+edx+2], al
440
align 4
647
 
441
.skip:
648
  .skip:
Line 442... Line 649...
442
        add     edx, 3
649
        add     edx, 3
443
        inc     ebp
650
        inc     ebp
444
        dec     ecx
651
        dec     ecx
Line 445... Line 652...
445
        jnz     .new_x
652
        jnz     .new_x
446
 
653
 
447
        add     esi, [putimg.line_increment]
654
        add     esi, [putimg.line_increment]
448
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
655
        add     edx, [putimg.screen_newline]
449
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
656
        add     ebp, [putimg.winmap_newline]
450
 
657
 
451
        cmp     [putimg.ebp], putimage_get1bpp
-
 
452
        jz      .correct
658
        cmp     [putimg.ebp], putimage_get1bpp
453
        cmp     [putimg.ebp], putimage_get2bpp
659
        jz      .correct
454
        jz      .correct
660
        cmp     [putimg.ebp], putimage_get2bpp
455
        cmp     [putimg.ebp], putimage_get4bpp
661
        jz      .correct
456
        jnz     @f
-
 
457
;--------------------------------------
662
        cmp     [putimg.ebp], putimage_get4bpp
458
align 4
663
        jnz     @f
459
.correct:
664
 
460
        mov     eax, [putimg.edi]
665
  .correct:
461
        mov     byte [eax], 80h
666
        mov     eax, [putimg.edi]
-
 
667
        mov     byte [eax], 80h
462
;--------------------------------------
668
 
-
 
669
  @@:
463
align 4
670
        dec     edi
464
@@:
671
        jnz     .new_line
-
 
672
        jmp     put_image_end_24.finish
465
        dec     edi
673
 
466
        jnz     .new_line
-
 
-
 
674
;------------------------------------------------------------------------------
467
        jmp     put_image_end_24.finish
675
 
468
;------------------------------------------------------------------------------
676
align 4
469
align 4
677
put_image_end_32:
470
put_image_end_32:
678
 
471
        mov     edi, [putimg.real_sy]
679
        mov     edi, [putimg.real_sy]
472
;--------------------------------------
680
 
473
; check for hardware cursor
-
 
474
        mov     ecx, [_display.select_cursor]
681
; check for hardware cursor
475
        cmp     ecx, select_cursor
682
        mov     ecx, [_display.select_cursor]
476
        je      put_image_end_32_new
683
        cmp     ecx, select_cursor
477
        cmp     ecx, 0
-
 
478
        je      put_image_end_32_old
684
        je      put_image_end_32_new
479
;--------------------------------------
685
        cmp     ecx, 0
480
align 4
686
        je      put_image_end_32_old
481
.new_line:
687
 
482
        mov     ecx, [putimg.real_sx]
688
  .new_line:
483
;--------------------------------------
689
        mov     ecx, [putimg.real_sx]
484
align 4
690
 
485
.new_x:
-
 
-
 
691
  .new_x:
486
        push    [putimg.edi]
692
        push    [putimg.edi]
487
        mov     eax, [putimg.ebp+4]
693
        mov     eax, [putimg.ebp+4]
488
        call    eax
-
 
489
        cmp     [ebp], bl
694
        call    eax
490
        jne     .skip
695
        cmp     [ebp], bl
491
;--------------------------------------
696
        jne     .skip
492
; store to real LFB
697
 
493
        mov     [LFB_BASE+edx], eax
698
; store to LFB
494
;--------------------------------------
699
        mov     [LFB_BASE+edx], eax
Line 495... Line 700...
495
align 4
700
 
496
.skip:
701
  .skip:
497
        add     edx, 4
702
        add     edx, 4
Line 498... Line 703...
498
        inc     ebp
703
        inc     ebp
499
        dec     ecx
704
        dec     ecx
500
        jnz     .new_x
705
        jnz     .new_x
501
 
706
 
502
        add     esi, [putimg.line_increment]
707
        add     esi, [putimg.line_increment]
503
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
708
        add     edx, [putimg.screen_newline]
504
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
-
 
505
 
709
        add     ebp, [putimg.winmap_newline]
506
        cmp     [putimg.ebp], putimage_get1bpp
710
 
507
        jz      .correct
711
        cmp     [putimg.ebp], putimage_get1bpp
508
        cmp     [putimg.ebp], putimage_get2bpp
712
        jz      .correct
509
        jz      .correct
-
 
510
        cmp     [putimg.ebp], putimage_get4bpp
713
        cmp     [putimg.ebp], putimage_get2bpp
511
        jnz     @f
714
        jz      .correct
512
;--------------------------------------
715
        cmp     [putimg.ebp], putimage_get4bpp
513
align 4
716
        jnz     @f
514
.correct:
-
 
515
        mov     eax, [putimg.edi]
717
 
516
        mov     byte [eax], 80h
718
  .correct:
517
;--------------------------------------
719
        mov     eax, [putimg.edi]
518
align 4
720
        mov     byte [eax], 80h
519
@@:
721
 
520
        dec     edi
722
  @@:
521
        jnz     .new_line
723
        dec     edi
522
;--------------------------------------
-
 
523
align 4
-
 
524
.finish:
724
        jnz     .new_line
525
        add     esp, putimg.stack_data
725
 
526
        popad
726
  .finish:
-
 
727
        add     esp, putimg.stack_data
527
        cmp     [SCR_MODE], 0x12
728
        popad
-
 
729
        cmp     [SCR_MODE], 0x12
528
        jne     @f
730
        jne     @f
529
        call    VGA__putimage
731
        call    VGA__putimage
530
;--------------------------------------
-
 
531
align 4
732
  @@:
532
@@:
733
        mov     [EGA_counter], 1
533
        mov     [EGA_counter], 1
734
        ret
534
        ret
-
 
535
;------------------------------------------------------------------------------
-
 
536
align 4
735
 
537
put_image_end_32_old:
736
;------------------------------------------------------------------------------
538
;--------------------------------------
737
 
539
align 4
738
align 4
540
.new_line:
739
put_image_end_32_old:
541
        mov     ecx, [putimg.real_sx]
740
 
542
;--------------------------------------
-
 
543
align 4
-
 
Line -... Line 741...
-
 
741
  .new_line:
544
.new_x:
742
        mov     ecx, [putimg.real_sx]
545
        push    [putimg.edi]
743
  .new_x:
546
        mov     eax, [putimg.ebp+4]
744
        push    [putimg.edi]
547
        call    eax
745
        mov     eax, [putimg.ebp+4]
548
        cmp     [ebp], bl
746
        call    eax
Line 549... Line 747...
549
        jne     .skip
747
        cmp     [ebp], bl
550
;--------------------------------------
748
        jne     .skip
551
        push    ecx
749
 
552
 
750
        push    ecx
553
        neg     ecx
751
        neg     ecx
554
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
-
 
555
        shl     ecx, 16
752
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
556
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
753
        shl     ecx, 16
557
        sub     ecx, edi
754
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
558
 
755
        sub     ecx, edi
559
; check mouse area for putpixel
756
 
560
        call    check_mouse_area_for_putpixel
757
; check mouse area for putpixel
Line 561... Line 758...
561
        pop     ecx
758
        call    check_mouse_area_for_putpixel
562
; store to real LFB
759
        pop     ecx
563
        mov     [LFB_BASE+edx], eax
760
; store to LFB
Line 564... Line 761...
564
;--------------------------------------
761
        mov     [LFB_BASE+edx], eax
565
align 4
762
 
566
.skip:
763
  .skip:
567
        add     edx, 4
764
        add     edx, 4
568
        inc     ebp
765
        inc     ebp
569
        dec     ecx
766
        dec     ecx
570
        jnz     .new_x
-
 
571
 
767
        jnz     .new_x
572
        add     esi, [putimg.line_increment]
768
 
573
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
769
        add     esi, [putimg.line_increment]
574
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
770
        add     edx, [putimg.screen_newline]
575
 
-
 
576
        cmp     [putimg.ebp], putimage_get1bpp
771
        add     ebp, [putimg.winmap_newline]
577
        jz      .correct
772
 
578
        cmp     [putimg.ebp], putimage_get2bpp
773
        cmp     [putimg.ebp], putimage_get1bpp
579
        jz      .correct
774
        jz      .correct
580
        cmp     [putimg.ebp], putimage_get4bpp
775
        cmp     [putimg.ebp], putimage_get2bpp
-
 
776
        jz      .correct
581
        jnz     @f
777
        cmp     [putimg.ebp], putimage_get4bpp
-
 
778
        jnz     @f
582
;--------------------------------------
779
 
583
align 4
780
  .correct:
584
.correct:
-
 
585
        mov     eax, [putimg.edi]
781
        mov     eax, [putimg.edi]
586
        mov     byte [eax], 80h
782
        mov     byte [eax], 80h
587
;--------------------------------------
783
 
588
align 4
-
 
589
@@:
784
  @@:
590
        dec     edi
785
        dec     edi
591
        jnz     .new_line
786
        jnz     .new_line
592
        jmp     put_image_end_32.finish
787
        jmp     put_image_end_32.finish
593
;------------------------------------------------------------------------------
788
 
594
align 4
789
;------------------------------------------------------------------------------
595
put_image_end_32_new:
790
 
596
;--------------------------------------
-
 
-
 
791
align 4
597
align 4
792
put_image_end_32_new:
598
.new_line:
-
 
599
        mov     ecx, [putimg.real_sx]
793
 
600
;--------------------------------------
794
  .new_line:
601
align 4
795
        mov     ecx, [putimg.real_sx]
602
.new_x:
796
 
603
        push    [putimg.edi]
-
 
-
 
797
  .new_x:
604
        mov     eax, [putimg.ebp+4]
798
        push    [putimg.edi]
605
        call    eax
799
        mov     eax, [putimg.ebp+4]
606
        cmp     [ebp], bl
800
        call    eax
607
        jne     .skip
-
 
608
;--------------------------------------
801
        cmp     [ebp], bl
609
        push    ecx
802
        jne     .skip
610
;--------------------------------------
-
 
611
align 4
803
 
Line 612... Line 804...
612
.sh:
804
        push    ecx
613
        neg     ecx
805
 
614
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
-
 
-
 
806
  .sh:
615
;--------------------------------------
807
        neg     ecx
616
; check for X
808
        add     ecx, [putimg.real_sx_and_abs_cx + 4]
617
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
809
 
618
        jae     .no_mouse_area
-
 
619
 
810
; check for X
620
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
811
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
621
        jb      .no_mouse_area
-
 
-
 
812
        jae     .no_mouse_area
622
 
813
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
623
        shl     ecx, 16
814
        jb      .no_mouse_area
624
 
815
        shl     ecx, 16
625
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
816
 
Line 626... Line 817...
626
        sub     ecx, edi
817
        add     ecx, [putimg.real_sy_and_abs_cy + 4]
627
;--------------------------------------
818
        sub     ecx, edi
628
; check for Y
-
 
629
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
819
 
630
        jae     .no_mouse_area
820
; check for Y
631
 
821
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
822
        jae     .no_mouse_area
632
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
823
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
633
        jb      .no_mouse_area
824
        jb      .no_mouse_area
634
;--------------------------------------
-
 
635
; check mouse area for putpixel
825
 
636
        call    check_mouse_area_for_putpixel_new.1
826
; check mouse area for putpixel
637
        cmp     ecx, -1   ;SHIT HAPPENS?
827
        call    check_mouse_area_for_putpixel_new.1
638
        jne     .no_mouse_area
828
        cmp     ecx, -1         ; SHIT HAPPENS?
639
 
829
        jne     .no_mouse_area
640
        mov     ecx, [esp]
830
 
Line 641... Line 831...
641
        jmp     .sh
831
        mov     ecx, [esp]
642
;--------------------------------------
832
        jmp     .sh
643
align 4
833
 
Line 644... Line 834...
644
.no_mouse_area:
834
  .no_mouse_area:
645
        pop     ecx
835
        pop     ecx
646
; store to real LFB
836
 
647
        mov     [LFB_BASE+edx], eax
837
; store to LFB
648
;--------------------------------------
838
        mov     [LFB_BASE+edx], eax
649
align 4
839
 
650
.skip:
-
 
651
        add     edx, 4
840
  .skip:
652
        inc     ebp
841
        add     edx, 4
653
        dec     ecx
842
        inc     ebp
654
        jnz     .new_x
843
        dec     ecx
655
 
-
 
656
        add     esi, [putimg.line_increment]
844
        jnz     .new_x
657
        add     edx, [putimg.screen_newline];[BytesPerScanLine]
845
 
658
        add     ebp, [putimg.winmap_newline];[Screen_Max_X]
846
        add     esi, [putimg.line_increment]
659
 
847
        add     edx, [putimg.screen_newline]
660
        cmp     [putimg.ebp], putimage_get1bpp
848
        add     ebp, [putimg.winmap_newline]
661
        jz      .correct
-
 
662
        cmp     [putimg.ebp], putimage_get2bpp
-
 
663
        jz      .correct
-
 
Line -... Line 849...
-
 
849
 
664
        cmp     [putimg.ebp], putimage_get4bpp
850
        cmp     [putimg.ebp], putimage_get1bpp
665
        jnz     @f
851
        jz      .correct
666
;--------------------------------------
852
        cmp     [putimg.ebp], putimage_get2bpp
-
 
853
        jz      .correct
667
align 4
854
        cmp     [putimg.ebp], putimage_get4bpp
668
.correct:
855
        jnz     @f
669
        mov     eax, [putimg.edi]
856
 
Line -... Line 857...
-
 
857
  .correct:
-
 
858
        mov     eax, [putimg.edi]
-
 
859
        mov     byte [eax], 80h
670
        mov     byte [eax], 80h
860
 
671
;--------------------------------------
861
  @@:
672
align 4
862
        dec     edi
673
@@:
863
        jnz     .new_line
674
        dec     edi
864
        jmp     put_image_end_32.finish
675
        jnz     .new_line
865
 
676
        jmp     put_image_end_32.finish
866
;------------------------------------------------------------------------------
Line 677... Line 867...
677
;------------------------------------------------------------------------------
867
; eax = x coordinate
678
align 4
868
; ebx = y coordinate
679
__sys_putpixel:
869
; ecx = xx RR GG BB
680
 
870
; xx flags:
681
; eax = x coordinate
871
; 0x01000000 color inversion
682
; ebx = y coordinate
872
; 0x02000000 used for draw_rectangle without top line (for drawwindow_III and drawwindow_IV)
683
; ecx = ?? RR GG BB    ; 0x01000000 negation
-
 
684
                       ; 0x02000000 used for draw_rectangle without top line
873
; edi = 0x00000001 force
685
                       ;            for example drawwindow_III and drawwindow_IV
874
 
686
; edi = 0x00000001 force
875
align 4
687
 
876
__sys_putpixel:
688
        pushad
877
 
Line -... Line 878...
-
 
878
        pushad
689
        cmp     eax, [_display.width]
879
        cmp     [Screen_Max_X], eax
690
        jae     .exit
880
        jb      .exit
Line -... Line 881...
-
 
881
        cmp     [Screen_Max_Y], ebx
691
        cmp     ebx, [_display.height]
882
        jb      .exit
692
        jae     .exit
883
        test    edi, 1           ; force ?
693
        test    edi, 1           ; force ?
884
        jnz     .forced
694
        jnz     .forced
885
 
695
 
-
 
696
; not forced:
-
 
697
        mov     edx, [d_width_calc_area + ebx*4]
886
; not forced
698
        add     edx, [_WinMapAddress]
-
 
699
        movzx   edx, byte [eax+edx]
887
        mov     edx, [d_width_calc_area + ebx*4]
700
        cmp     edx, [CURRENT_TASK]
-
 
701
        jne     .exit
-
 
702
;--------------------------------------
888
        add     edx, [_WinMapAddress]
703
align 4
889
        movzx   edx, byte [eax+edx]
704
.forced:
890
        cmp     edx, [CURRENT_TASK]
-
 
891
        jne     .exit
705
; check if negation
892
 
-
 
893
  .forced:
-
 
894
; check for color inversion
-
 
895
        test    ecx, 0x01000000
706
        test    ecx, 0x01000000
896
        jz      .no_inv
707
        jz      .noneg
897
 
-
 
898
        push    eax ebx edx edi
-
 
899
        call    [GETPIXEL]
-
 
900
        pop     edi edx ebx eax
-
 
901
 
-
 
902
        not     ecx
-
 
903
        rol     ecx, 8
-
 
904
        mov     cl, [esp+32-8+3]
-
 
905
        ror     ecx, 8
-
 
906
        mov     [esp+32-8], ecx
-
 
907
  .no_inv:
-
 
908
        call    [PUTPIXEL]      ; call the real put_pixel function
-
 
909
  .exit:
-
 
910
        popad
-
 
911
        ret
-
 
912
 
-
 
913
;-----------------------------------------------------------------------------
-
 
914
; eax = x
-
 
915
; ebx = y
-
 
916
 
-
 
917
align 4
-
 
918
Vesa20_putpixel16:
-
 
919
 
-
 
920
        mov     ecx, eax
-
 
921
        shl     ecx, 16
-
 
922
        mov     cx, bx
-
 
923
 
-
 
924
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
-
 
925
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
926
        lea     edi, [eax*2]; edi = x*2
-
 
927
        mov     eax, [esp+32-8+4]
708
 
928
 
709
        call    getpixel
929
; check for hardware cursor
-
 
930
        cmp     [_display.select_cursor], 0
-
 
931
        jne     @f
-
 
932
; check mouse area for putpixel
-
 
933
        test    eax, 0x04000000
-
 
934
        jnz     @f
-
 
935
        call    check_mouse_area_for_putpixel
-
 
936
  @@:
-
 
937
; store to LFB
-
 
938
        and     eax, 00000000111110001111110011111000b
-
 
939
        shr     ah, 2
-
 
940
        shr     ax, 3
-
 
941
        ror     eax, 8
-
 
942
        add     al, ah
-
 
943
        rol     eax, 8
-
 
944
 
-
 
945
        mov     [LFB_BASE+ebx+edi], ax
-
 
946
        ret
-
 
947
 
-
 
948
;-----------------------------------------------------------------------------
-
 
949
; eax = x
-
 
950
; ebx = y
-
 
951
 
-
 
952
align 4
-
 
953
Vesa20_putpixel16_new:
-
 
954
 
-
 
955
        mov     ecx, eax
-
 
956
        shl     ecx, 16
-
 
957
        mov     cx, bx
-
 
958
 
-
 
959
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
-
 
960
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
961
        lea     edi, [eax*2]; edi = x*2
-
 
962
        mov     eax, [esp+32-8+4]
-
 
963
 
-
 
964
; check for hardware cursor
-
 
965
        cmp     [_display.select_cursor], select_cursor
-
 
966
        jne     @f
-
 
967
; check mouse area for putpixel
-
 
968
        test    eax, 0x04000000
-
 
969
        jnz     @f
-
 
970
 
-
 
971
; check for Y
-
 
972
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
973
        jae     @f
-
 
974
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
975
        jb      @f
-
 
976
        rol     ecx, 16
-
 
977
 
-
 
978
; check for X
-
 
979
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
980
        jae     @f
-
 
981
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
-
 
982
        jb      @f
-
 
983
        ror     ecx, 16
710
        not     ecx
984
 
711
 
985
        call    check_mouse_area_for_putpixel_new.1
712
        rol     ecx, 8
986
  @@:
Line 713... Line 987...
713
        mov     cl, [esp+32-8+3]
987
; store to LFB
714
        ror     ecx, 8
988
        and     eax, 00000000111110001111110011111000b
715
        mov     [esp+32-8], ecx
989
        shr     ah, 2
716
;--------------------------------------
990
        shr     ax, 3
717
align 4
-
 
-
 
991
        ror     eax, 8
718
.noneg:
992
        add     al, ah
719
; OK to set pixel
993
        rol     eax, 8
720
        call    dword [PUTPIXEL]; call the real put_pixel function
994
 
721
;--------------------------------------
995
        mov     [LFB_BASE+ebx+edi], ax
722
align 4
996
        ret
723
.exit:
997
 
724
        popad
998
;-----------------------------------------------------------------------------
725
        ret
-
 
726
;-----------------------------------------------------------------------------
-
 
727
align 4
999
; eax = x
-
 
1000
; ebx = y
728
Vesa20_putpixel24:
1001
 
729
; eax = x
1002
align 4
730
; ebx = y
1003
Vesa20_putpixel24:
731
        mov     ecx, eax
1004
 
732
        shl     ecx, 16
1005
        mov     ecx, eax
-
 
1006
        shl     ecx, 16
733
        mov     cx, bx
1007
        mov     cx, bx
734
 
-
 
735
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
-
 
736
        mov     ebx, [BPSLine_calc_area+ebx*4]
1008
 
737
        lea     edi, [eax+eax*2]; edi = x*3
1009
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
-
 
1010
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
1011
        lea     edi, [eax+eax*2]; edi = x*3
-
 
1012
        mov     eax, [esp+32-8+4]
-
 
1013
 
738
        mov     eax, [esp+32-8+4]
1014
; check for hardware cursor
739
;--------------------------------------
1015
        cmp     [_display.select_cursor], 0
740
; check for hardware cursor
1016
        jne     @f
Line 741... Line 1017...
741
        cmp     [_display.select_cursor], 0
1017
; check mouse area for putpixel
742
        jne     @f
1018
        test    eax, 0x04000000
743
; check mouse area for putpixel
1019
        jnz     @f
744
        test    eax, 0x04000000
1020
        call    check_mouse_area_for_putpixel
745
        jnz     @f
-
 
-
 
1021
  @@:
746
        call    check_mouse_area_for_putpixel
1022
 
747
;--------------------------------------
1023
; store to LFB
748
align 4
1024
        mov     [LFB_BASE+ebx+edi], ax
749
@@:
1025
        shr     eax, 16
750
; store to real LFB
1026
        mov     [LFB_BASE+ebx+edi+2], al
751
        mov     [LFB_BASE+ebx+edi], ax
1027
        ret
752
        shr     eax, 16
-
 
-
 
1028
 
753
        mov     [LFB_BASE+ebx+edi+2], al
1029
;-----------------------------------------------------------------------------
754
        ret
1030
; eax = x
755
;-----------------------------------------------------------------------------
1031
; ebx = y
756
align 4
-
 
757
Vesa20_putpixel24_new:
1032
 
758
; eax = x
1033
align 4
759
; ebx = y
-
 
760
        mov     ecx, eax
1034
Vesa20_putpixel24_new:
761
        shl     ecx, 16
-
 
-
 
1035
 
762
        mov     cx, bx
1036
        mov     ecx, eax
763
 
1037
        shl     ecx, 16
764
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
1038
        mov     cx, bx
765
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
766
        lea     edi, [eax+eax*2]; edi = x*3
1039
 
767
        mov     eax, [esp+32-8+4]
1040
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
768
;--------------------------------------
-
 
769
; check for hardware cursor
1041
        mov     ebx, [BPSLine_calc_area+ebx*4]
Line 770... Line 1042...
770
        cmp     [_display.select_cursor], select_cursor
1042
        lea     edi, [eax+eax*2]; edi = x*3
771
        jne     @f
-
 
772
; check mouse area for putpixel
-
 
773
        test    eax, 0x04000000
1043
        mov     eax, [esp+32-8+4]
774
        jnz     @f
1044
 
775
;--------------------------------------
1045
; check for hardware cursor
776
; check for Y
1046
        cmp     [_display.select_cursor], select_cursor
777
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
1047
        jne     @f
778
        jae     @f
1048
; check mouse area for putpixel
-
 
1049
        test    eax, 0x04000000
779
 
1050
        jnz     @f
780
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
781
        jb      @f
-
 
782
 
1051
 
783
        rol     ecx, 16
1052
; check for Y
-
 
1053
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
1054
        jae     @f
-
 
1055
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
1056
        jb      @f
784
;--------------------------------------
1057
        rol     ecx, 16
785
; check for X
1058
 
786
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
1059
; check for X
Line 787... Line 1060...
787
        jae     @f
1060
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
788
 
1061
        jae     @f
789
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
1062
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
790
        jb      @f
1063
        jb      @f
791
 
-
 
-
 
1064
        ror     ecx, 16
792
        ror     ecx, 16
1065
 
793
 
1066
        call    check_mouse_area_for_putpixel_new.1
794
        call    check_mouse_area_for_putpixel_new.1
1067
  @@:
795
;--------------------------------------
1068
; store to LFB
796
align 4
1069
        mov     [LFB_BASE+ebx+edi], ax
797
@@:
1070
        shr     eax, 16
798
; store to real LFB
1071
        mov     [LFB_BASE+ebx+edi+2], al
799
        mov     [LFB_BASE+ebx+edi], ax
-
 
800
        shr     eax, 16
-
 
801
        mov     [LFB_BASE+ebx+edi+2], al
1072
        ret
802
        ret
1073
 
803
;-----------------------------------------------------------------------------
1074
;-----------------------------------------------------------------------------
804
align 4
1075
; eax = x
805
Vesa20_putpixel32:
1076
; ebx = y
-
 
1077
 
806
; eax = x
1078
align 4
807
; ebx = y
-
 
808
        mov     ecx, eax
-
 
809
        shl     ecx, 16
1079
Vesa20_putpixel32:
810
        mov     cx, bx
1080
 
-
 
1081
        mov     ecx, eax
-
 
1082
        shl     ecx, 16
-
 
1083
        mov     cx, bx
-
 
1084
 
811
 
1085
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
812
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
1086
        mov     ebx, [BPSLine_calc_area+ebx*4]
813
        mov     ebx, [BPSLine_calc_area+ebx*4]
1087
        lea     edi, [ebx+eax*4]        ; edi = x*4+(y*y multiplier)
Line 814... Line 1088...
814
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
1088
        mov     eax, [esp+32-8+4]       ; eax = color
815
        mov     eax, [esp+32-8+4]; eax = color
1089
 
816
;--------------------------------------
1090
; check for hardware cursor
817
; check for hardware cursor
1091
        cmp     [_display.select_cursor], 0
818
        cmp     [_display.select_cursor], 0
-
 
-
 
1092
        jne     @f
819
        jne     @f
1093
; check mouse area for putpixel
820
; check mouse area for putpixel
1094
        test    eax, 0x04000000
821
        test    eax, 0x04000000
1095
        jnz     @f
822
        jnz     @f
1096
        call    check_mouse_area_for_putpixel
823
        call    check_mouse_area_for_putpixel
1097
  @@:
824
;--------------------------------------
1098
        and     eax, 0xffffff
825
align 4
-
 
-
 
1099
; store to LFB
826
@@:
1100
        mov     [LFB_BASE+edi], eax
827
        and     eax, 0xffffff
1101
        ret
828
; store to real LFB
1102
 
829
        mov     [LFB_BASE+edi], eax
-
 
830
        ret
1103
;-----------------------------------------------------------------------------
831
;-----------------------------------------------------------------------------
1104
; eax = x
832
align 4
-
 
833
Vesa20_putpixel32_new:
1105
; ebx = y
834
; eax = x
-
 
-
 
1106
 
835
; ebx = y
1107
align 4
836
        mov     ecx, eax
1108
Vesa20_putpixel32_new:
837
        shl     ecx, 16
1109
 
838
        mov     cx, bx
-
 
839
 
1110
        mov     ecx, eax
840
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
1111
        shl     ecx, 16
841
        mov     ebx, [BPSLine_calc_area+ebx*4]
-
 
842
        lea     edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
1112
        mov     cx, bx
Line 843... Line 1113...
843
        mov     eax, [esp+32-8+4]; eax = color
1113
 
844
;--------------------------------------
-
 
845
; check for hardware cursor
-
 
846
        cmp     [_display.select_cursor], select_cursor
1114
;        imul    ebx, [BytesPerScanLine]  ; ebx = y * y multiplier
847
        jne     @f
1115
        mov     ebx, [BPSLine_calc_area+ebx*4]
848
; check mouse area for putpixel
1116
        lea     edi, [ebx+eax*4]        ; edi = x*4+(y*y multiplier)
849
        test    eax, 0x04000000
1117
        mov     eax, [esp+32-8+4]       ; eax = color
850
        jnz     @f
1118
 
-
 
1119
; check for hardware cursor
851
;--------------------------------------
1120
        cmp     [_display.select_cursor], select_cursor
-
 
1121
        jne     @f
852
; check for Y
1122
; check mouse area for putpixel
853
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
1123
        test    eax, 0x04000000
-
 
1124
        jnz     @f
-
 
1125
 
-
 
1126
; check for Y
854
        jae     @f
1127
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
855
 
1128
        jae     @f
856
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
1129
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
1130
        jb      @f
-
 
1131
        rol     ecx, 16
857
        jb      @f
1132
 
858
 
1133
; check for X
859
        rol     ecx, 16
1134
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
860
;--------------------------------------
-
 
861
; check for X
-
 
862
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
863
        jae     @f
1135
        jae     @f
864
 
-
 
865
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
1136
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
866
        jb      @f
-
 
867
 
1137
        jb      @f
868
        ror     ecx, 16
1138
        ror     ecx, 16
-
 
1139
 
-
 
1140
        call    check_mouse_area_for_putpixel_new.1
869
 
1141
  @@:
Line 870... Line 1142...
870
        call    check_mouse_area_for_putpixel_new.1
1142
        and     eax, 0x00ffffff
871
;--------------------------------------
1143
; store to LFB
872
align 4
1144
        mov     [LFB_BASE+edi], eax
873
@@:
1145
        ret
874
        and     eax, 0xffffff
1146
 
875
; store to real LFB
1147
;-----------------------------------------------------------------------------
Line -... Line 1148...
-
 
1148
 
-
 
1149
align 4
876
        mov     [LFB_BASE+edi], eax
1150
calculate_edi:
877
        ret
1151
;        mov     edi, ebx
878
;-----------------------------------------------------------------------------
1152
;        imul    edi, [Screen_Max_X]
879
align 4
1153
;        add     edi, ebx
880
calculate_edi:
1154
        mov     edi, [d_width_calc_area + ebx*4]
Line 920... Line 1194...
920
        jg      .no_vline  ; x1 > x2 ?
1194
        jg      .no_vline  ; x1 > x2 ?
921
        mov     edx, ebp   ; else (if x1=x2)
1195
        mov     edx, ebp   ; else (if x1=x2)
922
        call    vline
1196
        call    vline
923
        push    edx ; necessary to rightly restore stack frame at .exit
1197
        push    edx ; necessary to rightly restore stack frame at .exit
924
        jmp     .exit
1198
        jmp     .exit
925
;--------------------------------------
-
 
926
align 4
1199
 
927
.x2lx1:
1200
  .x2lx1:
928
        neg     esi         ; get esi absolute value
1201
        neg     esi         ; get esi absolute value
929
;--------------------------------------
-
 
930
align 4
1202
 
931
.no_vline:
1203
  .no_vline:
932
; checking y-axis...
1204
; checking y-axis...
933
        sub     ebp, ebx    ; ebp = y2-y1
1205
        sub     ebp, ebx    ; ebp = y2-y1
934
        push    ebp         ; save y2-y1
1206
        push    ebp         ; save y2-y1
935
        jl      .y2ly1      ; is y2 less than y1 ?
1207
        jl      .y2ly1      ; is y2 less than y1 ?
936
        jg      .no_hline   ; y1 > y2 ?
1208
        jg      .no_hline   ; y1 > y2 ?
937
        mov     edx, [dl_x2]; else (if y1=y2)
1209
        mov     edx, [dl_x2]    ; else (if y1=y2)
938
        call    hline
1210
        call    hline
939
        jmp     .exit
1211
        jmp     .exit
940
;--------------------------------------
-
 
941
align 4
1212
 
942
.y2ly1:
1213
  .y2ly1:
943
        neg     ebp         ; get ebp absolute value
1214
        neg     ebp         ; get ebp absolute value
944
;--------------------------------------
-
 
945
align 4
1215
 
946
.no_hline:
1216
  .no_hline:
947
        cmp     ebp, esi
1217
        cmp     ebp, esi
948
        jle     .x_rules    ; |y2-y1| < |x2-x1|  ?
1218
        jle     .x_rules    ; |y2-y1| < |x2-x1|  ?
949
        cmp     [dl_y2], ebx; make sure y1 is at the begining
1219
        cmp     [dl_y2], ebx    ; make sure y1 is at the begining
950
        jge     .no_reverse1
1220
        jge     .no_reverse1
Line 953... Line 1223...
953
        mov     [dl_x2], eax
1223
        mov     [dl_x2], eax
954
        mov     [dl_x1], edx
1224
        mov     [dl_x1], edx
955
        mov     edx, [dl_y2]
1225
        mov     edx, [dl_y2]
956
        mov     [dl_y2], ebx
1226
        mov     [dl_y2], ebx
957
        mov     [dl_y1], edx
1227
        mov     [dl_y1], edx
958
;--------------------------------------
-
 
959
align 4
1228
 
960
.no_reverse1:
1229
  .no_reverse1:
961
        mov     eax, [dl_dx]
1230
        mov     eax, [dl_dx]
962
        cdq                 ; extend eax sing to edx
1231
        cdq                 ; extend eax sing to edx
963
        shl     eax, 16     ; using 16bit fix-point maths
1232
        shl     eax, 16     ; using 16bit fix-point maths
964
        idiv    ebp         ; eax = ((x2-x1)*65536)/(y2-y1)
1233
        idiv    ebp         ; eax = ((x2-x1)*65536)/(y2-y1)
965
;--------------------------------------
-
 
-
 
1234
 
966
; correction for the remainder of the division
1235
; correction for the remainder of the division
967
        shl     edx, 1
1236
        shl     edx, 1
968
        cmp     ebp, edx
1237
        cmp     ebp, edx
969
        jb      @f
1238
        jb      @f
970
        inc     eax
1239
        inc     eax
971
;--------------------------------------
-
 
972
align 4
-
 
973
@@:
1240
  @@:
974
;--------------------------------------
-
 
975
        mov     edx, ebp    ; edx = counter (number of pixels to draw)
1241
        mov     edx, ebp    ; edx = counter (number of pixels to draw)
976
        mov     ebp, 1 *65536; <<16   ; ebp = dy = 1.0
1242
        mov     ebp, 1 shl 16   ; ebp = dy = 1.0
977
        mov     esi, eax    ; esi = dx
1243
        mov     esi, eax    ; esi = dx
978
        jmp     .y_rules
1244
        jmp     .y_rules
979
;--------------------------------------
-
 
980
align 4
-
 
981
.x_rules:
1245
  .x_rules:
982
        cmp     [dl_x2], eax ; make sure x1 is at the begining
1246
        cmp     [dl_x2], eax ; make sure x1 is at the begining
983
        jge     .no_reverse2
1247
        jge     .no_reverse2
984
        neg     dword [dl_dy]
1248
        neg     dword [dl_dy]
985
        mov     edx, [dl_x2]
1249
        mov     edx, [dl_x2]
986
        mov     [dl_x2], eax
1250
        mov     [dl_x2], eax
987
        mov     [dl_x1], edx
1251
        mov     [dl_x1], edx
988
        mov     edx, [dl_y2]
1252
        mov     edx, [dl_y2]
989
        mov     [dl_y2], ebx
1253
        mov     [dl_y2], ebx
990
        mov     [dl_y1], edx
1254
        mov     [dl_y1], edx
991
;--------------------------------------
-
 
992
align 4
-
 
993
.no_reverse2:
1255
  .no_reverse2:
994
        xor     edx, edx
1256
        xor     edx, edx
995
        mov     eax, [dl_dy]
1257
        mov     eax, [dl_dy]
996
        cdq                 ; extend eax sing to edx
1258
        cdq                 ; extend eax sing to edx
997
        shl     eax, 16     ; using 16bit fix-point maths
1259
        shl     eax, 16     ; using 16bit fix-point maths
998
        idiv    esi         ; eax = ((y2-y1)*65536)/(x2-x1)
1260
        idiv    esi         ; eax = ((y2-y1)*65536)/(x2-x1)
999
;--------------------------------------
-
 
1000
; correction for the remainder of the division
1261
; correction for the remainder of the division
1001
        shl     edx, 1
1262
        shl     edx, 1
1002
        cmp     esi, edx
1263
        cmp     esi, edx
1003
        jb      @f
1264
        jb      @f
1004
        inc     eax
1265
        inc     eax
1005
;--------------------------------------
-
 
1006
align 4
-
 
1007
@@:
1266
  @@:
1008
;--------------------------------------
-
 
1009
        mov     edx, esi    ; edx = counter (number of pixels to draw)
1267
        mov     edx, esi    ; edx = counter (number of pixels to draw)
1010
        mov     esi, 1 *65536;<< 16   ; esi = dx = 1.0
1268
        mov     esi, 1 shl 16   ; esi = dx = 1.0
1011
        mov     ebp, eax    ; ebp = dy
1269
        mov     ebp, eax    ; ebp = dy
1012
;--------------------------------------
-
 
1013
align 4
1270
 
1014
.y_rules:
1271
  .y_rules:
1015
        mov     eax, [dl_x1]
1272
        mov     eax, [dl_x1]
1016
        mov     ebx, [dl_y1]
1273
        mov     ebx, [dl_y1]
1017
        shl     eax, 16
1274
        shl     eax, 16
1018
        shl     ebx, 16
1275
        shl     ebx, 16
Line 1019... Line 1276...
1019
 
1276
 
1020
        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
-
 
1021
;-----------------------------------------------------------------------------
-
 
1022
align 4
1277
        and     ecx, 0xFBFFFFFF ; negate 0x04000000 save to mouseunder area
1023
.draw:
1278
  .draw:
1024
        push    eax ebx
-
 
-
 
1279
        push    eax ebx
1025
;--------------------------------------
1280
 
1026
; correction for the remainder of the division
1281
; correction for the remainder of the division
1027
        test    ah, 0x80
1282
        test    ah, 0x80
1028
        jz      @f
1283
        jz      @f
1029
        add     eax, 1 shl 16
-
 
1030
;--------------------------------------
-
 
1031
align 4
1284
        add     eax, 1 shl 16
1032
@@:
-
 
1033
;--------------------------------------
1285
  @@:
1034
        shr     eax, 16
-
 
1035
;--------------------------------------
1286
        shr     eax, 16
1036
; correction for the remainder of the division
1287
; correction for the remainder of the division
1037
        test    bh, 0x80
1288
        test    bh, 0x80
1038
        jz      @f
1289
        jz      @f
1039
        add     ebx, 1 shl 16
-
 
1040
;--------------------------------------
-
 
1041
align 4
1290
        add     ebx, 1 shl 16
1042
@@:
-
 
1043
;--------------------------------------
1291
  @@:
1044
        shr     ebx, 16
1292
        shr     ebx, 16
1045
;        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
1293
;        and     ecx, 0xFBFFFFFF  ; negate 0x04000000 save to mouseunder area
1046
;        call    [putpixel]
1294
;        call    [putpixel]
1047
        call    __sys_putpixel
1295
        call    __sys_putpixel
Line 1054... Line 1302...
1054
        mov     eax, [dl_x2]
1302
        mov     eax, [dl_x2]
1055
        mov     ebx, [dl_y2]
1303
        mov     ebx, [dl_y2]
1056
;        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
1304
;        and     ecx, 0xFBFFFFFF ;n egate 0x04000000 save to mouseunder area
1057
;        call    [putpixel]
1305
;        call    [putpixel]
1058
        call    __sys_putpixel
1306
        call    __sys_putpixel
1059
;--------------------------------------
-
 
1060
align 4
1307
 
1061
.exit:
1308
  .exit:
1062
        add     esp, 6*4
1309
        add     esp, 6*4
1063
        popa
1310
        popa
1064
;        call    [draw_pointer]
1311
;        call    [draw_pointer]
1065
        ret
1312
        ret
-
 
1313
 
1066
;------------------------------------------------------------------------------
1314
;------------------------------------------------------------------------------
1067
align 4
-
 
1068
hline:
-
 
1069
; draw an horizontal line
1315
; draw an horizontal line
1070
; eax = x1
1316
; eax = x1
1071
; edx = x2
1317
; edx = x2
1072
; ebx = y
1318
; ebx = y
1073
; ecx = color
1319
; ecx = color
1074
; edi = force ?
1320
; edi = force ?
-
 
1321
 
-
 
1322
align 4
-
 
1323
hline:
-
 
1324
 
1075
        push    eax edx
1325
        push    eax edx
1076
        cmp     edx, eax   ; make sure x2 is above x1
1326
        cmp     edx, eax   ; make sure x2 is above x1
1077
        jge     @f
1327
        jge     @f
1078
        xchg    eax, edx
1328
        xchg    eax, edx
1079
;--------------------------------------
-
 
1080
align 4
-
 
1081
@@:
1329
  @@:
1082
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
1330
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
1083
;--------------------------------------
-
 
1084
align 4
-
 
1085
@@:
1331
  @@:
1086
;        call    [putpixel]
1332
;        call    [putpixel]
1087
        call    __sys_putpixel
1333
        call    __sys_putpixel
1088
        inc     eax
1334
        inc     eax
1089
        cmp     eax, edx
1335
        cmp     eax, edx
1090
        jle     @b
1336
        jle     @b
1091
        pop     edx eax
1337
        pop     edx eax
1092
        ret
1338
        ret
-
 
1339
 
1093
;------------------------------------------------------------------------------
1340
;------------------------------------------------------------------------------
1094
align 4
-
 
1095
vline:
-
 
1096
; draw a vertical line
1341
; draw a vertical line
1097
; eax = x
1342
; eax = x
1098
; ebx = y1
1343
; ebx = y1
1099
; edx = y2
1344
; edx = y2
1100
; ecx = color
1345
; ecx = color
1101
; edi = force ?
1346
; edi = force ?
-
 
1347
 
-
 
1348
align 4
-
 
1349
vline:
-
 
1350
 
1102
        push    ebx edx
1351
        push    ebx edx
1103
        cmp     edx, ebx   ; make sure y2 is above y1
1352
        cmp     edx, ebx   ; make sure y2 is above y1
1104
        jge     @f
1353
        jge     @f
1105
        xchg    ebx, edx
1354
        xchg    ebx, edx
1106
;--------------------------------------
-
 
1107
align 4
-
 
1108
@@:
1355
  @@:
1109
        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
1356
        and     ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
1110
;--------------------------------------
-
 
1111
align 4
-
 
1112
@@:
1357
  @@:
1113
;        call    [putpixel]
1358
;        call    [putpixel]
1114
        call    __sys_putpixel
1359
        call    __sys_putpixel
1115
        inc     ebx
1360
        inc     ebx
1116
        cmp     ebx, edx
1361
        cmp     ebx, edx
1117
        jle     @b
1362
        jle     @b
1118
        pop     edx ebx
1363
        pop     edx ebx
1119
        ret
1364
        ret
-
 
1365
 
1120
;------------------------------------------------------------------------------
1366
;------------------------------------------------------------------------------
-
 
1367
; eax   cx
-
 
1368
; ebx   cy
-
 
1369
; ecx   xe
-
 
1370
; edx   ye
-
 
1371
; edi   color
-
 
1372
 
1121
align 4
1373
align 4
-
 
1374
vesa20_drawbar:
-
 
1375
 
1122
virtual at esp
1376
virtual at esp
1123
drbar:
1377
drbar:
1124
     .bar_sx       dd ?
1378
     .bar_sx       dd ?
1125
     .bar_sy       dd ?
1379
     .bar_sy       dd ?
1126
     .bar_cx       dd ?
1380
     .bar_cx       dd ?
Line 1134... Line 1388...
1134
     .line_inc_map dd ?
1388
     .line_inc_map dd ?
1135
     .real_sx_and_abs_cx dd ?
1389
     .real_sx_and_abs_cx dd ?
1136
     .real_sy_and_abs_cy dd ?
1390
     .real_sy_and_abs_cy dd ?
1137
     .stack_data = 4*13
1391
     .stack_data = 4*13
1138
end virtual
1392
end virtual
1139
;--------------------------------------
-
 
1140
align 4
1393
 
1141
; eax   cx
-
 
1142
; ebx   cy
-
 
1143
; ecx   xe
-
 
1144
; edx   ye
-
 
1145
; edi   color
-
 
1146
vesa20_drawbar:
-
 
1147
        pushad
1394
        pushad
1148
        sub     esp, drbar.stack_data
1395
        sub     esp, drbar.stack_data
1149
        mov     [drbar.color], edi
1396
        mov     [drbar.color], edi
1150
        sub     edx, ebx
1397
        sub     edx, ebx
1151
        jle     .exit       ;// mike.dld, 2005-01-29
1398
        jle     .exit
1152
        sub     ecx, eax
1399
        sub     ecx, eax
1153
        jle     .exit       ;// mike.dld, 2005-01-29
1400
        jle     .exit
1154
        mov     [drbar.bar_sy], edx
1401
        mov     [drbar.bar_sy], edx
1155
        mov     [drbar.bar_sx], ecx
1402
        mov     [drbar.bar_sx], ecx
1156
        mov     [drbar.bar_cx], eax
1403
        mov     [drbar.bar_cx], eax
1157
        mov     [drbar.bar_cy], ebx
1404
        mov     [drbar.bar_cy], ebx
1158
        mov     edi, [TASK_BASE]
1405
        mov     edi, [TASK_BASE]
Line 1160... Line 1407...
1160
        add     ebx, [edi-twdw + WDATA.box.top]; win_cy
1407
        add     ebx, [edi-twdw + WDATA.box.top]         ; win_cy
1161
        mov     [drbar.abs_cx], eax
1408
        mov     [drbar.abs_cx], eax
1162
        mov     [drbar.abs_cy], ebx
1409
        mov     [drbar.abs_cy], ebx
1163
; real_sx = MIN(wnd_sx-bar_cx, bar_sx);
1410
; real_sx = MIN(wnd_sx-bar_cx, bar_sx);
1164
        mov     ebx, [edi-twdw + WDATA.box.width]; ebx = wnd_sx
1411
        mov     ebx, [edi-twdw + WDATA.box.width]       ; ebx = wnd_sx
1165
; \begin{diamond}[20.08.2006]
-
 
1166
; note that WDATA.box.width is one pixel less than real window x-size
1412
        inc     ebx                                     ; WDATA.box.width is one pixel less than real window x-size
1167
        inc     ebx
-
 
1168
; \end{diamond}[20.08.2006]
-
 
1169
        sub     ebx, [drbar.bar_cx]
1413
        sub     ebx, [drbar.bar_cx]
1170
        ja      @f
1414
        ja      @f
1171
;--------------------------------------
-
 
1172
align 4
1415
  .exit:
1173
.exit:                       ;// mike.dld, 2005-01-29
-
 
1174
        add     esp, drbar.stack_data
1416
        add     esp, drbar.stack_data
1175
        popad
1417
        popad
1176
        xor     eax, eax
1418
        xor     eax, eax
1177
        inc     eax
1419
        inc     eax
1178
        ret
1420
        ret
1179
;--------------------------------------
-
 
1180
align 4
-
 
1181
@@:
1421
  @@:
1182
        cmp     ebx, [drbar.bar_sx]
1422
        cmp     ebx, [drbar.bar_sx]
1183
        jbe     .end_x
1423
        jbe     .end_x
1184
        mov     ebx, [drbar.bar_sx]
1424
        mov     ebx, [drbar.bar_sx]
1185
;--------------------------------------
-
 
1186
align 4
-
 
1187
.end_x:
1425
  .end_x:
1188
        mov     [drbar.real_sx], ebx
1426
        mov     [drbar.real_sx], ebx
1189
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
1427
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
1190
        mov     ebx, [edi-twdw + WDATA.box.height]; ebx = wnd_sy
1428
        mov     ebx, [edi-twdw + WDATA.box.height]      ; ebx = wnd_sy
1191
; \begin{diamond}[20.08.2006]
-
 
1192
        inc     ebx
1429
        inc     ebx
1193
; \end{diamond}
-
 
1194
        sub     ebx, [drbar.bar_cy]
1430
        sub     ebx, [drbar.bar_cy]
1195
        ja      @f
1431
        ja      @f
1196
        add     esp, drbar.stack_data
1432
        add     esp, drbar.stack_data
1197
        popad
1433
        popad
1198
        xor     eax, eax
1434
        xor     eax, eax
1199
        inc     eax
1435
        inc     eax
1200
        ret
1436
        ret
1201
;--------------------------------------
-
 
1202
align 4
-
 
1203
@@:
1437
  @@:
1204
        cmp     ebx, [drbar.bar_sy]
1438
        cmp     ebx, [drbar.bar_sy]
1205
        jbe     .end_y
1439
        jbe     .end_y
1206
        mov     ebx, [drbar.bar_sy]
1440
        mov     ebx, [drbar.bar_sy]
1207
;--------------------------------------
-
 
1208
align 4
-
 
1209
.end_y:
1441
  .end_y:
1210
        mov     [drbar.real_sy], ebx
1442
        mov     [drbar.real_sy], ebx
1211
; line_inc_map
1443
; line_inc_map
1212
        mov     eax, [_display.width]
1444
        mov     eax, [Screen_Max_X]
1213
        sub     eax, [drbar.real_sx]
1445
        sub     eax, [drbar.real_sx]
-
 
1446
        inc     eax
1214
        mov     [drbar.line_inc_map], eax
1447
        mov     [drbar.line_inc_map], eax
1215
; line_inc_scr
1448
; line_inc_scr
1216
        mov     eax, [drbar.real_sx]
1449
        mov     eax, [drbar.real_sx]
1217
        mov     ebx, [_display.bpp]
1450
        mov     ebx, [_display.bytes_per_pixel]
1218
        shr     ebx, 3
-
 
1219
        imul    eax, ebx
1451
        imul    eax, ebx
1220
        neg     eax
1452
        neg     eax
1221
        add     eax, [_display.pitch]
1453
        add     eax, [_display.pitch]
1222
        mov     [drbar.line_inc_scr], eax
1454
        mov     [drbar.line_inc_scr], eax
1223
; pointer to screen
1455
; pointer to screen
Line 1227... Line 1459...
1227
        mov     eax, [drbar.abs_cx]
1459
        mov     eax, [drbar.abs_cx]
1228
        imul    eax, ebx
1460
        imul    eax, ebx
1229
        add     edx, eax
1461
        add     edx, eax
1230
; pointer to pixel map
1462
; pointer to pixel map
1231
        mov     eax, [drbar.abs_cy]
1463
        mov     eax, [drbar.abs_cy]
-
 
1464
;        imul    eax, [Screen_Max_X]
-
 
1465
;        add     eax, [drbar.abs_cy]
1232
        mov     eax, [d_width_calc_area + eax*4]
1466
        mov     eax, [d_width_calc_area + eax*4]
Line 1233... Line 1467...
1233
 
1467
 
1234
        add     eax, [drbar.abs_cx]
1468
        add     eax, [drbar.abs_cx]
1235
        add     eax, [_WinMapAddress]
1469
        add     eax, [_WinMapAddress]
1236
        xchg    eax, ebp
-
 
-
 
1470
        xchg    eax, ebp
1237
;--------------------------------------
1471
 
1238
        mov     ebx, [drbar.real_sx]
1472
        mov     ebx, [drbar.real_sx]
1239
        add     ebx, [drbar.abs_cx]
1473
        add     ebx, [drbar.abs_cx]
1240
        mov     [drbar.real_sx_and_abs_cx], ebx
1474
        mov     [drbar.real_sx_and_abs_cx], ebx
1241
        mov     ebx, [drbar.real_sy]
1475
        mov     ebx, [drbar.real_sy]
1242
        add     ebx, [drbar.abs_cy]
1476
        add     ebx, [drbar.abs_cy]
Line 1243... Line 1477...
1243
        mov     [drbar.real_sy_and_abs_cy], ebx
1477
        mov     [drbar.real_sy_and_abs_cy], ebx
1244
 
-
 
-
 
1478
 
1245
        add     edx, LFB_BASE
1479
        add     edx, LFB_BASE
1246
;--------------------------------------
1480
 
1247
; get process number
1481
; get process number
1248
        mov     ebx, [CURRENT_TASK]  ; bl - process num
1482
        mov     ebx, [CURRENT_TASK]  ; bl - process num
1249
        mov     esi, [drbar.real_sy]
1483
        mov     esi, [drbar.real_sy]
1250
        mov     eax, [drbar.color] ; BBGGRR00
1484
        mov     eax, [drbar.color] ; BBGGRR00
1251
        rol     eax, 8
1485
        rol     eax, 8
-
 
1486
        mov     bh, al  ; 0x80 drawing gradient bars
-
 
1487
        ror     eax, 8
-
 
1488
 
1252
        mov     bh, al  ; 0x80 drawing gradient bars
1489
        cmp     byte [_display.bits_per_pixel], 16
-
 
1490
        je      draw_bar_end_16
-
 
1491
        cmp     byte [_display.bits_per_pixel], 24
1253
        ror     eax, 8
1492
        je      draw_bar_end_24
-
 
1493
        cmp     byte [_display.bits_per_pixel], 32
1254
        cmp     byte [_display.bpp], 24
1494
        je      draw_bar_end_32
1255
        jne     draw_bar_end_32
-
 
1256
;--------------------------------------
-
 
1257
align 4
1495
 
1258
draw_bar_end_24:
1496
;--------------------------------------
1259
; eax - color high   RRGGBB
1497
; eax - color high   RRGGBB
1260
; bl - process num
1498
; bl - process num
1261
; ecx - temp
1499
; ecx - temp
1262
; edx - pointer to screen
1500
; edx - pointer to screen
-
 
1501
; esi - counter
-
 
1502
; edi - counter
1263
; esi - counter
1503
 
-
 
1504
align 4
1264
; edi - counter
1505
draw_bar_end_24:
1265
;--------------------------------------
1506
 
1266
; check for hardware cursor
1507
; check for hardware cursor
1267
        mov     ecx, [_display.select_cursor]
1508
        mov     ecx, [_display.select_cursor]
1268
        cmp     ecx, select_cursor
1509
        cmp     ecx, select_cursor
1269
        je      draw_bar_end_24_new
1510
        je      draw_bar_end_24_new
1270
        cmp     ecx, 0
-
 
1271
        je      draw_bar_end_24_old
-
 
1272
;--------------------------------------
1511
        cmp     ecx, 0
1273
align 4
1512
        je      draw_bar_end_24_old
1274
.new_y:
-
 
1275
        mov     edi, [drbar.real_sx]
-
 
1276
;--------------------------------------
1513
  .new_y:
1277
align 4
1514
        mov     edi, [drbar.real_sx]
1278
.new_x:
1515
  .new_x:
1279
        cmp     byte [ebp], bl
-
 
-
 
1516
        cmp     byte [ebp], bl
1280
        jne     .skip
1517
        jne     .skip
1281
;--------------------------------------
1518
 
1282
; store to real LFB
1519
; store to LFB
1283
        mov     [edx], ax
1520
        mov     [edx], ax
1284
        shr     eax, 16
-
 
1285
        mov     [edx + 2], al
-
 
1286
;--------------------------------------
1521
        shr     eax, 16
1287
align 4
1522
        mov     [edx + 2], al
1288
.skip:
1523
  .skip:
1289
; add pixel
1524
; add pixel
1290
        add     edx, 3
1525
        add     edx, 3
Line 1298... Line 1533...
1298
        test    bh, 0x80
1533
        test    bh, 0x80
1299
        jz      @f
1534
        jz      @f
1300
        test    al, al
1535
        test    al, al
1301
        jz      @f
1536
        jz      @f
1302
        dec     al
1537
        dec     al
1303
;--------------------------------------
-
 
1304
align 4
-
 
1305
@@:
1538
  @@:
1306
        dec     esi
1539
        dec     esi
1307
        jnz     .new_y
1540
        jnz     .new_y
1308
;--------------------------------------
-
 
1309
align 4
-
 
1310
.end:
1541
  .end:
1311
        add     esp, drbar.stack_data
1542
        add     esp, drbar.stack_data
1312
        popad
1543
        popad
1313
        xor     eax, eax
1544
        xor     eax, eax
1314
        ret
1545
        ret
-
 
1546
 
1315
;------------------------------------------------------------------------------
1547
;------------------------------------------------------------------------------
-
 
1548
 
1316
align 4
1549
align 4
1317
draw_bar_end_24_old:
1550
draw_bar_end_24_old:
1318
;--------------------------------------
-
 
1319
align 4
1551
 
1320
.new_y:
1552
  .new_y:
1321
        mov     edi, [drbar.real_sx]
1553
        mov     edi, [drbar.real_sx]
1322
;--------------------------------------
-
 
1323
align 4
-
 
1324
.new_x:
1554
  .new_x:
1325
        cmp     byte [ebp], bl
1555
        cmp     byte [ebp], bl
1326
        jne     .skip
1556
        jne     .skip
1327
;--------------------------------------
-
 
-
 
1557
 
1328
        mov     ecx, [drbar.real_sx_and_abs_cx]
1558
        mov     ecx, [drbar.real_sx_and_abs_cx]
1329
        sub     ecx, edi
1559
        sub     ecx, edi
1330
        shl     ecx, 16
1560
        shl     ecx, 16
1331
        add     ecx, [drbar.real_sy_and_abs_cy]
1561
        add     ecx, [drbar.real_sy_and_abs_cy]
1332
        sub     ecx, esi
1562
        sub     ecx, esi
1333
; check mouse area for putpixel
1563
; check mouse area for putpixel
1334
        call    check_mouse_area_for_putpixel
1564
        call    check_mouse_area_for_putpixel
1335
; store to real LFB
1565
; store to LFB
1336
        mov     [edx], ax
1566
        mov     [edx], ax
1337
        shr     eax, 16
1567
        shr     eax, 16
1338
        mov     [edx + 2], al
1568
        mov     [edx + 2], al
1339
        mov     eax, [drbar.color]
1569
        mov     eax, [drbar.color]
1340
;--------------------------------------
-
 
1341
align 4
-
 
1342
.skip:
1570
  .skip:
1343
; add pixel
1571
; add pixel
1344
        add     edx, 3
1572
        add     edx, 3
1345
        inc     ebp
1573
        inc     ebp
1346
        dec     edi
1574
        dec     edi
Line 1352... Line 1580...
1352
        test    bh, 0x80
1580
        test    bh, 0x80
1353
        jz      @f
1581
        jz      @f
1354
        test    al, al
1582
        test    al, al
1355
        jz      @f
1583
        jz      @f
1356
        dec     al
1584
        dec     al
1357
;--------------------------------------
-
 
1358
align 4
-
 
1359
@@:
1585
  @@:
1360
        dec     esi
1586
        dec     esi
1361
        jnz     .new_y
1587
        jnz     .new_y
1362
        jmp     draw_bar_end_24.end
1588
        jmp     draw_bar_end_24.end
-
 
1589
 
1363
;------------------------------------------------------------------------------
1590
;------------------------------------------------------------------------------
-
 
1591
 
1364
align 4
1592
align 4
1365
draw_bar_end_24_new:
1593
draw_bar_end_24_new:
1366
;--------------------------------------
-
 
1367
align 4
1594
 
1368
.new_y:
1595
  .new_y:
1369
        mov     edi, [drbar.real_sx]
1596
        mov     edi, [drbar.real_sx]
1370
;--------------------------------------
-
 
1371
align 4
-
 
1372
.new_x:
1597
  .new_x:
1373
        cmp     byte [ebp], bl
1598
        cmp     byte [ebp], bl
1374
        jne     .skip
1599
        jne     .skip
1375
;--------------------------------------
-
 
-
 
1600
 
1376
        mov     ecx, [drbar.real_sy_and_abs_cy]
1601
        mov     ecx, [drbar.real_sy_and_abs_cy]
1377
        sub     ecx, esi
1602
        sub     ecx, esi
1378
;--------------------------------------
-
 
-
 
1603
 
1379
; check for Y
1604
; check for Y
1380
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
1605
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
1381
        jae     .no_mouse_area
1606
        jae     .no_mouse_area
1382
 
-
 
1383
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
1607
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
1384
        jb      .no_mouse_area
1608
        jb      .no_mouse_area
1385
 
-
 
1386
        rol     ecx, 16
1609
        rol     ecx, 16
1387
        add     ecx, [drbar.real_sx_and_abs_cx]
1610
        add     ecx, [drbar.real_sx_and_abs_cx]
1388
        sub     ecx, edi
1611
        sub     ecx, edi
1389
;--------------------------------------
-
 
-
 
1612
 
1390
; check for X
1613
; check for X
1391
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
1614
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
1392
        jae     .no_mouse_area
1615
        jae     .no_mouse_area
1393
 
-
 
1394
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
1616
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
1395
        jb      .no_mouse_area
1617
        jb      .no_mouse_area
1396
 
-
 
1397
        ror     ecx, 16
1618
        ror     ecx, 16
1398
;--------------------------------------
-
 
-
 
1619
 
1399
; check mouse area for putpixel
1620
; check mouse area for putpixel
1400
        push    eax
1621
        push    eax
1401
        call    check_mouse_area_for_putpixel_new.1
1622
        call    check_mouse_area_for_putpixel_new.1
1402
        mov     [edx], ax
1623
        mov     [edx], ax
1403
        shr     eax, 16
1624
        shr     eax, 16
1404
        mov     [edx + 2], al
1625
        mov     [edx + 2], al
1405
        pop     eax
1626
        pop     eax
1406
        jmp     .skip
1627
        jmp     .skip
1407
; store to real LFB
-
 
1408
;--------------------------------------
-
 
1409
align 4
1628
 
1410
.no_mouse_area:
1629
  .no_mouse_area:
-
 
1630
; store to LFB
1411
        mov     [edx], ax
1631
        mov     [edx], ax
1412
        ror     eax, 16
1632
        ror     eax, 16
1413
        mov     [edx + 2], al
1633
        mov     [edx + 2], al
1414
        rol     eax, 16
1634
        rol     eax, 16
1415
;--------------------------------------
-
 
1416
align 4
-
 
1417
.skip:
1635
  .skip:
-
 
1636
 
1418
; add pixel
1637
; add pixel
1419
        add     edx, 3
1638
        add     edx, 3
1420
        inc     ebp
1639
        inc     ebp
1421
        dec     edi
1640
        dec     edi
1422
        jnz     .new_x
1641
        jnz     .new_x
-
 
1642
 
1423
; add line
1643
; add line
1424
        add     edx, [drbar.line_inc_scr]
1644
        add     edx, [drbar.line_inc_scr]
1425
        add     ebp, [drbar.line_inc_map]
1645
        add     ebp, [drbar.line_inc_map]
-
 
1646
 
1426
; drawing gradient bars
1647
; drawing gradient bars
1427
        test    bh, 0x80
1648
        test    bh, 0x80
1428
        jz      @f
1649
        jz      @f
1429
        test    al, al
1650
        test    al, al
1430
        jz      @f
1651
        jz      @f
1431
        dec     al
1652
        dec     al
1432
;--------------------------------------
-
 
1433
align 4
-
 
1434
@@:
1653
  @@:
1435
        dec     esi
1654
        dec     esi
1436
        jnz     .new_y
1655
        jnz     .new_y
1437
        jmp     draw_bar_end_24.end
1656
        jmp     draw_bar_end_24.end
-
 
1657
 
1438
;------------------------------------------------------------------------------
1658
;------------------------------------------------------------------------------
1439
align 4
-
 
1440
draw_bar_end_32:
-
 
1441
; eax - color high   RRGGBB
1659
; eax - color high   RRGGBB
1442
; bl - process num
1660
; bl - process num
1443
; ecx - temp
1661
; ecx - temp
1444
; edx - pointer to screen
1662
; edx - pointer to screen
1445
; esi - counter
1663
; esi - counter
1446
; edi - counter
1664
; edi - counter
-
 
1665
 
1447
;--------------------------------------
1666
draw_bar_end_32:
-
 
1667
 
1448
; check for hardware cursor
1668
; check for hardware cursor
1449
        mov     ecx, [_display.select_cursor]
1669
        mov     ecx, [_display.select_cursor]
1450
        cmp     ecx, select_cursor
1670
        cmp     ecx, select_cursor
1451
        je      draw_bar_end_32_new
1671
        je      draw_bar_end_32_new
1452
        cmp     ecx, 0
1672
        cmp     ecx, 0
1453
        je      draw_bar_end_32_old
1673
        je      draw_bar_end_32_old
1454
;--------------------------------------
-
 
1455
align 4
1674
 
1456
.new_y:
1675
  .new_y:
1457
        mov     edi, [drbar.real_sx]
1676
        mov     edi, [drbar.real_sx]
1458
;--------------------------------------
-
 
1459
align 4
-
 
1460
.new_x:
1677
  .new_x:
1461
        cmp     byte [ebp], bl
1678
        cmp     byte [ebp], bl
1462
        jne     .skip
1679
        jne     .skip
1463
;--------------------------------------
-
 
-
 
1680
 
1464
; store to real LFB
1681
; store to LFB
1465
        mov     [edx], eax
1682
        mov     [edx], eax
1466
        mov     eax, [drbar.color]
1683
        mov     eax, [drbar.color]
1467
;--------------------------------------
-
 
1468
align 4
-
 
1469
.skip:
1684
  .skip:
-
 
1685
 
1470
; add pixel
1686
; add pixel
1471
        add     edx, 4
1687
        add     edx, 4
1472
        inc     ebp
1688
        inc     ebp
1473
        dec     edi
1689
        dec     edi
1474
        jnz     .new_x
1690
        jnz     .new_x
-
 
1691
 
1475
; add line
1692
; add line
1476
        add     edx, [drbar.line_inc_scr]
1693
        add     edx, [drbar.line_inc_scr]
1477
        add     ebp, [drbar.line_inc_map]
1694
        add     ebp, [drbar.line_inc_map]
-
 
1695
 
1478
; drawing gradient bars
1696
; drawing gradient bars
1479
        test    bh, 0x80
1697
        test    bh, 0x80
1480
        jz      @f
1698
        jz      @f
1481
        test    al, al
1699
        test    al, al
1482
        jz      @f
1700
        jz      @f
1483
        dec     al
1701
        dec     al
1484
;--------------------------------------
-
 
1485
align 4
-
 
1486
@@:
1702
  @@:
1487
        dec     esi
1703
        dec     esi
1488
        jnz     .new_y
1704
        jnz     .new_y
1489
;--------------------------------------
-
 
1490
align 4
-
 
1491
.end:
1705
  .end:
1492
        add     esp, drbar.stack_data
1706
        add     esp, drbar.stack_data
1493
        popad
1707
        popad
1494
        cmp     [SCR_MODE], 0x12
1708
        cmp     [SCR_MODE], 0x12
1495
        jne     @f
1709
        jne     @f
1496
        call    VGA_draw_bar
1710
        call    VGA_draw_bar
1497
;--------------------------------------
-
 
1498
align 4
-
 
1499
@@:
1711
  @@:
1500
        xor     eax, eax
1712
        xor     eax, eax
1501
        mov     [EGA_counter], 1
1713
        mov     [EGA_counter], 1
1502
        ret
1714
        ret
1503
;------------------------------------------------------------------------------
-
 
1504
align 4
1715
 
1505
draw_bar_end_32_old:
1716
draw_bar_end_32_old:
1506
;--------------------------------------
-
 
1507
align 4
1717
 
1508
.new_y:
1718
  .new_y:
1509
        mov     edi, [drbar.real_sx]
1719
        mov     edi, [drbar.real_sx]
1510
;--------------------------------------
-
 
1511
align 4
-
 
1512
.new_x:
1720
  .new_x:
1513
        cmp     byte [ebp], bl
1721
        cmp     byte [ebp], bl
1514
        jne     .skip
1722
        jne     .skip
1515
;--------------------------------------
-
 
-
 
1723
 
1516
        mov     ecx, [drbar.real_sx_and_abs_cx]
1724
        mov     ecx, [drbar.real_sx_and_abs_cx]
1517
        sub     ecx, edi
1725
        sub     ecx, edi
1518
        shl     ecx, 16
1726
        shl     ecx, 16
1519
        add     ecx, [drbar.real_sy_and_abs_cy]
1727
        add     ecx, [drbar.real_sy_and_abs_cy]
1520
        sub     ecx, esi
1728
        sub     ecx, esi
Line 1521... Line 1729...
1521
 
1729
 
1522
; check mouse area for putpixel
1730
; check mouse area for putpixel
1523
        call    check_mouse_area_for_putpixel
1731
        call    check_mouse_area_for_putpixel
1524
; store to real LFB
1732
; store to LFB
1525
        mov     [edx], eax
1733
        mov     [edx], eax
1526
        mov     eax, [drbar.color]
-
 
1527
;--------------------------------------
-
 
1528
align 4
1734
        mov     eax, [drbar.color]
1529
.skip:
1735
  .skip:
1530
; add pixel
1736
; add pixel
1531
        add     edx, 4
1737
        add     edx, 4
1532
        inc     ebp
1738
        inc     ebp
Line 1539... Line 1745...
1539
        test    bh, 0x80
1745
        test    bh, 0x80
1540
        jz      @f
1746
        jz      @f
1541
        test    al, al
1747
        test    al, al
1542
        jz      @f
1748
        jz      @f
1543
        dec     al
1749
        dec     al
1544
;--------------------------------------
-
 
1545
align 4
-
 
1546
@@:
1750
  @@:
1547
        dec     esi
1751
        dec     esi
1548
        jnz     .new_y
1752
        jnz     .new_y
1549
        jmp     draw_bar_end_32.end
1753
        jmp     draw_bar_end_32.end
-
 
1754
 
1550
;------------------------------------------------------------------------------
1755
;------------------------------------------------------------------------------
-
 
1756
 
1551
align 4
1757
align 4
1552
draw_bar_end_32_new:
1758
draw_bar_end_32_new:
1553
;--------------------------------------
-
 
1554
align 4
1759
 
1555
.new_y:
1760
  .new_y:
1556
        mov     edi, [drbar.real_sx]
1761
        mov     edi, [drbar.real_sx]
1557
;--------------------------------------
-
 
1558
align 4
-
 
1559
.new_x:
1762
  .new_x:
1560
        cmp     byte [ebp], bl
1763
        cmp     byte [ebp], bl
1561
        jne     .skip
1764
        jne     .skip
1562
;--------------------------------------
-
 
-
 
1765
 
1563
        mov     ecx, [drbar.real_sy_and_abs_cy]
1766
        mov     ecx, [drbar.real_sy_and_abs_cy]
1564
        sub     ecx, esi
1767
        sub     ecx, esi
1565
;--------------------------------------
-
 
-
 
1768
 
1566
; check for Y
1769
; check for Y
1567
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
1770
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
1568
        jae     .no_mouse_area
1771
        jae     .no_mouse_area
1569
 
-
 
1570
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
1772
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
1571
        jb      .no_mouse_area
1773
        jb      .no_mouse_area
1572
 
-
 
1573
        rol     ecx, 16
1774
        rol     ecx, 16
1574
        add     ecx, [drbar.real_sx_and_abs_cx]
1775
        add     ecx, [drbar.real_sx_and_abs_cx]
1575
        sub     ecx, edi
1776
        sub     ecx, edi
1576
;--------------------------------------
-
 
-
 
1777
 
1577
; check for X
1778
; check for X
1578
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
1779
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
1579
        jae     .no_mouse_area
1780
        jae     .no_mouse_area
1580
 
-
 
1581
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
1781
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
1582
        jb      .no_mouse_area
1782
        jb      .no_mouse_area
1583
 
-
 
1584
        ror     ecx, 16
1783
        ror     ecx, 16
1585
;--------------------------------------
-
 
-
 
1784
 
1586
; check mouse area for putpixel
1785
; check mouse area for putpixel
1587
        push    eax
1786
        push    eax
1588
        call    check_mouse_area_for_putpixel_new.1
1787
        call    check_mouse_area_for_putpixel_new.1
1589
        mov     [edx], eax
1788
        mov     [edx], eax
1590
        pop     eax
1789
        pop     eax
1591
        jmp     .skip
1790
        jmp     .skip
1592
; store to real LFB
-
 
1593
;--------------------------------------
-
 
1594
align 4
-
 
1595
.no_mouse_area:
1791
  .no_mouse_area:
-
 
1792
 
-
 
1793
; store to LFB
1596
        mov     [edx], eax
1794
        mov     [edx], eax
1597
;--------------------------------------
-
 
1598
align 4
-
 
1599
.skip:
1795
  .skip:
-
 
1796
 
1600
; add pixel
1797
; add pixel
1601
        add     edx, 4
1798
        add     edx, 4
1602
        inc     ebp
1799
        inc     ebp
1603
        dec     edi
1800
        dec     edi
1604
        jnz     .new_x
1801
        jnz     .new_x
-
 
1802
 
1605
; add line
1803
; add line
1606
        add     edx, [drbar.line_inc_scr]
1804
        add     edx, [drbar.line_inc_scr]
1607
        add     ebp, [drbar.line_inc_map]
1805
        add     ebp, [drbar.line_inc_map]
-
 
1806
 
1608
; drawing gradient bars
1807
; drawing gradient bars
1609
        test    bh, 0x80
1808
        test    bh, 0x80
1610
        jz      @f
1809
        jz      @f
1611
        test    al, al
1810
        test    al, al
1612
        jz      @f
1811
        jz      @f
1613
        dec     al
1812
        dec     al
1614
;--------------------------------------
-
 
1615
align 4
-
 
1616
@@:
1813
  @@:
1617
        dec     esi
1814
        dec     esi
1618
        jnz     .new_y
1815
        jnz     .new_y
1619
        jmp     draw_bar_end_32.end
1816
        jmp     draw_bar_end_32.end
-
 
1817
 
1620
;------------------------------------------------------------------------------
1818
;------------------------------------------------------------------------------
-
 
1819
; eax - color high   RRGGBB
-
 
1820
; bl - process num
-
 
1821
; ecx - temp
-
 
1822
; edx - pointer to screen
-
 
1823
; esi - counter
-
 
1824
; edi - counter
-
 
1825
 
-
 
1826
align 4
-
 
1827
draw_bar_end_16:
-
 
1828
 
-
 
1829
; check for hardware cursor
-
 
1830
        mov     ecx, [_display.select_cursor]
-
 
1831
        cmp     ecx, select_cursor
-
 
1832
        je      draw_bar_end_16_new
-
 
1833
        cmp     ecx, 0
-
 
1834
        je      draw_bar_end_16_old
-
 
1835
  .new_y:
-
 
1836
        mov     edi, [drbar.real_sx]
-
 
1837
  .new_x:
-
 
1838
        cmp     byte [ebp], bl
-
 
1839
        jne     .skip
-
 
1840
; convert to 16 bpp and store to LFB
-
 
1841
        and     eax, 00000000111110001111110011111000b
-
 
1842
        shr     ah, 2
-
 
1843
        shr     ax, 3
-
 
1844
        ror     eax, 8
-
 
1845
        add     al, ah
-
 
1846
        rol     eax, 8
-
 
1847
        mov     [edx], ax
-
 
1848
        mov     eax, [drbar.color]
-
 
1849
  .skip:
-
 
1850
 
-
 
1851
; add pixel
-
 
1852
        add     edx, 2
-
 
1853
        inc     ebp
-
 
1854
        dec     edi
-
 
1855
        jnz     .new_x
-
 
1856
; add line
-
 
1857
        add     edx, [drbar.line_inc_scr]
-
 
1858
        add     ebp, [drbar.line_inc_map]
-
 
1859
; drawing gradient bars
-
 
1860
        test    bh, 0x80
-
 
1861
        jz      @f
-
 
1862
        test    al, al
-
 
1863
        jz      @f
-
 
1864
        dec     al
-
 
1865
  @@:
-
 
1866
        dec     esi
-
 
1867
        jnz     .new_y
-
 
1868
  .end:
-
 
1869
        add     esp, drbar.stack_data
-
 
1870
        popad
-
 
1871
        cmp     [SCR_MODE], 0x12
-
 
1872
        jne     @f
-
 
1873
        call    VGA_draw_bar
-
 
1874
  @@:
-
 
1875
        xor     eax, eax
-
 
1876
        mov     [EGA_counter], 1
-
 
1877
        ret
-
 
1878
 
-
 
1879
;------------------------------------------------------------------------------
-
 
1880
 
-
 
1881
align 4
-
 
1882
draw_bar_end_16_old:
-
 
1883
 
-
 
1884
  .new_y:
-
 
1885
        mov     edi, [drbar.real_sx]
-
 
1886
  .new_x:
-
 
1887
        cmp     byte [ebp], bl
-
 
1888
        jne     .skip
-
 
1889
 
-
 
1890
        mov     ecx, [drbar.real_sx_and_abs_cx]
-
 
1891
        sub     ecx, edi
-
 
1892
        shl     ecx, 16
-
 
1893
        add     ecx, [drbar.real_sy_and_abs_cy]
-
 
1894
        sub     ecx, esi
-
 
1895
 
-
 
1896
; check mouse area for putpixel
-
 
1897
        call    check_mouse_area_for_putpixel
-
 
1898
; convert to 16 bpp and store to LFB
-
 
1899
        and     eax, 00000000111110001111110011111000b
-
 
1900
        shr     ah, 2
-
 
1901
        shr     ax, 3
-
 
1902
        ror     eax, 8
-
 
1903
        add     al, ah
-
 
1904
        rol     eax, 8
-
 
1905
        mov     [edx], ax
-
 
1906
        mov     eax, [drbar.color]
-
 
1907
.skip:
-
 
1908
 
-
 
1909
; add pixel
-
 
1910
        add     edx, 2
-
 
1911
        inc     ebp
-
 
1912
        dec     edi
-
 
1913
        jnz     .new_x
-
 
1914
 
-
 
1915
; add line
-
 
1916
        add     edx, [drbar.line_inc_scr]
-
 
1917
        add     ebp, [drbar.line_inc_map]
-
 
1918
 
-
 
1919
; drawing gradient bars
-
 
1920
        test    bh, 0x80
-
 
1921
        jz      @f
-
 
1922
        test    al, al
-
 
1923
        jz      @f
-
 
1924
        dec     al
-
 
1925
  @@:
-
 
1926
        dec     esi
-
 
1927
        jnz     .new_y
-
 
1928
        jmp     draw_bar_end_16.end
-
 
1929
 
-
 
1930
;------------------------------------------------------------------------------
-
 
1931
 
-
 
1932
align 4
-
 
1933
draw_bar_end_16_new:
-
 
1934
 
-
 
1935
  .new_y:
-
 
1936
        mov     edi, [drbar.real_sx]
-
 
1937
  .new_x:
-
 
1938
        cmp     byte [ebp], bl
-
 
1939
        jne     .skip
-
 
1940
 
-
 
1941
        mov     ecx, [drbar.real_sy_and_abs_cy]
-
 
1942
        sub     ecx, esi
-
 
1943
 
-
 
1944
; check for Y
-
 
1945
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
1946
        jae     .no_mouse_area
-
 
1947
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
1948
        jb      .no_mouse_area
-
 
1949
        rol     ecx, 16
-
 
1950
        add     ecx, [drbar.real_sx_and_abs_cx]
-
 
1951
        sub     ecx, edi
-
 
1952
 
-
 
1953
; check for X
-
 
1954
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
1955
        jae     .no_mouse_area
-
 
1956
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
-
 
1957
        jb      .no_mouse_area
-
 
1958
        ror     ecx, 16
-
 
1959
 
-
 
1960
; check mouse area for putpixel
-
 
1961
        push    eax
-
 
1962
        call    check_mouse_area_for_putpixel_new.1
-
 
1963
        push    eax
-
 
1964
        and     eax, 00000000111110001111110011111000b
-
 
1965
        shr     ah, 2
-
 
1966
        shr     ax, 3
-
 
1967
        ror     eax, 8
-
 
1968
        add     al, ah
-
 
1969
        rol     eax, 8
-
 
1970
        mov     [edx], ax
-
 
1971
        pop     eax
-
 
1972
        pop     eax
-
 
1973
        jmp     .skip
-
 
1974
 
-
 
1975
  .no_mouse_area:
-
 
1976
; convert to 16 bpp and store to LFB
-
 
1977
        push    eax
-
 
1978
        and     eax, 00000000111110001111110011111000b
-
 
1979
        shr     ah, 2
-
 
1980
        shr     ax, 3
-
 
1981
        ror     eax, 8
-
 
1982
        add     al, ah
-
 
1983
        rol     eax, 8
-
 
1984
        mov     [edx], ax
-
 
1985
        pop     eax
-
 
1986
  .skip:
-
 
1987
 
-
 
1988
; add pixel
-
 
1989
        add     edx, 2
-
 
1990
        inc     ebp
-
 
1991
        dec     edi
-
 
1992
        jnz     .new_x
-
 
1993
 
-
 
1994
; add line
-
 
1995
        add     edx, [drbar.line_inc_scr]
-
 
1996
        add     ebp, [drbar.line_inc_map]
-
 
1997
 
-
 
1998
; drawing gradient bars
-
 
1999
        test    bh, 0x80
-
 
2000
        jz      @f
-
 
2001
        test    al, al
-
 
2002
        jz      @f
-
 
2003
        dec     al
-
 
2004
  @@:
-
 
2005
        dec     esi
-
 
2006
        jnz     .new_y
-
 
2007
        jmp     draw_bar_end_16.end
-
 
2008
 
-
 
2009
;------------------------------------------------------------------------------
-
 
2010
 
1621
align 4
2011
align 4
1622
vesa20_drawbackground_tiled:
2012
vesa20_drawbackground_tiled:
-
 
2013
 
1623
        pushad
2014
        pushad
1624
; External loop for all y from start to end
2015
; External loop for all y from start to end
1625
        mov     ebx, [draw_data+32+RECT.top]    ; y start
2016
        mov     ebx, [draw_data+32+RECT.top]    ; y start
1626
;--------------------------------------
-
 
1627
align 4
-
 
1628
dp2:
2017
  dp2:
1629
        mov     ebp, [draw_data+32+RECT.left]   ; x start
2018
        mov     ebp, [draw_data+32+RECT.left]   ; x start
1630
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
2019
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
1631
;                       and LFB data (output for our function) [edi]
2020
;                       and LFB data (output for our function) [edi]
1632
;        mov     eax, [BytesPerScanLine]
2021
;        mov     eax, [BytesPerScanLine]
1633
;        mul     ebx
2022
;        mul     ebx
1634
        mov     eax, [BPSLine_calc_area+ebx*4]
2023
        mov     eax, [BPSLine_calc_area+ebx*4]
1635
        xchg    ebp, eax
2024
        xchg    ebp, eax
1636
        add     ebp, eax
2025
        add     ebp, eax
1637
        add     ebp, eax
2026
        add     ebp, eax
-
 
2027
        cmp     byte [_display.bytes_per_pixel], 2
-
 
2028
        je      @f
1638
        add     ebp, eax
2029
        add     ebp, eax
1639
        cmp     byte [_display.bpp], 24    ; 24 or 32 bpp ? - x size
2030
        cmp     byte [_display.bytes_per_pixel], 3
1640
        jz      @f
2031
        je      @f
1641
        add     ebp, eax
2032
        add     ebp, eax
1642
;--------------------------------------
-
 
1643
align 4
2033
 
1644
@@:
2034
  @@:
1645
        add     ebp, LFB_BASE
2035
        add     ebp, LFB_BASE
1646
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
2036
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1647
        call    calculate_edi
2037
        call    calculate_edi
1648
        xchg    edi, ebp
2038
        xchg    edi, ebp
Line 1672... Line 2062...
1672
; eax = x, ebx = y (screen coordinates)
2062
; eax = x, ebx = y (screen coordinates)
1673
; ecx = deltax - number of pixels left in current tile block
2063
; ecx = deltax - number of pixels left in current tile block
1674
; edx = 1
2064
; edx = 1
1675
; esi -> bgr memory, edi -> output
2065
; esi -> bgr memory, edi -> output
1676
; ebp = offset in WinMapAddress
2066
; ebp = offset in WinMapAddress
1677
;--------------------------------------
-
 
1678
align 4
-
 
1679
dp3:
2067
  dp3:
1680
        cmp     [ebp], dl
2068
        cmp     [ebp], dl
1681
        jnz     nbgp
2069
        jnz     .next_pix
1682
;--------------------------------------
-
 
1683
        push    eax ecx
-
 
Line -... Line 2070...
-
 
2070
 
1684
 
2071
        push    eax ecx
1685
        mov     ecx, eax
2072
        mov     ecx, eax
1686
        shl     ecx, 16
2073
        shl     ecx, 16
Line 1687... Line 2074...
1687
        add     ecx, ebx
2074
        add     ecx, ebx
Line 1691... Line 2078...
1691
; check for hardware cursor
2078
; check for hardware cursor
1692
        cmp     [_display.select_cursor], select_cursor
2079
        cmp     [_display.select_cursor], select_cursor
1693
        je      @f
2080
        je      @f
1694
        cmp     [_display.select_cursor], 0
2081
        cmp     [_display.select_cursor], 0
1695
        jne     .no_mouseunder
2082
        jne     .no_mouseunder
1696
;--------------------------------------
-
 
1697
align 4
-
 
1698
@@:
2083
  @@:
1699
        and     eax, 0xffffff
2084
        and     eax, 0xffffff
1700
; check mouse area for putpixel
2085
; check mouse area for putpixel
1701
        call    [_display.check_mouse]
2086
        call    [_display.check_mouse]
1702
;--------------------------------------
-
 
1703
align 4
-
 
1704
.no_mouseunder:
2087
  .no_mouseunder:
-
 
2088
 
-
 
2089
        cmp     byte [_display.bits_per_pixel], 16
-
 
2090
        je      .16bpp
1705
; store to real LFB
2091
; store to LFB
1706
        mov     [edi], ax
2092
        mov     [edi], ax
1707
        shr     eax, 16
2093
        shr     eax, 16
1708
        mov     [edi+2], al
2094
        mov     [edi+2], al
-
 
2095
        pop     ecx eax
-
 
2096
        jmp     .next_pix
Line -... Line 2097...
-
 
2097
 
-
 
2098
  .16bpp:
-
 
2099
; convert to 16 bpp and store to LFB
-
 
2100
        and     eax, 00000000111110001111110011111000b
-
 
2101
        shr     ah, 2
-
 
2102
        shr     ax, 3
-
 
2103
        ror     eax, 8
-
 
2104
        add     al, ah
-
 
2105
        rol     eax, 8
1709
 
2106
        mov     [edi], ax
-
 
2107
        pop     ecx eax
1710
        pop     ecx eax
2108
 
1711
;--------------------------------------
-
 
1712
align 4
2109
; Advance to next pixel
1713
nbgp:
2110
  .next_pix:
1714
        add     esi, 3
2111
        add     esi, 3
1715
        add     edi, 3
-
 
1716
;--------------------------------------
-
 
1717
align 4
2112
        add     edi, [_display.bytes_per_pixel]
1718
@@:
-
 
1719
        cmp     byte [_display.bpp], 25    ; 24 or 32 bpp?
-
 
1720
        sbb     edi, -1         ; +1 for 32 bpp
-
 
1721
; I do not use 'inc eax' because this is slightly slower then 'add eax,1'
2113
 
1722
        add     ebp, edx
2114
        add     ebp, edx
1723
        add     eax, edx
2115
        add     eax, edx
1724
        cmp     eax, [draw_data+32+RECT.right]
2116
        cmp     eax, [draw_data+32+RECT.right]
1725
        ja      dp4
2117
        ja      dp4
1726
        sub     ecx, edx
2118
        sub     ecx, edx
-
 
2119
        jnz     dp3
1727
        jnz     dp3
2120
 
1728
; next tile block on x-axis
2121
; next tile block on x-axis
1729
        mov     ecx, [BgrDataWidth]
2122
        mov     ecx, [BgrDataWidth]
1730
        sub     esi, ecx
2123
        sub     esi, ecx
1731
        sub     esi, ecx
2124
        sub     esi, ecx
1732
        sub     esi, ecx
2125
        sub     esi, ecx
1733
        jmp     dp3
-
 
1734
;--------------------------------------
2126
        jmp     dp3
1735
align 4
2127
 
1736
dp4:
2128
  dp4:
1737
; next scan line
2129
; next scan line
1738
        inc     ebx
2130
        inc     ebx
1739
        cmp     ebx, [draw_data+32+RECT.bottom]
2131
        cmp     ebx, [draw_data+32+RECT.bottom]
1740
        jbe     dp2
2132
        jbe     dp2
1741
        popad
2133
        popad
1742
        mov     [EGA_counter], 1
2134
        mov     [EGA_counter], 1
1743
        cmp     [SCR_MODE], 0x12
2135
        cmp     [SCR_MODE], 0x12
1744
        jne     @f
2136
        jne     @f
1745
        call    VGA_drawbackground
-
 
1746
;--------------------------------------
-
 
1747
align 4
2137
        call    VGA_drawbackground
1748
@@:
2138
  @@:
-
 
2139
        ret
1749
        ret
2140
 
-
 
2141
;------------------------------------------------------------------------------
1750
;------------------------------------------------------------------------------
2142
 
1751
align 4
2143
align 4
-
 
2144
vesa20_drawbackground_stretch:
1752
vesa20_drawbackground_stretch:
2145
 
1753
        pushad
2146
        pushad
1754
; Helper variables
2147
; Helper variables
1755
; calculate 2^32*(BgrDataWidth) mod (ScreenWidth)
2148
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
-
 
2149
        mov     eax, [BgrDataWidth]
1756
        mov     eax, [BgrDataWidth]
2150
        dec     eax
1757
        xor     edx, edx
2151
        xor     edx, edx
1758
        div     dword [_display.width]
2152
        div     dword [Screen_Max_X]
1759
        push    eax     ; high
2153
        push    eax     ; high
1760
        xor     eax, eax
2154
        xor     eax, eax
1761
        div     dword [_display.width]
2155
        div     dword [Screen_Max_X]
-
 
2156
        push    eax     ; low
1762
        push    eax     ; low
2157
 
1763
; the same for height
2158
; the same for height
-
 
2159
        mov     eax, [BgrDataHeight]
1764
        mov     eax, [BgrDataHeight]
2160
        dec     eax
1765
        xor     edx, edx
2161
        xor     edx, edx
1766
        div     dword [_display.height]
2162
        div     dword [Screen_Max_Y]
1767
        push    eax     ; high
2163
        push    eax     ; high
1768
        xor     eax, eax
2164
        xor     eax, eax
1769
        div     dword [_display.height]
2165
        div     dword [Screen_Max_Y]
-
 
2166
        push    eax     ; low
1770
        push    eax     ; low
2167
 
1771
; External loop for all y from start to end
2168
; External loop for all y from start to end
1772
        mov     ebx, [draw_data+32+RECT.top]    ; y start
2169
        mov     ebx, [draw_data+32+RECT.top]    ; y start
1773
        mov     ebp, [draw_data+32+RECT.left]   ; x start
2170
        mov     ebp, [draw_data+32+RECT.left]   ; x start
1774
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
2171
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
Line 1777... Line 2174...
1777
;        mul     ebx
2174
;        mul     ebx
1778
        mov     eax, [BPSLine_calc_area+ebx*4]
2175
        mov     eax, [BPSLine_calc_area+ebx*4]
1779
        xchg    ebp, eax
2176
        xchg    ebp, eax
1780
        add     ebp, eax
2177
        add     ebp, eax
1781
        add     ebp, eax
2178
        add     ebp, eax
-
 
2179
        cmp     byte [_display.bytes_per_pixel], 2
-
 
2180
        jz      @f
1782
        add     ebp, eax
2181
        add     ebp, eax
1783
        cmp     byte [_display.bpp], 24    ; 24 or 32 bpp ? - x size
2182
        cmp     byte [_display.bytes_per_pixel], 3
1784
        jz      @f
2183
        jz      @f
1785
        add     ebp, eax
2184
        add     ebp, eax
1786
;--------------------------------------
-
 
1787
align 4
-
 
1788
@@:
2185
  @@:
-
 
2186
 
1789
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
2187
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1790
        call    calculate_edi
2188
        call    calculate_edi
1791
        xchg    edi, ebp
2189
        xchg    edi, ebp
-
 
2190
 
1792
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
2191
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
1793
        push    ebx
2192
        push    ebx
1794
        push    eax
2193
        push    eax
1795
; 2) Calculate offset in background memory block
2194
; 2) Calculate offset in background memory block
1796
        mov     eax, ebx
2195
        mov     eax, ebx
Line 1812... Line 2211...
1812
        lea     esi, [esi*3]
2211
        lea     esi, [esi*3]
1813
        add     esi, [img_background]
2212
        add     esi, [img_background]
1814
        push    eax
2213
        push    eax
1815
        push    edx
2214
        push    edx
1816
        push    esi
2215
        push    esi
-
 
2216
 
1817
; 3) Smooth horizontal
2217
; 3) Smooth horizontal
1818
;--------------------------------------
-
 
1819
align 4
-
 
1820
bgr_resmooth0:
2218
  bgr_resmooth0:
1821
        mov     ecx, [esp+8]
2219
        mov     ecx, [esp+8]
1822
        mov     edx, [esp+4]
2220
        mov     edx, [esp+4]
1823
        mov     esi, [esp]
2221
        mov     esi, [esp]
1824
        push    edi
2222
        push    edi
1825
        mov     edi, bgr_cur_line
2223
        mov     edi, bgr_cur_line
1826
        call    smooth_line
2224
        call    smooth_line
1827
;--------------------------------------
-
 
1828
align 4
2225
 
1829
bgr_resmooth1:
2226
  bgr_resmooth1:
1830
        mov     eax, [esp+16+4]
2227
        mov     eax, [esp+16+4]
1831
        inc     eax
2228
        inc     eax
1832
        cmp     eax, [BgrDataHeight]
2229
        cmp     eax, [BgrDataHeight]
1833
        jae     bgr.no2nd
2230
        jae     bgr.no2nd
Line 1837... Line 2234...
1837
        add     esi, [BgrDataWidth]
2234
        add     esi, [BgrDataWidth]
1838
        add     esi, [BgrDataWidth]
2235
        add     esi, [BgrDataWidth]
1839
        add     esi, [BgrDataWidth]
2236
        add     esi, [BgrDataWidth]
1840
        mov     edi, bgr_next_line
2237
        mov     edi, bgr_next_line
1841
        call    smooth_line
2238
        call    smooth_line
1842
;--------------------------------------
-
 
1843
align 4
2239
 
1844
bgr.no2nd:
2240
  bgr.no2nd:
1845
        pop     edi
2241
        pop     edi
1846
;--------------------------------------
-
 
1847
align 4
2242
 
1848
sdp3:
2243
  sdp3:
1849
        xor     esi, esi
2244
        xor     esi, esi
1850
        mov     ecx, [esp+12]
2245
        mov     ecx, [esp+12]
-
 
2246
 
1851
; 4) Loop through redraw rectangle and copy background data
2247
; 4) Loop through redraw rectangle and copy background data
1852
; Registers meaning:
2248
; Registers meaning:
1853
; esi = offset in current line, edi -> output
2249
; esi = offset in current line, edi -> output
1854
; ebp = offset in WinMapAddress
2250
; ebp = offset in WinMapAddress
1855
; dword [esp] = offset in bgr data
2251
; dword [esp] = offset in bgr data
Line 1858... Line 2254...
1858
; dword [esp+20] = x
2254
; dword [esp+20] = x
1859
; dword [esp+24] = y
2255
; dword [esp+24] = y
1860
; precalculated constants:
2256
; precalculated constants:
1861
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
2257
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
1862
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
2258
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
1863
;--------------------------------------
-
 
1864
align 4
2259
 
1865
sdp3a:
2260
  sdp3a:
1866
        mov     eax, [_WinMapAddress]
2261
        mov     eax, [_WinMapAddress]
1867
        cmp     [ebp+eax], byte 1
2262
        cmp     [ebp+eax], byte 1
1868
        jnz     snbgp
2263
        jnz     snbgp
1869
        mov     eax, [bgr_cur_line+esi]
2264
        mov     eax, [bgr_cur_line+esi]
1870
        test    ecx, ecx
2265
        test    ecx, ecx
1871
        jz      .novert
2266
        jz      .novert
1872
        mov     ebx, [bgr_next_line+esi]
2267
        mov     ebx, [bgr_next_line+esi]
1873
        call    [overlapping_of_points_ptr]
2268
        call    [overlapping_of_points_ptr]
1874
;--------------------------------------
-
 
1875
align 4
2269
 
1876
.novert:
2270
  .novert:
1877
        push    ecx
2271
        push    ecx
1878
; check for hardware cursor
2272
; check for hardware cursor
1879
        cmp     [_display.select_cursor], select_cursor
2273
        cmp     [_display.select_cursor], select_cursor
1880
        je      @f
2274
        je      @f
1881
        cmp     [_display.select_cursor], 0
2275
        cmp     [_display.select_cursor], 0
1882
        jne     .no_mouseunder
2276
        jne     .no_mouseunder
1883
;--------------------------------------
-
 
1884
align 4
-
 
1885
@@:
2277
  @@:
1886
        mov     ecx, [esp+20+4]        ;x
2278
        mov     ecx, [esp+20+4]        ;x
1887
        shl     ecx, 16
2279
        shl     ecx, 16
1888
        add     ecx, [esp+24+4]        ;y
2280
        add     ecx, [esp+24+4]        ;y
1889
; check mouse area for putpixel
2281
; check mouse area for putpixel
1890
        call    [_display.check_mouse]
2282
        call    [_display.check_mouse]
1891
;--------------------------------------
-
 
1892
align 4
-
 
1893
.no_mouseunder:
2283
  .no_mouseunder:
-
 
2284
 
-
 
2285
        cmp     [_display.bits_per_pixel], 16
-
 
2286
        jne     .not_16bpp
-
 
2287
; convert to 16 bpp and store to LFB
-
 
2288
        and     eax, 00000000111110001111110011111000b
-
 
2289
        shr     ah, 2
-
 
2290
        shr     ax, 3
-
 
2291
        ror     eax, 8
-
 
2292
        add     al, ah
-
 
2293
        rol     eax, 8
-
 
2294
        mov     [LFB_BASE+edi], ax
-
 
2295
        pop     ecx
-
 
2296
        jmp     snbgp
-
 
2297
  .not_16bpp:
-
 
2298
 
1894
; store to real LFB
2299
; store to LFB
1895
        mov     [LFB_BASE+edi], ax
2300
        mov     [LFB_BASE+edi], ax
1896
        shr     eax, 16
2301
        shr     eax, 16
1897
        mov     [LFB_BASE+edi+2], al
2302
        mov     [LFB_BASE+edi+2], al
1898
        pop     ecx
2303
        pop     ecx
1899
;--------------------------------------
-
 
1900
align 4
2304
 
1901
snbgp:
2305
  snbgp:
1902
        cmp     byte [_display.bpp], 25
2306
        add     edi, [_display.bytes_per_pixel]
1903
        sbb     edi, -4
-
 
1904
        add     ebp, 1
2307
        add     ebp, 1
1905
        mov     eax, [esp+20]
2308
        mov     eax, [esp+20]
1906
        add     eax, 1
2309
        add     eax, 1
1907
        mov     [esp+20], eax
2310
        mov     [esp+20], eax
1908
        add     esi, 4
2311
        add     esi, 4
1909
        cmp     eax, [draw_data+32+RECT.right]
2312
        cmp     eax, [draw_data+32+RECT.right]
1910
        jbe     sdp3a
2313
        jbe     sdp3a
1911
;--------------------------------------
-
 
1912
align 4
2314
 
1913
sdp4:
2315
  sdp4:
1914
; next y
2316
; next y
1915
        mov     ebx, [esp+24]
2317
        mov     ebx, [esp+24]
1916
        add     ebx, 1
2318
        add     ebx, 1
1917
        mov     [esp+24], ebx
2319
        mov     [esp+24], ebx
1918
        cmp     ebx, [draw_data+32+RECT.bottom]
2320
        cmp     ebx, [draw_data+32+RECT.bottom]
1919
        ja      sdpdone
2321
        ja      sdpdone
-
 
2322
 
1920
; advance edi, ebp to next scan line
2323
; advance edi, ebp to next scan line
1921
        sub     eax, [draw_data+32+RECT.left]
2324
        sub     eax, [draw_data+32+RECT.left]
1922
        sub     ebp, eax
2325
        sub     ebp, eax
1923
        add     ebp, [_display.width]
2326
        add     ebp, [Screen_Max_X]
-
 
2327
        add     ebp, 1
1924
        sub     edi, eax
2328
        sub     edi, eax
1925
        sub     edi, eax
2329
        sub     edi, eax
-
 
2330
        cmp     byte [_display.bytes_per_pixel], 2
-
 
2331
        jz      @f
1926
        sub     edi, eax
2332
        sub     edi, eax
1927
        cmp     byte [_display.bpp], 24
2333
        cmp     byte [_display.bytes_per_pixel], 3
1928
        jz      @f
2334
        jz      @f
1929
        sub     edi, eax
2335
        sub     edi, eax
1930
;--------------------------------------
-
 
1931
align 4
2336
 
1932
@@:
2337
  @@:
1933
        add     edi, [_display.pitch]
2338
        add     edi, [_display.pitch]
1934
; restore ecx,edx; advance esi to next background line
2339
; restore ecx,edx; advance esi to next background line
1935
        mov     eax, [esp+28]
2340
        mov     eax, [esp+28]
1936
        mov     ebx, [esp+32]
2341
        mov     ebx, [esp+32]
Line 1949... Line 2354...
1949
        cmp     ebx, -1
2354
        cmp     ebx, -1
1950
        jnz     bgr_resmooth0
2355
        jnz     bgr_resmooth0
1951
        push    edi
2356
        push    edi
1952
        mov     esi, bgr_next_line
2357
        mov     esi, bgr_next_line
1953
        mov     edi, bgr_cur_line
2358
        mov     edi, bgr_cur_line
1954
        mov     ecx, [_display.width]
2359
        mov     ecx, [Screen_Max_X]
-
 
2360
        inc     ecx
1955
        rep movsd
2361
        rep movsd
1956
        jmp     bgr_resmooth1
2362
        jmp     bgr_resmooth1
1957
;--------------------------------------
-
 
1958
align 4
2363
 
1959
sdpdone:
2364
  sdpdone:
1960
        add     esp, 44
2365
        add     esp, 44
1961
        popad
2366
        popad
1962
        mov     [EGA_counter], 1
2367
        mov     [EGA_counter], 1
1963
        cmp     [SCR_MODE], 0x12
2368
        cmp     [SCR_MODE], 0x12
1964
        jne     @f
2369
        jne     @f
1965
        call    VGA_drawbackground
2370
        call    VGA_drawbackground
1966
;--------------------------------------
-
 
1967
align 4
-
 
1968
@@:
2371
  @@:
1969
        ret
2372
        ret
Line 1970... Line -...
1970
 
-
 
1971
uglobal
-
 
1972
;--------------------------------------
-
 
1973
align 4
-
 
1974
bgr_cur_line    rd      1920    ; maximum width of screen
-
 
1975
bgr_next_line   rd      1920
-
 
1976
;--------------------------------------
-
 
1977
endg
2373
 
-
 
2374
;--------------------------------------
1978
;--------------------------------------
2375
 
1979
align 4
2376
align 4
1980
smooth_line:
2377
smooth_line:
1981
        mov     al, [esi+2]
2378
        mov     al, [esi+2]
1982
        shl     eax, 16
2379
        shl     eax, 16
1983
        mov     ax, [esi]
2380
        mov     ax, [esi]
1984
        test    ecx, ecx
2381
        test    ecx, ecx
1985
        jz      @f
2382
        jz      @f
1986
        mov     ebx, [esi+2]
2383
        mov     ebx, [esi+2]
1987
        shr     ebx, 8
2384
        shr     ebx, 8
1988
        call    [overlapping_of_points_ptr]
-
 
1989
;--------------------------------------
-
 
1990
align 4
2385
        call    [overlapping_of_points_ptr]
1991
@@:
2386
  @@:
1992
        stosd
2387
        stosd
1993
        mov     eax, [esp+20+8]
2388
        mov     eax, [esp+20+8]
1994
        add     eax, 1
2389
        add     eax, 1
Line 2000... Line 2395...
2000
        adc     edx, [esp+40+8]
2395
        adc     edx, [esp+40+8]
2001
        sub     eax, edx
2396
        sub     eax, edx
2002
        lea     eax, [eax*3]
2397
        lea     eax, [eax*3]
2003
        sub     esi, eax
2398
        sub     esi, eax
2004
        jmp     smooth_line
2399
        jmp     smooth_line
2005
;--------------------------------------
-
 
2006
align 4
-
 
2007
@@:
2400
  @@:
2008
        mov     eax, [draw_data+32+RECT.left]
2401
        mov     eax, [draw_data+32+RECT.left]
2009
        mov     [esp+20+8], eax
2402
        mov     [esp+20+8], eax
2010
        ret
2403
        ret
-
 
2404
 
2011
;------------------------------------------------------------------------------
2405
;------------------------------------------------------------------------------
-
 
2406
 
2012
align 16
2407
align 16
2013
overlapping_of_points:
2408
overlapping_of_points:
2014
if 0
2409
if 0
2015
; this version of procedure works, but is slower than next version
2410
; this version of procedure works, but is slower than next version
2016
        push    ecx edx
2411
        push    ecx edx
Line 2070... Line 2465...
2070
        ror     eax, 16
2465
        ror     eax, 16
2071
        pop     ecx
2466
        pop     ecx
2072
        ret
2467
        ret
2073
end if
2468
end if
Line 2074... Line -...
2074
 
-
 
2075
iglobal
-
 
2076
;--------------------------------------
-
 
2077
align 4
-
 
2078
overlapping_of_points_ptr       dd      overlapping_of_points
-
 
2079
;--------------------------------------
2469
 
2080
endg
2470
 
-
 
2471
;------------------------------------------------------------------------------
2081
;------------------------------------------------------------------------------
2472
 
2082
align 4
2473
align 4
-
 
2474
init_background:
2083
init_background:
2475
 
2084
        mov     edi, BgrAuxTable
2476
        mov     edi, BgrAuxTable
2085
        xor     edx, edx
-
 
2086
;--------------------------------------
2477
        xor     edx, edx
2087
align 4
2478
 
2088
.loop2:
2479
  .loop2:
2089
        mov     eax, edx
2480
        mov     eax, edx
2090
        shl     eax, 8
2481
        shl     eax, 8
2091
        neg     eax
2482
        neg     eax
2092
        mov     ecx, 0x200
-
 
2093
;--------------------------------------
2483
        mov     ecx, 0x200
2094
align 4
2484
 
2095
.loop1:
2485
  .loop1:
2096
        mov     byte [edi], ah
2486
        mov     byte [edi], ah
2097
        inc     edi
2487
        inc     edi
2098
        add     eax, edx
2488
        add     eax, edx
2099
        loop    .loop1
2489
        loop    .loop1
2100
        add     dl, 4
2490
        add     dl, 4
2101
        jnz     .loop2
2491
        jnz     .loop2
2102
        test    byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
2492
        test    byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
2103
        jz      @f
2493
        jz      @f
2104
        mov     [overlapping_of_points_ptr], overlapping_of_points_mmx
-
 
2105
;--------------------------------------
-
 
2106
align 4
2494
        mov     [overlapping_of_points_ptr], overlapping_of_points_mmx
2107
@@:
2495
  @@:
-
 
2496
        ret
2108
        ret
2497
 
-
 
2498
;------------------------------------------------------------------------------
2109
;------------------------------------------------------------------------------
2499
 
2110
align 16
2500
align 16
-
 
2501
overlapping_of_points_mmx:
2111
overlapping_of_points_mmx:
2502
 
2112
        movd    mm0, eax
2503
        movd    mm0, eax
2113
        movd    mm4, eax
2504
        movd    mm4, eax
2114
        movd    mm1, ebx
2505
        movd    mm1, ebx
2115
        pxor    mm2, mm2
2506
        pxor    mm2, mm2
Line 2123... Line 2514...
2123
        pmullw  mm1, mm3
2514
        pmullw  mm1, mm3
2124
        psrlw   mm1, 8
2515
        psrlw   mm1, 8
2125
        packuswb mm1, mm2
2516
        packuswb mm1, mm2
2126
        paddb   mm4, mm1
2517
        paddb   mm4, mm1
2127
        movd    eax, mm4
2518
        movd    eax, mm4
-
 
2519
 
2128
        ret
2520
        ret
-
 
2521
 
2129
;------------------------------------------------------------------------------
2522
;------------------------------------------------------------------------------