Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygeni386vid.c
Go to the documentation of this file.
00001 /* 00002 * FreeLoader 00003 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 00020 #include <freeldr.h> 00021 00022 #define NDEBUG 00023 #include <debug.h> 00024 00025 DBG_DEFAULT_CHANNEL(UI); 00026 00027 #include <pshpack2.h> 00028 typedef struct 00029 { 00030 UCHAR Signature[4]; // (ret) signature ("VESA") 00031 // (call) VESA 2.0 request signature ("VBE2"), required to receive 00032 // version 2.0 info 00033 USHORT VesaVersion; // VESA version number (one-digit minor version -- 0102h = v1.2) 00034 ULONG OemNamePtr; // pointer to OEM name 00035 // "761295520" for ATI 00036 ULONG Capabilities; // capabilities flags (see #00078) 00037 ULONG SupportedModeListPtr; // pointer to list of supported VESA and OEM video modes 00038 // (list of words terminated with FFFFh) 00039 USHORT TotalVideoMemory; // total amount of video memory in 64K blocks 00040 00041 // ---VBE v1.x --- 00042 //UCHAR Reserved[236]; 00043 00044 // ---VBE v2.0 --- 00045 USHORT OemSoftwareVersion; // OEM software version (BCD, high byte = major, low byte = minor) 00046 ULONG VendorNamePtr; // pointer to vendor name 00047 ULONG ProductNamePtr; // pointer to product name 00048 ULONG ProductRevisionStringPtr; // pointer to product revision string 00049 USHORT VBE_AF_Version; // (if capabilities bit 3 set) VBE/AF version (BCD) 00050 // 0100h for v1.0P 00051 ULONG AcceleratedModeListPtr; // (if capabilities bit 3 set) pointer to list of supported 00052 // accelerated video modes (list of words terminated with FFFFh) 00053 UCHAR Reserved[216]; // reserved for VBE implementation 00054 UCHAR ScratchPad[256]; // OEM scratchpad (for OEM strings, etc.) 00055 } VESA_SVGA_INFO, *PVESA_SVGA_INFO; 00056 #include <poppack.h> 00057 00058 // Bitfields for VESA capabilities: 00059 // 00060 // Bit(s) Description (Table 00078) 00061 // 0 DAC can be switched into 8-bit mode 00062 // 1 non-VGA controller 00063 // 2 programmed DAC with blank bit (i.e. only during blanking interval) 00064 // 3 (VBE v3.0) controller supports hardware stereoscopic signalling 00065 // 3 controller supports VBE/AF v1.0P extensions 00066 // 4 (VBE v3.0) if bit 3 set: 00067 // =0 stereo signalling via external VESA stereo connector 00068 // =1 stereo signalling via VESA EVC connector 00069 // 4 (VBE/AF v1.0P) must call EnableDirectAccess to access framebuffer 00070 // 5 (VBE/AF v1.0P) controller supports hardware mouse cursor 00071 // 6 (VBE/AF v1.0P) controller supports hardware clipping 00072 // 7 (VBE/AF v1.0P) controller supports transparent BitBLT 00073 // 8-31 reserved (0) 00074 00075 // Notes: The list of supported video modes is stored in the reserved 00076 // portion of the SuperVGA information record by some implementations, 00077 // and it may thus be necessary to either copy the mode list or use a 00078 // different buffer for all subsequent VESA calls. Not all of the video 00079 // modes in the list of mode numbers may be supported, e.g. if they require 00080 // more memory than currently installed or are not supported by the 00081 // attached monitor. Check any mode you intend to use through AX=4F01h first.. 00082 // The 1.1 VESA document specifies 242 reserved bytes at the end, so the 00083 // buffer should be 262 bytes to ensure that it is not overrun; for v2.0, 00084 // the buffer should be 512 bytes. The S3 specific video modes will most 00085 // likely follow the FFFFh terminator at the end of the standard modes. 00086 // A search must then be made to find them, FFFFh will also terminate this 00087 // second list. In some cases, only a "stub" VBE may be present, supporting 00088 // only AX=4F00h; this case may be assumed if the list of supported video modes 00089 // is empty (consisting of a single word of FFFFh) 00090 #if 0 00091 static VOID BiosSetVideoFont8x16(VOID) 00092 { 00093 REGS Regs; 00094 00095 // Int 10h AX=1114h 00096 // VIDEO - TEXT-MODE CHARGEN - LOAD ROM 8x16 CHARACTER SET (VGA) 00097 // 00098 // AX = 1114h 00099 // BL = block to load 00100 // Return: 00101 // Nothing 00102 Regs.w.ax = 0x1114; 00103 Regs.b.bl = 0; 00104 Int386(0x10, &Regs, &Regs); 00105 } 00106 00107 static VOID VideoSetTextCursorPosition(ULONG X, ULONG Y) 00108 { 00109 } 00110 00111 static ULONG VideoGetTextCursorPositionX(VOID) 00112 { 00113 REGS Regs; 00114 00115 // Int 10h AH=03h 00116 // VIDEO - GET CURSOR POSITION AND SIZE 00117 // 00118 // AH = 03h 00119 // BH = page number 00120 // 0-3 in modes 2&3 00121 // 0-7 in modes 0&1 00122 // 0 in graphics modes 00123 // Return: 00124 // AX = 0000h (Phoenix BIOS) 00125 // CH = start scan line 00126 // CL = end scan line 00127 // DH = row (00h is top) 00128 // DL = column (00h is left) 00129 Regs.b.ah = 0x03; 00130 Regs.b.bh = 0x00; 00131 Int386(0x10, &Regs, &Regs); 00132 00133 return Regs.b.dl; 00134 } 00135 00136 static ULONG VideoGetTextCursorPositionY(VOID) 00137 { 00138 REGS Regs; 00139 00140 // Int 10h AH=03h 00141 // VIDEO - GET CURSOR POSITION AND SIZE 00142 // 00143 // AH = 03h 00144 // BH = page number 00145 // 0-3 in modes 2&3 00146 // 0-7 in modes 0&1 00147 // 0 in graphics modes 00148 // Return: 00149 // AX = 0000h (Phoenix BIOS) 00150 // CH = start scan line 00151 // CL = end scan line 00152 // DH = row (00h is top) 00153 // DL = column (00h is left) 00154 Regs.b.ah = 0x03; 00155 Regs.b.bh = 0x00; 00156 Int386(0x10, &Regs, &Regs); 00157 00158 return Regs.b.dh; 00159 } 00160 #endif 00161 00162 USHORT BiosIsVesaSupported(VOID) 00163 { 00164 REGS Regs; 00165 PVESA_SVGA_INFO SvgaInfo = (PVESA_SVGA_INFO)BIOSCALLBUFFER; 00166 //USHORT* VideoModes; 00167 //USHORT Index; 00168 00169 TRACE("BiosIsVesaSupported()\n"); 00170 00171 RtlZeroMemory(SvgaInfo, sizeof(VESA_SVGA_INFO)); 00172 00173 // Make sure we receive version 2.0 info 00174 SvgaInfo->Signature[0] = 'V'; 00175 SvgaInfo->Signature[1] = 'B'; 00176 SvgaInfo->Signature[2] = 'E'; 00177 SvgaInfo->Signature[3] = '2'; 00178 00179 // Int 10h AX=4F00h 00180 // VESA SuperVGA BIOS (VBE) - GET SuperVGA INFORMATION 00181 // 00182 // AX = 4F00h 00183 // ES:DI -> buffer for SuperVGA information (see #00077) 00184 // Return: 00185 // AL = 4Fh if function supported 00186 // AH = status 00187 // 00h successful 00188 // ES:DI buffer filled 00189 // 01h failed 00190 // ---VBE v2.0--- 00191 // 02h function not supported by current hardware configuration 00192 // 03h function invalid in current video mode 00193 // 00194 // Determine whether VESA BIOS extensions are present and the 00195 // capabilities supported by the display adapter 00196 // 00197 // Installation check;VESA SuperVGA 00198 Regs.w.ax = 0x4F00; 00199 Regs.w.es = BIOSCALLBUFSEGMENT; 00200 Regs.w.di = BIOSCALLBUFOFFSET; 00201 Int386(0x10, &Regs, &Regs); 00202 00203 TRACE("AL = 0x%x\n", Regs.b.al); 00204 TRACE("AH = 0x%x\n", Regs.b.ah); 00205 00206 if (Regs.w.ax != 0x004F) 00207 { 00208 ERR("VESA BIOS call failed\n"); 00209 return 0x0000; 00210 } 00211 00212 TRACE("Supported.\n"); 00213 TRACE("SvgaInfo->Signature[4] = %c%c%c%c\n", SvgaInfo->Signature[0], SvgaInfo->Signature[1], SvgaInfo->Signature[2], SvgaInfo->Signature[3]); 00214 TRACE("SvgaInfo->VesaVersion = v%d.%d\n", ((SvgaInfo->VesaVersion >> 8) & 0xFF), (SvgaInfo->VesaVersion & 0xFF)); 00215 TRACE("SvgaInfo->OemNamePtr = 0x%x\n", SvgaInfo->OemNamePtr); 00216 TRACE("SvgaInfo->Capabilities = 0x%x\n", SvgaInfo->Capabilities); 00217 TRACE("SvgaInfo->VideoMemory = %dK\n", SvgaInfo->TotalVideoMemory * 64); 00218 TRACE("---VBE v2.0 ---\n"); 00219 TRACE("SvgaInfo->OemSoftwareVersion = v%d.%d\n", ((SvgaInfo->OemSoftwareVersion >> 8) & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 12) & 0x0F) * 10), (SvgaInfo->OemSoftwareVersion & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 4) & 0x0F) * 10)); 00220 TRACE("SvgaInfo->VendorNamePtr = 0x%x\n", SvgaInfo->VendorNamePtr); 00221 TRACE("SvgaInfo->ProductNamePtr = 0x%x\n", SvgaInfo->ProductNamePtr); 00222 TRACE("SvgaInfo->ProductRevisionStringPtr = 0x%x\n", SvgaInfo->ProductRevisionStringPtr); 00223 TRACE("SvgaInfo->VBE/AF Version = 0x%x (BCD WORD)\n", SvgaInfo->VBE_AF_Version); 00224 00225 if (SvgaInfo->Signature[0] != 'V' || 00226 SvgaInfo->Signature[1] != 'E' || 00227 SvgaInfo->Signature[2] != 'S' || 00228 SvgaInfo->Signature[3] != 'A') 00229 { 00230 ERR("Bad signature in VESA information (%c%c%c%c)\n", 00231 SvgaInfo->Signature[0], 00232 SvgaInfo->Signature[1], 00233 SvgaInfo->Signature[2], 00234 SvgaInfo->Signature[3]); 00235 return 0x0000; 00236 } 00237 00238 return SvgaInfo->VesaVersion; 00239 } Generated on Tue May 22 2012 04:22:46 for ReactOS by
1.7.6.1
|