Rev 233 | 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 | lea eax,[eax+ebx*8] |
||
254 | serge | 433 | |
227 | serge | 434 | |
435 | add eax, LFBAddress+CURSOR_IMAGE_OFFSET |
||
436 | ret |
||
437 | endp |
||
438 | |||
439 | |||
440 | video_free: |
||
233 | serge | 441 | pushfd |
442 | cli |
||
443 | sub eax, LFBAddress+CURSOR_IMAGE_OFFSET |
||
444 | shr eax, 14 |
||
445 | mov ebx, cursor_map |
||
446 | bts [ebx], eax |
||
447 | shr eax, 3 |
||
448 | and eax, not 3 |
||
449 | add eax, ebx |
||
450 | cmp [cursor_start], eax |
||
451 | ja @f |
||
452 | popfd |
||
453 | ret |
||
454 | @@: |
||
455 | mov [cursor_start], eax |
||
456 | popfd |
||
457 | ret |
||
458 | |||
459 | |||
460 | proc ati_cursor stdcall, hcursor:dword, src:dword, flags:dword |
||
227 | serge | 461 | |
462 | |||
463 | |||
464 | |||
465 | mov [edi+CURSOR.base], eax |
||
466 | |||
467 | |||
468 | mov ebx, [flags] |
||
469 | cmp bx, LOAD_INDIRECT |
||
470 | je .indirect |
||
471 | |||
472 | |||
473 | movzx edx, word [esi+12] |
||
474 | mov [edi+CURSOR.hot_x], ecx |
||
475 | mov [edi+CURSOR.hot_y], edx |
||
476 | |||
477 | |||
478 | mov eax, [hcursor] |
||
479 | .fail: |
||
480 | ret |
||
481 | .indirect: |
||
482 | shr ebx, 16 |
||
483 | movzx ecx, bh |
||
484 | movzx edx, bl |
||
485 | mov [edi+CURSOR.hot_x], ecx |
||
233 | serge | 486 | mov [edi+CURSOR.hot_y], edx |
487 | |||
227 | serge | 488 | |
489 | push edi |
||
490 | mov ecx, 64*64 |
||
491 | xor eax,eax |
||
492 | rep stosd |
||
493 | |||
494 | |||
495 | pop edi |
||
496 | mov ebx, 32 |
||
497 | cld |
||
498 | @@: |
||
499 | mov ecx, 32 |
||
500 | rep movsd |
||
501 | add edi, 128 |
||
502 | dec ebx |
||
503 | jnz @B |
||
504 | mov eax, [hcursor] |
||
505 | ret |
||
506 | endp |
||
507 | |||
508 | |||
509 | proc ati_init_cursor stdcall, dst:dword, src:dword |
||
510 | locals |
||
214 | serge | 511 | rBase dd ? |
512 | pQuad dd ? |
||
513 | pBits dd ? |
||
514 | pAnd dd ? |
||
515 | width dd ? |
||
516 | height dd ? |
||
517 | counter dd ? |
||
518 | endl |
||
519 | |||
520 | |||
227 | serge | 521 | add esi,[esi+18] |
522 | mov eax,esi |
||
523 | |||
214 | serge | 524 | |
227 | serge | 525 | je .img_24 |
526 | cmp [esi+BI.biBitCount], 8 |
||
233 | serge | 527 | je .img_8 |
528 | cmp [esi+BI.biBitCount], 4 |
||
529 | je .img_4 |
||
530 | |||
531 | |||
532 | add eax, [esi] |
||
533 | mov [pQuad],eax |
||
534 | add eax,8 |
||
535 | mov [pBits],eax |
||
536 | add eax, 128 |
||
537 | mov [pAnd],eax |
||
538 | mov eax,[esi+4] |
||
539 | mov [width],eax |
||
540 | mov ebx,[esi+8] |
||
541 | shr ebx,1 |
||
542 | mov [height],ebx |
||
543 | |||
544 | |||
545 | add edi, 32*31*4 |
||
546 | mov [rBase],edi |
||
547 | |||
548 | |||
549 | .l21: |
||
550 | mov ebx, [pBits] |
||
551 | mov ebx, [ebx] |
||
552 | bswap ebx |
||
553 | mov eax, [pAnd] |
||
554 | mov eax, [eax] |
||
555 | bswap eax |
||
556 | mov [counter], 32 |
||
557 | @@: |
||
558 | xor edx, edx |
||
559 | shl eax,1 |
||
560 | setc dl |
||
561 | dec edx |
||
562 | |||
563 | |||
564 | shl ebx,1 |
||
565 | setc cl |
||
566 | mov ecx, [esi+ecx*4] |
||
567 | and ecx, edx |
||
568 | and edx, 0xFF000000 |
||
569 | or edx, ecx |
||
570 | mov [edi], edx |
||
571 | |||
572 | |||
573 | dec [counter] |
||
574 | jnz @B |
||
575 | |||
576 | |||
577 | add [pAnd], 4 |
||
578 | mov edi,[rBase] |
||
579 | sub edi,128 |
||
580 | mov [rBase],edi |
||
581 | sub [height],1 |
||
582 | jnz .l21 |
||
583 | jmp .copy |
||
584 | .img_4: |
||
227 | serge | 585 | add eax, [esi] |
214 | serge | 586 | mov [pQuad],eax |
587 | add eax,64 |
||
588 | mov [pBits],eax |
||
589 | add eax, 0x200 |
||
590 | mov [pAnd],eax |
||
591 | mov eax,[esi+4] |
||
592 | mov [width],eax |
||
593 | mov ebx,[esi+8] |
||
594 | shr ebx,1 |
||
595 | mov [height],ebx |
||
596 | |||
597 | |||
598 | add edi, 32*31*4 |
||
599 | mov [rBase],edi |
||
600 | |||
601 | |||
233 | serge | 602 | mov ebx, [pBits] |
214 | serge | 603 | .l4: |
233 | serge | 604 | mov eax, [pAnd] |
605 | mov eax, [eax] |
||
606 | bswap eax |
||
214 | serge | 607 | mov [counter], 16 |
608 | @@: |
||
609 | xor edx, edx |
||
610 | shl eax,1 |
||
611 | setc dl |
||
612 | dec edx |
||
613 | |||
614 | |||
233 | serge | 615 | and cl, 0xF0 |
616 | shr ecx, 2 |
||
214 | serge | 617 | mov ecx, [esi+ecx] |
233 | serge | 618 | and ecx, edx |
214 | serge | 619 | and edx, 0xFF000000 |
620 | or edx, ecx |
||
621 | mov [edi], edx |
||
622 | |||
623 | |||
624 | shl eax,1 |
||
625 | setc dl |
||
626 | dec edx |
||
627 | |||
628 | |||
233 | serge | 629 | and cl, 0x0F |
630 | mov ecx, [esi+ecx*4] |
||
631 | and ecx, edx |
||
214 | serge | 632 | and edx, 0xFF000000 |
633 | or edx, ecx |
||
634 | mov [edi+4], edx |
||
635 | |||
636 | |||
637 | add edi, 8 |
||
638 | dec [counter] |
||
639 | jnz @B |
||
640 | |||
641 | |||
233 | serge | 642 | mov edi,[rBase] |
214 | serge | 643 | sub edi,128 |
644 | mov [rBase],edi |
||
645 | sub [height],1 |
||
646 | jnz .l4 |
||
233 | serge | 647 | jmp .copy |
227 | serge | 648 | .img_8: |
233 | serge | 649 | add eax, [esi] |
650 | mov [pQuad],eax |
||
651 | add eax,1024 |
||
652 | mov [pBits],eax |
||
653 | add eax, 1024 |
||
654 | mov [pAnd],eax |
||
655 | mov eax,[esi+4] |
||
656 | mov [width],eax |
||
657 | mov ebx,[esi+8] |
||
658 | shr ebx,1 |
||
659 | mov [height],ebx |
||
660 | |||
214 | serge | 661 | |
233 | serge | 662 | add edi, 32*31*4 |
663 | mov [rBase],edi |
||
664 | |||
665 | |||
666 | mov ebx, [pBits] |
||
667 | .l81: |
||
668 | mov eax, [pAnd] |
||
669 | mov eax, [eax] |
||
670 | bswap eax |
||
671 | mov [counter], 32 |
||
672 | @@: |
||
673 | xor edx, edx |
||
674 | shl eax,1 |
||
675 | setc dl |
||
676 | dec edx |
||
677 | |||
678 | |||
679 | mov ecx, [esi+ecx*4] |
||
680 | and ecx, edx |
||
681 | and edx, 0xFF000000 |
||
682 | or edx, ecx |
||
683 | mov [edi], edx |
||
684 | |||
685 | |||
686 | add edi, 4 |
||
687 | dec [counter] |
||
688 | jnz @B |
||
689 | |||
690 | |||
691 | mov edi,[rBase] |
||
692 | sub edi,128 |
||
693 | mov [rBase],edi |
||
694 | sub [height],1 |
||
695 | jnz .l81 |
||
696 | jmp .copy |
||
697 | .img_24: |
||
227 | serge | 698 | add eax, [esi] |
699 | mov [pQuad],eax |
||
700 | add eax, 0xC00 |
||
701 | mov [pAnd],eax |
||
702 | mov eax,[esi+BI.biWidth] |
||
703 | mov [width],eax |
||
704 | mov ebx,[esi+BI.biHeight] |
||
705 | shr ebx,1 |
||
706 | mov [height],ebx |
||
707 | |||
708 | |||
709 | add edi, 32*31*4 |
||
710 | mov [rBase],edi |
||
711 | |||
712 | |||
713 | mov ebx, [pQuad] |
||
714 | .row_24: |
||
715 | mov eax, [esi] |
||
716 | bswap eax |
||
717 | mov [counter], 32 |
||
718 | @@: |
||
719 | xor edx, edx |
||
720 | shl eax,1 |
||
721 | setc dl |
||
722 | dec edx |
||
723 | |||
724 | |||
725 | and ecx, 0x00FFFFFF |
||
726 | and ecx, edx |
||
727 | and edx, 0xFF000000 |
||
728 | or edx, ecx |
||
729 | mov [edi], edx |
||
730 | add ebx, 3 |
||
731 | add edi, 4 |
||
732 | dec [counter] |
||
733 | jnz @B |
||
734 | |||
735 | |||
736 | mov edi,[rBase] |
||
737 | sub edi,128 |
||
738 | mov [rBase],edi |
||
739 | sub [height],1 |
||
740 | jnz .row_24 |
||
741 | .copy: |
||
742 | mov edi, [dst] |
||
743 | mov ecx, 64*64 |
||
214 | serge | 744 | xor eax,eax |
745 | rep stosd |
||
746 | |||
747 | |||
748 | mov edi, [dst] |
||
227 | serge | 749 | mov ebx, 32 |
214 | serge | 750 | cld |
227 | serge | 751 | @@: |
752 | mov ecx, 32 |
||
214 | serge | 753 | rep movsd |
227 | serge | 754 | add edi, 128 |
214 | serge | 755 | dec ebx |
227 | serge | 756 | jnz @B |
757 | ret |
||
214 | serge | 758 | endp |
759 | |||
760 | |||
761 | proc engFlush |
||
762 | |||
763 | |||
764 | |||
765 | |||
766 | or eax,RD_RB2D_DC_FLUSH_ALL |
||
767 | mov [edi+RD_RB2D_DSTCACHE_CTLSTAT],eax |
||
768 | |||
769 | |||
770 | @@: |
||
771 | mov eax,[edi+RD_RB2D_DSTCACHE_CTLSTAT] |
||
772 | and eax, RD_RB2D_DC_BUSY |
||
773 | jz .exit |
||
774 | |||
775 | |||
776 | jnz @B |
||
777 | .exit: |
||
778 | ret |
||
779 | endp |
||
780 | |||
781 | |||
782 | engWaitForFifo: |
||
783 | cnt equ bp+8 |
||
784 | push ebp |
||
785 | mov ebp, esp |
||
786 | |||
787 | |||
788 | |||
789 | |||
790 | @@: |
||
791 | mov eax, [edi+RD_RBBM_STATUS] |
||
792 | and eax, RD_RBBM_FIFOCNT_MASK |
||
793 | cmp eax, [ebp+8] |
||
794 | jae .exit |
||
795 | |||
796 | |||
797 | jmp @B |
||
798 | |||
799 | |||
800 | leave |
||
801 | ret 4 |
||
802 | |||
803 | |||
804 | proc engWaitForIdle |
||
805 | |||
806 | |||
227 | serge | 807 | call engWaitForFifo |
808 | |||
214 | serge | 809 | |
227 | serge | 810 | mov ecx ,RD_TIMEOUT |
811 | @@: |
||
214 | serge | 812 | mov eax, [edi+RD_RBBM_STATUS] |
227 | serge | 813 | and eax,RD_RBBM_ACTIVE |
814 | jz .exit |
||
815 | |||
214 | serge | 816 | |
227 | serge | 817 | jnz @B |
818 | .exit: |
||
214 | serge | 819 | call engFlush |
227 | serge | 820 | ret |
821 | endp |
||
214 | serge | 822 | |
823 | |||
824 | proc engRestore |
||
825 | |||
826 | |||
827 | ; call engWaitForFifo |
||
828 | |||
829 | |||
830 | |||
831 | |||
227 | serge | 832 | call engWaitForFifo |
833 | |||
214 | serge | 834 | |
835 | |||
836 | |||
837 | shr eax, 10d |
||
838 | or eax,(64d shl 22d) |
||
839 | mov [edi+RD_DEFAULT_OFFSET],eax |
||
840 | mov [edi+RD_SRC_PITCH_OFFSET],eax |
||
841 | mov [edi+RD_DST_PITCH_OFFSET],eax |
||
842 | |||
843 | |||
844 | call engWaitForFifo |
||
845 | |||
846 | |||
847 | mov eax, [edi+RD_DP_DATATYPE] |
||
848 | btr eax, 29d |
||
849 | mov [edi+RD_DP_DATATYPE],eax |
||
850 | |||
851 | |||
852 | call engWaitForFifo |
||
853 | |||
854 | |||
855 | mov dword [edi+RD_DEFAULT_SC_BOTTOM_RIGHT],\ |
||
856 | (RD_DEFAULT_SC_RIGHT_MAX or RD_DEFAULT_SC_BOTTOM_MAX) |
||
857 | |||
858 | |||
859 | call engWaitForFifo |
||
860 | |||
861 | |||
862 | mov dword [edi+RD_DP_GUI_MASTER_CNTL],\ |
||
863 | (RD_GMC_BRUSH_SOLID_COLOR or \ |
||
864 | RD_GMC_SRC_DATATYPE_COLOR or \ |
||
865 | (6 shl RD_GMC_DST_DATATYPE_SHIFT) or \ |
||
866 | RD_GMC_CLR_CMP_CNTL_DIS or \ |
||
867 | RD_ROP3_P or \ |
||
868 | RD_GMC_WR_MSK_DIS) |
||
869 | |||
870 | |||
871 | |||
872 | call engWaitForFifo |
||
873 | |||
874 | |||
875 | |||
876 | |||
877 | mov dword [edi+RD_DST_LINE_END], 0 |
||
878 | mov dword [edi+RD_DP_BRUSH_FRGD_CLR], 808000ffh |
||
879 | mov dword [edi+RD_DP_BRUSH_BKGD_CLR], 002020ffh |
||
880 | mov dword [edi+RD_DP_SRC_FRGD_CLR], 808000ffh |
||
881 | mov dword [edi+RD_DP_SRC_BKGD_CLR], 004000ffh |
||
882 | mov dword [edi+RD_DP_WRITE_MASK],0ffffffffh |
||
883 | |||
884 | |||
885 | |||
886 | |||
887 | endp |
||
888 | |||
889 | |||
890 | engSetupSolidFill: |
||
891 | push ebp |
||
892 | mov ebp, esp |
||
893 | |||
894 | |||
895 | call engWaitForFifo |
||
896 | |||
897 | |||
898 | |||
899 | |||
900 | wrr RD_DP_BRUSH_FRGD_CLR,eax |
||
901 | |||
902 | |||
903 | mov dword [edi+RD_DP_CNTL],(RD_DST_X_LEFT_TO_RIGHT or RD_DST_Y_TOP_TO_BOTTOM) |
||
904 | leave |
||
905 | ret 4 |
||
906 | |||
907 | |||
908 | |||
909 | drvSolidFill: |
||
910 | ;x:word,y:word,w:word,h:word,color:dword |
||
911 | push ebp |
||
912 | mov ebp, esp |
||
913 | x equ ebp+8 |
||
914 | y equ ebp+12 |
||
915 | w equ ebp+16 |
||
916 | h equ ebp+20 |
||
917 | color equ ebp+24 |
||
918 | |||
919 | |||
227 | serge | 920 | call engSetupSolidFill |
921 | |||
214 | serge | 922 | |
227 | serge | 923 | call engWaitForFifo |
924 | |||
214 | serge | 925 | |
227 | serge | 926 | |
214 | serge | 927 | |
227 | serge | 928 | mov ebx, [x] |
929 | shl eax,16 |
||
930 | or eax, ebx |
||
931 | |||
214 | serge | 932 | |
227 | serge | 933 | mov edx, [h] |
934 | shl ecx,16 |
||
935 | or ecx, edx |
||
936 | mov [edi+RD_DST_Y_X], eax |
||
937 | mov [edi+RD_DST_WIDTH_HEIGHT], ecx |
||
938 | call engFlush |
||
939 | leave |
||
940 | ret 20 |
||
941 | |||
214 | serge | 942 | |
943 | devices dd (R8500 shl 16)+VID_ATI |
||
944 | dd (R9000 shl 16)+VID_ATI |
||
945 | dd (R9200 shl 16)+VID_ATI |
||
946 | dd (R9500 shl 16)+VID_ATI |
||
947 | dd (R9500P shl 16)+VID_ATI |
||
948 | dd (R9550 shl 16)+VID_ATI |
||
949 | dd (R9600 shl 16)+VID_ATI |
||
950 | dd (R9600XT shl 16)+VID_ATI |
||
951 | dd (R9700P shl 16)+VID_ATI |
||
952 | dd (R9800 shl 16)+VID_ATI |
||
953 | dd (R9800P shl 16)+VID_ATI |
||
954 | dd (R9800XT shl 16)+VID_ATI |
||
955 | dd 0 ;terminator |
||
956 | |||
957 | |||
227 | serge | 958 | |
214 | serge | 959 | |
227 | serge | 960 | |
214 | serge | 961 | |
962 | msgPCI db 'PCI accsess not supported',13,10,0 |
||
963 | msgFail db 'device not found',13,10,0 |
||
964 | msg_neg db 'neg ecx',13,10,0 |
||
233 | serge | 965 | buff db 8 dup(0) |
966 | db 13,10, 0 |
||
967 | |||
214 | serge | 968 | |
969 | |||
970 | |||
971 | |||
972 | |||
227 | serge | 973 | cursor_map rd 2 |
974 | cursor_start rd 1 |
||
975 | cursor_end rd 1 |
||
976 | |||
214 | serge | 977 | |
227 | serge | 978 | devfn dd ? |
979 | ati_io dd ? |
||
980 |