1 /* Generate the VGABIOS VBE Tables */
5 #define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB 16
15 /* standard VESA modes */
16 { 640, 400, 8 , 0x100},
17 { 640, 480, 8 , 0x101},
18 { 800, 600, 4 , 0x102},
19 { 800, 600, 8 , 0x103},
20 { 1024, 768, 4 , 0x104},
21 { 1024, 768, 8 , 0x105},
22 { 1280, 1024, 4 , 0x106},
23 { 1280, 1024, 8 , 0x107},
24 { 320, 200, 15 , 0x10D},
25 { 320, 200, 16 , 0x10E},
26 { 320, 200, 24 , 0x10F},
27 { 640, 480, 15 , 0x110},
28 { 640, 480, 16 , 0x111},
29 { 640, 480, 24 , 0x112},
30 { 800, 600, 15 , 0x113},
31 { 800, 600, 16 , 0x114},
32 { 800, 600, 24 , 0x115},
33 { 1024, 768, 15 , 0x116},
34 { 1024, 768, 16 , 0x117},
35 { 1024, 768, 24 , 0x118},
36 { 1280, 1024, 15 , 0x119},
37 { 1280, 1024, 16 , 0x11A},
38 { 1280, 1024, 24 , 0x11B},
39 { 1600, 1200, 8 , 0x11C},
40 { 1600, 1200, 15 , 0x11D},
41 { 1600, 1200, 16 , 0x11E},
42 { 1600, 1200, 24 , 0x11F},
44 /* BOCHS/PLE, 86 'own' mode numbers */
45 { 320, 200, 32 , 0x140},
46 { 640, 400, 32 , 0x141},
47 { 640, 480, 32 , 0x142},
48 { 800, 600, 32 , 0x143},
49 { 1024, 768, 32 , 0x144},
50 { 1280, 1024, 32 , 0x145},
51 { 320, 200, 8 , 0x146},
52 { 1600, 1200, 32 , 0x147},
53 { 1152, 864, 8 , 0x148},
54 { 1152, 864, 15 , 0x149},
55 { 1152, 864, 16 , 0x14a},
56 { 1152, 864, 24 , 0x14b},
57 { 1152, 864, 32 , 0x14c},
58 { 1280, 768, 16 , 0x175},
59 { 1280, 768, 24 , 0x176},
60 { 1280, 768, 32 , 0x177},
61 { 1280, 800, 16 , 0x178},
62 { 1280, 800, 24 , 0x179},
63 { 1280, 800, 32 , 0x17a},
64 { 1280, 960, 16 , 0x17b},
65 { 1280, 960, 24 , 0x17c},
66 { 1280, 960, 32 , 0x17d},
67 { 1440, 900, 16 , 0x17e},
68 { 1440, 900, 24 , 0x17f},
69 { 1440, 900, 32 , 0x180},
70 { 1400, 1050, 16 , 0x181},
71 { 1400, 1050, 24 , 0x182},
72 { 1400, 1050, 32 , 0x183},
73 { 1680, 1050, 16 , 0x184},
74 { 1680, 1050, 24 , 0x185},
75 { 1680, 1050, 32 , 0x186},
76 { 1920, 1200, 16 , 0x187},
77 { 1920, 1200, 24 , 0x188},
78 { 1920, 1200, 32 , 0x189},
79 { 2560, 1600, 16 , 0x18a},
80 { 2560, 1600, 24 , 0x18b},
81 { 2560, 1600, 32 , 0x18c},
85 int main(int argc
, char **argv
)
89 int r_size
, r_pos
, g_size
, g_pos
, b_size
, b_pos
, a_size
, a_pos
;
91 long vram_size
= VBE_DISPI_TOTAL_VIDEO_MEMORY_MB
* 1024 * 1024;
93 printf("/* THIS FILE IS AUTOMATICALLY GENERATED - DO NOT EDIT */\n\n");
94 printf("#define VBE_DISPI_TOTAL_VIDEO_MEMORY_MB %d\n\n", VBE_DISPI_TOTAL_VIDEO_MEMORY_MB
);
95 printf("static ModeInfoListItem mode_info_list[]=\n");
97 for (pm
= modes
; pm
->mode
!= 0; pm
++) {
99 pitch
= (pm
->width
+ 7) / 8;
101 pitch
= pm
->width
* ((pm
->depth
+ 7) / 8);
102 pages
= vram_size
/ (pm
->height
* pitch
);
104 printf("{ 0x%04x, /* %dx%dx%d */\n",
105 pm
->mode
, pm
->width
, pm
->height
, pm
->depth
);
107 printf("{ /*Bit16u ModeAttributes*/ %s,\n",
108 "VBE_MODE_ATTRIBUTE_SUPPORTED | "
109 "VBE_MODE_ATTRIBUTE_EXTENDED_INFORMATION_AVAILABLE | "
110 "VBE_MODE_ATTRIBUTE_COLOR_MODE | "
111 "VBE_MODE_ATTRIBUTE_TTY_BIOS_SUPPORT | "
112 "VBE_MODE_ATTRIBUTE_GRAPHICS_MODE");
114 printf("{ /*Bit16u ModeAttributes*/ %s,\n",
115 "VBE_MODE_ATTRIBUTE_SUPPORTED | "
116 "VBE_MODE_ATTRIBUTE_EXTENDED_INFORMATION_AVAILABLE | "
117 "VBE_MODE_ATTRIBUTE_COLOR_MODE | "
118 "VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE | "
119 "VBE_MODE_ATTRIBUTE_GRAPHICS_MODE");
120 printf("/*Bit8u WinAAttributes*/ %s,\n",
121 "VBE_WINDOW_ATTRIBUTE_RELOCATABLE | "
122 "VBE_WINDOW_ATTRIBUTE_READABLE | "
123 "VBE_WINDOW_ATTRIBUTE_WRITEABLE");
125 printf("/*Bit8u WinBAttributes*/ %d,\n", 0);
127 printf("/*Bit16u WinGranularity*/ %s,\n", "VBE_DISPI_BANK_SIZE_KB");
129 printf("/*Bit16u WinSize*/ %s,\n", "VBE_DISPI_BANK_SIZE_KB");
131 printf("/*Bit16u WinASegment*/ %s,\n", "VGAMEM_GRAPH");
133 printf("/*Bit16u WinBSegment*/ 0x%04x,\n", 0);
135 printf("/*Bit32u WinFuncPtr*/ %d,\n", 0);
137 printf("/*Bit16u BytesPerScanLine*/ %d,\n", pitch
);
139 // Mandatory information for VBE 1.2 and above
140 printf("/*Bit16u XResolution*/ %d,\n", pm
->width
);
141 printf("/*Bit16u YResolution*/ %d,\n", pm
->height
);
142 printf("/*Bit8u XCharSize*/ %d,\n", 8);
143 printf("/*Bit8u YCharSize*/ %d,\n", 16);
144 if (pm
->depth
== 4) {
145 printf("/*Bit8u NumberOfPlanes*/ %d,\n", 4);
147 printf("/*Bit8u NumberOfPlanes*/ %d,\n", 1);
149 printf("/*Bit8u BitsPerPixel*/ %d,\n", pm
->depth
);
150 printf("/*Bit8u NumberOfBanks*/ %d,\n",
151 (pm
->height
* pitch
+ 65535) / 65536);
154 str
= "VBE_MEMORYMODEL_PLANAR";
155 else if (pm
->depth
== 8)
156 str
= "VBE_MEMORYMODEL_PACKED_PIXEL";
158 str
= "VBE_MEMORYMODEL_DIRECT_COLOR";
159 printf("/*Bit8u MemoryModel*/ %s,\n", str
);
160 printf("/*Bit8u BankSize*/ %d,\n", 0);
162 printf("/*Bit8u NumberOfImagePages*/ %d,\n", (pages
/ 4) - 1);
164 printf("/*Bit8u NumberOfImagePages*/ %d,\n", pages
- 1);
165 printf("/*Bit8u Reserved_page*/ %d,\n", 0);
167 // Direct Color fields (required for direct/6 and YUV/7 memory models)
221 printf("/*Bit8u RedMaskSize*/ %d,\n", r_size
);
222 printf("/*Bit8u RedFieldPosition*/ %d,\n", r_pos
);
223 printf("/*Bit8u GreenMaskSize*/ %d,\n", g_size
);
224 printf("/*Bit8u GreenFieldPosition*/ %d,\n", g_pos
);
225 printf("/*Bit8u BlueMaskSize*/ %d,\n", b_size
);
226 printf("/*Bit8u BlueFieldPosition*/ %d,\n", b_pos
);
227 printf("/*Bit8u RsvdMaskSize*/ %d,\n", a_size
);
228 printf("/*Bit8u RsvdFieldPosition*/ %d,\n", a_pos
);
230 printf("/*Bit8u DirectColorModeInfo*/ %s,\n",
231 "VBE_DIRECTCOLOR_RESERVED_BITS_AVAILABLE");
233 printf("/*Bit8u DirectColorModeInfo*/ %s,\n", "0");
235 // Mandatory information for VBE 2.0 and above
237 printf("/*Bit32u PhysBasePtr*/ %s,\n",
238 "VBE_DISPI_LFB_PHYSICAL_ADDRESS");
240 printf("/*Bit32u PhysBasePtr*/ %s,\n", "0");
241 printf("/*Bit32u OffScreenMemOffset*/ %d,\n", 0);
242 printf("/*Bit16u OffScreenMemSize*/ %d,\n", 0);
243 // Mandatory information for VBE 3.0 and above
244 printf("/*Bit16u LinBytesPerScanLine*/ %d,\n", pitch
);
245 printf("/*Bit8u BnkNumberOfPages*/ %d,\n", 0);
246 printf("/*Bit8u LinNumberOfPages*/ %d,\n", 0);
247 printf("/*Bit8u LinRedMaskSize*/ %d,\n", r_size
);
248 printf("/*Bit8u LinRedFieldPosition*/ %d,\n", r_pos
);
249 printf("/*Bit8u LinGreenMaskSize*/ %d,\n", g_size
);
250 printf("/*Bit8u LinGreenFieldPosition*/ %d,\n", g_pos
);
251 printf("/*Bit8u LinBlueMaskSize*/ %d,\n", b_size
);
252 printf("/*Bit8u LinBlueFieldPosition*/ %d,\n", b_pos
);
253 printf("/*Bit8u LinRsvdMaskSize*/ %d,\n", a_size
);
254 printf("/*Bit8u LinRsvdFieldPosition*/ %d,\n", a_pos
);
255 printf("/*Bit32u MaxPixelClock*/ %d,\n", 0);
259 printf("{ VBE_VESA_MODE_END_OF_LIST,\n");