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