📄 vidtype.c
字号:
/* CXL - Copyright (c) 1987-1989 by Mike Smedley - All Rights Reserved */
/* VIDTYPE.C - determines the type of video display adapter */
#include <conio.h>
#include <dos.h>
#include "cxlvid.h"
#if defined(_M_IX86)
#define inportb(a) inp(a)
#endif
#define TIMEOUT 32767
int vidtype(void)
{
union _REGS regs;
int v;
/* Check for PS/2 compatible video BIOS by calling the get */
/* video configuration function. If it exists, the video */
/* configuration code will be returned in BL. */
regs.h.ah=0x1a;
regs.h.al=0;
_int86(0x10,®s,®s);
if(regs.h.al==0x1a) {
switch(regs.h.bl) {
case 0:
v=V_NONE;
break;
case 1:
v=V_MDA;
break;
case 4:
v=V_EGA;
break;
case 5:
v=V_EGAMONO;
break;
case 7:
v=V_VGAMONO;
break;
case 8:
v=V_VGA;
break;
case 10:
case 12:
v=V_MCGA;
break;
case 11:
v=V_MCGAMONO;
break;
default:
v=V_CGA;
}
}
else {
/* OK, we know that it's not a PS/2 BIOS, so check for an EGA. */
/* If an EGA exists, BH will contain non-zero if in mono mode. */
regs.h.ah=0x12;
regs.x.bx=0x10;
_int86(0x10,®s,®s);
if(regs.x.bx!=0x10) {
regs.h.ah=0x12;
regs.h.bl=0x10;
_int86(0x10,®s,®s);
v=regs.h.bh?V_EGAMONO:V_EGA;
}
else {
/* Now we know it's not an EGA. Get the BIOS equipment */
/* flag and test for CGA, MDA, or no video adapter. */
_int86(0x11,®s,®s);
switch(((regs.h.al&0x30)>>4)) {
case 1:
case 2:
v=V_CGA;
break;
case 3:
v=V_MDA;
break;
default:
v=V_NONE;
}
}
}
return(v);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -