瀏覽代碼

* EGA support added

git-svn-id: trunk@15968 -
nickysn 15 年之前
父節點
當前提交
a56c5afc0e
共有 3 個文件被更改,包括 87 次插入10 次删除
  1. 65 2
      packages/graph/src/go32v2/graph.pp
  2. 14 0
      packages/graph/src/inc/graphh.inc
  3. 8 8
      packages/graph/src/sdlgraph/sdlgraph.pp

+ 65 - 2
packages/graph/src/go32v2/graph.pp

@@ -3682,6 +3682,69 @@ const CrtAddress: word = 0;
          AddMode(mode);
        end;
 
+     if EGADetected 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) }
+         inWindows := true;
+         SaveVideoState := @SaveStateVGA;
+         RestoreVideoState := @RestoreStateVGA;
+
+         InitMode(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.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);
+         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.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.XAspect := 7750;
+         mode.YAspect := 10000;
+         AddMode(mode);
+       end;
+
      if VGADetected then
        begin
          SaveVideoState := @SaveStateVGA;
@@ -3892,7 +3955,7 @@ const CrtAddress: word = 0;
          InitMode(mode);
          mode.ModeNumber:=VGALo;
          mode.DriverNumber := VGA;
-         mode.ModeName:='640 x 200 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;
@@ -3918,7 +3981,7 @@ const CrtAddress: word = 0;
          InitMode(mode);
          mode.ModeNumber:=VGAMed;
          mode.DriverNumber := VGA;
-         mode.ModeName:='640 x 350 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;

+ 14 - 0
packages/graph/src/inc/graphh.inc

@@ -323,6 +323,9 @@ type
        Detect        = 0;
        CGA           = 1;
        MCGA          = 2;
+       EGA           = 3;
+       EGA64         = 4;
+       EGAMono       = 5;
        LowRes        = 6; { nickysn: used to be 1, but moved to 6, because I added CGA }
        HercMono      = 7;
        VGA           = 9;
@@ -363,6 +366,17 @@ type
        MCGAMed = 4;
        MCGAHi = 5;
 
+       { EGA Driver modes }
+       EGALo      = 0;  { 640x200 16 color 4 page }
+       EGAHi      = 1;  { 640x350 16 color 2 page }
+
+       { EGA64 Driver modes }
+       EGA64Lo    = 0;  { 640x200 16 color 1 page }
+       EGA64Hi    = 1;  { 640x350 4 color  1 page }
+
+       { EGAMono Driver modes }
+       EGAMonoHi  = 3;  { 640x350 64K on card, 1 page; 256K on card, 2 page }
+
        { VGA Driver modes }
        VGALo   = 0;
        VGAMed  = 1;

+ 8 - 8
packages/graph/src/sdlgraph/sdlgraph.pp

@@ -66,9 +66,9 @@ It's highly recommended to use Detect (0 constant) for grDriver and grmode: init
  //Detect      =0;     is in the graphh.inc
  //CGA           =1;   is in graphh.inc
  //MCGA	       =2;   is in graphh.inc
- EGA           =3;
- EGA64         =4;
- EGAMono       =5;
+ //EGA           =3;   is in graphh.inc
+ //EGA64         =4;   is in graphh.inc
+ //EGAMono       =5;   is in graphh.inc
  IBM8514       =6;
  //HercMono      =7;   is in the graphh.inc
  ATT400        =8;
@@ -89,16 +89,16 @@ It's highly recommended to use Detect (0 constant) for grDriver and grmode: init
  //MCGAMed       =4;   is in graphh.inc
  //MCGAHi        =5;   is in graphh.inc
  
- EGAMonoHi     =3;
+ //EGAMonoHi     =3;   is in graphh.inc
  //HercMonoHi    =0;      is in the graphh.inc
  //VGALo         =0;      is in the graphh.inc
  //VGAMed        =1;      is in the graphh.inc
  //VGAHi         =2;      is in the graphh.inc
  
- EGALo         =0;
- EGAHi         =1;
- EGA64Lo       =0;
- EGA64Hi       =1;
+ //EGALo         =0;   is in graphh.inc
+ //EGAHi         =1;   is in graphh.inc
+ //EGA64Lo       =0;   is in graphh.inc
+ //EGA64Hi       =1;   is in graphh.inc
  
  ATT400C0      =0;
  ATT400C1      =1;