PATCH: SVGA code fix + VESA Get SuperVGA INFORMATION implementation

Christian Costa titan.costa at wanadoo.fr
Mon May 27 16:13:10 CDT 2002


Changelog: 

The SVGA block code was not accessible (AH and AL inverted). Fixed.
Removed duplicate VESA Get SuperVGA INFORMATION function.
Fix and finish its implementation.
Add 2 functions to managed structures in the BiosSys segment.

         Modified files: dlls/winedos/int10.c
                         msdos/dosmem.c
                         include/miscemu.h

Christian Costa   titan.costa at wanadoo.fr

-------------- next part --------------
Index: include/miscemu.h
===================================================================
RCS file: /home/wine/wine/include/miscemu.h,v
retrieving revision 1.46
diff -u -r1.46 miscemu.h
--- include/miscemu.h	10 Mar 2002 00:02:34 -0000	1.46
+++ include/miscemu.h	27 May 2002 20:57:38 -0000
@@ -134,7 +134,23 @@
 
 } VIDEOFUNCTIONALITY;
 
+typedef struct
+{
+    DWORD Signature;
+    BYTE  Minor;
+    BYTE  Major;
+    DWORD StaticVendorString;
+    DWORD CapabilitiesFlags;
+    DWORD StaticModeList;
+} VESAINFO;
+
 #include "poppack.h"
+
+/* Index for bios structures stored at f000:e000 */ 
+enum {OFF_VIDEOSTATE,OFF_VIDEOFUNCTIONALITY,OFF_VESAINFO,OFF_VESASTRING,OFF_VESAMODELIST};
+
+extern WORD DOSMEM_AddBiosSysStruct(int,int);
+extern WORD DOSMEM_GetBiosSysStructOffset(int);
 
 extern WORD DOSMEM_0000H;
 extern WORD DOSMEM_BiosDataSeg;
Index: msdos/dosmem.c
===================================================================
RCS file: /home/wine/wine/msdos/dosmem.c,v
retrieving revision 1.36
diff -u -r1.36 dosmem.c
--- msdos/dosmem.c	10 Mar 2002 00:18:35 -0000	1.36
+++ msdos/dosmem.c	27 May 2002 20:57:39 -0000
@@ -47,6 +47,9 @@
 
 DWORD DOSMEM_CollateTable;
 
+static int StructOffset[256];            /* Offsets for all structures at f000:e000*/
+static int CurrentStructOffset = 0xe000; /* Current free offset */
+
 /* use 2 low bits of 'size' for the housekeeping */
 
 #define DM_BLOCK_DEBUG		0xABE00000
@@ -239,6 +242,23 @@
     return DOSMEM_dosmem+0xf0000;
 }
 
+/* Add a structure in the BiosSys area (with size and index) and
+   return its offset */ 
+WORD DOSMEM_AddBiosSysStruct(int size,int index)
+{
+  int Offset = CurrentStructOffset;
+  StructOffset[index]= CurrentStructOffset;     
+  CurrentStructOffset += size;
+  return Offset;
+}
+
+/* Return the offset of a structure specified by the index */ 
+WORD DOSMEM_GetBiosSysStructOffset(int index)
+{
+  return StructOffset[index];
+}
+
+
 /***********************************************************************
  *           DOSMEM_FillBiosSegments
  *
@@ -250,18 +270,32 @@
     BYTE *pBiosROMTable = pBiosSys+0xe6f5;
     BIOSDATA *pBiosData = DOSMEM_BiosData();
 
-    /* bogus 0xe0xx addresses !! Adapt int 0x10/0x1b if change needed */
-    VIDEOFUNCTIONALITY *pVidFunc = (VIDEOFUNCTIONALITY *)(pBiosSys+0xe000);
-    VIDEOSTATE *pVidState = (VIDEOSTATE *)(pBiosSys+0xe010);
+    /* Supported VESA mode, see int10.c */
+    WORD ConstVesaModeList[]={0x00,0x01,0x02,0x03,0x07,0x0D,0x0E,0x10,0x12,0x13,
+                              0x100,0x101,0x102,0x103,0x104,0x105,0x106,0x107,0x10D,0x10E,
+                              0x10F,0x110,0x111,0x112,0x113,0x114,0x115,0x116,0x117,0x118,
+                              0x119,0x11A,0x11B,0xFFFF};
+    char * ConstVesaString = "WINE SVGA BOARD";
     int i;
 
+    VIDEOFUNCTIONALITY *pVidFunc = (VIDEOFUNCTIONALITY *)
+          (pBiosSys+DOSMEM_AddBiosSysStruct(sizeof(VIDEOFUNCTIONALITY),OFF_VIDEOFUNCTIONALITY));
+    VIDEOSTATE *pVidState = (VIDEOSTATE *)
+          (pBiosSys+DOSMEM_AddBiosSysStruct(sizeof(VIDEOSTATE),OFF_VIDEOSTATE));
+    VESAINFO *pVesaInfo = (VESAINFO *)
+          (pBiosSys+DOSMEM_AddBiosSysStruct(sizeof(VESAINFO),OFF_VESAINFO));
+    char * VesaString = (char *)
+          (pBiosSys+DOSMEM_AddBiosSysStruct(strlen(ConstVesaString)+1,OFF_VESASTRING));
+    WORD * VesaModeList = (WORD *)
+          (pBiosSys+DOSMEM_AddBiosSysStruct(sizeof(ConstVesaModeList),OFF_VESAMODELIST));
+
       /* Clear all unused values */
     memset( pBiosData, 0, sizeof(*pBiosData) );
     memset( pVidFunc,  0, sizeof(*pVidFunc ) );
     memset( pVidState, 0, sizeof(*pVidState) );
