* updated go32v2 graph unit video card detection code with the latest code from the msdos graph unit (which supports detection of EGAMono, MCGA and combinations of two video cards)

git-svn-id: trunk@30281 -
This commit is contained in:
nickysn 2015-03-22 21:35:28 +00:00
parent 2fdc4f06de
commit 3d8c941c6c

View File

@ -3567,11 +3567,14 @@ const CrtAddress: word = 0;
end;
var
HGCDetected : Boolean;
CGADetected : Boolean; { TRUE means real CGA, *not* EGA or VGA }
EGADetected : Boolean; { TRUE means EGA or higher (VGA) }
VGADetected : Boolean;
HGCDetected : Boolean = FALSE;
CGADetected : Boolean = FALSE; { TRUE means real CGA, *not* EGA or VGA }
EGAColorDetected : Boolean = FALSE; { TRUE means true EGA with a color monitor }
EGAMonoDetected : Boolean = FALSE; { TRUE means true EGA with a monochrome (MDA) monitor }
MCGADetected : Boolean = FALSE;
VGADetected : Boolean = FALSE;
mode: TModeInfo;
regs: TDPMIRegisters;
begin
QueryAdapterInfo := ModeList;
{ If the mode listing already exists... }
@ -3580,92 +3583,83 @@ const CrtAddress: word = 0;
if assigned(ModeList) then
exit;
HGCDetected := FALSE;
CGADetected := FALSE;
EGADetected := FALSE;
VGADetected := FALSE;
{ check if EGA adapter supPorted... }
asm
mov ah,12h
mov bx,0FF10h
{$ifdef fpc}
push ebx
push ebp
push esi
push edi
{$endif fpc}
int 10h { get EGA information }
{$ifdef fpc}
pop edi
pop esi
pop ebp
{$endif fpc}
cmp bh,0ffh
{$ifdef fpc}
pop ebx
{$endif fpc}
jz @noega
mov [EGADetected],TRUE
@noega:
end ['EBX','EAX'];
{$ifdef logging}
LogLn('EGA detected: '+strf(Longint(EGADetected)));
{$endif logging}
{ check if VGA adapter supPorted... }
if EGADetected then
{ check if VGA/MCGA adapter supported... }
regs.ax:=$1a00;
RealIntr($10,regs); { get display combination code...}
if regs.al=$1a then
begin
asm
mov ax,1a00h
{$ifdef fpc}
push ebp
push esi
push edi
push ebx
{$endif fpc}
int 10h { get display combination code...}
{$ifdef fpc}
pop ebx
pop edi
pop esi
pop ebp
{$endif fpc}
cmp al,1ah { check if supPorted... }
jne @novga
{ now check if this is the ATI EGA }
mov ax,1c00h { get state size for save... }
{ ... all imPortant data }
mov cx,07h
{$ifdef fpc}
push ebp
push esi
push edi
push ebx
{$endif fpc}
int 10h
{$ifdef fpc}
pop ebx
pop edi
pop esi
pop ebp
{$endif fpc}
cmp al,1ch { success? }
jne @novga
mov [VGADetected],TRUE
@novga:
end ['ECX','EAX'];
while regs.bx <> 0 do
begin
case regs.bl of
1: { monochrome adapter (MDA or HGC) }
begin
{ check if Hercules adapter supported ... }
HGCDetected:=Test6845($3B4);
end;
2: CGADetected:=TRUE;
4: EGAColorDetected:=TRUE;
5: EGAMonoDetected:=TRUE;
{6: PGA, this is rare stuff, how do we handle it? }
7, 8: VGADetected:=TRUE;
10, 11, 12: MCGADetected:=TRUE;
end;
{ check both primary and secondary display adapter }
regs.bx:=regs.bx shr 8;
end;
end;
{$ifdef logging}
LogLn('VGA detected: '+strf(Longint(VGADetected)));
{$endif logging}
{ older than EGA? }
if not EGADetected then
if VGADetected then
begin
{ check if Hercules adapter supPorted ... }
{ now check if this is the ATI EGA }
regs.ax:=$1c00; { get state size for save... }
{ ... all important data }
regs.cx:=$07;
RealIntr($10,regs);
VGADetected:=regs.al=$1c;
end;
if not VGADetected and not MCGADetected and
not EGAColorDetected and not EGAMonoDetected and
not CGADetected and not HGCDetected then
begin
{ check if EGA adapter supported... }
regs.ah:=$12;
regs.bx:=$FF10;
RealIntr($10,regs); { get EGA information }
if regs.bh<>$FF then
case regs.cl of
0..3, { primary: MDA/HGC, secondary: EGA color }
6..9: { primary: EGA color, secondary: MDA/HGC (optional) }
begin
EGAColorDetected:=TRUE;
{ check if Hercules adapter supported ... }
HGCDetected:=Test6845($3B4);
end;
4..5, { primary: CGA, secondary: EGA mono }
10..11: { primary: EGA mono, secondary: CGA (optional) }
begin
EGAMonoDetected:=TRUE;
{ check if CGA adapter supported ... }
CGADetected := Test6845($3D4);
end;
end;
end;
{ older than EGA? }
if not VGADetected and not MCGADetected and
not EGAColorDetected and not EGAMonoDetected and
not CGADetected and not HGCDetected then
begin
{ check if Hercules adapter supported ... }
HGCDetected := Test6845($3B4);
{ check if CGA adapter supPorted ... }
{ check if CGA adapter supported ... }
CGADetected := Test6845($3D4);
end;
{$ifdef logging}
LogLn('HGC detected: '+strf(Longint(HGCDetected)));
LogLn('CGA detected: '+strf(Longint(CGADetected)));
LogLn('EGA color detected: '+strf(Longint(EGAColorDetected)));
LogLn('EGA mono detected: '+strf(Longint(EGAMonoDetected)));
LogLn('MCGA detected: '+strf(Longint(MCGADetected)));
LogLn('VGA detected: '+strf(Longint(VGADetected)));
{$endif logging}
if HGCDetected then
begin
{ HACK:
@ -3702,7 +3696,7 @@ const CrtAddress: word = 0;
mode.YAspect := 10000;
AddMode(mode);
end;
if CGADetected or EGADetected then
if CGADetected or EGAColorDetected or MCGADetected or VGADetected then
begin
{ HACK:
until we create Save/RestoreStateCGA, we use Save/RestoreStateVGA
@ -3755,7 +3749,7 @@ const CrtAddress: word = 0;
AddMode(mode);
end;
if EGADetected then
if EGAColorDetected or VGADetected then
begin
{ HACK:
until we create Save/RestoreStateEGA, we use Save/RestoreStateVGA
@ -3797,8 +3791,14 @@ const CrtAddress: word = 0;
AddMode(mode);
end;
if VGADetected then
if MCGADetected or VGADetected then
begin
{ HACK:
until we create Save/RestoreStateEGA, we use Save/RestoreStateVGA
with the inWindows flag enabled (so we only save the mode number
and nothing else) }
if not VGADetected then
inWindows := true;
SaveVideoState := @SaveStateVGA;
{$ifdef logging}
LogLn('Setting VGA SaveVideoState to '+strf(longint(SaveVideoState)));
@ -3897,7 +3897,18 @@ const CrtAddress: word = 0;
mode.XAspect := 8333;
mode.YAspect := 10000;
AddMode(mode);
end;
if VGADetected then
begin
SaveVideoState := @SaveStateVGA;
{$ifdef logging}
LogLn('Setting VGA SaveVideoState to '+strf(longint(SaveVideoState)));
{$endif logging}
RestoreVideoState := @RestoreStateVGA;
{$ifdef logging}
LogLn('Setting VGA RestoreVideoState to '+strf(longint(RestoreVideoState)));
{$endif logging}
{ now add all standard VGA modes... }
InitMode(mode);
mode.DriverNumber:= LowRes;