⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 computer.c

📁 Dos6.0
💻 C
📖 第 1 页 / 共 4 页
字号:

          loopne  ContinuePop     ; Loop if not found

          and   cx,cx             ; Is CX == 0 (end of search length)?
          jz    not_found         ; We're done (no match)

          and   dl,dl             ; Is the 4th character a NULL?
          jz    was_found         ; If so, we found it

          lodsb                   ; Otherwise, check the 4th character

          and   al,0xDF           ; Fast "toupper()"
          cmp   dl,al             ; Is it a match?

          loopne  ContinuePop     ; Loop if not found

          and   cx,cx             ; Is CX == 0 (end of search length)?
          jz    not_found         ; We're done (no match)

          jmp   was_found         ; Otherwise, we have a match

        not_found:
          pop   ax                ; Remove the SI from the stack
          mov   fFoundFlag,FALSE  ; Set the flag saying we didn't find it
          jmp   done

        was_found:                ; Adjust SI to point
          pop   si                ;   directly at the string
          dec   si

          mov   fFoundFlag,TRUE   ; We found it
          mov   wSearchLength,cx  ; Set the variables to continue the search
          mov   wStringOffset,si
          mov   wStringSegment,ds

        done:
          pop   di
          pop   ds
        }

      if (fFoundFlag)
        {

          /* Set the pointer for continuing the search */
          fpSearchArea = (CHAR FAR *)
                           ((DWORD) wStringSegment << 16) +
                           (DWORD) wStringOffset;

          /* If the strings fully match, return the address of the string */
          if (!(_fmemicmp (fpSearchArea, (CHAR FAR *) pszSearchString,
                          wLength)))
            return (fpSearchArea);
          else
            /* Otherwise, keep searching */
            fpSearchArea = (wLength < 4) ? fpSearchArea + wLength :
                           fpSearchArea + 4;
        }
      else
        return (NULL);
    }
}


/*********************************************************************
 * fbMemString - far, buffer, string locator.  Looks forward and
 *               backwards for the first non-printing ASCII characters
 *               to locate the beginning and ending of a string in
 *               RAM.  Skips white space at the beginning and end of
 *               the string.
 *
 * pszfString1   Far pointer to the area of memory containing the
 *               string.
 *
 * pwLength      Changed to reflect the length of the string.
 *
 * returns CHAR FAR * to beginning of string, and pwLength is changed
 *         to reflect the length of the string.
 *********************************************************************/

CHAR FAR *fbMemString (register CHAR FAR *pszfString,
                       register WORD *pwLength)
{
  int iNewLineCount = 0;    /* Counts the number of newline characters */
  int iCountSinceNewLine = 0; /* Number of characters since the last newline */
  int iCharCount    = 0;    /* Counts the number of characters preceeding */
                            /*   the found string */

  /* Search backwards to beginning of string or 192 bytes */
  /*   or three lines, whichever is less                  */
  while (++iCharCount < 192 && iNewLineCount <= 3 && 
         ((*pszfString >= ' ' && *pszfString <= 126 &&
           *pszfString != '$' && *pszfString != '@') ||
           *pszfString == '\r' || *pszfString == '\n' ||
           *pszfString == '\t'))
    {
      if (*pszfString == '\r' || iCountSinceNewLine > REPORT_WIDTH - 10)
        {
          ++iNewLineCount;
          iCountSinceNewLine = 0;
        }
      else
        ++iCountSinceNewLine;

      --pszfString;
    }

  ++pszfString;
  iNewLineCount = 0;

  /* Skip over whitespace at the beginning of the string */
  while (*pszfString == ' ' || *pszfString == '\r' ||
         *pszfString == '\n' || *pszfString == '\t')
    ++pszfString;

  *pwLength = 0;
  iCountSinceNewLine = 0;

  /* Search forward to end of readable text */
  while ((pszfString[*pwLength] >= ' ' && pszfString[*pwLength] <= 126 &&
          pszfString[*pwLength] != '$' && pszfString[*pwLength] != '@') ||
          pszfString[*pwLength] == '\r' || pszfString[*pwLength] == '\n' ||
          pszfString[*pwLength] == '\t')
    {
      if (pszfString[*pwLength] == '\r')
        if (++iNewLineCount > 4)
          break;
        else
          iCountSinceNewLine = 0;


      if (++iCountSinceNewLine > REPORT_WIDTH - 10)
        if (++iNewLineCount > 4)
          break;
        else
          iCountSinceNewLine = 0;

      ++(*pwLength);
    }

  /* Search backward to first printable character which will */
  /*   skip over whitespace at the end of the string */
  while (pszfString[*pwLength] <= ' ' || pszfString[*pwLength] > 127 ||
         pszfString[*pwLength] == '$' || pszfString[*pwLength] == '@')
    --(*pwLength);

  *pwLength = (++(*pwLength)> 240) ? 240 : *pwLength;

  return (pszfString);
}


/**********************************************************************
 * GetBiosCageory - Uses bComputerType, bSubModel, and bRevisionLevel
 *                           to determine the computer descriptions.
 *
 * pComputer - Computer information structure.
 *
 * Returns:  VOID
 **********************************************************************/

