summaryrefslogtreecommitdiff
path: root/packages/graph
diff options
context:
space:
mode:
authornickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-09-11 17:56:36 +0000
committernickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-09-11 17:56:36 +0000
commit62eb1b4417e63342c88a5a18d59264b5aeed3725 (patch)
tree6417c003789b64f879ff508e5231bda40131c32c /packages/graph
parent390f1deb9352145e34abf3954f2f77eb27d72309 (diff)
downloadfpc-62eb1b4417e63342c88a5a18d59264b5aeed3725.tar.gz
* CGA modes are now supported on a real CGA or EGA (tested with dosbox, machine=cga/ega)
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@15967 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/graph')
-rw-r--r--packages/graph/src/go32v2/graph.pp29
1 files changed, 22 insertions, 7 deletions
diff --git a/packages/graph/src/go32v2/graph.pp b/packages/graph/src/go32v2/graph.pp
index e83cf7e0b2..8823d2687b 100644
--- a/packages/graph/src/go32v2/graph.pp
+++ b/packages/graph/src/go32v2/graph.pp
@@ -3419,6 +3419,7 @@ const CrtAddress: word = 0;
var
HGCDetected : Boolean;
+ CGADetected : Boolean; { TRUE means real CGA, *not* EGA or VGA }
EGADetected : Boolean; { TRUE means EGA or higher (VGA) }
VGADetected : Boolean;
mode: TModeInfo;
@@ -3432,6 +3433,7 @@ const CrtAddress: word = 0;
HGCDetected := FALSE;
+ CGADetected := FALSE;
EGADetected := FALSE;
VGADetected := FALSE;
{ check if EGA adapter supPorted... }
@@ -3512,6 +3514,8 @@ const CrtAddress: word = 0;
begin
{ check if Hercules adapter supPorted ... }
HGCDetected := Test6845($3B4);
+ { check if CGA adapter supPorted ... }
+ CGADetected := Test6845($3D4);
end;
if HGCDetected then
begin
@@ -3546,16 +3550,15 @@ const CrtAddress: word = 0;
mode.YAspect := 10000;
AddMode(mode);
end;
- if VGADetected then
+ if CGADetected or EGADetected then
begin
+ { HACK:
+ until we create Save/RestoreStateCGA, we use Save/RestoreStateVGA
+ with the inWindows flag enabled (so we only save the mode number
+ and nothing else) }
+ inWindows := true;
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 CGA modes... }
InitMode(mode);
@@ -3677,6 +3680,18 @@ const CrtAddress: word = 0;
mode.XAspect := 4167;
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 MCGA modes... }
{ yes, most of these are the same as the CGA modes; this is TP7