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