Checking for VESA compatible system


call INT 10h service 4Fh (subservice 00h?)

INT 10h - VESA SuperVGA BIOS - GET SuperVGA INFORMATION
On Entry:
- AX = 4F00h
- ES:DI -> 256-byte buffer for SuperVGA information
On Return:
- AL = 4Fh function supported
- AH = status
- - 00h successful
- - 01h failed
- - 02h (VBE 2) function not supported by current hardware config
- - 03h (VBE 2) function invalid in current mode


This code was assembled with NBASM

.model tiny
.code

	org	100h
  
	mov	ax,cs		; free unused part of Mem Block
	mov	es,ax		;   for .COM file format
	mov	bx,4096		;
	mov	ah,4Ah		;
	int	21h		;

	mov	ax,4F00h	; Service 4Fh of INT 10h
	mov	di,offset Buff	;  returns info (need place for it)
	int	10h		;
	cmp	al,4Fh		; if al = 4Fh then success
	je	short IsSup	;
	mov	dx,offset NotSupS ; else fail.
	mov	ah,09		;
	int	21h		;
	jmp	short Done	;
IsSup:	push	ax		; save RC
	mov	dx,offset SupS	;
	mov	ah,09		;
	int	21h		;
	pop	ax		; restore RC
	mov	dx,offset SuccS	; assume Successful
	or	ah,ah		; completely successful??
	jz	short PrntIt	;
	mov	dx,offset FailS	; Failed
PrntIt:	push	ax		; save RC
	mov	ah,09		;
	int	21h		;
	pop	ax		; restore RC
	xor	ah,ah		; if success then DONE
	jz	short Done	;
	mov	dx,offset FailS1 ; Assume hardware
	cmp	ah,02		;
	je	short PrntIt1	;
	mov	dx,offset FailS2 ; video mode
PrntIt1:	mov	ah,09	;
	int	21h		;
Done:	int	20h		; exit to DOS

NotSupS	db  13,10,'This system does not support VESA comp. video',36
SupS	db  13,10,'This system supports VESA comp. video'	
	db  13,10,'  status: ',36
SuccS	db  'OK',36
FailS	db  'Failed',36
FailS1	db  '  Function not supported by current hardware config.',36
FailS2	db  '  Function invalid in current mode',36
Buff:

.end


The contents of the buffer:
Offset   Size     Description
 00h    DWORD       Signature ('VESA'). For VBE 2.0 this field must be set to
                      "VBE2" before the call to fill in the version 2.0 fields
 04h    WORD        VESA version number
 06h    DWORD       Pointer to OEM name
 0Ah    DWORD       Capabilities.
                      Bit  0  Set if the DAC can switch width, clear if it is
                               fixed 6 bits per primary color
                           1  (VBE2) non-VGA controller
                           2  (VBE2) Programmed DAC with blank bit
 0Eh    DWORD       Pointer to list of supported VESA and OEM video modes
                      Terminated with 0FFFFh.
 12h    WORD        Video memory in 64k blocks
 14h    WORD      OEM software version                 *VBE v2.0*
 16h    DWORD     Pointer to vendor name               *VBE v2.0*
 1Ah    DWORD     Pointer to product name              *VBE v2.0*
 1Eh    DWORD     Pointer to product revision string   *VBE v2.0*
100h  256 bytes   OEM scratchpad
The buffer is defined as 256 bytes for version 1.0 & 1.2, 262 bytes for 
version 1.1 and 512 bytes for version 2.0. Note: Some VESA drivers have been 
known to write beyond the end of the official buffer.
(Clipped from Ralph Browns Interrupt List)