MCPcopy Create free account
hub / github.com/NetHack/NetHack / vga_detect

Function vga_detect

sys/msdos/vidvga.c:927–948  ·  view source on GitHub ↗

* This will verify the existence of a VGA adapter on the machine. * Video function call 0x1a returns 0x1a in AL if successful, and * returns the following values in BL for the active display: * * 0=no display, 1=MDA, 2=CGA, 4=EGA(color-monitor), * 5=EGA(mono-monitor), 6=PGA, 7=VGA(mono-monitor), 8=VGA(color-monitor), * 0xB=MCGA(mono-monitor), 0xC=MCGA(color-monitor), 0xFF=unknown) */

Source from the content-addressed store, hash-verified

925 * 0xB=MCGA(mono-monitor), 0xC=MCGA(color-monitor), 0xFF=unknown)
926 */
927int
928vga_detect(void)
929{
930 union REGS regs;
931
932 regs.h.al = 0;
933 regs.h.ah = 0x1a;
934 (void) int86(VIDEO_BIOS, &regs, &regs);
935 /*
936 * debug
937 *
938 * printf("vga_detect returned al=%02x, bh=%02x, bl=%02x\n",
939 * (int)regs.h.al, (int)regs.h.bh, (int)regs.h.bl);
940 * getch();
941 */
942 if ((int) regs.h.al == 0x1a) {
943 if (((int) regs.h.bl == 8) || ((int) regs.h.bl == 7)) {
944 return 1;
945 }
946 }
947 return 0;
948}
949
950extern int curframecolor; /* video.c */
951

Callers 1

assign_videoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected