- applied patch from the qemu project (Fabrice Bellard)
[vgabios.git] / clext.c
blob26b7228480d5a51bb2ab88f6739bee11ce0efdb9
1 //
2 // QEMU Cirrus CLGD 54xx VGABIOS Extension.
3 //
4 // Copyright (c) 2004 Makoto Suzuki (suzu)
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
21 //#define CIRRUS_VESA3_PMINFO
22 #ifdef VBE
23 #undef CIRRUS_VESA3_PMINFO
24 #endif
26 #define PM_BIOSMEM_CURRENT_MODE 0x449
27 #define PM_BIOSMEM_CRTC_ADDRESS 0x463
28 #define PM_BIOSMEM_VBE_MODE 0x4BA
30 typedef struct
32 /* + 0 */
33 unsigned short mode;
34 unsigned short width;
35 unsigned short height;
36 unsigned short depth;
37 /* + 8 */
38 unsigned short hidden_dac; /* 0x3c6 */
39 unsigned short *seq; /* 0x3c4 */
40 unsigned short *graph; /* 0x3ce */
41 unsigned short *crtc; /* 0x3d4 */
42 /* +16 */
43 unsigned char bitsperpixel;
44 unsigned char vesacolortype;
45 unsigned char vesaredmask;
46 unsigned char vesaredpos;
47 unsigned char vesagreenmask;
48 unsigned char vesagreenpos;
49 unsigned char vesabluemask;
50 unsigned char vesabluepos;
51 /* +24 */
52 unsigned char vesareservedmask;
53 unsigned char vesareservedpos;
54 } cirrus_mode_t;
55 #define CIRRUS_MODE_SIZE 26
58 /* For VESA BIOS 3.0 */
59 #define CIRRUS_PM16INFO_SIZE 20
61 /* VGA */
62 unsigned short cseq_vga[] = {0x0007,0xffff};
63 unsigned short cgraph_vga[] = {0x0009,0x000a,0x000b,0xffff};
64 unsigned short ccrtc_vga[] = {0x001a,0x001b,0x001d,0xffff};
66 /* extensions */
67 unsigned short cgraph_svgacolor[] = {
68 0x0000,0x0001,0x0002,0x0003,0x0004,0x4005,0x0506,0x0f07,0xff08,
69 0x0009,0x000a,0x000b,
70 0xffff
72 /* 640x480x8 */
73 unsigned short cseq_640x480x8[] = {
74 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1107,
75 0x580b,0x580c,0x580d,0x580e,
76 0x0412,0x0013,0x2017,
77 0x331b,0x331c,0x331d,0x331e,
78 0xffff
80 unsigned short ccrtc_640x480x8[] = {
81 0x2c11,
82 0x5f00,0x4f01,0x4f02,0x8003,0x5204,0x1e05,0x0b06,0x3e07,
83 0x4009,0x000c,0x000d,
84 0xea10,0xdf12,0x5013,0x4014,0xdf15,0x0b16,0xc317,0xff18,
85 0x001a,0x221b,0x001d,
86 0xffff
88 /* 640x480x16 */
89 unsigned short cseq_640x480x16[] = {
90 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1707,
91 0x580b,0x580c,0x580d,0x580e,
92 0x0412,0x0013,0x2017,
93 0x331b,0x331c,0x331d,0x331e,
94 0xffff
96 unsigned short ccrtc_640x480x16[] = {
97 0x2c11,
98 0x5f00,0x4f01,0x4f02,0x8003,0x5204,0x1e05,0x0b06,0x3e07,
99 0x4009,0x000c,0x000d,
100 0xea10,0xdf12,0xa013,0x4014,0xdf15,0x0b16,0xc317,0xff18,
101 0x001a,0x221b,0x001d,
102 0xffff
104 /* 640x480x24 */
105 unsigned short cseq_640x480x24[] = {
106 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1507,
107 0x580b,0x580c,0x580d,0x580e,
108 0x0412,0x0013,0x2017,
109 0x331b,0x331c,0x331d,0x331e,
110 0xffff
112 unsigned short ccrtc_640x480x24[] = {
113 0x2c11,
114 0x5f00,0x4f01,0x4f02,0x8003,0x5204,0x1e05,0x0b06,0x3e07,
115 0x4009,0x000c,0x000d,
116 0xea10,0xdf12,0x0013,0x4014,0xdf15,0x0b16,0xc317,0xff18,
117 0x001a,0x321b,0x001d,
118 0xffff
120 /* 800x600x8 */
121 unsigned short cseq_800x600x8[] = {
122 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1107,
123 0x230b,0x230c,0x230d,0x230e,
124 0x0412,0x0013,0x2017,
125 0x141b,0x141c,0x141d,0x141e,
126 0xffff
128 unsigned short ccrtc_800x600x8[] = {
129 0x2311,0x7d00,0x6301,0x6302,0x8003,0x6b04,0x1a05,0x9806,0xf007,
130 0x6009,0x000c,0x000d,
131 0x7d10,0x5712,0x6413,0x4014,0x5715,0x9816,0xc317,0xff18,
132 0x001a,0x221b,0x001d,
133 0xffff
135 /* 800x600x16 */
136 unsigned short cseq_800x600x16[] = {
137 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1707,
138 0x230b,0x230c,0x230d,0x230e,
139 0x0412,0x0013,0x2017,
140 0x141b,0x141c,0x141d,0x141e,
141 0xffff
143 unsigned short ccrtc_800x600x16[] = {
144 0x2311,0x7d00,0x6301,0x6302,0x8003,0x6b04,0x1a05,0x9806,0xf007,
145 0x6009,0x000c,0x000d,
146 0x7d10,0x5712,0xc813,0x4014,0x5715,0x9816,0xc317,0xff18,
147 0x001a,0x221b,0x001d,
148 0xffff
150 /* 800x600x24 */
151 unsigned short cseq_800x600x24[] = {
152 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1507,
153 0x230b,0x230c,0x230d,0x230e,
154 0x0412,0x0013,0x2017,
155 0x141b,0x141c,0x141d,0x141e,
156 0xffff
158 unsigned short ccrtc_800x600x24[] = {
159 0x2311,0x7d00,0x6301,0x6302,0x8003,0x6b04,0x1a05,0x9806,0xf007,
160 0x6009,0x000c,0x000d,
161 0x7d10,0x5712,0x2c13,0x4014,0x5715,0x9816,0xc317,0xff18,
162 0x001a,0x321b,0x001d,
163 0xffff
165 /* 1024x768x8 */
166 unsigned short cseq_1024x768x8[] = {
167 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1107,
168 0x760b,0x760c,0x760d,0x760e,
169 0x0412,0x0013,0x2017,
170 0x341b,0x341c,0x341d,0x341e,
171 0xffff
173 unsigned short ccrtc_1024x768x8[] = {
174 0x2911,0xa300,0x7f01,0x7f02,0x8603,0x8304,0x9405,0x2406,0xf507,
175 0x6009,0x000c,0x000d,
176 0x0310,0xff12,0x8013,0x4014,0xff15,0x2416,0xc317,0xff18,
177 0x001a,0x221b,0x001d,
178 0xffff
180 /* 1024x768x16 */
181 unsigned short cseq_1024x768x16[] = {
182 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1707,
183 0x760b,0x760c,0x760d,0x760e,
184 0x0412,0x0013,0x2017,
185 0x341b,0x341c,0x341d,0x341e,
186 0xffff
188 unsigned short ccrtc_1024x768x16[] = {
189 0x2911,0xa300,0x7f01,0x7f02,0x8603,0x8304,0x9405,0x2406,0xf507,
190 0x6009,0x000c,0x000d,
191 0x0310,0xff12,0x0013,0x4014,0xff15,0x2416,0xc317,0xff18,
192 0x001a,0x321b,0x001d,
193 0xffff
195 /* 1024x768x24 */
196 unsigned short cseq_1024x768x24[] = {
197 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1507,
198 0x760b,0x760c,0x760d,0x760e,
199 0x0412,0x0013,0x2017,
200 0x341b,0x341c,0x341d,0x341e,
201 0xffff
203 unsigned short ccrtc_1024x768x24[] = {
204 0x2911,0xa300,0x7f01,0x7f02,0x8603,0x8304,0x9405,0x2406,0xf507,
205 0x6009,0x000c,0x000d,
206 0x0310,0xff12,0x8013,0x4014,0xff15,0x2416,0xc317,0xff18,
207 0x001a,0x321b,0x001d,
208 0xffff
210 /* 1280x1024x8 */
211 unsigned short cseq_1280x1024x8[] = {
212 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1107,
213 0x760b,0x760c,0x760d,0x760e,
214 0x0412,0x0013,0x2017,
215 0x341b,0x341c,0x341d,0x341e,
216 0xffff
218 unsigned short ccrtc_1280x1024x8[] = {
219 0x2911,0xc300,0x9f01,0x9f02,0x8603,0x8304,0x9405,0x2406,0xf707,
220 0x6009,0x000c,0x000d,
221 0x0310,0xff12,0xa013,0x4014,0xff15,0x2416,0xc317,0xff18,
222 0x001a,0x221b,0x001d,
223 0xffff
225 /* 1280x1024x16 */
226 unsigned short cseq_1280x1024x16[] = {
227 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1707,
228 0x760b,0x760c,0x760d,0x760e,
229 0x0412,0x0013,0x2017,
230 0x341b,0x341c,0x341d,0x341e,
231 0xffff
233 unsigned short ccrtc_1280x1024x16[] = {
234 0x2911,0xc300,0x9f01,0x9f02,0x8603,0x8304,0x9405,0x2406,0xf707,
235 0x6009,0x000c,0x000d,
236 0x0310,0xff12,0x4013,0x4014,0xff15,0x2416,0xc317,0xff18,
237 0x001a,0x321b,0x001d,
238 0xffff
241 /* 1600x1200x8 */
242 unsigned short cseq_1600x1200x8[] = {
243 0x0300,0x2101,0x0f02,0x0003,0x0e04,0x1107,
244 0x760b,0x760c,0x760d,0x760e,
245 0x0412,0x0013,0x2017,
246 0x341b,0x341c,0x341d,0x341e,
247 0xffff
249 unsigned short ccrtc_1600x1200x8[] = {
250 0x2911,0xc300,0x9f01,0x9f02,0x8603,0x8304,0x9405,0x2406,0xf707,
251 0x6009,0x000c,0x000d,
252 0x0310,0xff12,0xa013,0x4014,0xff15,0x2416,0xc317,0xff18,
253 0x001a,0x221b,0x001d,
254 0xffff
257 cirrus_mode_t cirrus_modes[] =
259 {0x5f,640,480,8,0x00,
260 cseq_640x480x8,cgraph_svgacolor,ccrtc_640x480x8,8,
261 4,0,0,0,0,0,0,0,0},
262 {0x64,640,480,16,0xe1,
263 cseq_640x480x16,cgraph_svgacolor,ccrtc_640x480x16,16,
264 6,5,11,6,5,5,0,0,0},
265 {0x66,640,480,15,0xf0,
266 cseq_640x480x16,cgraph_svgacolor,ccrtc_640x480x16,16,
267 6,5,10,5,5,5,0,1,15},
268 {0x71,640,480,24,0xe5,
269 cseq_640x480x24,cgraph_svgacolor,ccrtc_640x480x24,24,
270 6,8,16,8,8,8,0,0,0},
272 {0x5c,800,600,8,0x00,
273 cseq_800x600x8,cgraph_svgacolor,ccrtc_800x600x8,8,
274 4,0,0,0,0,0,0,0,0},
275 {0x65,800,600,16,0xe1,
276 cseq_800x600x16,cgraph_svgacolor,ccrtc_800x600x16,16,
277 6,5,11,6,5,5,0,0,0},
278 {0x67,800,600,15,0xf0,
279 cseq_800x600x16,cgraph_svgacolor,ccrtc_800x600x16,16,
280 6,5,10,5,5,5,0,1,15},
282 {0x60,1024,768,8,0x00,
283 cseq_1024x768x8,cgraph_svgacolor,ccrtc_1024x768x8,8,
284 4,0,0,0,0,0,0,0,0},
285 {0x74,1024,768,16,0xe1,
286 cseq_1024x768x16,cgraph_svgacolor,ccrtc_1024x768x16,16,
287 6,5,11,6,5,5,0,0,0},
288 {0x68,1024,768,15,0xf0,
289 cseq_1024x768x16,cgraph_svgacolor,ccrtc_1024x768x16,16,
290 6,5,10,5,5,5,0,1,15},
292 {0x78,800,600,24,0xe5,
293 cseq_800x600x24,cgraph_svgacolor,ccrtc_800x600x24,24,
294 6,8,16,8,8,8,0,0,0},
295 {0x79,1024,768,24,0xe5,
296 cseq_1024x768x24,cgraph_svgacolor,ccrtc_1024x768x24,24,
297 6,8,16,8,8,8,0,0,0},
299 {0x6d,1280,1024,8,0x00,
300 cseq_1280x1024x8,cgraph_svgacolor,ccrtc_1280x1024x8,8,
301 4,0,0,0,0,0,0,0,0},
302 {0x69,1280,1024,15,0xf0,
303 cseq_1280x1024x16,cgraph_svgacolor,ccrtc_1280x1024x16,16,
304 6,5,10,5,5,5,0,1,15},
305 {0x75,1280,1024,16,0xe1,
306 cseq_1280x1024x16,cgraph_svgacolor,ccrtc_1280x1024x16,16,
307 6,5,11,6,5,5,0,0,0},
309 {0x7b,1600,1200,8,0x00,
310 cseq_1600x1200x8,cgraph_svgacolor,ccrtc_1600x1200x8,8,
311 4,0,0,0,0,0,0,0,0},
313 {0xfe,0,0,0,0,cseq_vga,cgraph_vga,ccrtc_vga,0,
314 0xff,0,0,0,0,0,0,0,0},
315 {0xff,0,0,0,0,0,0,0,0,
316 0xff,0,0,0,0,0,0,0,0},
319 unsigned char cirrus_id_table[] = {
320 // 5430
321 0xA0, 0x32,
322 // 5446
323 0xB8, 0x39,
325 0xff, 0xff
329 unsigned short cirrus_vesa_modelist[] = {
330 // 640x480x8
331 0x101, 0x5f,
332 // 640x480x15
333 0x110, 0x66,
334 // 640x480x16
335 0x111, 0x64,
336 // 640x480x24
337 0x112, 0x71,
338 // 800x600x8
339 0x103, 0x5c,
340 // 800x600x15
341 0x113, 0x67,
342 // 800x600x16
343 0x114, 0x65,
344 // 800x600x24
345 0x115, 0x78,
346 // 1024x768x8
347 0x105, 0x60,
348 // 1024x768x15
349 0x116, 0x68,
350 // 1024x768x16
351 0x117, 0x74,
352 // 1024x768x24
353 0x118, 0x79,
354 // 1280x1024x8
355 0x107, 0x6d,
356 // 1280x1024x15
357 0x119, 0x69,
358 // 1280x1024x16
359 0x11a, 0x75,
360 // invalid
361 0xffff,0xffff
365 ASM_START
367 cirrus_installed:
368 .ascii "cirrus-compatible VGA is detected"
369 .byte 0x0d,0x0a
370 .byte 0x0d,0x0a,0x00
372 cirrus_not_installed:
373 .ascii "cirrus-compatible VGA is not detected"
374 .byte 0x0d,0x0a
375 .byte 0x0d,0x0a,0x00
377 cirrus_vesa_vendorname:
378 cirrus_vesa_productname:
379 cirrus_vesa_oemname:
380 .ascii "VGABIOS Cirrus extension"
381 .byte 0
382 cirrus_vesa_productrevision:
383 .ascii "1.0"
384 .byte 0
386 cirrus_init:
387 call cirrus_check
388 jnz no_cirrus
389 SET_INT_VECTOR(0x10, #0xC000, #cirrus_int10_handler)
390 mov al, #0x0f ; memory setup
391 mov dx, #0x3C4
392 out dx, al
393 inc dx
394 in al, dx
395 and al, #0x18
396 mov ah, al
397 mov al, #0x0a
398 dec dx
399 out dx, ax
400 mov ax, #0x0007 ; set vga mode
401 out dx, ax
402 mov ax, #0x0431 ; reset bitblt
403 mov dx, #0x3CE
404 out dx, ax
405 mov ax, #0x0031
406 out dx, ax
407 no_cirrus:
410 cirrus_display_info:
411 push ds
412 push si
413 push cs
414 pop ds
415 call cirrus_check
416 mov si, #cirrus_not_installed
417 jnz cirrus_msgnotinstalled
418 mov si, #cirrus_installed
420 cirrus_msgnotinstalled:
421 call _display_string
422 pop si
423 pop ds
426 cirrus_check:
427 push ax
428 push dx
429 mov ax, #0x9206
430 mov dx, #0x3C4
431 out dx, ax
432 inc dx
433 in al, dx
434 cmp al, #0x12
435 pop dx
436 pop ax
440 cirrus_int10_handler:
441 pushf
442 push bp
443 cmp ah, #0x00 ;; set video mode
444 jz cirrus_set_video_mode
445 cmp ah, #0x12 ;; cirrus extension
446 jz cirrus_extbios
447 cmp ah, #0x4F ;; VESA extension
448 jz cirrus_vesa
450 cirrus_unhandled:
451 pop bp
452 popf
453 jmp vgabios_int10_handler
455 cirrus_return:
456 #ifdef CIRRUS_DEBUG
457 call cirrus_debug_dump
458 #endif
459 pop bp
460 popf
461 iret
463 cirrus_set_video_mode:
464 #ifdef CIRRUS_DEBUG
465 call cirrus_debug_dump
466 #endif
467 push si
468 push ax
469 push bx
470 push ds
471 #ifdef CIRRUS_VESA3_PMINFO
472 db 0x2e ;; cs:
473 mov si, [cirrus_vesa_sel0000_data]
474 #else
475 xor si, si
476 #endif
477 mov ds, si
478 xor bx, bx
479 mov [PM_BIOSMEM_VBE_MODE], bx
480 pop ds
481 pop bx
482 call cirrus_get_modeentry
483 jnc cirrus_set_video_mode_extended
484 mov al, #0xfe
485 call cirrus_get_modeentry_nomask
486 call cirrus_switch_mode
487 pop ax
488 pop si
489 jmp cirrus_unhandled
491 cirrus_extbios:
492 #ifdef CIRRUS_DEBUG
493 call cirrus_debug_dump
494 #endif
495 cmp bl, #0x80
496 jb cirrus_unhandled
497 cmp bl, #0xAF
498 ja cirrus_unhandled
499 push bx
500 and bx, #0x7F
501 shl bx, 1
502 db 0x2e ;; cs:
503 mov bp, cirrus_extbios_handlers[bx]
504 pop bx
505 push #cirrus_return
506 push bp
509 cirrus_vesa:
510 #ifdef CIRRUS_DEBUG
511 call cirrus_debug_dump
512 #endif
513 cmp al, #0x0F
514 ja cirrus_vesa_not_handled
515 push bx
516 xor bx, bx
517 mov bl, al
518 shl bx, 1
519 db 0x2e ;; cs:
520 mov bp, cirrus_vesa_handlers[bx]
521 pop bx
522 push #cirrus_return
523 push bp
526 cirrus_vesa_not_handled:
527 mov ax, #0x014F ;; not implemented
528 jmp cirrus_return
530 #ifdef CIRRUS_DEBUG
531 cirrus_debug_dump:
532 push es
533 push ds
534 pusha
535 push cs
536 pop ds
537 call _cirrus_debugmsg
538 popa
539 pop ds
540 pop es
542 #endif
544 cirrus_set_video_mode_extended:
545 call cirrus_switch_mode
546 pop ax ;; mode
547 test al, #0x80
548 jnz cirrus_set_video_mode_extended_1
549 push ax
550 mov ax, #0xffff ; set to 0xff to keep win 2K happy
551 call cirrus_clear_vram
552 pop ax
553 cirrus_set_video_mode_extended_1:
554 and al, #0x7f
556 push ds
557 #ifdef CIRRUS_VESA3_PMINFO
558 db 0x2e ;; cs:
559 mov si, [cirrus_vesa_sel0000_data]
560 #else
561 xor si, si
562 #endif
563 mov ds, si
564 mov [PM_BIOSMEM_CURRENT_MODE], al
565 pop ds
567 mov al, #0x20
569 pop si
570 jmp cirrus_return
572 cirrus_vesa_pmbios_init:
573 retf
574 cirrus_vesa_pmbios_entry:
575 pushf
576 push bp
577 cmp ah, #0x4F
578 jnz cirrus_vesa_pmbios_unimplemented
579 cmp al, #0x0F
580 ja cirrus_vesa_pmbios_unimplemented
581 push bx
582 xor bx, bx
583 mov bl, al
584 shl bx, 1
585 db 0x2e ;; cs:
586 mov bp, cirrus_vesa_handlers[bx]
587 pop bx
588 push #cirrus_vesa_pmbios_return
589 push bp
591 cirrus_vesa_pmbios_unimplemented:
592 mov ax, #0x014F
593 cirrus_vesa_pmbios_return:
594 pop bp
595 popf
596 retf
598 ; in si:mode table
599 cirrus_switch_mode:
600 push ds
601 push bx
602 push dx
603 push cs
604 pop ds
606 mov bx, [si+10] ;; seq
607 mov dx, #0x3c4
608 mov ax, #0x1206
609 out dx, ax ;; Unlock cirrus special
610 call cirrus_switch_mode_setregs
612 mov bx, [si+12] ;; graph
613 mov dx, #0x3ce
614 call cirrus_switch_mode_setregs
616 mov bx, [si+14] ;; crtc
617 call cirrus_get_crtc
618 call cirrus_switch_mode_setregs
620 mov dx, #0x3c6
621 mov al, #0x00
622 out dx, al
623 in al, dx
624 in al, dx
625 in al, dx
626 in al, dx
627 mov al, [si+8] ;; hidden dac
628 out dx, al
629 mov al, #0xff
630 out dx, al
632 mov al, #0x00
633 mov bl, [si+17] ;; memory model
634 or bl, bl
635 jz is_text_mode
636 mov al, #0x01
637 cmp bl, #0x03
638 jnz is_text_mode
639 or al, #0x40
640 is_text_mode:
641 mov bl, #0x10
642 call biosfn_get_single_palette_reg
643 and bh, #0xfe
644 or bh, al
645 call biosfn_set_single_palette_reg
647 pop dx
648 pop bx
649 pop ds
652 cirrus_enable_16k_granularity:
653 push ax
654 push dx
655 mov dx, #0x3ce
656 mov al, #0x0b
657 out dx, al
658 inc dx
659 in al, dx
660 or al, #0x20 ;; enable 16k
661 out dx, al
662 pop dx
663 pop ax
666 cirrus_switch_mode_setregs:
667 csms_1:
668 mov ax, [bx]
669 cmp ax, #0xffff
670 jz csms_2
671 out dx, ax
672 add bx, #0x2
673 jmp csms_1
674 csms_2:
677 cirrus_extbios_80h:
678 push dx
679 call cirrus_get_crtc
680 mov al, #0x27
681 out dx, al
682 inc dx
683 in al, dx
684 mov bx, #_cirrus_id_table
685 c80h_1:
686 db 0x2e ;; cs:
687 mov ah, [bx]
688 cmp ah, al
689 jz c80h_2
690 cmp ah, #0xff
691 jz c80h_2
692 inc bx
693 inc bx
694 jmp c80h_1
695 c80h_2:
696 db 0x2e ;; cs:
697 mov al, 0x1[bx]
698 pop dx
699 mov ah, #0x00
700 xor bx, bx
703 cirrus_extbios_81h:
704 mov ax, #0x100 ;; XXX
706 cirrus_extbios_82h:
707 push dx
708 call cirrus_get_crtc
709 xor ax, ax
710 mov al, #0x27
711 out dx, al
712 inc dx
713 in al, dx
714 and al, #0x03
715 mov ah, #0xAF
716 pop dx
719 cirrus_extbios_85h:
720 push cx
721 push dx
722 mov dx, #0x3C4
723 mov al, #0x0f ;; get DRAM band width
724 out dx, al
725 inc dx
726 in al, dx
727 ;; al = 4 << bandwidth
728 mov cl, al
729 shr cl, #0x03
730 and cl, #0x03
731 cmp cl, #0x03
732 je c85h2
733 mov al, #0x04
734 shl al, cl
735 jmp c85h3
736 c85h2:
737 ;; 4MB or 2MB
738 and al, #0x80
739 mov al, #0x20 ;; 2 MB
740 je c85h3
741 mov al, #0x40 ;; 4 MB
742 c85h3:
743 pop dx
744 pop cx
747 cirrus_extbios_9Ah:
748 mov ax, #0x4060
749 mov cx, #0x1132
752 cirrus_extbios_A0h:
753 call cirrus_get_modeentry
754 mov ah, #0x01
755 sbb ah, #0x00
756 mov bx, cirrus_extbios_A0h_callback
757 mov si, #0xffff
758 mov di, bx
759 mov ds, bx
760 mov es, bx
763 cirrus_extbios_A0h_callback:
764 ;; fatal: not implemented yet
767 retf
769 cirrus_extbios_A1h:
770 mov bx, #0x0E00 ;; IBM 8512/8513, color
773 cirrus_extbios_A2h:
774 mov al, #0x07 ;; HSync 31.5 - 64.0 kHz
777 cirrus_extbios_AEh:
778 mov al, #0x01 ;; High Refresh 75Hz
781 cirrus_extbios_unimplemented:
784 cirrus_vesa_00h:
785 push ds
786 push si
787 mov bp, di
788 push es
789 pop ds
791 mov ax, [di]
792 cmp ax, #0x4256 ;; VB
793 jnz cv00_1
794 mov ax, [di+2]
795 cmp ax, #0x3245 ;; E2
796 jnz cv00_1
797 ;; VBE2
798 lea di, 0x14[bp]
799 mov ax, #0x0100 ;; soft ver.
800 stosw
801 mov ax, # cirrus_vesa_vendorname
802 stosw
803 mov ax, cs
804 stosw
805 mov ax, # cirrus_vesa_productname
806 stosw
807 mov ax, cs
808 stosw
809 mov ax, # cirrus_vesa_productrevision
810 stosw
811 mov ax, cs
812 stosw
813 cv00_1:
814 mov di, bp
815 mov ax, #0x4556 ;; VE
816 stosw
817 mov ax, #0x4153 ;; SA
818 stosw
819 mov ax, #0x0200 ;; v2.00
820 stosw
821 mov ax, # cirrus_vesa_oemname
822 stosw
823 mov ax, cs
824 stosw
825 xor ax, ax ;; caps
826 stosw
827 stosw
828 lea ax, 0x40[bp]
829 stosw
830 mov ax, es
831 stosw
832 call cirrus_extbios_85h ;; vram in 64k
833 mov ah, #0x00
834 stosw
836 push cs
837 pop ds
838 lea di, 0x40[bp]
839 mov si, #_cirrus_vesa_modelist
840 cv00_2:
841 lodsw
842 stosw
843 add si, #2
844 cmp ax, #0xffff
845 jnz cv00_2
847 mov ax, #0x004F
848 mov di, bp
849 pop si
850 pop ds
853 cirrus_vesa_01h:
854 mov ax, cx
855 and ax, #0x3fff
856 call cirrus_vesamode_to_mode
857 cmp ax, #0xffff
858 jnz cirrus_vesa_01h_1
859 jmp cirrus_vesa_unimplemented
860 cirrus_vesa_01h_1:
861 push ds
862 push si
863 push cx
864 push dx
865 push bx
866 mov bp, di
868 push cs
869 pop ds
870 call cirrus_get_modeentry_nomask
872 push di
873 xor ax, ax
874 mov cx, #0x80
876 stosw ;; clear buffer
877 pop di
879 mov ax, #0x003b ;; mode
880 stosw
881 mov ax, #0x0007 ;; attr
882 stosw
883 mov ax, #0x0010 ;; granularity =16K
884 stosw
885 mov ax, #0x0040 ;; size =64K
886 stosw
887 mov ax, #0xA000 ;; segment A
888 stosw
889 xor ax, ax ;; no segment B
890 stosw
891 mov ax, #cirrus_vesa_05h_farentry
892 stosw
893 mov ax, cs
894 stosw
895 call cirrus_get_line_offset_entry
896 stosw ;; bytes per scan line
897 mov ax, [si+2] ;; width
898 stosw
899 mov ax, [si+4] ;; height
900 stosw
901 mov ax, #0x08
902 stosb
903 mov ax, #0x10
904 stosb
905 mov al, #1 ;; count of planes
906 stosb
907 mov al, [si+6] ;; bpp
908 stosb
909 mov al, #0x1 ;; XXX number of banks
910 stosb
911 mov al, [si+17]
912 stosb ;; memory model
913 mov al, #0x0 ;; XXX size of bank in K
914 stosb
915 call cirrus_get_line_offset_entry
916 mov bx, [si+4]
917 mul bx ;; dx:ax=vramdisp
918 or ax, ax
919 jz cirrus_vesa_01h_3
920 inc dx
921 cirrus_vesa_01h_3:
922 call cirrus_extbios_85h ;; al=vram in 64k
923 mov ah, #0x00
924 mov cx, dx
925 xor dx, dx
926 div cx
927 dec ax
928 stosb ;; number of image pages = vramtotal/vramdisp-1
929 mov al, #0x00
930 stosb
932 ;; v1.2+ stuffs
933 push si
934 add si, #18
935 movsw
936 movsw
937 movsw
938 movsw
939 pop si
941 mov ah, [si+16]
942 mov al, #0x0
943 sub ah, #9
944 rcl al, #1 ; bit 0=palette flag
945 stosb ;; direct screen mode info
947 ;; v2.0+ stuffs
948 ;; 32-bit LFB address
949 xor ax, ax
950 stosw
951 call cirrus_get_lfb_addr
952 stosw
953 or ax, ax
954 jz cirrus_vesa_01h_4
955 push di
956 mov di, bp
957 db 0x26 ;; es:
958 mov ax, [di]
959 or ax, #0x0080 ;; mode bit 7:LFB
960 stosw
961 pop di
962 cirrus_vesa_01h_4:
964 xor ax, ax
965 stosw ; reserved
966 stosw ; reserved
967 stosw ; reserved
969 mov ax, #0x004F
970 mov di, bp
971 pop bx
972 pop dx
973 pop cx
974 pop si
975 pop ds
977 test cx, #0x4000 ;; LFB flag
978 jz cirrus_vesa_01h_5
979 push cx
980 db 0x26 ;; es:
981 mov cx, [di]
982 cmp cx, #0x0080 ;; is LFB supported?
983 jnz cirrus_vesa_01h_6
984 mov ax, #0x014F ;; error - no LFB
985 cirrus_vesa_01h_6:
986 pop cx
987 cirrus_vesa_01h_5:
990 cirrus_vesa_02h:
991 ;; XXX support CRTC registers
992 test bx, #0x3e00
993 jnz cirrus_vesa_02h_2 ;; unknown flags
994 mov ax, bx
995 and ax, #0x1ff ;; bit 8-0 mode
996 cmp ax, #0x100 ;; legacy VGA mode
997 jb cirrus_vesa_02h_legacy
998 call cirrus_vesamode_to_mode
999 cmp ax, #0xffff
1000 jnz cirrus_vesa_02h_1
1001 cirrus_vesa_02h_2:
1002 jmp cirrus_vesa_unimplemented
1003 cirrus_vesa_02h_legacy:
1004 #ifdef CIRRUS_VESA3_PMINFO
1005 db 0x2e ;; cs:
1006 cmp byte ptr [cirrus_vesa_is_protected_mode], #0
1007 jnz cirrus_vesa_02h_2
1008 #endif // CIRRUS_VESA3_PMINFO
1009 int #0x10
1010 mov ax, #0x004F
1012 cirrus_vesa_02h_1:
1013 push si
1014 push ax
1015 call cirrus_get_modeentry_nomask
1016 call cirrus_switch_mode
1017 test bx, #0x4000 ;; LFB
1018 jnz cirrus_vesa_02h_3
1019 call cirrus_enable_16k_granularity
1020 cirrus_vesa_02h_3:
1021 test bx, #0x8000 ;; no clear
1022 jnz cirrus_vesa_02h_4
1023 push ax
1024 xor ax,ax
1025 call cirrus_clear_vram
1026 pop ax
1027 cirrus_vesa_02h_4:
1028 pop ax
1029 push ds
1030 #ifdef CIRRUS_VESA3_PMINFO
1031 db 0x2e ;; cs:
1032 mov si, [cirrus_vesa_sel0000_data]
1033 #else
1034 xor si, si
1035 #endif
1036 mov ds, si
1037 mov [PM_BIOSMEM_CURRENT_MODE], al
1038 mov [PM_BIOSMEM_VBE_MODE], bx
1039 pop ds
1040 pop si
1041 mov ax, #0x004F
1044 cirrus_vesa_03h:
1045 push ds
1046 #ifdef CIRRUS_VESA3_PMINFO
1047 db 0x2e ;; cs:
1048 mov ax, [cirrus_vesa_sel0000_data]
1049 #else
1050 xor ax, ax
1051 #endif
1052 mov ds, ax
1053 mov bx, # PM_BIOSMEM_VBE_MODE
1054 mov ax, [bx]
1055 mov bx, ax
1056 test bx, bx
1057 jnz cirrus_vesa_03h_1
1058 mov bx, # PM_BIOSMEM_CURRENT_MODE
1059 mov al, [bx]
1060 mov bl, al
1061 xor bh, bh
1062 cirrus_vesa_03h_1:
1063 mov ax, #0x004f
1064 pop ds
1067 cirrus_vesa_05h_farentry:
1068 call cirrus_vesa_05h
1069 retf
1071 cirrus_vesa_05h:
1072 cmp bl, #0x01
1073 ja cirrus_vesa_05h_1
1074 cmp bh, #0x00
1075 jz cirrus_vesa_05h_setmempage
1076 cmp bh, #0x01
1077 jz cirrus_vesa_05h_getmempage
1078 cirrus_vesa_05h_1:
1079 jmp cirrus_vesa_unimplemented
1080 cirrus_vesa_05h_setmempage:
1081 or dh, dh ; address must be < 0x100
1082 jnz cirrus_vesa_05h_1
1083 push dx
1084 mov al, bl ;; bl=bank number
1085 add al, #0x09
1086 mov ah, dl ;; dx=window address in granularity
1087 mov dx, #0x3ce
1088 out dx, ax
1089 pop dx
1090 mov ax, #0x004F
1092 cirrus_vesa_05h_getmempage:
1093 mov al, bl ;; bl=bank number
1094 add al, #0x09
1095 mov dx, #0x3ce
1096 out dx, al
1097 inc dx
1098 in al, dx
1099 xor dx, dx
1100 mov dl, al ;; dx=window address in granularity
1101 mov ax, #0x004F
1104 cirrus_vesa_06h:
1105 mov ax, cx
1106 cmp bl, #0x01
1107 je cirrus_vesa_06h_3
1108 cmp bl, #0x02
1109 je cirrus_vesa_06h_2
1110 jb cirrus_vesa_06h_1
1111 mov ax, #0x0100
1113 cirrus_vesa_06h_1:
1114 call cirrus_get_bpp_bytes
1115 mov bl, al
1116 xor bh, bh
1117 mov ax, cx
1118 mul bx
1119 cirrus_vesa_06h_2:
1120 call cirrus_set_line_offset
1121 cirrus_vesa_06h_3:
1122 call cirrus_get_bpp_bytes
1123 mov bl, al
1124 xor bh, bh
1125 xor dx, dx
1126 call cirrus_get_line_offset
1127 push ax
1128 div bx
1129 mov cx, ax
1130 pop bx
1131 call cirrus_extbios_85h ;; al=vram in 64k
1132 xor dx, dx
1133 mov dl, al
1134 xor ax, ax
1135 div bx
1136 mov dx, ax
1137 mov ax, #0x004f
1140 cirrus_vesa_07h:
1141 cmp bl, #0x80
1142 je cirrus_vesa_07h_1
1143 cmp bl, #0x01
1144 je cirrus_vesa_07h_2
1145 jb cirrus_vesa_07h_1
1146 mov ax, #0x0100
1148 cirrus_vesa_07h_1:
1149 push dx
1150 call cirrus_get_bpp_bytes
1151 mov bl, al
1152 xor bh, bh
1153 mov ax, cx
1154 mul bx
1155 pop bx
1156 push ax
1157 call cirrus_get_line_offset
1158 mul bx
1159 pop bx
1160 add ax, bx
1161 jnc cirrus_vesa_07h_3
1162 inc dx
1163 cirrus_vesa_07h_3:
1164 push dx
1165 and dx, #0x0003
1166 mov bx, #0x04
1167 div bx
1168 pop dx
1169 shr dx, #2
1170 call cirrus_set_start_addr
1171 mov ax, #0x004f
1173 cirrus_vesa_07h_2:
1174 call cirrus_get_start_addr
1175 shl dx, #2
1176 push dx
1177 mov bx, #0x04
1178 mul bx
1179 pop bx
1180 or dx, bx
1181 push ax
1182 call cirrus_get_line_offset
1183 mov bx, ax
1184 pop ax
1185 div bx
1186 push ax
1187 push dx
1188 call cirrus_get_bpp_bytes
1189 mov bl, al
1190 xor bh, bh
1191 pop ax
1192 xor dx, dx
1193 div bx
1194 mov cx, ax
1195 pop dx
1196 mov ax, #0x004f
1199 cirrus_vesa_unimplemented:
1200 mov ax, #0x014F ;; not implemented
1204 ;; in ax:vesamode, out ax:cirrusmode
1205 cirrus_vesamode_to_mode:
1206 push ds
1207 push cx
1208 push si
1209 push cs
1210 pop ds
1211 mov cx, #0xffff
1212 mov si, #_cirrus_vesa_modelist
1213 cvtm_1:
1214 cmp [si],ax
1215 jz cvtm_2
1216 cmp [si],cx
1217 jz cvtm_2
1218 add si, #4
1219 jmp cvtm_1
1220 cvtm_2:
1221 mov ax,[si+2]
1222 pop si
1223 pop cx
1224 pop ds
1227 ; cirrus_get_crtc
1228 ;; NOTE - may be called in protected mode
1229 cirrus_get_crtc:
1230 push ds
1231 push ax
1232 mov dx, #0x3cc
1233 in al, dx
1234 and al, #0x01
1235 shl al, #5
1236 mov dx, #0x3b4
1237 add dl, al
1238 pop ax
1239 pop ds
1242 ;; in - al:mode, out - cflag:result, si:table, ax:destroyed
1243 cirrus_get_modeentry:
1244 and al, #0x7f
1245 cirrus_get_modeentry_nomask:
1246 mov si, #_cirrus_modes
1247 cgm_1:
1248 db 0x2e ;; cs:
1249 mov ah, [si]
1250 cmp al, ah
1251 jz cgm_2
1252 cmp ah, #0xff
1253 jz cgm_4
1254 add si, # CIRRUS_MODE_SIZE
1255 jmp cgm_1
1256 cgm_4:
1257 xor si, si
1258 stc ;; video mode is not supported
1259 jmp cgm_3
1260 cgm_2:
1261 clc ;; video mode is supported
1262 cgm_3:
1265 ; get LFB address
1266 ; out - ax:LFB address (high 16 bit)
1267 ;; NOTE - may be called in protected mode
1268 cirrus_get_lfb_addr:
1269 push cx
1270 push dx
1271 push eax
1272 xor cx, cx
1273 mov dl, #0x00
1274 call cirrus_pci_read
1275 cmp ax, #0xffff
1276 jz cirrus_get_lfb_addr_5
1277 cirrus_get_lfb_addr_3:
1278 mov dl, #0x00
1279 call cirrus_pci_read
1280 cmp ax, #0x1013 ;; cirrus
1281 jz cirrus_get_lfb_addr_4
1282 add cx, #0x8
1283 cmp cx, #0x200 ;; search bus #0 and #1
1284 jb cirrus_get_lfb_addr_3
1285 cirrus_get_lfb_addr_5:
1286 xor dx, dx ;; no LFB
1287 jmp cirrus_get_lfb_addr_6
1288 cirrus_get_lfb_addr_4:
1289 mov dl, #0x10 ;; I/O space #0
1290 call cirrus_pci_read
1291 test ax, #0xfff1
1292 jnz cirrus_get_lfb_addr_5
1293 shr eax, #16
1294 mov dx, ax ;; LFB address
1295 cirrus_get_lfb_addr_6:
1296 pop eax
1297 mov ax, dx
1298 pop dx
1299 pop cx
1302 cirrus_pci_read:
1303 mov eax, #0x00800000
1304 mov ax, cx
1305 shl eax, #8
1306 mov al, dl
1307 mov dx, #0xcf8
1308 out dx, eax
1309 add dl, #4
1310 in eax, dx
1313 ;; out - al:bytes per pixel
1314 cirrus_get_bpp_bytes:
1315 push dx
1316 mov dx, #0x03c4
1317 mov al, #0x07
1318 out dx, al
1319 inc dx
1320 in al, dx
1321 and al, #0x0e
1322 cmp al, #0x06
1323 jne cirrus_get_bpp_bytes_1
1324 and al, #0x02
1325 cirrus_get_bpp_bytes_1:
1326 shr al, #1
1327 cmp al, #0x04
1328 je cirrus_get_bpp_bytes_2
1329 inc al
1330 cirrus_get_bpp_bytes_2:
1331 pop dx
1334 ;; in - ax: new line offset
1335 cirrus_set_line_offset:
1336 shr ax, #3
1337 push ax
1338 call cirrus_get_crtc
1339 mov al, #0x13
1340 out dx, al
1341 inc dx
1342 pop ax
1343 out dx, al
1344 dec dx
1345 mov al, #0x1b
1346 out dx, al
1347 inc dx
1348 shl ah, #4
1349 in al, dx
1350 and al, #ef
1351 or al, ah
1352 out dx, al
1355 ;; out - ax: active line offset
1356 cirrus_get_line_offset:
1357 push dx
1358 push bx
1359 call cirrus_get_crtc
1360 mov al, #0x13
1361 out dx, al
1362 inc dx
1363 in al, dx
1364 mov bl, al
1365 dec dx
1366 mov al, #0x1b
1367 out dx, al
1368 inc dx
1369 in al, dx
1370 mov ah, al
1371 shr ah, #4
1372 and ah, #0x01
1373 mov al, bl
1374 shl ax, #3
1375 pop bx
1376 pop dx
1379 ;; in - si: table
1380 ;; out - ax: line offset for mode
1381 cirrus_get_line_offset_entry:
1382 push bx
1383 mov bx, [si+14] ;; crtc table
1384 push bx
1385 offset_loop1:
1386 mov ax, [bx]
1387 cmp al, #0x13
1388 je offset_found1
1389 inc bx
1390 inc bx
1391 jnz offset_loop1
1392 offset_found1:
1393 xor al, al
1394 shr ax, #5
1395 pop bx
1396 push ax
1397 offset_loop2:
1398 mov ax, [bx]
1399 cmp al, #0x1b
1400 je offset_found2
1401 inc bx
1402 inc bx
1403 jnz offset_loop2
1404 offset_found2:
1405 pop bx
1406 and ax, #0x1000
1407 shr ax, #1
1408 or ax, bx
1409 pop bx
1412 ;; in - new address in DX:AX
1413 cirrus_set_start_addr:
1414 push bx
1415 push dx
1416 push ax
1417 call cirrus_get_crtc
1418 mov al, #0x0d
1419 out dx, al
1420 inc dx
1421 pop ax
1422 out dx, al
1423 dec dx
1424 mov al, #0x0c
1425 out dx, al
1426 inc dx
1427 mov al, ah
1428 out dx, al
1429 dec dx
1430 mov al, #0x1d
1431 out dx, al
1432 inc dx
1433 in al, dx
1434 and al, #0x7f
1435 pop bx
1436 mov ah, bl
1437 shl bl, #4
1438 and bl, #0x80
1439 or al, bl
1440 out dx, al
1441 dec dx
1442 mov bl, ah
1443 and ah, #0x01
1444 shl bl, #1
1445 and bl, #0x0c
1446 or ah, bl
1447 mov al, #0x1b
1448 out dx, al
1449 inc dx
1450 in al, dx
1451 and al, #0xf2
1452 or al, ah
1453 out dx, al
1454 pop bx
1457 ;; out - current address in DX:AX
1458 cirrus_get_start_addr:
1459 push bx
1460 call cirrus_get_crtc
1461 mov al, #0x0c
1462 out dx, al
1463 inc dx
1464 in al, dx
1465 mov ah, al
1466 dec dx
1467 mov al, #0x0d
1468 out dx, al
1469 inc dx
1470 in al, dx
1471 push ax
1472 dec dx
1473 mov al, #0x1b
1474 out dx, al
1475 inc dx
1476 in al, dx
1477 dec dx
1478 mov bl, al
1479 and al, #0x01
1480 and bl, #0x0c
1481 shr bl, #1
1482 or bl, al
1483 mov al, #0x1d
1484 out dx, al
1485 inc dx
1486 in al, dx
1487 and al, #0x80
1488 shr al, #4
1489 or bl, al
1490 mov dl, bl
1491 xor dh, dh
1492 pop ax
1493 pop bx
1496 cirrus_clear_vram:
1497 pusha
1498 push es
1499 mov si, ax
1501 call cirrus_enable_16k_granularity
1502 call cirrus_extbios_85h
1503 shl al, #2
1504 mov bl, al
1505 xor ah,ah
1506 cirrus_clear_vram_1:
1507 mov al, #0x09
1508 mov dx, #0x3ce
1509 out dx, ax
1510 push ax
1511 mov cx, #0xa000
1512 mov es, cx
1513 xor di, di
1514 mov ax, si
1515 mov cx, #8192
1517 rep
1518 stosw
1519 pop ax
1520 inc ah
1521 cmp ah, bl
1522 jne cirrus_clear_vram_1
1524 pop es
1525 popa
1528 cirrus_extbios_handlers:
1529 ;; 80h
1530 dw cirrus_extbios_80h
1531 dw cirrus_extbios_81h
1532 dw cirrus_extbios_82h
1533 dw cirrus_extbios_unimplemented
1534 ;; 84h
1535 dw cirrus_extbios_unimplemented
1536 dw cirrus_extbios_85h
1537 dw cirrus_extbios_unimplemented
1538 dw cirrus_extbios_unimplemented
1539 ;; 88h
1540 dw cirrus_extbios_unimplemented
1541 dw cirrus_extbios_unimplemented
1542 dw cirrus_extbios_unimplemented
1543 dw cirrus_extbios_unimplemented
1544 ;; 8Ch
1545 dw cirrus_extbios_unimplemented
1546 dw cirrus_extbios_unimplemented
1547 dw cirrus_extbios_unimplemented
1548 dw cirrus_extbios_unimplemented
1549 ;; 90h
1550 dw cirrus_extbios_unimplemented
1551 dw cirrus_extbios_unimplemented
1552 dw cirrus_extbios_unimplemented
1553 dw cirrus_extbios_unimplemented
1554 ;; 94h
1555 dw cirrus_extbios_unimplemented
1556 dw cirrus_extbios_unimplemented
1557 dw cirrus_extbios_unimplemented
1558 dw cirrus_extbios_unimplemented
1559 ;; 98h
1560 dw cirrus_extbios_unimplemented
1561 dw cirrus_extbios_unimplemented
1562 dw cirrus_extbios_9Ah
1563 dw cirrus_extbios_unimplemented
1564 ;; 9Ch
1565 dw cirrus_extbios_unimplemented
1566 dw cirrus_extbios_unimplemented
1567 dw cirrus_extbios_unimplemented
1568 dw cirrus_extbios_unimplemented
1569 ;; A0h
1570 dw cirrus_extbios_A0h
1571 dw cirrus_extbios_A1h
1572 dw cirrus_extbios_A2h
1573 dw cirrus_extbios_unimplemented
1574 ;; A4h
1575 dw cirrus_extbios_unimplemented
1576 dw cirrus_extbios_unimplemented
1577 dw cirrus_extbios_unimplemented
1578 dw cirrus_extbios_unimplemented
1579 ;; A8h
1580 dw cirrus_extbios_unimplemented
1581 dw cirrus_extbios_unimplemented
1582 dw cirrus_extbios_unimplemented
1583 dw cirrus_extbios_unimplemented
1584 ;; ACh
1585 dw cirrus_extbios_unimplemented
1586 dw cirrus_extbios_unimplemented
1587 dw cirrus_extbios_AEh
1588 dw cirrus_extbios_unimplemented
1590 cirrus_vesa_handlers:
1591 ;; 00h
1592 dw cirrus_vesa_00h
1593 dw cirrus_vesa_01h
1594 dw cirrus_vesa_02h
1595 dw cirrus_vesa_03h
1596 ;; 04h
1597 dw cirrus_vesa_unimplemented
1598 dw cirrus_vesa_05h
1599 dw cirrus_vesa_06h
1600 dw cirrus_vesa_07h
1601 ;; 08h
1602 dw cirrus_vesa_unimplemented
1603 dw cirrus_vesa_unimplemented
1604 dw cirrus_vesa_unimplemented
1605 dw cirrus_vesa_unimplemented
1606 ;; 0Ch
1607 dw cirrus_vesa_unimplemented
1608 dw cirrus_vesa_unimplemented
1609 dw cirrus_vesa_unimplemented
1610 dw cirrus_vesa_unimplemented
1614 ASM_END
1616 #ifdef CIRRUS_VESA3_PMINFO
1617 ASM_START
1618 cirrus_vesa_pminfo:
1619 /* + 0 */
1620 .byte 0x50,0x4d,0x49,0x44 ;; signature[4]
1621 /* + 4 */
1622 dw cirrus_vesa_pmbios_entry ;; entry_bios
1623 dw cirrus_vesa_pmbios_init ;; entry_init
1624 /* + 8 */
1625 cirrus_vesa_sel0000_data:
1626 dw 0x0000 ;; sel_00000
1627 cirrus_vesa_selA000_data:
1628 dw 0xA000 ;; sel_A0000
1629 /* +12 */
1630 cirrus_vesa_selB000_data:
1631 dw 0xB000 ;; sel_B0000
1632 cirrus_vesa_selB800_data:
1633 dw 0xB800 ;; sel_B8000
1634 /* +16 */
1635 cirrus_vesa_selC000_data:
1636 dw 0xC000 ;; sel_C0000
1637 cirrus_vesa_is_protected_mode:
1638 ;; protected mode flag and checksum
1639 dw (~((0xf2 + (cirrus_vesa_pmbios_entry >> 8) + (cirrus_vesa_pmbios_entry) \
1640 + (cirrus_vesa_pmbios_init >> 8) + (cirrus_vesa_pmbios_init)) & 0xff) << 8) + 0x01
1641 ASM_END
1642 #endif // CIRRUS_VESA3_PMINFO
1645 #ifdef CIRRUS_DEBUG
1646 static void cirrus_debugmsg(DI, SI, BP, SP, BX, DX, CX, AX, DS, ES, FLAGS)
1647 Bit16u DI, SI, BP, SP, BX, DX, CX, AX, ES, DS, FLAGS;
1649 if((GET_AH()!=0x0E)&&(GET_AH()!=0x02)&&(GET_AH()!=0x09)&&(AX!=0x4F05))
1650 printf("vgabios call ah%02x al%02x bx%04x cx%04x dx%04x\n",GET_AH(),GET_AL(),BX,CX,DX);
1652 #endif