VideoModePtr
VideoModePtr:指向显示卡VBE所支持显示模式列表的指针。
每个模式号占一个字节(16)位,模式号以)0FFFFH(-1)结束。
uint16/*far*/ *VideoModePtr; // 指向所支持显示模式列表的指针
注意:
是far指针,这个数组里面都是存放的far指针。
统计模式个数
//uint16/*far*/ *modeFarPtr = vbeInfo->VideoModePtr;
/*uint16 *modeRealPtr = (uint16 *)getAddrFromCharfar((uint32)(modeFarPtr));
int count = 0;
while(*modeRealPtr != (uint16)-1){
modeFarPtr++;
modeRealPtr = (uint16 *)getAddrFromCharfar((uint32)(modeFarPtr));
count ++;
uint16/*far*/ *modeFarPtr = vbeInfo->VideoModePtr;
uint16 *modeRealPtr = (uint16 *)getAddrFromCharfar((uint32)(modeFarPtr));
int count = 0;
while(*modeRealPtr != (uint16)-1){
modeRealPtr ++;
count ++;
两种写法打印的效果是一样的,但是还是下面的写法在逻辑上更正确一些。
打印每个模式号,36个,每行打印6个
void testVesaSvga(){
int startLine = 0;
BOOTINFO *binfo = (BOOTINFO *) 0x0ff0; // 在boot中写入
// 打印寄存器的值
// sprintf(buf, "[ax: %x], [es: %x], [di: %x]", binfo->scrnx, binfo->scrny, binfo->di);
// print_str_fix_pos((80*startLine+0)*2, buf);
// sprintf(buf, "return [al: %x], [ah: %x]", binfo->vmode, binfo->leds);
// print_str_fix_pos((80*(startLine++)+0)*2, buf);
// 1.打印VBESignature
VBEINFO *vbeInfo = (VBEINFO *) 0x0ffe; // 在boot中写入
buf[0] = vbeInfo->VBESignature[0];
buf[1] = vbeInfo->VBESignature[1];
buf[2] = vbeInfo->VBESignature[2];
buf[3] = vbeInfo->VBESignature[3];
buf[4] = '\0';
print_str_fix_pos((80*(startLine++)+0)*2, buf);
//init_palette(); // 初始化调色板
//draw_ui(binfo->scrnx, binfo->scrny, binfo->vram); // 绘制ui
//putfont8(binfo->vram, binfo->scrnx, 8, 8, COL8_FFFFFF, font_A); // 打印字符A
// 2.打印VbeVersion
sprintf(buf, "VbeVersion : 0x%4.4X", vbeInfo->VBEVersion);
print_str_fix_pos((80*(startLine++)+0)*2, buf);
// 3.打印OEMStringPtr
sprintf(buf, "OEMStringPtr : %s", (char*)getAddrFromCharfar((uint32)(vbeInfo->OEMStringPtr)));
print_str_fix_pos((80*(startLine++)+0)*2, buf);
// 4.打印显示卡特性
sprintf(buf, "Capabilities : 0x%8.8lX", vbeInfo->Capabilities);
print_str_fix_pos((80*(startLine++)+0)*2, buf);
// 5.打印VideoModePtr
//uint16/*far*/ *modeFarPtr = vbeInfo->VideoModePtr;
/*uint16 *modeRealPtr = (uint16 *)getAddrFromCharfar((uint32)(modeFarPtr));
int count = 0;
while(*modeRealPtr != (uint16)-1){
modeFarPtr++;
modeRealPtr = (uint16 *)getAddrFromCharfar((uint32)(modeFarPtr));
count ++;
uint16/*far*/ *modeFarPtr = vbeInfo->VideoModePtr;
uint16 *modeRealPtr = (uint16 *)getAddrFromCharfar((uint32)(modeFarPtr));
int count = 0;
while(*modeRealPtr != (uint16)-1){
modeRealPtr ++;
count ++;
sprintf(buf, "TotalVideoModeNum: %d", count);
print_str_fix_pos((80*(startLine++)+0)*2, buf);
// 36个,每行打印6个
modeFarPtr = vbeInfo->VideoModePtr;
modeRealPtr = (uint16 *)getAddrFromCharfar((uint32)(modeFarPtr));
for(int i=0; i<6; i++){
uint16 modeNum1 = *(modeFarPtr);
uint16 modeNum2 = *(modeFarPtr+1);
uint16 modeNum3 = *(modeFarPtr+2);
uint16 modeNum4 = *(modeFarPtr+3);
uint16 modeNum5 = *(modeFarPtr+4);
uint16 modeNum6 = *(modeFarPtr+5);
sprintf(buf, "0x%4.4X, 0x%4.4X, 0x%4.4X, 0x%4.4X, 0x%4.4X, 0x%4.4X", modeNum1, modeNum2, modeNum3, modeNum4, modeNum5, modeNum6);
print_str_fix_pos((80*(startLine++)+0)*2, buf);
modeFarPtr += 6;
// 6.打印VRamMemory
sprintf(buf, "TotalMemory : 0x%4.4X (%ldKB)", vbeInfo->VRAMMemory, vbeInfo->VRAMMemory * (uint32)64);
print_str_fix_pos((80*(startLine++)+0)*2, buf);
/* 以下为VESA VBE 2.0版本以上定义,2.0版本好像没有!
// 7.打印OemSoftwareRev
sprintf(buf, "OemSoftwareRev : 0x%4.4X", vbeInfo->OemSoftwareRev);
print_str_fix_pos((80*(startLine++)+0)*2, buf);
// 8.打印OemVendorNamePtr
sprintf(buf, "OemVendorNamePtr : %s", (char*)getAddrFromCharfar((uint32)(vbeInfo->OemVendorNamePtr)));
print_str_fix_pos((80*(startLine++)+0)*2, buf);
// 9.打印OemProductNamePtr
sprintf(buf, "OemProductNamePtr: %s", (char*)getAddrFromCharfar((uint32)(vbeInfo->OemProductNamePtr)));
print_str_fix_pos((80*(startLine++)+0)*2, buf);
// 7.打印OemSoftwareRev