From 668832828340dcadca5fe19d7efe1dbf1c9eeb7f Mon Sep 17 00:00:00 2001 From: nickysn Date: Sat, 11 Sep 2010 19:17:47 +0000 Subject: * EGA support added git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@15968 3ad0048d-3df7-0310-abae-a5850022a9f2 --- packages/graph/src/go32v2/graph.pp | 67 ++++++++++++++++++++++++++++++++- packages/graph/src/inc/graphh.inc | 14 +++++++ packages/graph/src/sdlgraph/sdlgraph.pp | 16 ++++---- 3 files changed, 87 insertions(+), 10 deletions(-) (limited to 'packages/graph') diff --git a/packages/graph/src/go32v2/graph.pp b/packages/graph/src/go32v2/graph.pp index 8823d2687b..053b4b6da6 100644 --- a/packages/graph/src/go32v2/graph.pp +++ b/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; diff --git a/packages/graph/src/inc/graphh.inc b/packages/graph/src/inc/graphh.inc index b5a26fa1b9..be33015a68 100644 --- a/packages/graph/src/inc/graphh.inc +++ b/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; diff --git a/packages/graph/src/sdlgraph/sdlgraph.pp b/packages/graph/src/sdlgraph/sdlgraph.pp index 9cbe8f763e..36730e04c9 100644 --- a/packages/graph/src/sdlgraph/sdlgraph.pp +++ b/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; -- cgit v1.2.1