int main(void) { RMREGS regs; RMSREGS sregs; VgaInfoBlock vgaInfo; ushort *mode; uint vgLen; uchar *vgPtr; unsigned r_vgseg,r_vgoff; /* Allocate a 256 byte block of real memory for communicating with * the VESA BIOS. */ if ((vgPtr = PM_getVESABuf(&vgLen,&r_vgseg,&r_vgoff)) == NULL) { printf("Unable to allocate VESA memory buffer!\n"); exit(1); } /* Call the VESA VBE to see if it is out there */ regs.x.ax = 0x4F00; regs.x.di = r_vgoff; sregs.es = r_vgseg; memcpy(vgPtr,"VBE2",4); PM_int86x(0x10, ®s, ®s, &sregs); memcpy(&vgaInfo,vgPtr,sizeof(VgaInfoBlock)); if (regs.x.ax == 0x4F && strncmp(vgaInfo.VESASignature,"VESA",4) == 0) { printf("VESA VBE version %d.%d BIOS detected\n\n", vgaInfo.VESAVersion >> 8, vgaInfo.VESAVersion & 0xF); printf("Available video modes:\n"); mode = PM_mapRealPointer(vgaInfo.VideoModePtr >> 16, vgaInfo.VideoModePtr & 0xFFFF); while (*mode != 0xFFFF) { printf(" %04hXh (%08X)\n", *mode, (int)mode); mode++; } }
void VBEAPI VBE_init(void) /**************************************************************************** * * Function: VBE_init * * Description: Initialises the VBE transfer buffer in real mode DC.memory. * This routine is called by the VESAVBE module every time * it needs to use the transfer buffer, so we simply allocate * it once and then return. * ****************************************************************************/ { if (!state->VESABuf_ptr) { /* Allocate a global buffer for communicating with the VESA VBE */ if ((state->VESABuf_ptr = PM_getVESABuf(&VESABuf_len, &state->VESABuf_rseg, &state->VESABuf_roff)) == NULL) PM_fatalError("VESAVBE.C: Real mode memory allocation failed!"); } }