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