Browse Source

* extracted the common code for CGA320x200 TModeInfo initialization to a
separate procedure

git-svn-id: trunk@25689 -

nickysn 12 years ago
parent
commit
bf01f953e6
1 changed files with 29 additions and 136 deletions
  1. 29 136
      packages/graph/src/msdos/graph.pp

+ 29 - 136
packages/graph/src/msdos/graph.pp

@@ -3109,6 +3109,27 @@ const CrtAddress: word = 0;
         Test6845 := False;
     end;
 
+    procedure FillCommonCGA320(var mode: TModeInfo);
+    begin
+      mode.HardwarePages := 0;
+      mode.MaxColor := 4;
+      mode.PaletteSize := 16;
+      mode.DirectColor := FALSE;
+      mode.MaxX := 319;
+      mode.MaxY := 199;
+      mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixelCGA320;
+      mode.PutPixel:={$ifdef fpc}@{$endif}PutPixelCGA320;
+      mode.GetPixel:={$ifdef fpc}@{$endif}GetPixelCGA320;
+      mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
+      mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
+      mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
+      mode.HLine := {$ifdef fpc}@{$endif}HLineCGA320;
+      mode.SetBkColor := {$ifdef fpc}@{$endif}SetBkColorCGA320;
+      mode.GetBkColor := {$ifdef fpc}@{$endif}GetBkColorCGA320;
+      mode.XAspect := 8333;
+      mode.YAspect := 10000;
+    end;
+
    var
     HGCDetected : Boolean;
     CGADetected : Boolean; { TRUE means real CGA, *not* EGA or VGA }
@@ -3212,99 +3233,35 @@ const CrtAddress: word = 0;
 
          { now add all standard CGA modes...       }
          InitMode(mode);
+         FillCommonCGA320(mode);
          mode.DriverNumber := CGA;
-         mode.HardwarePages := 0;
          mode.ModeNumber := CGAC0;
          mode.ModeName:='320 x 200 CGA C0';
-         mode.MaxColor := 4;
-         mode.PaletteSize := 16;
-         mode.DirectColor := FALSE;
-         mode.MaxX := 319;
-         mode.MaxY := 199;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixelCGA320;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixelCGA320;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixelCGA320;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
          mode.InitMode := {$ifdef fpc}@{$endif}InitCGA320C0;
-         mode.HLine := {$ifdef fpc}@{$endif}HLineCGA320;
-         mode.SetBkColor := {$ifdef fpc}@{$endif}SetBkColorCGA320;
-         mode.GetBkColor := {$ifdef fpc}@{$endif}GetBkColorCGA320;
-         mode.XAspect := 8333;
-         mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);
+         FillCommonCGA320(mode);
          mode.DriverNumber := CGA;
-         mode.HardwarePages := 0;
          mode.ModeNumber := CGAC1;
          mode.ModeName:='320 x 200 CGA C1';
-         mode.MaxColor := 4;
-         mode.PaletteSize := 16;
-         mode.DirectColor := FALSE;
-         mode.MaxX := 319;
-         mode.MaxY := 199;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixelCGA320;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixelCGA320;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixelCGA320;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
          mode.InitMode := {$ifdef fpc}@{$endif}InitCGA320C1;
-         mode.HLine := {$ifdef fpc}@{$endif}HLineCGA320;
-         mode.SetBkColor := {$ifdef fpc}@{$endif}SetBkColorCGA320;
-         mode.GetBkColor := {$ifdef fpc}@{$endif}GetBkColorCGA320;
-         mode.XAspect := 8333;
-         mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);
+         FillCommonCGA320(mode);
          mode.DriverNumber := CGA;
-         mode.HardwarePages := 0;
          mode.ModeNumber := CGAC2;
          mode.ModeName:='320 x 200 CGA C2';
-         mode.MaxColor := 4;
-         mode.PaletteSize := 16;
-         mode.DirectColor := FALSE;
-         mode.MaxX := 319;
-         mode.MaxY := 199;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixelCGA320;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixelCGA320;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixelCGA320;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
          mode.InitMode := {$ifdef fpc}@{$endif}InitCGA320C2;
-         mode.HLine := {$ifdef fpc}@{$endif}HLineCGA320;
-         mode.SetBkColor := {$ifdef fpc}@{$endif}SetBkColorCGA320;
-         mode.GetBkColor := {$ifdef fpc}@{$endif}GetBkColorCGA320;
-         mode.XAspect := 8333;
-         mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);
+         FillCommonCGA320(mode);
          mode.DriverNumber := CGA;
-         mode.HardwarePages := 0;
          mode.ModeNumber := CGAC3;
          mode.ModeName:='320 x 200 CGA C3';
