📄 video.c
字号:
pVideo->aszVideoBiosVersion[i][0] = '\0';
}
}
return (FALSE);
}
/*********************************************************************
* SprintVideoInfo - Put video information into a set of strings to be
* printed or displayed.
*
* pVideo - Pointer to video information structure.
* szSumStrings - Summary string area.
*
* Returns: NULL if an error occured.
*********************************************************************/
QSZ * SprintVideoInfo (VIDEO_STRUCT *pVideo,
CHAR szSumStrings[][MAX_SUMM_INFO + 5])
{
WORD wNmbrStrings; /* Number of strings */
WORD wNmbrChars; /* Number of characters in the strings */
WORD wIndex; /* Index to the structure of TSR data */
WORD i; /* Looping variable */
QSZ *pqszStrings = NULL; /* Location for storing string pointers */
/* Summary Strings */
if (szSumStrings != NULL)
{
/* Adapter Type (CGA/EGA/VGA/etc) */
strncpy (szSumStrings[0], pVideo->szAdapterType, MAX_SUMM_INFO);
strncat (szSumStrings[0], pszCommaSpace,
MAX_SUMM_INFO - strlen (szSumStrings[0]));
/* Adapter Manufacturer */
if (pVideo->szAdapterName[0] != '\0')
strncat (szSumStrings[0], pVideo->szAdapterName,
MAX_SUMM_INFO - strlen (szSumStrings[0]));
/* Adapter Model */
strncpy (szSumStrings[1], pVideo->szAdapterModel, MAX_SUMM_INFO);
return (NULL);
}
/* Overestimate the amount of space required for the strings */
wNmbrStrings = 20;
wNmbrChars = sizeof (VIDEO_STRUCT) +
(wNmbrStrings * MAX_VIDEO_TITLE_LENGTH) + 50;
/* Allocate space for the pointer area and string area */
pqszStrings = AllocStringSpace (wNmbrStrings, wNmbrChars);
if (pqszStrings == NULL)
return (NULL);
/* Put the information in place */
for (i = 0, wIndex = 0; paszVideoTitles[wIndex] != NULL ; ++i, ++wIndex)
{
WORD wIndent; /* Amount to indent */
CHAR chBuffer[MAX_VESA_OEM_NAME]; /* Buffer for string data */
PSZ pszString = NULL; /* String pointer */
/* Title for this line of data */
wIndent = MAX_VIDEO_TITLE_LENGTH -
strlen (paszVideoTitles[wIndex]);
Qmemset (pqszStrings[i], ' ', wIndent);
Qstrcpy (&pqszStrings[i][wIndent], paszVideoTitles[wIndex]);
/* Place the appropriate information on the line */
switch (wIndex)
{
case VID_ADAPTER_TYPE:
pszString = pVideo->szAdapterType;
break;
case VID_NAME:
pszString = pVideo->szAdapterName;
break;
case VID_MODEL:
pszString = pVideo->szAdapterModel;
break;
case VID_DISPLAY_TYPE:
pszString = pVideo->szDisplayType;
break;
case VID_MODE:
sprintf (chBuffer, "%d", pVideo->bMode0);
pszString = chBuffer;
break;
case VID_NMBR_COLUMNS:
sprintf (chBuffer, "%d", pVideo->bNmbrCols0);
pszString = chBuffer;
break;
case VID_NMBR_ROWS:
sprintf (chBuffer, "%d", pVideo->bNmbrRows);
pszString = chBuffer;
break;
case VID_BIOS_VERSION_1:
pszString = pVideo->aszVideoBiosVersion[0];
/* Skip blank BIOS version lines */
if (pVideo->aszVideoBiosVersion[1][0] == '\0')
wIndex += 2;
break;
case VID_BIOS_VERSION_2:
pszString = pVideo->aszVideoBiosVersion[1];
/* Skip blank BIOS version lines */
if (pVideo->aszVideoBiosVersion[2][0] == '\0')
++wIndex;
break;
case VID_BIOS_VERSION_3:
pszString = pVideo->aszVideoBiosVersion[2];
break;
case VID_BIOS_DATE:
pszString = pVideo->szVideoBiosDate;
break;
case VID_VESA_COMPAT:
if (pVideo->bVesaVersionMajor == 0 &&
pVideo->bVesaVersionMinor == 0)
{
pszString = pszNo;
wIndex += 2;
}
else
pszString = pszYes;
break;
case VID_VESA_VERSION:
sprintf (chBuffer, "%X.%02X", pVideo->bVesaVersionMajor,
pVideo->bVesaVersionMinor);
pszString = chBuffer;
break;
case VID_VESA_OEM:
pszString = pVideo->szVesaOemName;
break;
case VID_2NDARY_ADAPTER:
pszString = pVideo->sz2ndAdapterType;
if (pVideo->wTigaInterrupt == 0)
wIndex += 2;
break;
case VID_TIGA_VERSION:
sprintf (chBuffer, "%d.%02d", pVideo->wTigaMajor,
pVideo->wTigaMinor);
pszString = chBuffer;
break;
case VID_TIGA_INT:
sprintf (chBuffer, "%XH / %04X:%04X ", pVideo->wTigaInterrupt,
FP_SEG (pVideo->dwTigaIntAddress),
FP_OFF (pVideo->dwTigaIntAddress));
/* Mention if the signature was found */
if (pVideo->fTigaSignatureFound == TRUE)
strcat (chBuffer, "TIGA Signature Found");
else if (pVideo->fTigaSignatureFound == FALSE)
strcat (chBuffer, "TIGA Signature Not Found");
pszString = chBuffer;
break;
default:
pszString = "";
}
/* Put the information on the line */
Qstrcat (pqszStrings[i], pszString);
/* Set the next pointer */
PrepNextString (pqszStrings, i);
}
/* Set the last pointer to NULL */
pqszStrings[i] = NULL;
/* Return the pointer to pqszStrings */
return (pqszStrings);
}
/*********************************************************************
* SubsystemName - This function returns the type of video adapter.
*********************************************************************/
PSZ SubsystemName (BYTE bType)
{
if (bType & 0x80)
return (ppszHercName[bType & 0x7F]);
else
return (ppszIbmName[bType]);
}
/*********************************************************************
* DisplayType - This function returns the type of display.
*********************************************************************/
PSZ DisplayName (BYTE bType)
{
return (ppszDisplayName[bType]);
}
/*********************************************************************
* GetTigaInfo - Determines the TIGA driver information.
*
* pVideo - Video information structure
*
* Returns: TRUE if the TIGA communications driver (CD) is found.
*********************************************************************/
BOOL GetTigaInfo (VIDEO_STRUCT *pVideo)
{
PSZ pszTigaEnvString; /* Pointer to TIGA environment variable */
PSZ pszIntIdent; /* Interrupt number identifier */
WORD wTigaIntNumber; /* TIGA CD interrupt number */
union REGS regs; /* Registers for int86 call */
struct SREGS sregs; /* Segment regs for int86x */
CHAR FAR *fpszSignature; /* pointer to signature "TIGA" */
/* Get the TIGA environment string */
pszTigaEnvString = getenv ("TIGA");
if (pszTigaEnvString == NULL)
return (FALSE);
/* Find the interrupt number */
pszIntIdent = strstr (pszTigaEnvString, " -i0");
if (pszIntIdent != NULL)
{
/* Parse for the interrupt number */
sscanf (&pszIntIdent[5], "%x", &wTigaIntNumber);
}
else
wTigaIntNumber = 0x7F;
/* Set the interrupt number in the struture */
pVideo->wTigaInterrupt = wTigaIntNumber;
/* Get the interrupt address */
regs.h.ah = 0x35;
regs.h.al = (BYTE) wTigaIntNumber;
int86x (0x21, ®s, ®s, &sregs);
pVideo->dwTigaIntAddress = ((DWORD) sregs.es << 16) + regs.x.bx;
if (sregs.es == 0 && regs.x.bx == 0)
return (FALSE);
/* Determine if the TIGA CD is installed and operating */
regs.x.ax = 0x4321;
int86 (wTigaIntNumber, ®s, ®s);
/* AX == 0 if TIGA CD is installed */
if (regs.x.ax == 0)
{
/* Obtain the TIGA version */
regs.h.ah = 1;
int86 (wTigaIntNumber, ®s, ®s);
if (regs.x.bx != 0x1234)
{
/* BX != 0x1234 means TIGA 1.1 */
pVideo->wTigaMajor = 1;
pVideo->wTigaMinor = 1;
pVideo->fTigaSignatureFound = 0xFFFF;
}
else
{
/* Otherwise, the TIGA version number is in CH.CL (decimal) */
pVideo->wTigaMajor = (WORD) regs.h.ch;
pVideo->wTigaMinor = (WORD) regs.h.cl;
}
/* Look for the "TIGA\0" signature at the interrupt address. */
/* (Only valid for TIGA 2.2 and above) */
if (pVideo->wTigaMajor * 100 + pVideo->wTigaMinor >= 220)
{
/* Point to the signature */
fpszSignature = (CHAR FAR *) pVideo->dwTigaIntAddress + 2;
if (_fmemcmp (fpszSignature, "TIGA", 5) == 0)
pVideo->fTigaSignatureFound = TRUE;
else
pVideo->fTigaSignatureFound = FALSE;
}
else
pVideo->fTigaSignatureFound = 0xFFFF;
/* Set the highest class of display adapter into the */
/* Secondary Display field. */
if ((WORD) (pVideo->bSubsystem1) ^ 0x180 <
(WORD) (pVideo->bSubsystem0 ^ 0x180))
pVideo->bSubsystem1 = pVideo->bSubsystem0;
pVideo->bSubsystem0 = VIDEO_TYPE_TIGA;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -