The PS/2 and VGA BIOS keep a display combination code: a number for the active adapter and monitor, and one for a second, alternate display. Function 1Ah with AL = 00h returns them in BL and BH and sets AL to 1Ah as proof that it understood the call. An EGA, CGA or MDA BIOS does not have the function and leaves AL as it was, so CMP AL, 1Ah after the call is the standard test for a VGA.

CodeDisplay
00hnone
01hMDA, monochrome monitor
02hCGA, colour monitor
04hEGA, colour monitor
05hEGA, monochrome monitor
06hPGA
07hVGA, monochrome monitor
08hVGA, colour monitor
0Ah, 0ChMCGA, digital / analogue colour monitor
0BhMCGA, monochrome monitor
FFhunknown

AL = 01h sets the codes, which only display drivers that switch monitors need. Programs read them:

Prints "active 08h, alternate 00h": DOSBox-X emulates one VGA-compatible card with a colour monitor.
MOV AX, 1A00h ; get the display combination code
INT 10h
CMP AL, 1Ah ; does the BIOS know the function?
JNE OLD1
MOV [DCC1], BX ; BL = active, BH = alternate
MOV AH, 09h
MOV DX, OFFSET TXT1
INT 21h
MOV AL, BYTE PTR [DCC1] ; the active display
CALL PHEX2
MOV AH, 09h
MOV DX, OFFSET TXT2
INT 21h
MOV AL, BYTE PTR [DCC1+1] ; the alternate
CALL PHEX2
MOV DX, OFFSET TXT3
JMP LAST1
OLD1:
MOV DX, OFFSET TXT4 ; an EGA or older
LAST1:
MOV AH, 09h
INT 21h
DCC1 DW 0
TXT1 DB "active $"
TXT2 DB "h, alternate $"
TXT3 DB "h", 13, 10, "$"
TXT4 DB "no VGA BIOS", 13, 10, "$"
PHEX2: ; print AL as two hex digits; changes AX, CX, DX
PUSH AX
MOV CL, 4
SHR AL, CL ; the high nibble first
CALL PDIG1
POP AX
AND AL, 0Fh ; then the low one, falling into PDIG1
PDIG1:
ADD AL, "0"
CMP AL, "9"
JBE PDIG2
ADD AL, 7 ; "A".."F"
PDIG2:
MOV DL, AL
MOV AH, 02h ; DOS: print DL
INT 21h
RET

Finding out what card is there

The usual ladder: try INT 10h AH=1Ah (VGA or MCGA); if AL did not come back as 1Ah, try INT 10h AH=12h with BL = 10h (EGA); if BL stays 10h, look at the mode from INT 10h AH=0Fh: 07h means a monochrome card, anything else a CGA. Telling a Hercules card from a plain MDA needs a hardware trick: bit 7 of port 3BAh changes with each frame only on a Hercules.

Pitfalls

An SVGA card reports 08h like any VGA; learning more about it takes the VESA functions, starting with AX = 4F00h. The codes say what the BIOS believes is attached, which on old machines came from switches set by hand. DOSBox-X configured as an EGA or CGA machine does not answer, exactly like the real cards.