memset ( vbelnfoPtr, '\0\ sizeof ( VESAInfo )); strncpy ( vbelnfoPtr -> vbeSign, "VBE2", 4 );

Компьютерная графика. Полигональные модели

rmRegs.eax = 0x4F00; rmRegs.es = vbelnfoPool.segment; rmRegs.edi = 0;
RMVideoInt ();
if (rmRegs.eax != 0x4F ) return 0;
vbelnfoPtr -> OEM = (char *) RM2PMPtr (
vbelnfoPtr->OEM); vbelnfoPtr -> modeListPtr = (short *) RM2PMPtr (
vbelnfoPtr->modeListPtr); vbelnfoPtr -> OEMVendorName = (char *) RM2PMPtr (
vbelnfoPtr->OEMVendorName vbelnfoPtr -> OEMProductName = (char *) RM2PMPtr (
vbelnfoPtr->OEMProductName vbelnfoPtr -> OEMProductRev = (char*) RM2PMPtr(
vbelnfoPtr->OEMProductRev);
if ( strncmp (vbelnfoPtr -> vbeSign, "VESA", 4 )) return 0;
if ( vbelnfoPtr -> version >= 0x0200 && vbelnfoPtr -> OEMVendorName == NULL ) vbelnfoPtr -> version = 0x0102;
return vbelnfoPtr -> version >= 0x200;
}
void doneVBE2 () {
if (IfbPtr != NULL ) // unmap mapped LFB
DPMIUnmapPhysieal (IfbPtr);
DPMIFreeDosMem ( vbelnfoPool); // free allocated
// Dos memory
DPMIFreeDosMem (vbeModePool); setVESAMode (3 );
}
findVESAMode (int mode ) {
rmRegs.eax = 0x4F01; // set up registers
rmRegs.ecx = mode; // for RM interrupt
rmRegs.es = vbeModePool.segment; rmRegs.edi = 0;
RMVideoInt (); // execute video
// interrupt
return (rmRegs.eax & OxFFFF ) == 0x4F; // check for validity
}
setVESAMode (int mode ) {
if ( mode == 3 ) {

4. Работа с основными графическими устройст

rmRegs.eax = 3; RMVideoInt (); return 1;
}
if ( IFindVESAMode ( mode ) )// retrieve
return 0; // VESAModelnfo
rmRegs.eax = 0x4F02;
rmRegs.ebx = mode | 0x4000;// ask foir LFB
RMVideoInt (); // execute video
// interrupt
if ( ( rmRegs.eax & OxFFFF ) != 0x4F ) return 0;
if ( IfbPtr != NULL ) //unmap previously
// mapped memory
DPMIUnmapPhysical ( IfbPtr );
// map linear // frame buffer
IfbPtr = DPMIMapPhysical ( vbeModelnfoPtr -> physBasePtr, (long) vbelnfoPtr -> tOtalMemory*64*1024 );
bytesPerLine = vbeModelnfoPtr -> bytesPerScanLine; bitsPerPixel = vbeModelnfoPtr ~> bitsPerPixel;

⇐ Предыдущая| |Следующая ⇒