Explorar o código

* extracted the common code for the EGA/VGA 16-colour TModeInfo initialization

git-svn-id: trunk@25695 -
nickysn %!s(int64=11) %!d(string=hai) anos
pai
achega
6d83c37da1
Modificáronse 1 ficheiros con 28 adicións e 67 borrados
  1. 28 67
      packages/graph/src/msdos/graph.pp

+ 28 - 67
packages/graph/src/msdos/graph.pp

@@ -3151,6 +3151,22 @@ const CrtAddress: word = 0;
       mode.YAspect := 10000;
     end;
 
+    procedure FillCommonEGAVGA16(var mode: TModeInfo);
+    begin
+      mode.MaxColor := 16;
+      mode.DirectColor := FALSE;
+      mode.PaletteSize := mode.MaxColor;
+      mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16;
+      mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16;
+      mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16;
+      mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
+      mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
+      mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
+      mode.HLine := {$ifdef fpc}@{$endif}HLine16;
+      mode.VLine := {$ifdef fpc}@{$endif}VLine16;
+      mode.GetScanLine := {$ifdef fpc}@{$endif}GetScanLine16;
+    end;
+
    var
     HGCDetected : Boolean;
     CGADetected : Boolean; { TRUE means real CGA, *not* EGA or VGA }
@@ -3306,53 +3322,31 @@ const CrtAddress: word = 0;
          RestoreVideoState := @RestoreStateVGA;
 
          InitMode(mode);
+         FillCommonEGAVGA16(mode);
          mode.ModeNumber:=EGALo;
          mode.DriverNumber := EGA;
          mode.ModeName:='640 x 200 EGA';
-         mode.MaxColor := 16;
-         mode.HardwarePages := 2;
-         mode.DirectColor := FALSE;
-         mode.PaletteSize := mode.MaxColor;
          mode.MaxX := 639;
          mode.MaxY := 199;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
+         mode.HardwarePages := 2;
          mode.SetVisualPage := {$ifdef fpc}@{$endif}SetVisual200;
          mode.SetActivePage := {$ifdef fpc}@{$endif}SetActive200;
          mode.InitMode := {$ifdef fpc}@{$endif}Init640x200x16;
-         mode.HLine := {$ifdef fpc}@{$endif}HLine16;
-         mode.VLine := {$ifdef fpc}@{$endif}VLine16;
-         mode.GetScanLine := {$ifdef fpc}@{$endif}GetScanLine16;
          mode.XAspect := 4500;
          mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);
+         FillCommonEGAVGA16(mode);
          mode.ModeNumber:=EGAHi;
          mode.DriverNumber := EGA;
          mode.ModeName:='640 x 350 EGA';
-         mode.HardwarePages := 1;
-         mode.MaxColor := 16;
-         mode.DirectColor := FALSE;
-         mode.PaletteSize := mode.MaxColor;
          mode.MaxX := 639;
          mode.MaxY := 349;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16;
-         mode.InitMode := {$ifdef fpc}@{$endif}Init640x350x16;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
+         mode.HardwarePages := 1;
          mode.SetVisualPage := {$ifdef fpc}@{$endif}SetVisual350;
          mode.SetActivePage := {$ifdef fpc}@{$endif}SetActive350;
-         mode.HLine := {$ifdef fpc}@{$endif}HLine16;
-         mode.VLine := {$ifdef fpc}@{$endif}VLine16;
-         mode.GetScanLine := {$ifdef fpc}@{$endif}GetScanLine16;
+         mode.InitMode := {$ifdef fpc}@{$endif}Init640x350x16;
          mode.XAspect := 7750;
          mode.YAspect := 10000;
          AddMode(mode);
@@ -3484,77 +3478,44 @@ const CrtAddress: word = 0;
          AddMode(mode);
 
          InitMode(mode);
+         FillCommonEGAVGA16(mode);
          mode.ModeNumber:=VGALo;
          mode.DriverNumber := VGA;
          mode.ModeName:='640 x 200 EGA'; { yes, it says 'EGA' even for the VGA driver; this is TP7 compatible }
-         mode.MaxColor := 16;
-         mode.HardwarePages := 2;
-         mode.DirectColor := FALSE;
-         mode.PaletteSize := mode.MaxColor;
          mode.MaxX := 639;
          mode.MaxY := 199;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
+         mode.HardwarePages := 2;
          mode.SetVisualPage := {$ifdef fpc}@{$endif}SetVisual200;
          mode.SetActivePage := {$ifdef fpc}@{$endif}SetActive200;
          mode.InitMode := {$ifdef fpc}@{$endif}Init640x200x16;
-         mode.HLine := {$ifdef fpc}@{$endif}HLine16;
-         mode.VLine := {$ifdef fpc}@{$endif}VLine16;
-         mode.GetScanLine := {$ifdef fpc}@{$endif}GetScanLine16;
          mode.XAspect := 4500;
          mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);
+         FillCommonEGAVGA16(mode);
          mode.ModeNumber:=VGAMed;
          mode.DriverNumber := VGA;
          mode.ModeName:='640 x 350 EGA'; { yes, it says 'EGA' even for the VGA driver; this is TP7 compatible }
-         mode.HardwarePages := 1;
-         mode.MaxColor := 16;
-         mode.DirectColor := FALSE;
-         mode.PaletteSize := mode.MaxColor;
          mode.MaxX := 639;
          mode.MaxY := 349;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16;
-         mode.InitMode := {$ifdef fpc}@{$endif}Init640x350x16;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
+         mode.HardwarePages := 1;
          mode.SetVisualPage := {$ifdef fpc}@{$endif}SetVisual350;
          mode.SetActivePage := {$ifdef fpc}@{$endif}SetActive350;
-         mode.HLine := {$ifdef fpc}@{$endif}HLine16;
-         mode.VLine := {$ifdef fpc}@{$endif}VLine16;
-         mode.GetScanLine := {$ifdef fpc}@{$endif}GetScanLine16;
+         mode.InitMode := {$ifdef fpc}@{$endif}Init640x350x16;
          mode.XAspect := 7750;
          mode.YAspect := 10000;
          AddMode(mode);
 
          InitMode(mode);
+         FillCommonEGAVGA16(mode);
          mode.ModeNumber:=VGAHi;
          mode.DriverNumber := VGA;
-         mode.HardwarePages := 0;
          mode.ModeName:='640 x 480 VGA';
-         mode.MaxColor := 16;
-         mode.DirectColor := FALSE;
-         mode.PaletteSize := mode.MaxColor;
          mode.MaxX := 639;
          mode.MaxY := 479;
-         mode.DirectPutPixel:={$ifdef fpc}@{$endif}DirectPutPixel16;
-         mode.PutPixel:={$ifdef fpc}@{$endif}PutPixel16;
-         mode.GetPixel:={$ifdef fpc}@{$endif}GetPixel16;
-         mode.SetRGBPalette := {$ifdef fpc}@{$endif}SetVGARGBPalette;
-         mode.GetRGBPalette := {$ifdef fpc}@{$endif}GetVGARGBPalette;
-         mode.SetAllPalette := {$ifdef fpc}@{$endif}SetVGARGBAllPalette;
+         mode.HardwarePages := 0;
          mode.InitMode := {$ifdef fpc}@{$endif}Init640x480x16;
-         mode.HLine := {$ifdef fpc}@{$endif}HLine16;
-         mode.VLine := {$ifdef fpc}@{$endif}VLine16;
-         mode.GetScanLine := {$ifdef fpc}@{$endif}GetScanLine16;
          mode.XAspect := 10000;
          mode.YAspect := 10000;
          AddMode(mode);