-         mode.MaxColor := 4;
-         mode.PaletteSize := 16;
-         mode.DirectColor := FALSE;
-         mode.MaxX := 319;
-         mode.MaxY := 199;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixelCGA320;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixelCGA320;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixelCGA320;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
          mode.InitMode := {$ifdef fpc}@{$endif}InitCGA320C3;
-         mode.HLine := {$ifdef fpc}@{$endif}HLineCGA320;
-         mode.SetBkColor := {$ifdef fpc}@{$endif}SetBkColorCGA320;
-         mode.GetBkColor := {$ifdef fpc}@{$endif}GetBkColorCGA320;
-         mode.XAspect := 8333;
-         mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);
@@ -3411,99 +3368,35 @@ const CrtAddress: word = 0;
          { yes, most of these are the same as the CGA modes; this is TP7
            compatible }
          InitMode(mode);
+         FillCommonCGA320(mode);
          mode.DriverNumber := MCGA;
-         mode.HardwarePages := 0;
          mode.ModeNumber := MCGAC0;
          mode.ModeName:='320 x 200 CGA C0'; { yes, it says 'CGA' even for the MCGA driver; this is TP7 compatible }
-         mode.MaxColor := 4;
-         mode.PaletteSize := 16;
-         mode.DirectColor := FALSE;
-         mode.MaxX := 319;
-         mode.MaxY := 199;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixelCGA320;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixelCGA320;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixelCGA320;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
          mode.InitMode := {$ifdef fpc}@{$endif}InitCGA320C0;
-         mode.HLine := {$ifdef fpc}@{$endif}HLineCGA320;
-         mode.SetBkColor := {$ifdef fpc}@{$endif}SetBkColorCGA320;
-         mode.GetBkColor := {$ifdef fpc}@{$endif}GetBkColorCGA320;
-         mode.XAspect := 8333;
-         mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);
+         FillCommonCGA320(mode);
          mode.DriverNumber := MCGA;
-         mode.HardwarePages := 0;
          mode.ModeNumber := MCGAC1;
          mode.ModeName:='320 x 200 CGA C1'; { yes, it says 'CGA' even for the MCGA driver; this is TP7 compatible }
-         mode.MaxColor := 4;
-         mode.PaletteSize := 16;
-         mode.DirectColor := FALSE;
-         mode.MaxX := 319;
-         mode.MaxY := 199;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixelCGA320;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixelCGA320;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixelCGA320;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
          mode.InitMode := {$ifdef fpc}@{$endif}InitCGA320C1;
-         mode.HLine := {$ifdef fpc}@{$endif}HLineCGA320;
-         mode.SetBkColor := {$ifdef fpc}@{$endif}SetBkColorCGA320;
-         mode.GetBkColor := {$ifdef fpc}@{$endif}GetBkColorCGA320;
-         mode.XAspect := 8333;
-         mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);
+         FillCommonCGA320(mode);
          mode.DriverNumber := MCGA;
-         mode.HardwarePages := 0;
          mode.ModeNumber := MCGAC2;
          mode.ModeName:='320 x 200 CGA C2'; { yes, it says 'CGA' even for the MCGA driver; this is TP7 compatible }
-         mode.MaxColor := 4;
-         mode.PaletteSize := 16;
-         mode.DirectColor := FALSE;
-         mode.MaxX := 319;
-         mode.MaxY := 199;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixelCGA320;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixelCGA320;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixelCGA320;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
          mode.InitMode := {$ifdef fpc}@{$endif}InitCGA320C2;
-         mode.HLine := {$ifdef fpc}@{$endif}HLineCGA320;
-         mode.SetBkColor := {$ifdef fpc}@{$endif}SetBkColorCGA320;
-         mode.GetBkColor := {$ifdef fpc}@{$endif}GetBkColorCGA320;
-         mode.XAspect := 8333;
-         mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);
+         FillCommonCGA320(mode);
          mode.DriverNumber := MCGA;
-         mode.HardwarePages := 0;
          mode.ModeNumber := MCGAC3;
          mode.ModeName:='320 x 200 CGA C3'; { yes, it says 'CGA' even for the MCGA driver; this is TP7 compatible }
-         mode.MaxColor := 4;
-         mode.PaletteSize := 16;
-         mode.DirectColor := FALSE;
-         mode.MaxX := 319;
-         mode.MaxY := 199;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixelCGA320;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixelCGA320;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixelCGA320;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
          mode.InitMode := {$ifdef fpc}@{$endif}InitCGA320C3;
-         mode.HLine := {$ifdef fpc}@{$endif}HLineCGA320;
-         mode.SetBkColor := {$ifdef fpc}@{$endif}SetBkColorCGA320;
-         mode.GetBkColor := {$ifdef fpc}@{$endif}GetBkColorCGA320;
-         mode.XAspect := 8333;
-         mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);