Rev 227 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
214 | serge | 1 | |
2 | |||
3 | |||
4 | |||
5 | |||
227 | serge | 6 | |
214 | serge | 7 | |
8 | |||
9 | |||
227 | serge | 10 | LOAD_FROM_MEM equ 1 |
11 | LOAD_INDIRECT equ 2 |
||
12 | LOAD_SYSTEM equ 3 |
||
13 | |||
14 | |||
233 | serge | 15 | |
16 | |||
227 | serge | 17 | .biSize dd ? ; DWORD |
18 | .biWidth dd ? ; LONG |
||
19 | .biHeight dd ? ; LONG |
||
20 | .biPlanes dw ? ; WORD |
||
21 | .biBitCount dw ? ; WORD |
||
22 | .biCompression dd ? ; DWORD |
||
23 | .biSizeImage dd ? ; DWORD |
||
24 | .biXPelsPerMeter dd ? ; LONG |
||
25 | .biYPelsPerMeter dd ? ; LONG |
||
26 | .biClrUsed dd ? ; DWORD |
||
27 | .biClrImportant dd ? ; DWORD |
||
28 | } |
||
29 | |||
30 | |||
31 | BI BITMAPINFOHEADER |
||
32 | end virtual |
||
33 | |||
34 | |||
35 | { .magic dd ? |
||
36 | .size dd ? |
||
37 | .pid dd ? |
||
38 | .base dd ? |
||
39 | .hot_x dd ? |
||
40 | .hot_y dd ? |
||
41 | } |
||
42 | virtual at 0 |
||
43 | CURSOR CURSOR |
||
44 | end virtual |
||
45 | |||
46 | |||
47 | |||
48 | |||
214 | serge | 49 | R9000 equ 0x4966 ;RV250 |
50 | R9200 equ 0x5961 ;RV280 |
||
51 | R9500 equ 0x4144 ;R300 |
||
52 | R9500P equ 0x4E45 ;R300 |
||
53 | R9550 equ 0x4153 ;RV350 |
||
54 | R9600 equ 0x4150 ;RV350 |
||
55 | R9600XT equ 0x4152 ;RV360 |
||
56 | R9700P equ 0x4E44 ;R300 |
||
57 | R9800 equ 0x4E49 ;R350 |
||
58 | R9800P equ 0x4E48 ;R350 |
||
59 | R9800XT equ 0x4E4A ;R360 |
||
60 | |||
61 | |||
62 | new_app_base equ 0x60400000; 0x01000000 |
||
63 | PROC_BASE equ OS_BASE+0x0080000 |
||
64 | |||
65 | |||
66 | PG_NOCACHE equ 0x018 |
||
67 | |||
68 | |||
69 | { .handle dd ? |
||
70 | .io_code dd ? |
||
71 | .input dd ? |
||
72 | .inp_size dd ? |
||
73 | .output dd ? |
||
74 | .out_size dd ? |
||
75 | } |
||
76 | |||
77 | |||
78 | IOCTL IOCTL |
||
79 | end virtual |
||
80 | |||
81 | |||
82 | RD_RB3D_CNTL equ 1c3ch |
||
83 | |||
84 | |||
85 | RD_CRTC_GEN_CNTL equ 0050h |
||
86 | RD_CRTC_CUR_EN equ 10000h |
||
87 | RD_DISPLAY_BASE_ADDR equ 023ch |
||
88 | RD_DEFAULT_OFFSET equ 16e0h |
||
89 | CUR_HORZ_VERT_OFF equ 0268h |
||
90 | CUR_HORZ_VERT_POSN equ 0264h |
||
91 | CUR_OFFSET equ 0260h |
||
92 | RD_RB3D_CNTL equ 1c3ch |
||
93 | RD_RBBM_STATUS equ 0e40h |
||
94 | RD_RBBM_FIFOCNT_MASK equ 007fh |
||
95 | RD_RBBM_ACTIVE equ 80000000h |
||
96 | RD_TIMEOUT equ 2000000 |
||
97 | |||
98 | |||
99 | RD_DP_BRUSH_BKGD_CLR equ 01478h |
||
100 | RD_DP_BRUSH_FRGD_CLR equ 0147ch |
||
101 | RD_DP_SRC_BKGD_CLR equ 015dch |
||
102 | RD_DP_SRC_FRGD_CLR equ 015d8h |
||
103 | RD_DP_CNTL equ 016c0h |
||
104 | RD_DP_DATATYPE equ 016c4h |
||
105 | RD_DP_WRITE_MASK equ 016cch |
||
106 | RD_DP_SRC_SOURCE_MEMORY equ (2 shl 24) |
||
107 | RD_DP_SRC_SOURCE_HOST_DATA equ (3 shl 24) |
||
108 | RD_DEFAULT_SC_BOTTOM_RIGHT equ 16e8h |
||
109 | RD_GMC_BRUSH_SOLID_COLOR equ (13 shl 4) |
||
110 | RD_DEFAULT_SC_RIGHT_MAX equ 1fffh |
||
111 | RD_DEFAULT_SC_BOTTOM_MAX equ 1fff0000h |
||
112 | RD_GMC_DST_DATATYPE_SHIFT equ 8 |
||
113 | |||
114 | |||
115 | RD_ROP3_P equ 00f00000h |
||
116 | |||
117 | |||
118 | RD_RB2D_DSTCACHE_CTLSTAT equ 0342ch |
||
119 | RD_RB2D_DC_FLUSH_ALL equ 000fh |
||
120 | RD_RB2D_DC_BUSY equ 80000000h |
||
121 | |||
122 | |||
123 | RD_GMC_SRC_DATATYPE_COLOR equ (3 shl 12) |
||
124 | RD_GMC_CLR_CMP_CNTL_DIS equ (1 shl 28) |
||
125 | RD_GMC_WR_MSK_DIS equ (1 shl 30) |
||
126 | |||
127 | |||
128 | |||
129 | |||
130 | RD_SRC_PITCH_OFFSET equ 1428h |
||
131 | |||
132 | |||
133 | RD_DST_Y_TOP_TO_BOTTOM equ 2 |
||
134 | RD_DST_Y_X equ 1438h |
||
135 | RD_DST_WIDTH_HEIGHT equ 1598h |
||
136 | RD_DST_LINE_START equ 1600h |
||
137 | RD_DST_LINE_END equ 1604h |
||
138 | R300_MEM_NUM_CHANNELS_MASK equ 0003h |
||
139 | |||
140 | |||
141 | { |
||
142 | mov edi, [ati_io] |
||
143 | mov op1, [edi+op2] |
||
144 | } |
||
145 | |||
146 | |||
147 | { |
||
148 | mov edi, [ati_io] |
||
149 | mov dword [edi+dest], src |
||
150 | } |
||
151 | |||
152 | |||
153 | |||
154 | public service_proc |
||
155 | public version |
||
227 | serge | 156 | |
214 | serge | 157 | |
158 | extrn PciApi |
||
159 | extrn PciRead32 |
||
160 | extrn AllocKernelSpace |
||
161 | extrn MapPage |
||
162 | extrn RegService |
||
163 | extrn SetHwCursor |
||
164 | extrn HwCursorRestore |
||
227 | serge | 165 | extrn HwCursorCreate |
166 | extrn LFBAddress |
||
214 | serge | 167 | extrn LoadFile |
168 | |||
169 | |||
170 | |||
171 | |||
172 | DRV_EXIT equ -1 |
||
173 | |||
174 | |||
175 | |||
176 | |||
177 | |||
178 | |||
227 | serge | 179 | jne .exit |
180 | |||
181 | |||
214 | serge | 182 | mov esi, msgInit |
183 | call SysMsgBoardStr |
||
184 | end if |
||
185 | |||
186 | |||
187 | test eax, eax |
||
227 | serge | 188 | jz .fail |
214 | serge | 189 | |
190 | |||
191 | test eax, eax |
||
192 | jz .fail |
||
193 | |||
194 | |||
227 | serge | 195 | mov edi, cursors |
196 | mov ecx, CURSOR_SIZE*16 |
||
197 | cld |
||
198 | rep stosd |
||
199 | |||
200 | |||
201 | mov [cursor_map], eax |
||
202 | mov [cursor_map+4], eax |
||
203 | mov edx, cursor_map |
||
204 | mov [cursor_start], edx |
||
205 | add edx, 4 |
||
206 | mov [cursor_end], edx |
||
207 | |||
208 | |||
214 | serge | 209 | test eax, eax |
210 | jz .fail |
||
211 | mov dword [SetHwCursor], drvCursorPos ;enable hardware cursor |
||
227 | serge | 212 | mov dword [HwCursorRestore], drv_restore |
213 | mov dword [HwCursorCreate], ati_cursor |
||
214 | ret |
||
215 | .fail: |
||
214 | serge | 216 | if DEBUG |
217 | mov esi, msgFail |
||
227 | serge | 218 | call SysMsgBoardStr |
214 | serge | 219 | end if |
220 | |||
221 | |||
222 | xor eax, eax |
||
223 | ; mov ebx, SetHwCursor |
||
227 | serge | 224 | ; mov dword [ebx], eax ;force disable hardware cursor |
225 | ret |
||
214 | serge | 226 | endp |
227 | |||
228 | |||
229 | io_code equ IOCTL.io_code |
||
230 | input equ IOCTL.input |
||
231 | inp_size equ IOCTL.inp_size |
||
232 | output equ IOCTL.output |
||
233 | out_size equ IOCTL.out_size |
||
234 | |||
235 | |||
236 | proc service_proc stdcall, ioctl:dword |
||
237 | |||
238 | |||
233 | serge | 239 | mov ebx, [edi+io_code] |
240 | cmp ebx, VIDEO_FREE |
||
241 | jne .fail |
||
242 | |||
214 | serge | 243 | |
233 | serge | 244 | call video_free |
245 | .fail: |
||
246 | xor eax, eax |
||
247 | ret |
||
248 | endp |
||
214 | serge | 249 | |
250 | |||
251 | restore io_code |
||
252 | restore input |
||
253 | restore inp_size |
||
254 | restore output |
||
255 | restore out_size |
||
256 | |||
257 | |||
258 | proc detect_ati |
||
259 | locals |
||
227 | serge | 260 | last_bus dd ? |
261 | endl |
||
262 | |||
214 | serge | 263 | |
227 | serge | 264 | mov [bus], eax |
265 | inc eax |
||
266 | call PciApi |
||
214 | serge | 267 | cmp eax, -1 |
227 | serge | 268 | je .err |
214 | serge | 269 | |
270 | |||
227 | serge | 271 | |
214 | serge | 272 | |
273 | and [devfn], 0 |
||
227 | serge | 274 | .next_dev: |
214 | serge | 275 | stdcall PciRead32, [bus], [devfn], dword 0 |
276 | test eax, eax |
||
227 | serge | 277 | jz .next |
278 | cmp eax, -1 |
||
279 | je .next |
||
280 | |||
214 | serge | 281 | |
227 | serge | 282 | @@: |
214 | serge | 283 | mov ebx, [edi] |
227 | serge | 284 | test ebx, ebx |
285 | jz .next |
||
286 | |||
214 | serge | 287 | |
227 | serge | 288 | je .found |
289 | add edi, 4 |
||
214 | serge | 290 | jmp @B |
227 | serge | 291 | |
214 | serge | 292 | |
227 | serge | 293 | inc [devfn] |
294 | cmp [devfn], 256 |
||
295 | jb .next_dev |
||
296 | mov eax, [bus] |
||
297 | inc eax |
||
298 | mov [bus], eax |
||
299 | cmp eax, [last_bus] |
||
300 | jna .next_bus |
||
301 | xor eax, eax |
||
302 | ret |
||
303 | .found: |
||
214 | serge | 304 | xor eax, eax |
227 | serge | 305 | inc eax |
214 | serge | 306 | ret |
227 | serge | 307 | .err: |
214 | serge | 308 | xor eax, eax |
309 | ret |
||
310 | endp |
||
311 | |||
312 | |||
313 | proc init_ati |
||
314 | |||
315 | |||
316 | test eax, eax |
||
317 | jz .fail |
||
318 | |||
319 | |||
320 | |||
321 | |||
322 | and eax, 0xFFFF0000 |
||
323 | mov esi, eax |
||
324 | |||
325 | |||
326 | mov edx, 16 |
||
327 | @@: |
||
328 | stdcall MapPage,edi,esi,PG_SW+PG_NOCACHE |
||
329 | add edi, 0x1000 |
||
227 | serge | 330 | add esi, 0x1000 |
214 | serge | 331 | dec edx |
332 | jnz @B |
||
333 | |||
334 | |||
335 | mov dword [edi+RD_RB3D_CNTL], 0 |
||
336 | call engRestore |
||
337 | |||
338 | |||
339 | mov eax, [edi+0x50] |
||
340 | mov ebx,3 |
||
341 | shl ebx,20 |
||
342 | not ebx |
||
343 | and eax,ebx |
||
344 | mov ebx, 2 |
||
345 | shl ebx,20 |
||
346 | or eax, ebx |
||
347 | mov [edi+0x50], eax |
||
348 | |||
349 | |||
350 | xor eax, eax |
||
351 | inc eax |
||
352 | .fail: |
||
353 | ret |
||
354 | endp |
||
355 | |||
356 | |||
357 | drv_restore: |
||
227 | serge | 358 | ret 8 |
359 | |||
360 | |||
361 | drvShowCursor: |
||
214 | serge | 362 | mov edi, [ati_io] |
363 | |||
364 | |||
365 | bts eax,16 |
||
366 | mov [edi+RD_CRTC_GEN_CNTL], eax |
||
367 | ret |
||
368 | |||
369 | |||
370 | proc drvCursorPos stdcall, hcursor:dword, x:dword, y:dword |
||
227 | serge | 371 | pushfd |
233 | serge | 372 | cli |
373 | |||
227 | serge | 374 | |
233 | serge | 375 | xor edx, edx |
376 | mov esi, [hcursor] |
||
377 | mov ebx, [x] |
||
378 | mov ecx, [y] |
||
379 | |||
214 | serge | 380 | |
233 | serge | 381 | jnc @F |
382 | neg ebx |
||
383 | mov eax, ebx |
||
384 | shl eax, 16 |
||
214 | serge | 385 | xor ebx, ebx |
233 | serge | 386 | @@: |
387 | sub ecx, [esi+CURSOR.hot_y] |
||
388 | jnc @F |
||
389 | neg ecx |
||
390 | mov ax, cx |
||
391 | mov edx, ecx |
||
392 | xor ecx, ecx |
||
393 | @@: |
||
394 | or eax, 0x80000000 |
||
395 | wrr CUR_HORZ_VERT_OFF, eax |
||
396 | |||
214 | serge | 397 | |
233 | serge | 398 | mov bx, cx |
399 | or ebx, 0x80000000 |
||
400 | wrr CUR_HORZ_VERT_POSN, ebx |
||
401 | |||
402 | |||
403 | add edx, [esi+CURSOR.base] |
||
404 | sub edx, LFBAddress |
||
405 | wrr CUR_OFFSET, edx |
||
406 | popfd |
||
407 | ret |
||
227 | serge | 408 | endp |
409 | |||
214 | serge | 410 | |
411 | proc video_alloc |
||
227 | serge | 412 | |
413 | |||
414 | cli |
||
415 | mov ebx, [cursor_start] |
||
416 | mov ecx, [cursor_end] |
||
417 | .l1: |
||
418 | bsf eax,[ebx]; |
||
419 | jnz .found |
||
420 | add ebx,4 |
||
421 | cmp ebx, ecx |
||
422 | jb .l1 |
||
423 | popfd |
||
424 | xor eax,eax |
||
425 | ret |
||
426 | .found: |
||
427 | btr [ebx], eax |
||
428 | popfd |
||
429 | |||
430 | |||
431 | sub ebx, cursor_map |
||
432 | shl ebx, 3 |
||
433 | add eax,ebx |
||
434 | |||
435 | |||
436 | add eax, LFBAddress+CURSOR_IMAGE_OFFSET |
||
437 | ret |
||
438 | endp |
||
439 | |||
440 | |||
441 | video_free: |
||
233 | serge | 442 | pushfd |
443 | cli |
||
444 | sub eax, LFBAddress+CURSOR_IMAGE_OFFSET |
||
445 | shr eax, 14 |
||
446 | mov ebx, cursor_map |
||
447 | bts [ebx], eax |
||
448 | shr eax, 3 |
||
449 | and eax, not 3 |
||
450 | add eax, ebx |
||
451 | cmp [cursor_start], eax |
||
452 | ja @f |
||
453 | popfd |
||
454 | ret |
||
455 | @@: |
||
456 | mov [cursor_start], eax |
||
457 | popfd |
||
458 | ret |
||
459 | |||
460 | |||
461 | proc ati_cursor stdcall, hcursor:dword, src:dword, flags:dword |
||
227 | serge | 462 | |
463 | |||
464 | |||
465 | |||
466 | mov [edi+CURSOR.base], eax |
||
467 | |||
468 | |||
469 | mov ebx, [flags] |
||
470 | cmp bx, LOAD_INDIRECT |
||
471 | je .indirect |
||
472 | |||
473 | |||
474 | movzx edx, word [esi+12] |
||
475 | mov [edi+CURSOR.hot_x], ecx |
||
476 | mov [edi+CURSOR.hot_y], edx |
||
477 | |||
478 | |||
479 | mov eax, [hcursor] |
||
480 | .fail: |
||
481 | ret |
||
482 | .indirect: |
||
483 | shr ebx, 16 |
||
484 | movzx ecx, bh |
||
485 | movzx edx, bl |
||
486 | mov [edi+CURSOR.hot_x], ecx |
||
233 | serge | 487 | mov [edi+CURSOR.hot_y], edx |
488 | |||
227 | serge | 489 | |
490 | push edi |
||
491 | mov ecx, 64*64 |
||
492 | xor eax,eax |
||
493 | rep stosd |
||
494 | |||
495 | |||
496 | pop edi |
||
497 | mov ebx, 32 |
||
498 | cld |
||
499 | @@: |
||
500 | mov ecx, 32 |
||
501 | rep movsd |
||
502 | add edi, 128 |
||
503 | dec ebx |
||
504 | jnz @B |
||
505 | mov eax, [hcursor] |
||
506 | ret |
||
507 | endp |
||
508 | |||
509 | |||
510 | proc ati_init_cursor stdcall, dst:dword, src:dword |
||
511 | locals |
||
214 | serge | 512 | rBase dd ? |
513 | pQuad dd ? |
||
514 | pBits dd ? |
||
515 | pAnd dd ? |
||
516 | width dd ? |
||
517 | height dd ? |
||
518 | counter dd ? |
||
519 | endl |
||
520 | |||
521 | |||
227 | serge | 522 | add esi,[esi+18] |
523 | mov eax,esi |
||
524 | |||
214 | serge | 525 | |
227 | serge | 526 | je .img_24 |
527 | cmp [esi+BI.biBitCount], 8 |
||
233 | serge | 528 | je .img_8 |
529 | cmp [esi+BI.biBitCount], 4 |
||
530 | je .img_4 |
||
531 | |||
532 | |||
533 | add eax, [esi] |
||
534 | mov [pQuad],eax |
||
535 | add eax,8 |
||
536 | mov [pBits],eax |
||
537 | add eax, 128 |
||
538 | mov [pAnd],eax |
||
539 | mov eax,[esi+4] |
||
540 | mov [width],eax |
||
541 | mov ebx,[esi+8] |
||
542 | shr ebx,1 |
||
543 | mov [height],ebx |
||
544 | |||
545 | |||
546 | add edi, 32*31*4 |
||
547 | mov [rBase],edi |
||
548 | |||
549 | |||
550 | .l21: |
||
551 | mov ebx, [pBits] |
||
552 | mov ebx, [ebx] |
||
553 | bswap ebx |
||
554 | mov eax, [pAnd] |
||
555 | mov eax, [eax] |
||
556 | bswap eax |
||
557 | mov [counter], 32 |
||
558 | @@: |
||
559 | xor edx, edx |
||
560 | shl eax,1 |
||
561 | setc dl |
||
562 | dec edx |
||
563 | |||
564 | |||
565 | shl ebx,1 |
||
566 | setc cl |
||
567 | mov ecx, [esi+ecx*4] |
||
568 | and ecx, edx |
||
569 | and edx, 0xFF000000 |
||
570 | or edx, ecx |
||
571 | mov [edi], edx |
||
572 | |||
573 | |||
574 | dec [counter] |
||
575 | jnz @B |
||
576 | |||
577 | |||
578 | add [pAnd], 4 |
||
579 | mov edi,[rBase] |
||
580 | sub edi,128 |
||
581 | mov [rBase],edi |
||
582 | sub [height],1 |
||
583 | jnz .l21 |
||
584 | jmp .copy |
||
585 | .img_4: |
||
227 | serge | 586 | add eax, [esi] |
214 | serge | 587 | mov [pQuad],eax |
588 | add eax,64 |
||
589 | mov [pBits],eax |
||
590 | add eax, 0x200 |
||
591 | mov [pAnd],eax |
||
592 | mov eax,[esi+4] |
||
593 | mov [width],eax |
||
594 | mov ebx,[esi+8] |
||
595 | shr ebx,1 |
||
596 | mov [height],ebx |
||
597 | |||
598 | |||
599 | add edi, 32*31*4 |
||
600 | mov [rBase],edi |
||
601 | |||
602 | |||
233 | serge | 603 | mov ebx, [pBits] |
214 | serge | 604 | .l4: |
233 | serge | 605 | mov eax, [pAnd] |
606 | mov eax, [eax] |
||
607 | bswap eax |
||
214 | serge | 608 | mov [counter], 16 |
609 | @@: |
||
610 | xor edx, edx |
||
611 | shl eax,1 |
||
612 | setc dl |
||
613 | dec edx |
||
614 | |||
615 | |||
233 | serge | 616 | and cl, 0xF0 |
617 | shr ecx, 2 |
||
214 | serge | 618 | mov ecx, [esi+ecx] |
233 | serge | 619 | and ecx, edx |
214 | serge | 620 | and edx, 0xFF000000 |
621 | or edx, ecx |
||
622 | mov [edi], edx |
||
623 | |||
624 | |||
625 | shl eax,1 |
||
626 | setc dl |
||
627 | dec edx |
||
628 | |||
629 | |||
233 | serge | 630 | and cl, 0x0F |
631 | mov ecx, [esi+ecx*4] |
||
632 | and ecx, edx |
||
214 | serge | 633 | and edx, 0xFF000000 |
634 | or edx, ecx |
||
635 | mov [edi+4], edx |
||
636 | |||
637 | |||
638 | add edi, 8 |
||
639 | dec [counter] |
||
640 | jnz @B |
||
641 | |||
642 | |||
233 | serge | 643 | mov edi,[rBase] |
214 | serge | 644 | sub edi,128 |
645 | mov [rBase],edi |
||
646 | sub [height],1 |
||
647 | jnz .l4 |
||
233 | serge | 648 | jmp .copy |
227 | serge | 649 | .img_8: |
233 | serge | 650 | add eax, [esi] |
651 | mov [pQuad],eax |
||
652 | add eax,1024 |
||
653 | mov [pBits],eax |
||
654 | add eax, 1024 |
||
655 | mov [pAnd],eax |
||
656 | mov eax,[esi+4] |
||
657 | mov [width],eax |
||
658 | mov ebx,[esi+8] |
||
659 | shr ebx,1 |
||
660 | mov [height],ebx |
||
661 | |||
214 | serge | 662 | |
233 | serge | 663 | add edi, 32*31*4 |
664 | mov [rBase],edi |
||
665 | |||
666 | |||
667 | mov ebx, [pBits] |
||
668 | .l81: |
||
669 | mov eax, [pAnd] |
||
670 | mov eax, [eax] |
||
671 | bswap eax |
||
672 | mov [counter], 32 |
||
673 | @@: |
||
674 | xor edx, edx |
||
675 | shl eax,1 |
||
676 | setc dl |
||
677 | dec edx |
||
678 | |||
679 | |||
680 | mov ecx, [esi+ecx*4] |
||
681 | and ecx, edx |
||
682 | and edx, 0xFF000000 |
||
683 | or edx, ecx |
||
684 | mov [edi], edx |
||
685 | |||
686 | |||
687 | add edi, 4 |
||
688 | dec [counter] |
||
689 | jnz @B |
||
690 | |||
691 | |||
692 | mov edi,[rBase] |
||
693 | sub edi,128 |
||
694 | mov [rBase],edi |
||
695 | sub [height],1 |
||
696 | jnz .l81 |
||
697 | jmp .copy |
||
698 | .img_24: |
||
227 | serge | 699 | add eax, [esi] |
700 | mov [pQuad],eax |
||
701 | add eax, 0xC00 |
||
702 | mov [pAnd],eax |
||
703 | mov eax,[esi+BI.biWidth] |
||
704 | mov [width],eax |
||
705 | mov ebx,[esi+BI.biHeight] |
||
706 | shr ebx,1 |
||
707 | mov [height],ebx |
||
708 | |||
709 | |||
710 | add edi, 32*31*4 |
||
711 | mov [rBase],edi |
||
712 | |||
713 | |||
714 | mov ebx, [pQuad] |
||
715 | .row_24: |
||
716 | mov eax, [esi] |
||
717 | bswap eax |
||
718 | mov [counter], 32 |
||
719 | @@: |
||
720 | xor edx, edx |
||
721 | shl eax,1 |
||
722 | setc dl |
||
723 | dec edx |
||
724 | |||
725 | |||
726 | and ecx, 0x00FFFFFF |
||
727 | and ecx, edx |
||
728 | and edx, 0xFF000000 |
||
729 | or edx, ecx |
||
730 | mov [edi], edx |
||
731 | add ebx, 3 |
||
732 | add edi, 4 |
||
733 | dec [counter] |
||
734 | jnz @B |
||
735 | |||
736 | |||
737 | mov edi,[rBase] |
||
738 | sub edi,128 |
||
739 | mov [rBase],edi |
||
740 | sub [height],1 |
||
741 | jnz .row_24 |
||
742 | .copy: |
||
743 | mov edi, [dst] |
||
744 | mov ecx, 64*64 |
||
214 | serge | 745 | xor eax,eax |
746 | rep stosd |
||
747 | |||
748 | |||
749 | mov edi, [dst] |
||
227 | serge | 750 | mov ebx, 32 |
214 | serge | 751 | cld |
227 | serge | 752 | @@: |
753 | mov ecx, 32 |
||
214 | serge | 754 | rep movsd |
227 | serge | 755 | add edi, 128 |
214 | serge | 756 | dec ebx |
227 | serge | 757 | jnz @B |
758 | ret |
||
214 | serge | 759 | endp |
760 | |||
761 | |||
762 | proc engFlush |
||
763 | |||
764 | |||
765 | |||
766 | |||
767 | or eax,RD_RB2D_DC_FLUSH_ALL |
||
768 | mov [edi+RD_RB2D_DSTCACHE_CTLSTAT],eax |
||
769 | |||
770 | |||
771 | @@: |
||
772 | mov eax,[edi+RD_RB2D_DSTCACHE_CTLSTAT] |
||
773 | and eax, RD_RB2D_DC_BUSY |
||
774 | jz .exit |
||
775 | |||
776 | |||
777 | jnz @B |
||
778 | .exit: |
||
779 | ret |
||
780 | endp |
||
781 | |||
782 | |||
783 | engWaitForFifo: |
||
784 | cnt equ bp+8 |
||
785 | push ebp |
||
786 | mov ebp, esp |
||
787 | |||
788 | |||
789 | |||
790 | |||
791 | @@: |
||
792 | mov eax, [edi+RD_RBBM_STATUS] |
||
793 | and eax, RD_RBBM_FIFOCNT_MASK |
||
794 | cmp eax, [ebp+8] |
||
795 | jae .exit |
||
796 | |||
797 | |||
798 | jmp @B |
||
799 | |||
800 | |||
801 | leave |
||
802 | ret 4 |
||
803 | |||
804 | |||
805 | proc engWaitForIdle |
||
806 | |||
807 | |||
227 | serge | 808 | call engWaitForFifo |
809 | |||
214 | serge | 810 | |
227 | serge | 811 | mov ecx ,RD_TIMEOUT |
812 | @@: |
||
214 | serge | 813 | mov eax, [edi+RD_RBBM_STATUS] |
227 | serge | 814 | and eax,RD_RBBM_ACTIVE |
815 | jz .exit |
||
816 | |||
214 | serge | 817 | |
227 | serge | 818 | jnz @B |
819 | .exit: |
||
214 | serge | 820 | call engFlush |
227 | serge | 821 | ret |
822 | endp |
||
214 | serge | 823 | |
824 | |||
825 | proc engRestore |
||
826 | |||
827 | |||
828 | ; call engWaitForFifo |
||
829 | |||
830 | |||
831 | |||
832 | |||
227 | serge | 833 | call engWaitForFifo |
834 | |||
214 | serge | 835 | |
836 | |||
837 | |||
838 | shr eax, 10d |
||
839 | or eax,(64d shl 22d) |
||
840 | mov [edi+RD_DEFAULT_OFFSET],eax |
||
841 | mov [edi+RD_SRC_PITCH_OFFSET],eax |
||
842 | mov [edi+RD_DST_PITCH_OFFSET],eax |
||
843 | |||
844 | |||
845 | call engWaitForFifo |
||
846 | |||
847 | |||
848 | mov eax, [edi+RD_DP_DATATYPE] |
||
849 | btr eax, 29d |
||
850 | mov [edi+RD_DP_DATATYPE],eax |
||
851 | |||
852 | |||
853 | call engWaitForFifo |
||
854 | |||
855 | |||
856 | mov dword [edi+RD_DEFAULT_SC_BOTTOM_RIGHT],\ |
||
857 | (RD_DEFAULT_SC_RIGHT_MAX or RD_DEFAULT_SC_BOTTOM_MAX) |
||
858 | |||
859 | |||
860 | call engWaitForFifo |
||
861 | |||
862 | |||
863 | mov dword [edi+RD_DP_GUI_MASTER_CNTL],\ |
||
864 | (RD_GMC_BRUSH_SOLID_COLOR or \ |
||
865 | RD_GMC_SRC_DATATYPE_COLOR or \ |
||
866 | (6 shl RD_GMC_DST_DATATYPE_SHIFT) or \ |
||
867 | RD_GMC_CLR_CMP_CNTL_DIS or \ |
||
868 | RD_ROP3_P or \ |
||
869 | RD_GMC_WR_MSK_DIS) |
||
870 | |||
871 | |||
872 | |||
873 | call engWaitForFifo |
||
874 | |||
875 | |||
876 | |||
877 | |||
878 | mov dword [edi+RD_DST_LINE_END], 0 |
||
879 | mov dword [edi+RD_DP_BRUSH_FRGD_CLR], 808000ffh |
||
880 | mov dword [edi+RD_DP_BRUSH_BKGD_CLR], 002020ffh |
||
881 | mov dword [edi+RD_DP_SRC_FRGD_CLR], 808000ffh |
||
882 | mov dword [edi+RD_DP_SRC_BKGD_CLR], 004000ffh |
||
883 | mov dword [edi+RD_DP_WRITE_MASK],0ffffffffh |
||
884 | |||
885 | |||
886 | |||
887 | |||
888 | endp |
||
889 | |||
890 | |||
891 | engSetupSolidFill: |
||
892 | push ebp |
||
893 | mov ebp, esp |
||
894 | |||
895 | |||
896 | call engWaitForFifo |
||
897 | |||
898 | |||
899 | |||
900 | |||
901 | wrr RD_DP_BRUSH_FRGD_CLR,eax |
||
902 | |||
903 | |||
904 | mov dword [edi+RD_DP_CNTL],(RD_DST_X_LEFT_TO_RIGHT or RD_DST_Y_TOP_TO_BOTTOM) |
||
905 | leave |
||
906 | ret 4 |
||
907 | |||
908 | |||
909 | |||
910 | drvSolidFill: |
||
911 | ;x:word,y:word,w:word,h:word,color:dword |
||
912 | push ebp |
||
913 | mov ebp, esp |
||
914 | x equ ebp+8 |
||
915 | y equ ebp+12 |
||
916 | w equ ebp+16 |
||
917 | h equ ebp+20 |
||
918 | color equ ebp+24 |
||
919 | |||
920 | |||
227 | serge | 921 | call engSetupSolidFill |
922 | |||
214 | serge | 923 | |
227 | serge | 924 | call engWaitForFifo |
925 | |||
214 | serge | 926 | |
227 | serge | 927 | |
214 | serge | 928 | |
227 | serge | 929 | mov ebx, [x] |
930 | shl eax,16 |
||
931 | or eax, ebx |
||
932 | |||
214 | serge | 933 | |
227 | serge | 934 | mov edx, [h] |
935 | shl ecx,16 |
||
936 | or ecx, edx |
||
937 | mov [edi+RD_DST_Y_X], eax |
||
938 | mov [edi+RD_DST_WIDTH_HEIGHT], ecx |
||
939 | call engFlush |
||
940 | leave |
||
941 | ret 20 |
||
942 | |||
214 | serge | 943 | |
944 | devices dd (R8500 shl 16)+VID_ATI |
||
945 | dd (R9000 shl 16)+VID_ATI |
||
946 | dd (R9200 shl 16)+VID_ATI |
||
947 | dd (R9500 shl 16)+VID_ATI |
||
948 | dd (R9500P shl 16)+VID_ATI |
||
949 | dd (R9550 shl 16)+VID_ATI |
||
950 | dd (R9600 shl 16)+VID_ATI |
||
951 | dd (R9600XT shl 16)+VID_ATI |
||
952 | dd (R9700P shl 16)+VID_ATI |
||
953 | dd (R9800 shl 16)+VID_ATI |
||
954 | dd (R9800P shl 16)+VID_ATI |
||
955 | dd (R9800XT shl 16)+VID_ATI |
||
956 | dd 0 ;terminator |
||
957 | |||
958 | |||
227 | serge | 959 | |
214 | serge | 960 | |
227 | serge | 961 | |
214 | serge | 962 | |
963 | msgPCI db 'PCI accsess not supported',13,10,0 |
||
964 | msgFail db 'device not found',13,10,0 |
||
965 | msg_neg db 'neg ecx',13,10,0 |
||
233 | serge | 966 | buff db 8 dup(0) |
967 | db 13,10, 0 |
||
968 | |||
214 | serge | 969 | |
970 | |||
971 | |||
972 | |||
973 | |||
227 | serge | 974 | cursor_map rd 2 |
975 | cursor_start rd 1 |
||
976 | cursor_end rd 1 |
||
977 | |||
214 | serge | 978 | |
227 | serge | 979 | devfn dd ? |
980 | ati_io dd ? |
||
981 |