mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 06:49:23 +02:00
* 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:
parent
2fdc4f06de
commit
3d8c941c6c
@ -3567,11 +3567,14 @@ const CrtAddress: word = 0;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
HGCDetected : Boolean;
|
HGCDetected : Boolean = FALSE;
|
||||||
CGADetected : Boolean; { TRUE means real CGA, *not* EGA or VGA }
|
CGADetected : Boolean = FALSE; { TRUE means real CGA, *not* EGA or VGA }
|
||||||
EGADetected : Boolean; { TRUE means EGA or higher (VGA) }
|
EGAColorDetected : Boolean = FALSE; { TRUE means true EGA with a color monitor }
|
||||||
VGADetected : Boolean;
|
EGAMonoDetected : Boolean = FALSE; { TRUE means true EGA with a monochrome (MDA) monitor }
|
||||||
|
MCGADetected : Boolean = FALSE;
|
||||||
|
VGADetected : Boolean = FALSE;
|
||||||
mode: TModeInfo;
|
mode: TModeInfo;
|
||||||
|
regs: TDPMIRegisters;
|
||||||
begin
|
begin
|
||||||
QueryAdapterInfo := ModeList;
|
QueryAdapterInfo := ModeList;
|
||||||
{ If the mode listing already exists... }
|
{ If the mode listing already exists... }
|
||||||
@ -3580,92 +3583,83 @@ const CrtAddress: word = 0;
|
|||||||
if assigned(ModeList) then
|
if assigned(ModeList) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
{ check if VGA/MCGA adapter supported... }
|
||||||
HGCDetected := FALSE;
|
regs.ax:=$1a00;
|
||||||
CGADetected := FALSE;
|
RealIntr($10,regs); { get display combination code...}
|
||||||
EGADetected := FALSE;
|
if regs.al=$1a then
|
||||||
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
|
|
||||||
begin
|
begin
|
||||||
asm
|
while regs.bx <> 0 do
|
||||||
mov ax,1a00h
|
begin
|
||||||
{$ifdef fpc}
|
case regs.bl of
|
||||||
push ebp
|
1: { monochrome adapter (MDA or HGC) }
|
||||||
push esi
|
begin
|
||||||
push edi
|
{ check if Hercules adapter supported ... }
|
||||||
push ebx
|
HGCDetected:=Test6845($3B4);
|
||||||
{$endif fpc}
|
end;
|
||||||
int 10h { get display combination code...}
|
2: CGADetected:=TRUE;
|
||||||
{$ifdef fpc}
|
4: EGAColorDetected:=TRUE;
|
||||||
pop ebx
|
5: EGAMonoDetected:=TRUE;
|
||||||
pop edi
|
{6: PGA, this is rare stuff, how do we handle it? }
|
||||||
pop esi
|
7, 8: VGADetected:=TRUE;
|
||||||
pop ebp
|
10, 11, 12: MCGADetected:=TRUE;
|
||||||
{$endif fpc}
|
end;
|
||||||
cmp al,1ah { check if supPorted... }
|
{ check both primary and secondary display adapter }
|
||||||
jne @novga
|
regs.bx:=regs.bx shr 8;
|
||||||
{ now check if this is the ATI EGA }
|
end;
|
||||||
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'];
|
|
||||||
end;
|
end;
|
||||||
{$ifdef logging}
|
if VGADetected then
|
||||||
LogLn('VGA detected: '+strf(Longint(VGADetected)));
|
|
||||||
{$endif logging}
|
|
||||||
{ older than EGA? }
|
|
||||||
if not EGADetected then
|
|
||||||
begin
|
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);
|
HGCDetected := Test6845($3B4);
|
||||||
{ check if CGA adapter supPorted ... }
|
{ check if CGA adapter supported ... }
|
||||||
CGADetected := Test6845($3D4);
|
CGADetected := Test6845($3D4);
|
||||||
end;
|
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
|
if HGCDetected then
|
||||||
begin
|
begin
|
||||||
{ HACK:
|
{ HACK:
|
||||||
@ -3702,7 +3696,7 @@ const CrtAddress: word = 0;
|
|||||||
mode.YAspect := 10000;
|
mode.YAspect := 10000;
|
||||||
AddMode(mode);
|
AddMode(mode);
|
||||||
end;
|
end;
|
||||||
if CGADetected or EGADetected then
|
if CGADetected or EGAColorDetected or MCGADetected or VGADetected then
|
||||||
begin
|
begin
|
||||||
{ HACK:
|
{ HACK:
|
||||||
until we create Save/RestoreStateCGA, we use Save/RestoreStateVGA
|
until we create Save/RestoreStateCGA, we use Save/RestoreStateVGA
|
||||||
@ -3755,7 +3749,7 @@ const CrtAddress: word = 0;
|
|||||||
AddMode(mode);
|
AddMode(mode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if EGADetected then
|
if EGAColorDetected or VGADetected then
|
||||||
begin
|
begin
|
||||||
{ HACK:
|
{ HACK:
|
||||||
until we create Save/RestoreStateEGA, we use Save/RestoreStateVGA
|
until we create Save/RestoreStateEGA, we use Save/RestoreStateVGA
|
||||||
@ -3797,8 +3791,14 @@ const CrtAddress: word = 0;
|
|||||||
AddMode(mode);
|
AddMode(mode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if VGADetected then
|
if MCGADetected or VGADetected then
|
||||||
begin
|
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;
|
SaveVideoState := @SaveStateVGA;
|
||||||
{$ifdef logging}
|
{$ifdef logging}
|
||||||
LogLn('Setting VGA SaveVideoState to '+strf(longint(SaveVideoState)));
|
LogLn('Setting VGA SaveVideoState to '+strf(longint(SaveVideoState)));
|
||||||
@ -3897,7 +3897,18 @@ const CrtAddress: word = 0;
|
|||||||
mode.XAspect := 8333;
|
mode.XAspect := 8333;
|
||||||
mode.YAspect := 10000;
|
mode.YAspect := 10000;
|
||||||
AddMode(mode);
|
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... }
|
{ now add all standard VGA modes... }
|
||||||
InitMode(mode);
|
InitMode(mode);
|
||||||
mode.DriverNumber:= LowRes;
|
mode.DriverNumber:= LowRes;
|
||||||
|
Loading…
Reference in New Issue
Block a user