#define UNKNOWN_COMPUTER  paszCommonStrings[0]
#define IBM_PC            paszCommonStrings[1]
#define IBM_PCJR          paszCommonStrings[2]
#define IBM_CONVERTIBLE   paszCommonStrings[3]
#define IBM_XT            paszCommonStrings[4]
#define IBM_XT_286        paszCommonStrings[5]
#define IBM_AT            paszCommonStrings[6]
#define IBM_PS2_25        paszCommonStrings[7]
#define IBM_PS2_25_30     paszCommonStrings[8]
#define IBM_PS2_30        paszCommonStrings[9]
#define IBM_PS2_30_286    paszCommonStrings[10]
#define IBM_PS2_50        paszCommonStrings[11]
#define IBM_PS2_50Z       paszCommonStrings[12]
#define IBM_PS2_55SX      paszCommonStrings[13]
#define IBM_PS2_60        paszCommonStrings[14]
#define IBM_PS2_70        paszCommonStrings[15]
#define IBM_PS2_P70       paszCommonStrings[16]
#define IBM_PS2_70_80     paszCommonStrings[17]
#define IBM_PS2_80        paszCommonStrings[18]
#define IBM_PS2_90        paszCommonStrings[19]
#define IBM_PS1           paszCommonStrings[20]
#define IBM_PS2_65SX      paszCommonStrings[21]

static char *paszCommonStrings[] =
  {
    "Not Determined",
    "IBM PC",
    "IBM PCjr",
    "IBM PC Convertible",
    "IBM PC/XT",
    "IBM PC/XT 286",
    "IBM PC/AT",
    "IBM PS/2 Model 25",
    "IBM PS/2 Model 25/30",
    "IBM PS/2 Model 30 286",
    "IBM PS/2 Model 30",
    "IBM PS/2 Model 50",
    "IBM PS/2 Model 50Z",
    "IBM PS/2 Model 55SX",
    "IBM PS/2 Model 60",
    "IBM PS/2 Model 70",
    "IBM PS/2 Model P70",
    "IBM PS/2 Model 70/80",
    "IBM PS/2 Model 80",
    "IBM PS/2 Model 90",
    "IBM PS/1",
    "IBM PS/2 Model 65SX"
  };

VOID GetBiosCategory (COMPUTER_STRUCT *pComputer)
{
  CHAR chBuffer[80];          /* Buffer for concatination of strings */
  PSZ pszString = chBuffer;   /* String pointer.  Pointing pszString */
                              /*   to chBuffer allows easy           */
                              /*   concatination of strings          */

  switch (pComputer->bComputerType)
    {
      case 0xff:
        {
          switch (pComputer->bRevisionLevel)
            {
              case 00:
              case 01:
                pszString = IBM_PC;
                break;

              case 02:
                pszString = IBM_XT;
                break;

              default:
                pszString = IBM_PC;
                break;
            }
          break;
        }

      case 0xfe:
        pszString = IBM_XT;
        break;

      case 0xfd:
        pszString = IBM_PCJR;
        break;

      case 0xfc:
        {
          switch (pComputer->bSubModel)
            {
              case 00:
              case 01:
                pszString = IBM_AT;
                break;

              case 02:
                pszString = IBM_XT_286;
                break;

              case 03:
                pszString = IBM_AT;
                break;

              case 04:
                {
                  switch (pComputer->bRevisionLevel)
                    {
                      case 00:
                        pszString = IBM_PS2_50;
                        break;

                      case 03:
                        pszString = IBM_PS2_50Z;
                        break;

                      default:
                        pszString = IBM_PS2_50;
                        break;
                    }
                  break;
                }

              case 05:
                pszString = IBM_PS2_60;
                break;

              case 9:
                pszString = IBM_PS2_30_286;
                break;

              case 0x0B:
                pszString = IBM_PS1;
                break;

              case 0x81:
                pszString = "Phoenix PC/AT Compatible BIOS";
                break;

              default:
                pszString = IBM_AT;
                break;
            }
          break;
        }

      case 0xfb:
        pszString = IBM_XT;
        break;

      case 0xfa:
        {
          switch (pComputer->bSubModel)
            {
              case 00:
                pszString = IBM_PS2_30;
                break;

              case 01:
                pszString = IBM_PS2_25;
                break;

              default:
                pszString = IBM_PS2_30;
                break;
            }
          break;
        }

      case 0xf9:
        pszString = IBM_CONVERTIBLE;
        break;

      case 0xf8:
        {
          switch (pComputer->bSubModel)
            {
              case 0:
              case 1:
                pszString = IBM_PS2_80;
                break;

              case 4:
              case 9:
              case 0x0A:
                pszString = IBM_PS2_70;
                break;

              case 0x0C:
                pszString = IBM_PS2_55SX;
                break;

              case 0x0D:
                pszString = IBM_PS2_70;
                break;

              case 0x14:
              case 0x16:
                pszString = IBM_PS2_90;
                break;

              case 0x1C:
                pszString = IBM_PS2_65SX;
                break;

              case 0x0B:
              case 0x50:
                pszString = IBM_PS2_P70;
                break;

              default:
                pszString = IBM_PS2_70_80;
                break;
            }
          break;
        }

      default:
        pszString = UNKNOWN_COMPUTER;
    }

  /* Set the value in the structure */

  strcpy (pComputer->szBiosCategory, pszString);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -