2 ===================================================================
3 RCS file: /sources/vgabios/vgabios/Makefile,v
4 retrieving revision 1.17
5 diff -u -w -r1.17 Makefile
6 --- Makefile 6 Mar 2005 13:06:47 -0000 1.17
7 +++ Makefile 14 Jun 2006 00:51:06 -0000
9 cirrus-bios: vgabios-cirrus.bin vgabios-cirrus.debug.bin
12 - /bin/rm -f biossums *.o *.s *.ld86 \
13 + /bin/rm -f biossums vbetables-gen vbetables.h *.o *.s *.ld86 \
14 temp.awk.* vgabios*.orig _vgabios_* _vgabios-debug_* core vgabios*.bin vgabios*.txt $(RELEASE).bin *.bak
20 $(CC) -o biossums biossums.c
22 +vbetables-gen: vbetables-gen.c
23 + $(CC) -o vbetables-gen vbetables-gen.c
25 +vbetables.h: vbetables-gen
26 + ./vbetables-gen > $@
28 ===================================================================
29 RCS file: /sources/vgabios/vgabios/clext.c,v
30 retrieving revision 1.10
31 diff -u -w -r1.10 clext.c
32 --- clext.c 25 Mar 2006 10:19:15 -0000 1.10
33 +++ clext.c 14 Jun 2006 00:51:06 -0000
35 cirrus_set_video_mode_extended:
36 call cirrus_switch_mode
39 + jnz cirrus_set_video_mode_extended_1
41 + mov ax, #0xffff ; set to 0xff to keep win 2K happy
42 + call cirrus_clear_vram
44 +cirrus_set_video_mode_extended_1:
48 @@ -1011,6 +1018,13 @@
50 call cirrus_enable_16k_granularity
52 + test bx, #0x8000 ;; no clear
53 + jnz cirrus_vesa_02h_4
56 + call cirrus_clear_vram
61 #ifdef CIRRUS_VESA3_PMINFO
62 @@ -1479,6 +1493,38 @@
71 + call cirrus_enable_16k_granularity
72 + call cirrus_extbios_85h
92 + jne cirrus_clear_vram_1
98 cirrus_extbios_handlers:
100 dw cirrus_extbios_80h
102 ===================================================================
103 RCS file: /sources/vgabios/vgabios/vbe.c,v
104 retrieving revision 1.48
105 diff -u -w -r1.48 vbe.c
106 --- vbe.c 26 Dec 2005 19:50:26 -0000 1.48
107 +++ vbe.c 14 Jun 2006 00:51:07 -0000
108 @@ -118,21 +118,114 @@
109 .word VBE_VESA_MODE_END_OF_LIST
114 dw vesa_pm_set_window - vesa_pm_start
115 - dw vesa_pm_set_display_strt - vesa_pm_start
116 + dw vesa_pm_set_display_start - vesa_pm_start
117 dw vesa_pm_unimplemented - vesa_pm_start
119 + dw vesa_pm_io_ports_table - vesa_pm_start
120 +vesa_pm_io_ports_table:
121 + dw VBE_DISPI_IOPORT_INDEX
122 + dw VBE_DISPI_IOPORT_INDEX + 1
123 + dw VBE_DISPI_IOPORT_DATA
124 + dw VBE_DISPI_IOPORT_DATA + 1
133 + je vesa_pm_set_display_window1
136 +vesa_pm_set_display_window1:
140 + mov dx, # VBE_DISPI_IOPORT_INDEX
141 + mov ax, # VBE_DISPI_INDEX_BANK
144 + mov dx, # VBE_DISPI_IOPORT_DATA
150 vesa_pm_set_display_start:
154 + je vesa_pm_set_display_start1
156 + je vesa_pm_set_display_start1
159 +vesa_pm_set_display_start1:
160 +; convert offset to (X, Y) coordinate
161 +; (would be simpler to change Bochs VBE API...)
174 + mov dx, # VBE_DISPI_IOPORT_INDEX
175 + mov ax, # VBE_DISPI_INDEX_VIRT_WIDTH
177 + mov dx, # VBE_DISPI_IOPORT_DATA
181 + mov dx, # VBE_DISPI_IOPORT_INDEX
182 + mov ax, # VBE_DISPI_INDEX_BPP
184 + mov dx, # VBE_DISPI_IOPORT_DATA
201 + mov dx, # VBE_DISPI_IOPORT_INDEX
202 + mov ax, # VBE_DISPI_INDEX_X_OFFSET
205 + mov dx, # VBE_DISPI_IOPORT_DATA
212 + mov dx, # VBE_DISPI_IOPORT_INDEX
213 + mov ax, # VBE_DISPI_INDEX_Y_OFFSET
216 + mov dx, # VBE_DISPI_IOPORT_DATA
228 vesa_pm_unimplemented:
233 +Bit16u vbe_biosfn_read_video_state_size()
238 +void vbe_biosfn_save_video_state(ES, BX)
239 + Bit16u ES; Bit16u BX;
243 + outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE);
244 + enable = inw(VBE_DISPI_IOPORT_DATA);
245 + write_word(ES, BX, enable);
247 + if (!(enable & VBE_DISPI_ENABLED))
249 + for(i = VBE_DISPI_INDEX_XRES; i <= VBE_DISPI_INDEX_Y_OFFSET; i++) {
250 + if (i != VBE_DISPI_INDEX_ENABLE) {
251 + outw(VBE_DISPI_IOPORT_INDEX, i);
252 + write_word(ES, BX, inw(VBE_DISPI_IOPORT_DATA));
259 +void vbe_biosfn_restore_video_state(ES, BX)
260 + Bit16u ES; Bit16u BX;
264 + enable = read_word(ES, BX);
267 + if (!(enable & VBE_DISPI_ENABLED)) {
268 + outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE);
269 + outw(VBE_DISPI_IOPORT_DATA, enable);
271 + outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_XRES);
272 + outw(VBE_DISPI_IOPORT_DATA, read_word(ES, BX));
274 + outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_YRES);
275 + outw(VBE_DISPI_IOPORT_DATA, read_word(ES, BX));
277 + outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_BPP);
278 + outw(VBE_DISPI_IOPORT_DATA, read_word(ES, BX));
280 + outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE);
281 + outw(VBE_DISPI_IOPORT_DATA, enable);
283 + for(i = VBE_DISPI_INDEX_BANK; i <= VBE_DISPI_INDEX_Y_OFFSET; i++) {
284 + outw(VBE_DISPI_IOPORT_INDEX, i);
285 + outw(VBE_DISPI_IOPORT_DATA, read_word(ES, BX));
291 /** Function 04h - Save/Restore State
294 @@ -849,10 +1000,48 @@
295 * BX = Number of 64-byte blocks to hold the state buffer (if DL=00h)
298 -void vbe_biosfn_save_restore_state(AX, DL, CX, ES, BX)
299 +void vbe_biosfn_save_restore_state(AX, CX, DX, ES, BX)
300 +Bit16u *AX; Bit16u CX; Bit16u DX; Bit16u ES; Bit16u *BX;
303 + Bit16u ss=get_SS();
304 + Bit16u result, val;
309 + val = biosfn_read_video_state_size2(CX);
311 + printf("VGA state size=%x\n", val);
314 + val += vbe_biosfn_read_video_state_size();
315 + write_word(ss, BX, val);
318 + val = read_word(ss, BX);
319 + val = biosfn_save_video_state(CX, ES, val);
321 + printf("VGA save_state offset=%x\n", val);
324 + vbe_biosfn_save_video_state(ES, val);
327 + val = read_word(ss, BX);
328 + val = biosfn_restore_video_state(CX, ES, val);
330 + printf("VGA restore_state offset=%x\n", val);
333 + vbe_biosfn_restore_video_state(ES, val);
340 + write_word(ss, AX, result);
343 /** Function 05h - Display Window Control
345 @@ -1090,7 +1279,7 @@
348 vbe_biosfn_return_protected_mode_interface:
355 ===================================================================
356 RCS file: /sources/vgabios/vgabios/vbe.h,v
357 retrieving revision 1.24
358 diff -u -w -r1.24 vbe.h
359 --- vbe.h 9 May 2004 20:31:31 -0000 1.24
360 +++ vbe.h 14 Jun 2006 00:51:07 -0000
362 void vbe_biosfn_return_controller_information(AX, ES, DI);
363 void vbe_biosfn_return_mode_information(AX, CX, ES, DI);
364 void vbe_biosfn_set_mode(AX, BX, ES, DI);
365 -void vbe_biosfn_save_restore_state(AX, DL, CX, ES, BX);
366 +void vbe_biosfn_save_restore_state(AX, CX, DX, ES, BX);
367 void vbe_biosfn_set_get_palette_data(AX);
368 void vbe_biosfn_return_protected_mode_interface(AX);
374 +typedef struct ModeInfoListItem
377 + ModeInfoBlockCompact info;
380 // VBE Return Status Info
382 #define VBE_RETURN_STATUS_SUPPORTED 0x4F
384 #define VBE_VESA_MODE_1280X1024X1555 0x119
385 #define VBE_VESA_MODE_1280X1024X565 0x11A
386 #define VBE_VESA_MODE_1280X1024X888 0x11B
387 +#define VBE_VESA_MODE_1600X1200X8 0x11C
388 +#define VBE_VESA_MODE_1600X1200X1555 0x11D
389 +#define VBE_VESA_MODE_1600X1200X565 0x11E
390 +#define VBE_VESA_MODE_1600X1200X888 0x11F
392 // BOCHS/PLEX86 'own' mode numbers
393 #define VBE_OWN_MODE_320X200X8888 0x140
395 #define VBE_OWN_MODE_1024X768X8888 0x144
396 #define VBE_OWN_MODE_1280X1024X8888 0x145
397 #define VBE_OWN_MODE_320X200X8 0x146
398 +#define VBE_OWN_MODE_1600X1200X8888 0x147
399 +#define VBE_OWN_MODE_1152X864X8 0x148
400 +#define VBE_OWN_MODE_1152X864X1555 0x149
401 +#define VBE_OWN_MODE_1152X864X565 0x14a
402 +#define VBE_OWN_MODE_1152X864X888 0x14b
403 +#define VBE_OWN_MODE_1152X864X8888 0x14c
405 #define VBE_VESA_MODE_END_OF_LIST 0xFFFF
411 - #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 4
412 + #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 8
414 #define VBE_DISPI_BANK_ADDRESS 0xA0000
415 #define VBE_DISPI_BANK_SIZE_KB 64
417 ===================================================================
418 RCS file: /sources/vgabios/vgabios/vgabios.c,v
419 retrieving revision 1.64
420 diff -u -w -r1.64 vgabios.c
421 --- vgabios.c 25 Mar 2006 10:19:16 -0000 1.64
422 +++ vgabios.c 14 Jun 2006 00:51:07 -0000
424 static void biosfn_write_string();
425 static void biosfn_read_state_info();
426 static void biosfn_read_video_state_size();
427 -static void biosfn_save_video_state();
428 -static void biosfn_restore_video_state();
429 +static Bit16u biosfn_save_video_state();
430 +static Bit16u biosfn_restore_video_state();
431 extern Bit8u video_save_pointer_table[];
433 // This is for compiling with gcc2 and gcc3
435 vbe_biosfn_set_mode(&AX,BX,ES,DI);
444 + vbe_biosfn_save_restore_state(&AX, CX, DX, ES, &BX);
448 @@ -3138,23 +3133,215 @@
451 // --------------------------------------------------------------------------------------------
452 -static void biosfn_read_video_state_size (CX,ES,BX) Bit16u CX;Bit16u ES;Bit16u BX;
453 +// --------------------------------------------------------------------------------------------
454 +static Bit16u biosfn_read_video_state_size2 (CX)
466 + size += (5 + 8 + 5) * 2 + 6;
469 + size += 3 + 256 * 3 + 1;
471 -static void biosfn_save_video_state (CX,ES,BX) Bit16u CX;Bit16u ES;Bit16u BX;
475 +static void biosfn_read_video_state_size (CX, BX)
476 + Bit16u CX; Bit16u *BX;
481 + Bit16u ss=get_SS();
482 + write_word(ss, BX, biosfn_read_video_state_size2(CX));
484 -static void biosfn_restore_video_state (CX,ES,BX) Bit16u CX;Bit16u ES;Bit16u BX;
486 +static Bit16u biosfn_save_video_state (CX,ES,BX)
487 + Bit16u CX;Bit16u ES;Bit16u BX;
492 + Bit16u i, v, crtc_addr, ar_index;
494 + crtc_addr = read_word(BIOSMEM_SEG, BIOSMEM_CRTC_ADDRESS);
496 + write_byte(ES, BX, inb(VGAREG_SEQU_ADDRESS)); BX++;
497 + write_byte(ES, BX, inb(crtc_addr)); BX++;
498 + write_byte(ES, BX, inb(VGAREG_GRDC_ADDRESS)); BX++;
499 + inb(VGAREG_ACTL_RESET);
500 + ar_index = inb(VGAREG_ACTL_ADDRESS);
501 + write_byte(ES, BX, ar_index); BX++;
502 + write_byte(ES, BX, inb(VGAREG_READ_FEATURE_CTL)); BX++;
505 + outb(VGAREG_SEQU_ADDRESS, i);
506 + write_byte(ES, BX, inb(VGAREG_SEQU_DATA)); BX++;
508 + outb(VGAREG_SEQU_ADDRESS, 0);
509 + write_byte(ES, BX, inb(VGAREG_SEQU_DATA)); BX++;
511 + for(i=0;i<=0x18;i++) {
513 + write_byte(ES, BX, inb(crtc_addr+1)); BX++;
516 + for(i=0;i<=0x13;i++) {
517 + inb(VGAREG_ACTL_RESET);
518 + outb(VGAREG_ACTL_ADDRESS, i | (ar_index & 0x20));
519 + write_byte(ES, BX, inb(VGAREG_ACTL_READ_DATA)); BX++;
521 + inb(VGAREG_ACTL_RESET);
523 + for(i=0;i<=8;i++) {
524 + outb(VGAREG_GRDC_ADDRESS,i);
525 + write_byte(ES, BX, inb(VGAREG_GRDC_DATA)); BX++;
528 + write_word(ES, BX, crtc_addr); BX+= 2;
530 + /* XXX: read plane latches */
531 + write_byte(ES, BX, 0); BX++;
532 + write_byte(ES, BX, 0); BX++;
533 + write_byte(ES, BX, 0); BX++;
534 + write_byte(ES, BX, 0); BX++;
537 + write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_MODE)); BX++;
538 + write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_NB_COLS)); BX += 2;
539 + write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE)); BX += 2;
540 + write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS)); BX += 2;
541 + write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS)); BX++;
542 + write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT)); BX += 2;
543 + write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL)); BX++;
544 + write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_SWITCHES)); BX++;
545 + write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_MODESET_CTL)); BX++;
546 + write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_CURSOR_TYPE)); BX += 2;
548 + write_word(ES, BX, read_word(BIOSMEM_SEG, BIOSMEM_CURSOR_POS+2*i));
551 + write_word(ES, BX, read_word(BIOSMEM_SEG,BIOSMEM_CURRENT_START)); BX += 2;
552 + write_byte(ES, BX, read_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE)); BX++;
554 + write_word(ES, BX, read_word(0, 0x1f * 4)); BX += 2;
555 + write_word(ES, BX, read_word(0, 0x1f * 4 + 2)); BX += 2;
556 + write_word(ES, BX, read_word(0, 0x43 * 4)); BX += 2;
557 + write_word(ES, BX, read_word(0, 0x43 * 4 + 2)); BX += 2;
560 + /* XXX: check this */
561 + write_byte(ES, BX, inb(VGAREG_DAC_STATE)); BX++; /* read/write mode dac */
562 + write_byte(ES, BX, inb(VGAREG_DAC_WRITE_ADDRESS)); BX++; /* pix address */
563 + write_byte(ES, BX, inb(VGAREG_PEL_MASK)); BX++;
564 + // Set the whole dac always, from 0
565 + outb(VGAREG_DAC_WRITE_ADDRESS,0x00);
566 + for(i=0;i<256*3;i++) {
567 + write_byte(ES, BX, inb(VGAREG_DAC_DATA)); BX++;
569 + write_byte(ES, BX, 0); BX++; /* color select register */
574 +static Bit16u biosfn_restore_video_state (CX,ES,BX)
575 + Bit16u CX;Bit16u ES;Bit16u BX;
577 + Bit16u i, crtc_addr, v, addr1, ar_index;
580 + // Reset Attribute Ctl flip-flop
581 + inb(VGAREG_ACTL_RESET);
583 + crtc_addr = read_word(ES, BX + 0x40);
588 + outb(VGAREG_SEQU_ADDRESS, i);
589 + outb(VGAREG_SEQU_DATA, read_byte(ES, BX)); BX++;
591 + outb(VGAREG_SEQU_ADDRESS, 0);
592 + outb(VGAREG_SEQU_DATA, read_byte(ES, BX)); BX++;
594 + // Disable CRTC write protection
595 + outw(crtc_addr,0x0011);
597 + for(i=0;i<=0x18;i++) {
600 + outb(crtc_addr+1, read_byte(ES, BX));
604 + // select crtc base address
605 + v = inb(VGAREG_READ_MISC_OUTPUT) & ~0x01;
606 + if (crtc_addr = 0x3d4)
608 + outb(VGAREG_WRITE_MISC_OUTPUT, v);
610 + // enable write protection if needed
611 + outb(crtc_addr, 0x11);
612 + outb(crtc_addr+1, read_byte(ES, BX - 0x18 + 0x11));
614 + // Set Attribute Ctl
615 + ar_index = read_byte(ES, addr1 + 0x03);
616 + inb(VGAREG_ACTL_RESET);
617 + for(i=0;i<=0x13;i++) {
618 + outb(VGAREG_ACTL_ADDRESS, i | (ar_index & 0x20));
619 + outb(VGAREG_ACTL_WRITE_DATA, read_byte(ES, BX)); BX++;
621 + outb(VGAREG_ACTL_ADDRESS, ar_index);
622 + inb(VGAREG_ACTL_RESET);
624 + for(i=0;i<=8;i++) {
625 + outb(VGAREG_GRDC_ADDRESS,i);
626 + outb(VGAREG_GRDC_DATA, read_byte(ES, BX)); BX++;
628 + BX += 2; /* crtc_addr */
629 + BX += 4; /* plane latches */
631 + outb(VGAREG_SEQU_ADDRESS, read_byte(ES, addr1)); addr1++;
632 + outb(crtc_addr, read_byte(ES, addr1)); addr1++;
633 + outb(VGAREG_GRDC_ADDRESS, read_byte(ES, addr1)); addr1++;
635 + outb(crtc_addr - 0x4 + 0xa, read_byte(ES, addr1)); addr1++;
638 + write_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_MODE, read_byte(ES, BX)); BX++;
639 + write_word(BIOSMEM_SEG,BIOSMEM_NB_COLS, read_word(ES, BX)); BX += 2;
640 + write_word(BIOSMEM_SEG,BIOSMEM_PAGE_SIZE, read_word(ES, BX)); BX += 2;
641 + write_word(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS, read_word(ES, BX)); BX += 2;
642 + write_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS, read_byte(ES, BX)); BX++;
643 + write_word(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT, read_word(ES, BX)); BX += 2;
644 + write_byte(BIOSMEM_SEG,BIOSMEM_VIDEO_CTL, read_byte(ES, BX)); BX++;
645 + write_byte(BIOSMEM_SEG,BIOSMEM_SWITCHES, read_byte(ES, BX)); BX++;
646 + write_byte(BIOSMEM_SEG,BIOSMEM_MODESET_CTL, read_byte(ES, BX)); BX++;
647 + write_word(BIOSMEM_SEG,BIOSMEM_CURSOR_TYPE, read_word(ES, BX)); BX += 2;
649 + write_word(BIOSMEM_SEG, BIOSMEM_CURSOR_POS+2*i, read_word(ES, BX));
652 + write_word(BIOSMEM_SEG,BIOSMEM_CURRENT_START, read_word(ES, BX)); BX += 2;
653 + write_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE, read_byte(ES, BX)); BX++;
655 + write_word(0, 0x1f * 4, read_word(ES, BX)); BX += 2;
656 + write_word(0, 0x1f * 4 + 2, read_word(ES, BX)); BX += 2;
657 + write_word(0, 0x43 * 4, read_word(ES, BX)); BX += 2;
658 + write_word(0, 0x43 * 4 + 2, read_word(ES, BX)); BX += 2;
662 + v = read_byte(ES, BX); BX++;
663 + outb(VGAREG_PEL_MASK, read_byte(ES, BX)); BX++;
664 + // Set the whole dac always, from 0
665 + outb(VGAREG_DAC_WRITE_ADDRESS,0x00);
666 + for(i=0;i<256*3;i++) {
667 + outb(VGAREG_DAC_DATA, read_byte(ES, BX)); BX++;
670 + outb(VGAREG_DAC_WRITE_ADDRESS, v);
675 // ============================================================================================
676 diff -u -w vbetables-gen.c
677 --- vbetables-gen.c 1970-01-01 01:00:00.000000000 +0100
678 +++ vbetables-gen.c 2006-06-14 00:52:18.000000000 +0200
680 +/* Generate the VGABIOS VBE Tables */
691 +ModeInfo modes[] = {
692 + /* standard VESA modes */
693 +{ 640, 400, 8 , 0x100},
694 +{ 640, 480, 8 , 0x101},
695 +{ 800, 600, 4 , 0x102},
696 +{ 800, 600, 8 , 0x103},
697 + //{ 1024, 768, 4 , 0x104},
698 +{ 1024, 768, 8 , 0x105},
699 + //{ 1280, 1024, 4 , 0x106},
700 +{ 1280, 1024, 8 , 0x107},
701 +{ 320, 200, 15 , 0x10D},
702 +{ 320, 200, 16 , 0x10E},
703 +{ 320, 200, 24 , 0x10F},
704 +{ 640, 480, 15 , 0x110},
705 +{ 640, 480, 16 , 0x111},
706 +{ 640, 480, 24 , 0x112},
707 +{ 800, 600, 15 , 0x113},
708 +{ 800, 600, 16 , 0x114},
709 +{ 800, 600, 24 , 0x115},
710 +{ 1024, 768, 15 , 0x116},
711 +{ 1024, 768, 16 , 0x117},
712 +{ 1024, 768, 24 , 0x118},
713 +{ 1280, 1024, 15 , 0x119},
714 +{ 1280, 1024, 16 , 0x11A},
715 +{ 1280, 1024, 24 , 0x11B},
716 +{ 1600, 1200, 8 , 0x11C},
717 +{ 1600, 1200, 15 , 0x11D},
718 +{ 1600, 1200, 16 , 0x11E},
719 +{ 1600, 1200, 24 , 0x11F},
721 + /* BOCHS/PLE, 86 'own' mode numbers */
722 +{ 320, 200, 32 , 0x140},
723 +{ 640, 400, 32 , 0x141},
724 +{ 640, 480, 32 , 0x142},
725 +{ 800, 600, 32 , 0x143},
726 +{ 1024, 768, 32 , 0x144},
727 +{ 1280, 1024, 32 , 0x145},
728 +{ 320, 200, 8 , 0x146},
729 +{ 1600, 1200, 32 , 0x147},
730 +{ 1152, 864, 8 , 0x148},
731 +{ 1152, 864, 15 , 0x149},
732 +{ 1152, 864, 16 , 0x14a},
733 +{ 1152, 864, 24 , 0x14b},
734 +{ 1152, 864, 32 , 0x14c},
738 +int main(int argc, char **argv)
740 + const ModeInfo *pm;
741 + int pitch, r_size, r_pos, g_size, g_pos, b_size, b_pos, a_size, a_pos;
744 + printf("/* THIS FILE IS AUTOMATICALLY GENERATED - DO NOT EDIT */\n");
745 + printf("static ModeInfoListItem mode_info_list[]=\n");
747 + for(pm = modes; pm->mode != 0; pm++) {
748 + printf("{ 0x%04x, /* %dx%dx%d */\n",
749 + pm->mode, pm->width, pm->height, pm->depth);
750 + printf("{ /*Bit16u ModeAttributes*/ %s,\n",
751 + "VBE_MODE_ATTRIBUTE_SUPPORTED | "
752 + "VBE_MODE_ATTRIBUTE_EXTENDED_INFORMATION_AVAILABLE | "
753 + "VBE_MODE_ATTRIBUTE_COLOR_MODE | "
754 + "VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE | "
755 + "VBE_MODE_ATTRIBUTE_GRAPHICS_MODE");
757 + printf("/*Bit8u WinAAttributes*/ %s,\n",
758 + "VBE_WINDOW_ATTRIBUTE_RELOCATABLE | "
759 + "VBE_WINDOW_ATTRIBUTE_READABLE | "
760 + "VBE_WINDOW_ATTRIBUTE_WRITEABLE");
762 + printf("/*Bit8u WinBAttributes*/ %d,\n", 0);
764 + printf("/*Bit16u WinGranularity*/ %s,\n", "VBE_DISPI_BANK_SIZE_KB");
766 + printf("/*Bit16u WinSize*/ %s,\n", "VBE_DISPI_BANK_SIZE_KB");
768 + printf("/*Bit16u WinASegment*/ %s,\n", "VGAMEM_GRAPH");
770 + printf("/*Bit16u WinBSegment*/ 0x%04x,\n", 0);
772 + printf("/*Bit32u WinFuncPtr*/ %d,\n", 0);
774 + if (pm->depth == 4)
775 + pitch = (pm->width + 7) / 8;
777 + pitch = pm->width * ((pm->depth + 7) / 8);
778 + printf("/*Bit16u BytesPerScanLine*/ %d,\n", pitch);
780 + // Mandatory information for VBE 1.2 and above
781 + printf("/*Bit16u XResolution*/ %d,\n", pm->width);
782 + printf("/*Bit16u YResolution*/ %d,\n", pm->height);
783 + printf("/*Bit8u XCharSize*/ %d,\n", 8);
784 + printf("/*Bit8u YCharSize*/ %d,\n", 16);
785 + if (pm->depth == 4) {
786 + printf("/*Bit8u NumberOfPlanes*/ %d,\n", 4);
787 + printf("/*Bit8u BitsPerPixel*/ %d,\n", pm->depth);
789 + printf("/*Bit8u NumberOfPlanes*/ %d,\n", 1);
790 + printf("/*Bit8u BitsPerPixel*/ %d,\n", pm->depth);
792 + printf("/*Bit8u NumberOfBanks*/ %d,\n",
793 + (pm->height * pitch + 65535) / 65536);
795 + if (pm->depth == 4)
796 + str = "VBE_MEMORYMODEL_PLANAR";
797 + else if (pm->depth == 8)
798 + str = "VBE_MEMORYMODEL_PACKED_PIXEL";
800 + str = "VBE_MEMORYMODEL_DIRECT_COLOR";
801 + printf("/*Bit8u MemoryModel*/ %s,\n", str);
802 + printf("/*Bit8u BankSize*/ %d,\n", 0);
804 + printf("/*Bit8u NumberOfImagePages*/ %d,\n", 0);
805 + printf("/*Bit8u Reserved_page*/ %d,\n", 0);
807 + // Direct Color fields (required for direct/6 and YUV/7 memory models)
808 + switch(pm->depth) {
861 + printf("/*Bit8u RedMaskSize*/ %d,\n", r_size);
862 + printf("/*Bit8u RedFieldPosition*/ %d,\n", r_pos);
863 + printf("/*Bit8u GreenMaskSize*/ %d,\n", g_size);
864 + printf("/*Bit8u GreenFieldPosition*/ %d,\n", g_pos);
865 + printf("/*Bit8u BlueMaskSize*/ %d,\n", b_size);
866 + printf("/*Bit8u BlueFieldPosition*/ %d,\n", b_pos);
867 + printf("/*Bit8u RsvdMaskSize*/ %d,\n", a_size);
868 + printf("/*Bit8u RsvdFieldPosition*/ %d,\n", a_pos);
869 + printf("/*Bit8u DirectColorModeInfo*/ %d,\n", 0);
871 +// Mandatory information for VBE 2.0 and above
872 + printf("/*Bit32u PhysBasePtr*/ %s,\n",
873 + "VBE_DISPI_LFB_PHYSICAL_ADDRESS");
874 + printf("/*Bit32u OffScreenMemOffset*/ %d,\n", 0);
875 + printf("/*Bit16u OffScreenMemSize*/ %d,\n", 0);
876 + // Mandatory information for VBE 3.0 and above
877 + printf("/*Bit16u LinBytesPerScanLine*/ %d,\n", pitch);
878 + printf("/*Bit8u BnkNumberOfPages*/ %d,\n", 0);
879 + printf("/*Bit8u LinNumberOfPages*/ %d,\n", 0);
880 + printf("/*Bit8u LinRedMaskSize*/ %d,\n", r_size);
881 + printf("/*Bit8u LinRedFieldPosition*/ %d,\n", r_pos);
882 + printf("/*Bit8u LinGreenMaskSize*/ %d,\n", g_size);
883 + printf("/*Bit8u LinGreenFieldPosition*/ %d,\n", g_pos);
884 + printf("/*Bit8u LinBlueMaskSize*/ %d,\n", b_size);
885 + printf("/*Bit8u LinBlueFieldPosition*/ %d,\n", b_pos);
886 + printf("/*Bit8u LinRsvdMaskSize*/ %d,\n", a_size);
887 + printf("/*Bit8u LinRsvdFieldPosition*/ %d,\n", a_pos);
888 + printf("/*Bit32u MaxPixelClock*/ %d,\n", 0);
891 + printf("{ VBE_VESA_MODE_END_OF_LIST,\n");