IBM called function 12h "alternate select"; in practice it is a grab bag of subfunctions chosen by BL, not by AL as elsewhere. The EGA BIOS brought BL = 10h and 20h, and the VGA added a row of switches. Those return AL = 12h when they are supported.
| BL | What it does |
|---|---|
| 10h | return EGA information (below) |
| 20h | install the card's own print-screen routine |
| 30h | text scan lines for the next mode set: AL = 0: 200, 1: 350, 2: 400 (VGA) |
| 31h | AL = 0: load the default palette at mode sets, 1: keep the current one |
| 32h | AL = 0: enable access to the card, 1: disable it |
| 33h | AL = 0: grey-scale summing on, 1: off |
| 34h | AL = 0: cursor emulation on, 1: off |
| 35h | switch between two displays (PS/2) |
| 36h | AL = 0: screen on, 1: screen off (memory stays usable) |
Is there an EGA or VGA?
With BL = 10h the BIOS of an EGA or later card returns BH = 0 for a colour display or 1 for a monochrome one, BL = the memory on the card in units of 64K, minus one (3 means 256K or more, and VGAs say 3), CH the feature connector bits and CL the card's configuration switches. A CGA or MDA BIOS does not know the function and leaves BL = 10h, and that is the test. To tell a VGA from an EGA, use INT 10h AH=1Ah, which the EGA lacks.
MOV AH, 12h ; alternate selectMOV BL, 10h ; get EGA informationINT 10hCMP BL, 10h ; unchanged: no EGA or VGA BIOSJE NONE1MOV DX, OFFSET COL1 ; BH = 0: colourOR BH, BHJZ SHOW1MOV DX, OFFSET MONO1 ; BH = 1: monochromeSHOW1:MOV AH, 09hINT 21h ; BL survives the DOS callMOV DL, BLADD DL, "0" ; the memory code, 0..3MOV AH, 02hINT 21hMOV DX, OFFSET CRLF1JMP LAST1NONE1:MOV DX, OFFSET NONE2LAST1:MOV AH, 09hINT 21hCOL1 DB "colour display, memory code $"MONO1 DB "mono display, memory code $"NONE2 DB "no EGA or VGA", 13, 10, "$"CRLF1 DB 13, 10, "$"
Pitfalls
BL = 30h only takes effect at the next mode set: for a 43-line screen on a VGA the sequence is BL = 30h with AL = 1 (350 lines), then mode 03h, then INT 10h AH=11h with AL = 12h for the 8×8 font. Turning the screen off with BL = 36h hides drawing until the picture is complete, but turn it on again before exiting, or the user sees nothing at all. The settings stay until changed or until the machine restarts, so restore what you change.