home *** CD-ROM | disk | FTP | other *** search
- Program TestBIOSInterfaceRoutines;
- {--------------------------------------------------------------}
- { This program is a test the collection of routines presented }
- { earlier that interface the BGI with the BIOS. The routines }
- { can be found in listing 10.12, 10.13, and 10.14. }
- {--------------------------------------------------------------}
-
- Uses Crt, Dos, Graph; { Link in necessary library units }
-
- Const
- PathToDrivers = ''; { Location of support file for BGI }
- DAC = 14; { DAC to get the RGB values from }
-
- Var
- GraphDriver,
- GraphMode : Integer; { Variables for graphics mode }
- Ch : Char; { Character to use for pausing }
- RedVal,
- GreenVal,
- BlueVal : Integer; { Values of each color in a DAC }
- VideoMode : Byte; { Value of active video mode }
- OutString : String; { String used to OutText Info }
-
- {$I GETMODE.INC} { Include routine from list 10.12 }
- {$I GETRGBP.INC} { Include routine from list 10.13 }
- {$I GRASCALE.INC} { Include routine from list 10.14 }
-
- Procedure ShowGrayScale;
- { This procedure will display a sequence of bars on the screen }
- { using the first 16 palette registers. }
-
- Var
- MaxX, MaxY : Word;
- Y1,Y2,YInc : Word; { Variables used to create bars }
- I : Word; { Loop counter variable }
- P : PaletteType; { Variable for original palette }
-
- Begin
- GetPalette( P ); { Save the original palette }
- For I := 0 to 15 Do { Reset palette to 1st 16 colors }
- SetPalette( I,I );
- MaxY := GetMaxY; { Create 16 bars on the screen }
- MaxX := GetMaxX;
- YInc := MaxY Div 16;
- Y1 := 0;
- Y2 := YInc;
- For I := 0 to 15 do
- Begin
- SetFillStyle( SolidFill, I );
- Bar( 0,Y1,MaxX,Y2 );
- Inc( Y1, YInc );
- Inc( Y2, YInc );
- End;
- Ch := Readkey; { Pause for Screen viewing }
- SetAllPalette( P ); { Restore original palette set }
- End;
-
- Begin
- GraphDriver := VGA; { Initialize graphics mode to VGA }
- GraphMode := VGAHi;
- InitGraph( GraphDriver, GraphMode, PathToDrivers );
- GetRGBPalette( DAC, RedVal, GreenVal, BlueVal );
- Str( RedVal, OutString ); { Convert result for displaying }
- MoveTo( 10,10 ); { Reposition Current Pointer }
- OutText( 'Red = ' + OutString );
- Str( GreenVal, OutString );
- OutText( ' Green = ' + OutString );
- Str( BlueVal, OutString );
- OutText( ' Blue = ' + OutString );
- Ch := Readkey; { Pause for screen viewing }
- ClearViewPort; { Clear the screen for next demo }
- CreateGrayScale( 0,16 ); { Create and display a gray scale }
- ShowGrayScale;
- ClearViewPort; { Clear the screen for next demo }
- VideoMode := GetVideoMode;
- Str( VideoMode, OutString );
- OutTextXY( 10,10, OutString );
- Ch := Readkey; { Pause for screen viewing }
- CloseGraph; { Shut down graphics system }
- GotoXY( 10,10 );
- Write( GetVideoMode );
- Ch := Readkey;
- End.