int vbe_get_mode_info(unsigned short mode, vbe_mode_info_t *vmi_p) { mmap_t map; if (lm_alloc(sizeof(vbe_mode_info_t), &map) == NULL) { return 1; } struct reg86u reg86; reg86.u.b.intno = VBE_INTERRUPT_VECTOR; /* BIOS video services */ reg86.u.b.ah = VBE_FUNCTION; reg86.u.b.al = VBE_RETURN_VBE_MODE_INFO; reg86.u.w.cx = mode; reg86.u.w.es = PB2BASE(map.phys); reg86.u.w.di = PB2OFF(map.phys); if (sys_int86(®86) == OK) { if (reg86.u.w.ax == VBE_FUNCTION_SUPPORTED | VBE_FUNCTION_CALL_SUCCESSFUL) { *vmi_p = *((vbe_mode_info_t *)map.virtual); lm_free(&map); return 0; } }
int vbe_get_mode_info(unsigned short mode, vbe_mode_info_t *vmi_p) { struct reg86u reg86; mmap_t memory; lm_init(); lm_alloc(VBE_MODE_INFO_SIZE, &memory); reg86.u.w.ax = 0x4F01; reg86.u.w.cx = 1 << 14 | mode; reg86.u.w.es = PB2BASE(memory.phys); reg86.u.w.di = PB2OFF(memory.phys); reg86.u.b.intno = 0x10; if(sys_int86(®86) != OK){ printf("vbe_get_mode_info: sys_int86() failed \n"); return 1; } memcpy(vmi_p, memory.virtual, VBE_MODE_INFO_SIZE); lm_free(&memory); return 0; }
int controler_info(){ mmap_t map_info; char * virtualBase = (char *) lm_init(); if(virtualBase == NULL) return 1; VESA_INFO *info = (VESA_INFO *)lm_alloc(sizeof(VESA_INFO), &map_info); info->VESASignature[0] = 'V'; info->VESASignature[1] = 'B'; info->VESASignature[2] = 'E'; info->VESASignature[3] = '2'; vbe_get_controler_info(map_info.phys); char* ptr; ptr = REALPTR(info->VideoModePtr) + virtualBase; unsigned short *videoModesPtr = (unsigned short *)ptr; printf("Capabilites: \n"); if(info->Capabilities[0] & BIT(0)){ printf("DAC width is switchable to 8 bits per primary color\n"); } else{ printf("DAC is fixed width, with 6 bits per primary color\n"); } if(info->Capabilities[0] & BIT(1)){ printf("Controller is not VGA compatible\n"); } else{ printf("Controller is VGA compatible\n"); } if(info->Capabilities[0] & BIT(2)){ printf("When programming large blocks of information to the RAMDAC, use the blank bit in Function 09h.\n"); } else{ printf("Normal RAMDAC operation\n"); } printf("\n Modes: \n"); while(*videoModesPtr != END){ printf("0x%X \t", *videoModesPtr); videoModesPtr++; } printf("\n\n VRAM SIZE: %d blocks of 64 KB\n", info->TotalMemory); lm_free(&map_info); return 0; }
int vbe_get_mode_info(unsigned short mode, vbe_mode_info_t *vmi_p) { struct reg86u registers; mmap_t address; lm_init(); lm_alloc(VBE_MODE_INFO_BLOCK_SIZE, &address); registers.u.b.ah = 0x4F; registers.u.b.al = 0x01; registers.u.w.es = PB2BASE(address.phys); registers.u.w.di = PB2OFF(address.phys); registers.u.b.intno = 0x10; registers.u.w.cx = 1 << 14 | mode; sys_int86(®isters); vbe_unpack_mode_info(address.virtual, vmi_p); lm_free(&address); return 1; }