+    memset( pVesaInfo, 0, sizeof(*pVesaInfo) );
 
     /* FIXME: should check the number of configured drives and ports */
-
     pBiosData->Com1Addr             = 0x3f8;
     pBiosData->Com2Addr             = 0x2f8;
     pBiosData->Lpt1Addr             = 0x378;
@@ -299,17 +333,18 @@
     *(pBiosROMTable+0x8)	= 0x00; /* feature byte 4 */
     *(pBiosROMTable+0x9)	= 0x00; /* feature byte 5 */
 
-    
+
     for (i = 0; i < 7; i++)
         pVidFunc->ModeSupport[i] = 0xff;
-    
+
     pVidFunc->ScanlineSupport     = 7;
     pVidFunc->NumberCharBlocks    = 0;
     pVidFunc->ActiveCharBlocks    = 0;
     pVidFunc->MiscFlags           = 0x8ff;
     pVidFunc->SavePointerFlags    = 0x3f;
 
-    pVidState->StaticFuncTable    = 0xf000e000;  /* FIXME: always real mode ? */
+                                    /* FIXME: always real mode ? */
+    pVidState->StaticFuncTable    = (0xf000<<16)+DOSMEM_GetBiosSysStructOffset(OFF_VIDEOFUNCTIONALITY);                                     
     pVidState->VideoMode          = pBiosData->VideoMode; /* needs updates! */
     pVidState->NumberColumns      = pBiosData->VideoColumns; /* needs updates! */
     pVidState->RegenBufLen        = 0;
@@ -339,6 +374,19 @@
     pVidState->VideoMem           = (pBiosData->ModeOptions & 0x60 >> 5);
     pVidState->SavePointerState   = 0;
     pVidState->DisplayStatus      = 4;
+
+    /* SVGA structures */
+    pVesaInfo->Signature          = *(DWORD*)"VESA";
+    pVesaInfo->Major              = 2;
+    pVesaInfo->Minor              = 0;
+                                    /* FIXME: always real mode ? */
+    pVesaInfo->StaticVendorString = (0xF000<<16)+DOSMEM_GetBiosSysStructOffset(OFF_VESASTRING);
+    pVesaInfo->CapabilitiesFlags  = 0xfffffffd; /* FIXME: not really supported */
+                                    /* FIXME: always real mode ? */
+    pVesaInfo->StaticModeList     = (0xF000<<16)+DOSMEM_GetBiosSysStructOffset(OFF_VESAMODELIST);
+
+    strcpy(VesaString,ConstVesaString);
+    memcpy(VesaModeList,ConstVesaModeList,sizeof(ConstVesaModeList));
 
     /* BIOS date string */
     strcpy((char *)pBiosSys+0xfff5, "13/01/99");
Index: dlls/winedos/int10.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/int10.c,v
retrieving revision 1.11
diff -u -r1.11 int10.c
--- dlls/winedos/int10.c	16 May 2002 20:27:54 -0000	1.11
+++ dlls/winedos/int10.c	27 May 2002 20:57:41 -0000
@@ -87,14 +87,17 @@
 {
     BIOSDATA *data = DOSMEM_BiosData();
 
-    if(AL_reg(context) == 0x4F) { /* VESA functions */
-	switch(AH_reg(context)) {
+    if(AH_reg(context) == 0x4F) { /* VESA functions */
+	switch(AL_reg(context)) {
 
 	case 0x00: /* GET SuperVGA INFORMATION */
-	    FIXME("Vesa Get SuperVGA Info STUB!\n");
+	    TRACE("VESA GET SuperVGA INFORMATION\n");
+	    memcpy(CTX_SEG_OFF_TO_LIN(context,context->SegEs,context->Edi),
+	    DOSMEM_BiosSys()+DOSMEM_GetBiosSysStructOffset(OFF_VESAINFO),sizeof(VESAINFO));
 	    AL_reg(context) = 0x4f;
-	    AH_reg(context) = 0x01; /* 0x01=failed 0x00=succesful */
+	    AH_reg(context) = 0x00; /* 0x00 = successful 0x01 = failed */
 	    break;
+ 
 	case 0x01: /* GET SuperVGA MODE INFORMATION */
 	    FIXME("VESA GET SuperVGA Mode Information - Not supported\n");
 	    AL_reg(context) = 0x4f;
@@ -739,7 +742,7 @@
           AL_reg(context) = 0x1b;
           /* Copy state information structure to ES:DI */
           memcpy(CTX_SEG_OFF_TO_LIN(context,context->SegEs,context->Edi),
-              DOSMEM_BiosSys()+0xe010,sizeof(VIDEOSTATE));
+              DOSMEM_BiosSys()+DOSMEM_GetBiosSysStructOffset(OFF_VIDEOSTATE),sizeof(VIDEOSTATE));
         }
         break;
 
@@ -747,20 +750,6 @@
         FIXME("Save/Restore Video State - Not Supported\n");
         break;
 
-    case 0x4f: /* Get SuperVGA INFORMATION */
-        {
-          BYTE *p =
-               CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Edi);
-          /* BOOL16 vesa20 = (*(DWORD *)p == *(DWORD *)"VBE2"); */
-  
-          TRACE("Get SuperVGA information\n");
-          AH_reg(context) = 0;
-          *(DWORD *)p = *(DWORD *)"VESA";
-          *(WORD *)(p+0x04) = 0x0200; /* VESA 2.0 */
-          *(DWORD *)(p+0x06) = 0x00000000; /* pointer to OEM name */
-          *(DWORD *)(p+0x0a) = 0xfffffffd; /* capabilities flags :-) */
-        }
-        break;
         case 0xef:  /* get video mode for hercules-compatibles   */
                     /* There's no reason to really support this  */
                     /* is there?....................(A.C.)       */


More information about the wine-patches mailing list