Rev 1664 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1664 | Rev 1707 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | ;; ;; |
15 | ;; ;; |
16 | ;; See file COPYING for details ;; |
16 | ;; See file COPYING for details ;; |
17 | ;; ;; |
17 | ;; ;; |
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 19... | Line 19... | ||
19 | 19 | ||
20 | $Revision: 1664 $ |
- | |
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 |
- | |
Line 31... | Line 20... | ||
31 | 20 | $Revision: 1707 $ |
|
32 | 21 | ||
33 | 22 | ||
Line 39... | Line 28... | ||
39 | ; ebx = y coordinate |
28 | ; ebx = y coordinate |
40 | ; |
29 | ; |
41 | ; ret: |
30 | ; ret: |
42 | ; ecx = 00 RR GG BB |
31 | ; ecx = 00 RR GG BB |
Line 43... | Line -... | ||
43 | - | ||
44 | getpixel: |
- | |
45 | push eax ebx edx edi |
- | |
46 | call dword [GETPIXEL] |
- | |
47 | pop edi edx ebx eax |
- | |
48 | ret |
- | |
49 | - | ||
50 | Vesa20_getpixel24: |
- | |
51 | ; eax = x |
- | |
52 | ; ebx = y |
- | |
53 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
- | |
54 | lea edi, [eax+eax*2] ; edi = x*3 |
- | |
55 | add edi, ebx ; edi = x*3+(y*y multiplier) |
- | |
56 | mov ecx, [LFB_BASE+edi] |
- | |
57 | and ecx, 0xffffff |
- | |
Line 58... | Line 32... | ||
58 | ret |
32 | |
59 | 33 | ||
- | 34 | get_pixel: |
|
60 | Vesa20_getpixel32: |
35 | mov ecx, [BytesPerScanLine] |
61 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
36 | imul ecx, ebx |
62 | lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
37 | lea ecx, [ecx+eax*4] ; ecx = x*4+(y*y multiplier) |
63 | mov ecx, [LFB_BASE+edi] |
38 | mov ecx, [ecx+LFB_BASE] |
Line 64... | Line 39... | ||
64 | and ecx, 0xffffff |
39 | and ecx, 0xffffff |
Line 127... | Line 102... | ||
127 | mov ebx, [eax-twdw + WDATA.box.top] |
102 | mov ebx, [eax-twdw + WDATA.box.top] |
128 | add ebx, [putimg.image_cy] |
103 | add ebx, [putimg.image_cy] |
129 | mov [putimg.abs_cy], ebx |
104 | mov [putimg.abs_cy], ebx |
130 | ; real_sx = MIN(wnd_sx-image_cx, image_sx); |
105 | ; real_sx = MIN(wnd_sx-image_cx, image_sx); |
131 | mov ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx |
106 | mov ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx |
132 | ; \begin{diamond}[20.08.2006] |
- | |
133 | ; note that WDATA.box.width is one pixel less than real window x-size |
107 | inc ebx ; WDATA.box.width is one pixel less than real window x-size |
134 | inc ebx |
- | |
135 | ; \end{diamond}[20.08.2006] |
- | |
136 | sub ebx, [putimg.image_cx] |
108 | sub ebx, [putimg.image_cx] |
137 | ja @f |
109 | ja @f |
138 | add esp, putimg.stack_data |
110 | add esp, putimg.stack_data |
139 | popad |
111 | popad |
140 | ret |
112 | ret |
Line 144... | Line 116... | ||
144 | mov ebx, [putimg.image_sx] |
116 | mov ebx, [putimg.image_sx] |
145 | .end_x: |
117 | .end_x: |
146 | mov [putimg.real_sx], ebx |
118 | mov [putimg.real_sx], ebx |
147 | ; init real_sy |
119 | ; init real_sy |
148 | mov ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy |
120 | mov ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy |
149 | ; \begin{diamond}[20.08.2006] |
- | |
150 | inc ebx |
121 | inc ebx |
151 | ; \end{diamond}[20.08.2006] |
- | |
152 | sub ebx, [putimg.image_cy] |
122 | sub ebx, [putimg.image_cy] |
153 | ja @f |
123 | ja @f |
154 | add esp, putimg.stack_data |
124 | add esp, putimg.stack_data |
155 | popad |
125 | popad |
156 | ret |
126 | ret |
Line 162... | Line 132... | ||
162 | mov [putimg.real_sy], ebx |
132 | mov [putimg.real_sy], ebx |
163 | ; line increment |
133 | ; line increment |
164 | mov eax, [putimg.image_sx] |
134 | mov eax, [putimg.image_sx] |
165 | mov ecx, [putimg.real_sx] |
135 | mov ecx, [putimg.real_sx] |
166 | sub eax, ecx |
136 | sub eax, ecx |
167 | ;; imul eax, [putimg.source_bpp] |
- | |
168 | ; lea eax, [eax + eax * 2] |
- | |
169 | call esi |
137 | call esi |
170 | add eax, [putimg.arg_0] |
138 | add eax, [putimg.arg_0] |
171 | mov [putimg.line_increment], eax |
139 | mov [putimg.line_increment], eax |
172 | ; winmap new line increment |
140 | ; winmap new line increment |
173 | mov eax, [Screen_Max_X] |
141 | mov eax, [Screen_Max_X] |
174 | inc eax |
142 | inc eax |
175 | sub eax, [putimg.real_sx] |
143 | sub eax, [putimg.real_sx] |
176 | mov [putimg.winmap_newline], eax |
144 | mov [putimg.winmap_newline], eax |
177 | ; screen new line increment |
145 | ; screen new line increment |
178 | mov eax, [BytesPerScanLine] |
146 | mov eax, [BytesPerScanLine] |
179 | movzx ebx, byte [ScreenBPP] |
- | |
180 | shr ebx, 3 |
147 | shl ecx, 1 |
181 | imul ecx, ebx |
148 | shl ecx, 1 |
182 | sub eax, ecx |
149 | sub eax, ecx |
183 | mov [putimg.screen_newline], eax |
150 | mov [putimg.screen_newline], eax |
184 | ; pointer to image |
151 | ; pointer to image |
185 | mov esi, [putimg.pti] |
152 | mov esi, [putimg.pti] |
186 | ; pointer to screen |
153 | ; pointer to screen |
187 | mov edx, [putimg.abs_cy] |
154 | mov edx, [putimg.abs_cy] |
188 | imul edx, [BytesPerScanLine] |
155 | imul edx, [BytesPerScanLine] |
189 | mov eax, [putimg.abs_cx] |
156 | mov eax, [putimg.abs_cx] |
190 | movzx ebx, byte [ScreenBPP] |
- | |
191 | shr ebx, 3 |
157 | shl eax, 1 |
192 | imul eax, ebx |
158 | shl eax, 1 |
193 | add edx, eax |
159 | add edx, eax |
194 | ; pointer to pixel map |
160 | ; pointer to pixel map |
195 | mov eax, [putimg.abs_cy] |
161 | mov eax, [putimg.abs_cy] |
196 | imul eax, [Screen_Max_X] |
162 | imul eax, [Screen_Max_X] |
197 | add eax, [putimg.abs_cy] |
163 | add eax, [putimg.abs_cy] |
198 | add eax, [putimg.abs_cx] |
164 | add eax, [putimg.abs_cx] |
199 | add eax, [_WinMapAddress] |
165 | add eax, [_WinMapAddress] |
200 | xchg eax, ebp |
166 | xchg eax, ebp |
201 | ; get process number |
167 | ; get process number |
202 | mov ebx, [CURRENT_TASK] |
168 | mov ebx, [CURRENT_TASK] |
203 | cmp byte [ScreenBPP], 32 |
- | |
204 | je put_image_end_32 |
- | |
205 | ;put_image_end_24: |
- | |
206 | mov edi, [putimg.real_sy] |
- | |
207 | align 4 |
- | |
208 | .new_line: |
- | |
209 | mov ecx, [putimg.real_sx] |
- | |
210 | ; push ebp edx |
- | |
211 | align 4 |
- | |
212 | .new_x: |
- | |
213 | push [putimg.edi] |
- | |
214 | mov eax, [putimg.ebp+4] |
- | |
215 | call eax |
- | |
216 | cmp [ebp], bl |
- | |
217 | jne .skip |
- | |
218 | ; mov eax, [esi] ; eax = RRBBGGRR |
- | |
219 | mov [LFB_BASE+edx], ax |
- | |
220 | shr eax, 16 |
- | |
221 | mov [LFB_BASE+edx+2], al |
- | |
222 | .skip: |
- | |
223 | ; add esi, 3 ;[putimg.source_bpp] |
- | |
224 | add edx, 3 |
- | |
225 | inc ebp |
- | |
226 | dec ecx |
- | |
227 | jnz .new_x |
- | |
228 | ; pop edx ebp |
- | |
229 | add esi, [putimg.line_increment] |
- | |
230 | add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
- | |
231 | add ebp, [putimg.winmap_newline] ;[Screen_Max_X] |
- | |
232 | ; inc ebp |
- | |
233 | cmp [putimg.ebp], putimage_get1bpp |
- | |
234 | jz .correct |
- | |
235 | cmp [putimg.ebp], putimage_get2bpp |
- | |
236 | jz .correct |
- | |
237 | cmp [putimg.ebp], putimage_get4bpp |
- | |
238 | jnz @f |
- | |
239 | .correct: |
- | |
240 | mov eax, [putimg.edi] |
- | |
241 | mov byte [eax], 80h |
- | |
242 | @@: |
- | |
243 | dec edi |
- | |
244 | jnz .new_line |
- | |
245 | .finish: |
- | |
246 | add esp, putimg.stack_data |
- | |
247 | popad |
- | |
248 | ret |
- | |
Line 249... | Line 169... | ||
249 | 169 | ||
250 | put_image_end_32: |
170 | put_image_end_32: |
251 | mov edi, [putimg.real_sy] |
171 | mov edi, [putimg.real_sy] |
252 | align 4 |
172 | align 4 |
253 | .new_line: |
173 | .new_line: |
254 | mov ecx, [putimg.real_sx] |
- | |
255 | ; push ebp edx |
174 | mov ecx, [putimg.real_sx] |
256 | align 4 |
175 | align 4 |
257 | .new_x: |
176 | .new_x: |
258 | push [putimg.edi] |
177 | push [putimg.edi] |
259 | mov eax, [putimg.ebp+4] |
178 | mov eax, [putimg.ebp+4] |
260 | call eax |
179 | call eax |
261 | cmp [ebp], bl |
180 | cmp [ebp], bl |
262 | jne .skip |
- | |
263 | ; mov eax, [esi] ; ecx = RRBBGGRR |
181 | jne .skip |
264 | mov [LFB_BASE+edx], eax |
182 | mov [LFB_BASE+edx], eax |
265 | .skip: |
- | |
266 | ; add esi, [putimg.source_bpp] |
183 | .skip: |
267 | add edx, 4 |
184 | add edx, 4 |
268 | inc ebp |
185 | inc ebp |
269 | dec ecx |
186 | dec ecx |
270 | jnz .new_x |
- | |
271 | ; pop edx ebp |
187 | jnz .new_x |
272 | add esi, [putimg.line_increment] |
188 | add esi, [putimg.line_increment] |
273 | add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
189 | add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
274 | add ebp, [putimg.winmap_newline] ;[Screen_Max_X] |
- | |
275 | ; inc ebp |
190 | add ebp, [putimg.winmap_newline] ;[Screen_Max_X] |
276 | cmp [putimg.ebp], putimage_get1bpp |
191 | cmp [putimg.ebp], putimage_get1bpp |
277 | jz .correct |
192 | jz .correct |
278 | cmp [putimg.ebp], putimage_get2bpp |
193 | cmp [putimg.ebp], putimage_get2bpp |
279 | jz .correct |
194 | jz .correct |
Line 286... | Line 201... | ||
286 | dec edi |
201 | dec edi |
287 | jnz .new_line |
202 | jnz .new_line |
288 | .finish: |
203 | .finish: |
289 | add esp, putimg.stack_data |
204 | add esp, putimg.stack_data |
290 | popad |
205 | popad |
291 | ; call VGA__putimage |
- | |
292 | ; mov [EGA_counter],1 |
- | |
293 | ret |
206 | ret |
Line 294... | Line -... | ||
294 | - | ||
295 | 207 | ||
296 | ;************************************************* |
208 | ;************************************************* |
297 | align 4 |
209 | align 4 |
Line 298... | Line 210... | ||
298 | __sys_putpixel: |
210 | __sys_putpixel: |
299 | 211 | ||
300 | ; eax = x coordinate |
212 | ; eax = x coordinate |
301 | ; ebx = y coordinate |
213 | ; ebx = y coordinate |
Line 302... | Line -... | ||
302 | ; ecx = ?? RR GG BB ; 0x01000000 negation |
- | |
303 | ; edi = 0x00000001 force |
- | |
304 | 214 | ; ecx = ?? RR GG BB ; 0x01000000 negation |
|
305 | ;;; mov [novesachecksum], dword 0 |
215 | ; edi = 0x00000001 force |
306 | pushad |
216 | |
307 | cmp [Screen_Max_X], eax |
217 | cmp [Screen_Max_X], eax |
- | 218 | jb .exit |
|
308 | jb .exit |
219 | cmp [Screen_Max_Y], ebx |
309 | cmp [Screen_Max_Y], ebx |
220 | jb .exit |
310 | jb .exit |
- | |
311 | test edi,1 ; force ? |
- | |
Line -... | Line 221... | ||
- | 221 | .check_forced: |
|
312 | jnz .forced |
222 | test edi,1 ; force ? |
313 | 223 | jnz .checked |
|
314 | ; not forced: |
224 | |
315 | 225 | .not_forced: |
|
316 | push eax |
226 | push edx |
317 | mov edx,[_display.width] ; screen x size |
227 | mov edx,[_display.width] ; screen x size |
318 | imul edx, ebx |
228 | imul edx, ebx |
319 | add eax, [_WinMapAddress] |
229 | add edx, [_WinMapAddress] |
Line -... | Line 230... | ||
- | 230 | movzx edx, byte [eax+edx] |
|
320 | movzx edx, byte [eax+edx] |
231 | cmp edx, [CURRENT_TASK] |
- | 232 | pop edx |
|
- | 233 | jne .exit |
|
321 | cmp edx, [CURRENT_TASK] |
234 | |
322 | pop eax |
235 | ; OK to set pixel |
323 | jne .exit |
236 | .checked: |
324 | 237 | push ebx |
|
325 | .forced: |
238 | imul ebx, [BytesPerScanLine] |
326 | ; check if negation |
239 | lea ebx, [ebx+eax*4] |
327 | test ecx,0x01000000 |
240 | test ecx,0x01000000 |
328 | jz .noneg |
241 | jz .noneg |
329 | call getpixel |
242 | mov ecx, [LFB_BASE+ebx] |
330 | not ecx |
243 | not ecx |
331 | mov [esp+32-8],ecx |
- | |
332 | .noneg: |
244 | and ecx, 0x01FFFFFF |
Line 333... | Line -... | ||
333 | ; OK to set pixel |
- | |
334 | call dword [PUTPIXEL] ; call the real put_pixel function |
- | |
335 | .exit: |
- | |
336 | popad |
- | |
337 | ret |
- | |
338 | - | ||
339 | align 4 |
- | |
340 | Vesa20_putpixel24: |
- | |
341 | ; eax = x |
- | |
342 | ; ebx = y |
- | |
343 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
- | |
Line 344... | Line 245... | ||
344 | lea edi, [eax+eax*2] ; edi = x*3 |
245 | .noneg: |
345 | mov eax, [esp+32-8+4] |
246 | mov [LFB_BASE+ebx], ecx |
346 | mov [LFB_BASE+ebx+edi], ax |
247 | pop ebx |
347 | shr eax, 16 |
248 | .exit: |
348 | mov [LFB_BASE+ebx+edi+2], al |
249 | ret |
349 | ret |
250 | |
350 | 251 | ||
351 | 252 | ||
352 | align 4 |
253 | align 4 |
Line -... | Line 254... | ||
- | 254 | put_pixel: ; left for compatibility with Vesa20_putpixel32 |
|
353 | Vesa20_putpixel32: |
255 | ; eax = x |
Line 354... | Line 256... | ||
354 | ; eax = x |
256 | ; ebx = y |
355 | ; ebx = y |
257 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
356 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
258 | lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
Line 490... | Line 392... | ||
490 | mov ebx, [dl_y2] |
392 | mov ebx, [dl_y2] |
491 | call [putpixel] |
393 | call [putpixel] |
492 | .exit: |
394 | .exit: |
493 | add esp, 6*4 |
395 | add esp, 6*4 |
494 | popa |
396 | popa |
495 | ; dec [mouse_pause] |
- | |
496 | call [draw_pointer] |
397 | call [draw_pointer] |
497 | ret |
398 | ret |
Line 498... | Line 399... | ||
498 | 399 | ||
499 | 400 | align 4 |
|
500 | hline: |
401 | hline: |
501 | ; draw an horizontal line |
402 | ; ------------ draw a horizontal line ------------- |
502 | ; eax = x1 |
403 | ; eax = x1 |
503 | ; edx = x2 |
404 | ; edx = x2 |
504 | ; ebx = y |
405 | ; ebx = y |
505 | ; ecx = color |
406 | ; ecx = color |
- | 407 | ; edi = force ? |
|
- | 408 | cmp ebx, [Screen_Max_Y] |
|
- | 409 | jge .out |
|
- | 410 | push eax ebp esi ebx edx |
|
506 | ; edi = force ? |
411 | mov ebp, [_display.width] ; ebp = screen co-ords base |
- | 412 | imul ebp, ebx |
|
- | 413 | add ebp, [_WinMapAddress] |
|
507 | push eax edx |
414 | |
508 | cmp edx, eax ; make sure x2 is above x1 |
415 | cmp edx, eax ; to make sure x2 > x1 |
509 | jge @f |
416 | jge @f |
510 | xchg eax, edx |
- | |
511 | align 4 |
417 | xchg eax, edx |
- | 418 | @@: |
|
- | 419 | cmp eax, [Screen_Max_X] |
|
- | 420 | jge .exit |
|
- | 421 | imul ebx, [BytesPerScanLine] |
|
- | 422 | add ebx, LFB_BASE |
|
- | 423 | cmp edx, [Screen_Max_X] ; last check |
|
- | 424 | jb .draw |
|
- | 425 | mov edx, [Screen_Max_X] |
|
- | 426 | ||
- | 427 | .draw: ; -- the line --- |
|
- | 428 | test edi,1 ; forced ? |
|
- | 429 | jnz .checked |
|
- | 430 | ; check whether the line covered by other windows |
|
- | 431 | movzx esi, byte [ebp+eax] |
|
512 | @@: |
432 | cmp esi, [CURRENT_TASK] |
- | 433 | jne .nextpixel |
|
- | 434 | .checked: |
|
- | 435 | test ecx,0x01000000 |
|
- | 436 | jz .noneg |
|
- | 437 | mov ecx, [ebx+eax*4] |
|
- | 438 | not ecx |
|
- | 439 | and ecx, 0x01FFFFFF ; keep bit[24] high ! |
|
- | 440 | .noneg: |
|
- | 441 | mov [ebx+eax*4], ecx |
|
513 | call [putpixel] |
442 | .nextpixel: |
514 | inc eax |
443 | inc eax |
515 | cmp eax, edx |
444 | cmp eax, edx |
- | 445 | jle .draw |
|
516 | jle @b |
446 | .exit: |
- | 447 | pop edx ebx esi ebp eax |
|
517 | pop edx eax |
448 | .out: |
Line 518... | Line 449... | ||
518 | ret |
449 | ret |
519 | 450 | ||
520 | 451 | align 4 |
|
521 | vline: |
452 | vline: |
522 | ; draw a vertical line |
453 | ; --------- draw a vertical line ------------ |
523 | ; eax = x |
454 | ; eax = x |
524 | ; ebx = y1 |
455 | ; ebx = y1 |
525 | ; edx = y2 |
456 | ; edx = y2 |
- | 457 | ; ecx = color |
|
- | 458 | ; edi = force ? |
|
- | 459 | cmp eax, [Screen_Max_X] |
|
- | 460 | jge .out |
|
- | 461 | push eax ebp esi ebx edx |
|
- | 462 | mov ebp, [_display.width] ; ebp = screen co-ords base |
|
526 | ; ecx = color |
463 | imul ebp, ebx |
- | 464 | add ebp, [_WinMapAddress] |
|
527 | ; edi = force ? |
465 | add ebp, eax |
528 | push ebx edx |
466 | |
529 | cmp edx, ebx ; make sure y2 is above y1 |
467 | cmp edx, ebx ; to make sure y2 > y1 |
530 | jge @f |
- | |
531 | xchg ebx, edx |
468 | jge @f |
- | 469 | xchg ebx, edx |
|
- | 470 | @@: |
|
- | 471 | cmp ebx, [Screen_Max_Y] |
|
- | 472 | jge .exit |
|
- | 473 | push ebx |
|
- | 474 | imul ebx, [BytesPerScanLine] |
|
- | 475 | shl eax, 1 |
|
- | 476 | shl eax, 1 |
|
- | 477 | add eax, ebx |
|
- | 478 | add eax, LFB_BASE |
|
- | 479 | pop ebx ; restore ebx = y1 |
|
- | 480 | cmp edx, [Screen_Max_Y] ; the last check |
|
- | 481 | jb .draw |
|
- | 482 | mov edx, [Screen_Max_Y] ; to prevent off-screen drawing |
|
- | 483 | ||
- | 484 | .draw: ; (vertical line itself) |
|
- | 485 | test edi,1 ; forced ? |
|
- | 486 | jnz .checked |
|
- | 487 | ; check whether the line covered by other windows |
|
532 | align 4 |
488 | movzx esi, byte [ebp] |
- | 489 | cmp esi, [CURRENT_TASK] |
|
- | 490 | jne .nextpixel |
|
- | 491 | .checked: |
|
- | 492 | test ecx,0x01000000 |
|
- | 493 | jz .noneg |
|
- | 494 | mov ecx, [eax] |
|
- | 495 | not ecx |
|
- | 496 | and ecx, 0x01FFFFFF ; keep bit[24] high ! |
|
- | 497 | .noneg: |
|
- | 498 | mov [eax], ecx |
|
- | 499 | .nextpixel: |
|
533 | @@: |
500 | add eax, [BytesPerScanLine] |
534 | call [putpixel] |
501 | add ebp, [_display.width] |
535 | inc ebx |
502 | inc ebx |
- | 503 | cmp ebx, edx |
|
536 | cmp ebx, edx |
504 | jle .draw |
- | 505 | .exit: |
|
537 | jle @b |
506 | pop edx ebx esi ebp eax |
Line 538... | Line 507... | ||
538 | pop edx ebx |
507 | .out: |
Line 568... | Line 537... | ||
568 | pushad |
537 | pushad |
569 | call [_display.disable_mouse] |
538 | call [_display.disable_mouse] |
570 | sub esp, drbar.stack_data |
539 | sub esp, drbar.stack_data |
571 | mov [drbar.color], edi |
540 | mov [drbar.color], edi |
572 | sub edx, ebx |
541 | sub edx, ebx |
573 | jle .exit ;// mike.dld, 2005-01-29 |
542 | jle .exit |
574 | sub ecx, eax |
543 | sub ecx, eax |
575 | jle .exit ;// mike.dld, 2005-01-29 |
544 | jle .exit |
576 | mov [drbar.bar_sy], edx |
545 | mov [drbar.bar_sy], edx |
577 | mov [drbar.bar_sx], ecx |
546 | mov [drbar.bar_sx], ecx |
578 | mov [drbar.bar_cx], eax |
547 | mov [drbar.bar_cx], eax |
579 | mov [drbar.bar_cy], ebx |
548 | mov [drbar.bar_cy], ebx |
580 | mov edi, [TASK_BASE] |
549 | mov edi, [TASK_BASE] |
Line 582... | Line 551... | ||
582 | add ebx, [edi-twdw + WDATA.box.top] ; win_cy |
551 | add ebx, [edi-twdw + WDATA.box.top] ; win_cy |
583 | mov [drbar.abs_cx], eax |
552 | mov [drbar.abs_cx], eax |
584 | mov [drbar.abs_cy], ebx |
553 | mov [drbar.abs_cy], ebx |
585 | ; real_sx = MIN(wnd_sx-bar_cx, bar_sx); |
554 | ; real_sx = MIN(wnd_sx-bar_cx, bar_sx); |
586 | mov ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx |
555 | mov ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx |
587 | ; \begin{diamond}[20.08.2006] |
- | |
588 | ; note that WDATA.box.width is one pixel less than real window x-size |
556 | ; note that WDATA.box.width is one pixel less than real window x-size |
589 | inc ebx |
557 | inc ebx |
590 | ; \end{diamond}[20.08.2006] |
- | |
591 | sub ebx, [drbar.bar_cx] |
558 | sub ebx, [drbar.bar_cx] |
592 | ja @f |
559 | ja @f |
593 | .exit: ;// mike.dld, 2005-01-29 |
560 | .exit: |
594 | add esp, drbar.stack_data |
561 | add esp, drbar.stack_data |
595 | popad |
562 | popad |
596 | xor eax, eax |
563 | xor eax, eax |
597 | inc eax |
564 | inc eax |
598 | ret |
565 | ret |
Line 602... | Line 569... | ||
602 | mov ebx, [drbar.bar_sx] |
569 | mov ebx, [drbar.bar_sx] |
603 | .end_x: |
570 | .end_x: |
604 | mov [drbar.real_sx], ebx |
571 | mov [drbar.real_sx], ebx |
605 | ; real_sy = MIN(wnd_sy-bar_cy, bar_sy); |
572 | ; real_sy = MIN(wnd_sy-bar_cy, bar_sy); |
606 | mov ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy |
573 | mov ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy |
607 | ; \begin{diamond}[20.08.2006] |
- | |
608 | inc ebx |
574 | inc ebx |
609 | ; \end{diamond} |
- | |
610 | sub ebx, [drbar.bar_cy] |
575 | sub ebx, [drbar.bar_cy] |
611 | ja @f |
576 | ja @f |
612 | add esp, drbar.stack_data |
577 | add esp, drbar.stack_data |
613 | popad |
578 | popad |
614 | xor eax, eax |
579 | xor eax, eax |
Line 625... | Line 590... | ||
625 | sub eax, [drbar.real_sx] |
590 | sub eax, [drbar.real_sx] |
626 | inc eax |
591 | inc eax |
627 | mov [drbar.line_inc_map], eax |
592 | mov [drbar.line_inc_map], eax |
628 | ; line_inc_scr |
593 | ; line_inc_scr |
629 | mov eax, [drbar.real_sx] |
594 | mov eax, [drbar.real_sx] |
630 | movzx ebx, byte [ScreenBPP] |
- | |
631 | shr ebx, 3 |
595 | shl eax, 1 |
632 | imul eax, ebx |
596 | shl eax, 1 |
633 | neg eax |
597 | neg eax |
634 | add eax, [BytesPerScanLine] |
598 | add eax, [BytesPerScanLine] |
635 | mov [drbar.line_inc_scr], eax |
599 | mov [drbar.line_inc_scr], eax |
636 | ; pointer to screen |
600 | ; pointer to screen |
637 | mov edx, [drbar.abs_cy] |
601 | mov edx, [drbar.abs_cy] |
638 | imul edx, [BytesPerScanLine] |
602 | imul edx, [BytesPerScanLine] |
639 | mov eax, [drbar.abs_cx] |
603 | mov eax, [drbar.abs_cx] |
640 | ; movzx ebx, byte [ScreenBPP] |
- | |
641 | ; shr ebx, 3 |
604 | shl eax, 1 |
642 | imul eax, ebx |
605 | shl eax, 1 |
643 | add edx, eax |
606 | add edx, eax |
644 | ; pointer to pixel map |
607 | ; pointer to pixel map |
645 | mov eax, [drbar.abs_cy] |
608 | mov eax, [drbar.abs_cy] |
646 | imul eax, [Screen_Max_X] |
609 | imul eax, [Screen_Max_X] |
647 | add eax, [drbar.abs_cy] |
610 | add eax, [drbar.abs_cy] |
648 | add eax, [drbar.abs_cx] |
611 | add eax, [drbar.abs_cx] |
649 | add eax, [_WinMapAddress] |
612 | add eax, [_WinMapAddress] |
650 | xchg eax, ebp |
613 | xchg eax, ebp |
651 | ; get process number |
614 | ; get process number |
652 | mov ebx, [CURRENT_TASK] |
615 | mov ebx, [CURRENT_TASK] |
653 | cmp byte [ScreenBPP], 24 |
- | |
654 | jne draw_bar_end_32 |
- | |
- | 616 | ||
655 | draw_bar_end_24: |
617 | draw_bar_end_32: |
656 | mov eax, [drbar.color] ;; BBGGRR00 |
- | |
657 | mov bh, al ;; bh = BB |
- | |
658 | shr eax, 8 ;; eax = RRGG |
- | |
659 | ; eax - color high RRGG |
618 | ; eax - color high RRGG |
660 | ; bl - process num |
619 | ; bl - process num |
661 | ; bh - color low BB |
620 | ; bh - color low BB |
662 | ; ecx - temp |
621 | ; ecx - temp |
663 | ; edx - pointer to screen |
622 | ; edx - pointer to screen |
664 | ; esi - counter |
623 | ; esi - counter |
665 | ; edi - counter |
624 | ; edi - counter |
666 | mov esi, [drbar.real_sy] |
- | |
667 | align 4 |
- | |
668 | .new_y: |
- | |
669 | mov edi, [drbar.real_sx] |
- | |
670 | align 4 |
- | |
671 | .new_x: |
- | |
672 | cmp byte [ebp], bl |
- | |
673 | jne .skip |
- | |
674 | - | ||
675 | mov [LFB_BASE+edx], bh |
- | |
676 | mov [LFB_BASE+edx + 1], ax |
- | |
677 | .skip: |
- | |
678 | ; add pixel |
- | |
679 | add edx, 3 |
- | |
680 | inc ebp |
- | |
681 | dec edi |
- | |
682 | jnz .new_x |
- | |
683 | ; add line |
- | |
684 | add edx, [drbar.line_inc_scr] |
- | |
685 | add ebp, [drbar.line_inc_map] |
- | |
686 | ; |
- | |
687 | test eax, 0x00800000 |
- | |
688 | jz @f |
- | |
689 | test bh, bh |
- | |
690 | jz @f |
- | |
691 | dec bh |
- | |
692 | @@: |
- | |
693 | ; |
- | |
694 | dec esi |
- | |
695 | jnz .new_y |
- | |
696 | add esp, drbar.stack_data |
- | |
697 | popad |
- | |
698 | xor eax, eax |
- | |
699 | ret |
- | |
700 | - | ||
701 | draw_bar_end_32: |
- | |
702 | mov eax, [drbar.color] ;; BBGGRR00 |
625 | mov eax, [drbar.color] ;; BBGGRR00 |
703 | mov esi, [drbar.real_sy] |
626 | mov esi, [drbar.real_sy] |
704 | align 4 |
627 | align 4 |
705 | .new_y: |
628 | .new_y: |
706 | mov edi, [drbar.real_sx] |
629 | mov edi, [drbar.real_sx] |
Line 729... | Line 652... | ||
729 | ; |
652 | ; |
730 | dec esi |
653 | dec esi |
731 | jnz .new_y |
654 | jnz .new_y |
732 | add esp, drbar.stack_data |
655 | add esp, drbar.stack_data |
733 | popad |
656 | popad |
- | 657 | xor eax, eax |
|
734 | ret |
658 | ret |
Line -... | Line 659... | ||
- | 659 | ||
735 | 660 | ||
736 | align 4 |
661 | align 4 |
737 | vesa20_drawbackground_tiled: |
662 | vesa20_drawbackground_tiled: |
738 | call [_display.disable_mouse] |
663 | call [_display.disable_mouse] |
739 | pushad |
664 | pushad |
Line 747... | Line 672... | ||
747 | mul ebx |
672 | mul ebx |
748 | xchg ebp, eax |
673 | xchg ebp, eax |
749 | add ebp, eax |
674 | add ebp, eax |
750 | add ebp, eax |
675 | add ebp, eax |
751 | add ebp, eax |
676 | add ebp, eax |
752 | cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size |
- | |
753 | jz @f |
- | |
754 | add ebp, eax |
677 | add ebp, eax |
755 | @@: |
- | |
756 | add ebp, LFB_BASE |
678 | add ebp, LFB_BASE |
757 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
679 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
758 | call calculate_edi |
680 | call calculate_edi |
759 | xchg edi, ebp |
681 | xchg edi, ebp |
760 | add ebp, [_WinMapAddress] |
682 | add ebp, [_WinMapAddress] |
Line 794... | Line 716... | ||
794 | jmp @f |
716 | jmp @f |
795 | nbgp: |
717 | nbgp: |
796 | add esi, 3 |
718 | add esi, 3 |
797 | add edi, 3 |
719 | add edi, 3 |
798 | @@: |
720 | @@: |
799 | cmp [ScreenBPP], byte 25 ; 24 or 32 bpp? |
- | |
800 | sbb edi, -1 ; +1 for 32 bpp |
721 | inc edi ; +1 for 32 bpp |
801 | ; I do not use 'inc eax' because this is slightly slower then 'add eax,1' |
- | |
802 | add ebp, edx |
722 | add ebp, edx |
803 | add eax, edx |
723 | add eax, edx |
804 | cmp eax, [draw_data+32+RECT.right] |
724 | cmp eax, [draw_data+32+RECT.right] |
805 | ja dp4 |
725 | ja dp4 |
806 | sub ecx, edx |
726 | sub ecx, edx |
Line 853... | Line 773... | ||
853 | mul ebx |
773 | mul ebx |
854 | xchg ebp, eax |
774 | xchg ebp, eax |
855 | add ebp, eax |
775 | add ebp, eax |
856 | add ebp, eax |
776 | add ebp, eax |
857 | add ebp, eax |
777 | add ebp, eax |
858 | cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size |
- | |
859 | jz @f |
- | |
860 | add ebp, eax |
778 | add ebp, eax |
861 | @@: |
779 | |
862 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
780 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
863 | call calculate_edi |
781 | call calculate_edi |
864 | xchg edi, ebp |
782 | xchg edi, ebp |
865 | ; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress |
783 | ; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress |
866 | push ebx |
784 | push ebx |
Line 939... | Line 857... | ||
939 | mov [LFB_BASE+edi], ax |
857 | mov [LFB_BASE+edi], ax |
940 | shr eax, 16 |
858 | shr eax, 16 |
Line 941... | Line 859... | ||
941 | 859 | ||
942 | mov [LFB_BASE+edi+2], al |
860 | mov [LFB_BASE+edi+2], al |
943 | snbgp: |
- | |
944 | cmp [ScreenBPP], byte 25 |
861 | snbgp: |
945 | sbb edi, -4 |
862 | add edi, 4 |
946 | add ebp, 1 |
863 | inc ebp |
947 | mov eax, [esp+20] |
864 | mov eax, [esp+20] |
948 | add eax, 1 |
865 | inc eax |
949 | mov [esp+20], eax |
866 | mov [esp+20], eax |
950 | add esi, 4 |
867 | add esi, 4 |
951 | cmp eax, [draw_data+32+RECT.right] |
868 | cmp eax, [draw_data+32+RECT.right] |
952 | jbe sdp3a |
869 | jbe sdp3a |
953 | sdp4: |
870 | sdp4: |
954 | ; next y |
871 | ; next y |
955 | mov ebx, [esp+24] |
872 | mov ebx, [esp+24] |
956 | add ebx, 1 |
873 | inc ebx |
957 | mov [esp+24], ebx |
874 | mov [esp+24], ebx |
958 | cmp ebx, [draw_data+32+RECT.bottom] |
875 | cmp ebx, [draw_data+32+RECT.bottom] |
959 | ja sdpdone |
876 | ja sdpdone |
960 | ; advance edi, ebp to next scan line |
877 | ; advance edi, ebp to next scan line |
961 | sub eax, [draw_data+32+RECT.left] |
878 | sub eax, [draw_data+32+RECT.left] |
962 | sub ebp, eax |
879 | sub ebp, eax |
963 | add ebp, [Screen_Max_X] |
880 | add ebp, [Screen_Max_X] |
964 | add ebp, 1 |
881 | inc ebp |
965 | sub edi, eax |
882 | sub edi, eax |
966 | sub edi, eax |
883 | sub edi, eax |
967 | sub edi, eax |
- | |
968 | cmp [ScreenBPP], byte 24 |
- | |
969 | jz @f |
884 | sub edi, eax |
970 | sub edi, eax |
- | |
971 | @@: |
885 | sub edi, eax |
972 | add edi, [BytesPerScanLine] |
886 | add edi, [BytesPerScanLine] |
973 | ; restore ecx,edx; advance esi to next background line |
887 | ; restore ecx,edx; advance esi to next background line |
974 | mov eax, [esp+28] |
888 | mov eax, [esp+28] |
975 | mov ebx, [esp+32] |
889 | mov ebx, [esp+32] |
Line 1015... | Line 929... | ||
1015 | shr ebx, 8 |
929 | shr ebx, 8 |
1016 | call [overlapping_of_points_ptr] |
930 | call [overlapping_of_points_ptr] |
1017 | @@: |
931 | @@: |
1018 | stosd |
932 | stosd |
1019 | mov eax, [esp+20+8] |
933 | mov eax, [esp+20+8] |
1020 | add eax, 1 |
934 | inc eax |
1021 | mov [esp+20+8], eax |
935 | mov [esp+20+8], eax |
1022 | cmp eax, [draw_data+32+RECT.right] |
936 | cmp eax, [draw_data+32+RECT.right] |
1023 | ja @f |
937 | ja @f |
1024 | add ecx, [esp+36+8] |
938 | add ecx, [esp+36+8] |
1025 | mov eax, edx |
939 | mov eax, edx |
Line 1033... | Line 947... | ||
1033 | mov [esp+20+8], eax |
947 | mov [esp+20+8], eax |
1034 | ret |
948 | ret |
Line 1035... | Line 949... | ||
1035 | 949 | ||
1036 | align 16 |
950 | align 16 |
1037 | overlapping_of_points: |
- | |
1038 | if 0 |
- | |
1039 | ; this version of procedure works, but is slower than next version |
- | |
1040 | push ecx edx |
- | |
1041 | mov edx, eax |
- | |
1042 | push esi |
- | |
1043 | shr ecx, 24 |
- | |
1044 | mov esi, ecx |
- | |
1045 | mov ecx, ebx |
- | |
1046 | movzx ebx, dl |
- | |
1047 | movzx eax, cl |
- | |
1048 | sub eax, ebx |
- | |
1049 | movzx ebx, dh |
- | |
1050 | imul eax, esi |
- | |
1051 | add dl, ah |
- | |
1052 | movzx eax, ch |
- | |
1053 | sub eax, ebx |
- | |
1054 | imul eax, esi |
- | |
1055 | add dh, ah |
- | |
1056 | ror ecx, 16 |
- | |
1057 | ror edx, 16 |
- | |
1058 | movzx eax, cl |
- | |
1059 | movzx ebx, dl |
- | |
1060 | sub eax, ebx |
- | |
1061 | imul eax, esi |
- | |
1062 | pop esi |
- | |
1063 | add dl, ah |
- | |
1064 | mov eax, edx |
- | |
1065 | pop edx |
- | |
1066 | ror eax, 16 |
- | |
1067 | pop ecx |
- | |
1068 | ret |
- | |
1069 | else |
951 | overlapping_of_points: |
1070 | push ecx edx |
952 | push ecx edx |
1071 | mov edx, eax |
953 | mov edx, eax |
1072 | push esi |
954 | push esi |
1073 | shr ecx, 26 |
955 | shr ecx, 26 |
Line 1092... | Line 974... | ||
1092 | mov eax, edx |
974 | mov eax, edx |
1093 | pop edx |
975 | pop edx |
1094 | ror eax, 16 |
976 | ror eax, 16 |
1095 | pop ecx |
977 | pop ecx |
1096 | ret |
978 | ret |
1097 | end if |
- | |
Line 1098... | Line 979... | ||
1098 | 979 | ||
1099 | iglobal |
980 | iglobal |
1100 | align 4 |
981 | align 4 |
1101 | overlapping_of_points_ptr dd overlapping_of_points |
982 | overlapping_of_points_ptr dd overlapping_of_points |