Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
; Get display combination code.
; See RBIL INTERRUP.A - V-101A00.
mov ax,1A00h
int 10h
cmp al,1Ah ; AL = 1Ah if function is supported.
jne @@novga
; BL = Active display code.
; BH = Alternate display code.
cmp bl,8 ; Is color analog VGA active?
jne @@novga
; Make sure an ATI EGA Wonder isnt lying to us.
; See RBIL INTERRUP.A - V-101A00 and V-101C.
mov ax,1C00h ; Video save/restore state function.
mov cx,2 ; Only video hardware (CX=0) is supported on EGA Wonder.
int 10h ; So lets check for color registers and DAC state. (CX=2)
cmp al,1Ch ; AL = 1Ch if function is supported.
jne @@novga
; Yes, we have an active color analog VGA!
mov ax,1 ; Indicate success, VGA support was detected!
jmp @@done
@@novga:
xor ax,ax ; Indicate failure, no VGA was detected!
@@done:
ret
bitshifter wrote:I used RBIL to make this, is it enough to be proper?
That should be enough to detect if a "VGA or later" is present. It won't detect if there's a monitor attached or not, or guarantee that the video card isn't in an SVGA mode. Therefore it can't reliably be used to determine if the computer is "headless" or not; or determine if it's safe to use legacy VGA IO ports.
Mostly, it's only really useful as a hint.
For example, I use "int 0x10, al=0x1A" in an attempt to detect if the computer is "headless" or not in boot code, but also provide a way for the user to override this (which is also why I don't feel the need to care about "ATI EGA Wonder" for my code); and use BIOS functions (including VBE) to ensure that I never need to use any legacy VGA IO ports (excluding within native video drivers).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.