Subversion Repositories Kolibri OS

Rev

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

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