qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CGA.PAS
  Example Contents Index                                    Back
 
PROGRAM cga;
 
{ CGA.PAS : Demonstrates CGA colors }
 
USES
    MSGraph;
 
CONST
    bkcolor : ARRAY [0..7] OF LongInt = (_Black, _Blue, _Green, _Cyan,
                                         _Red, _Magenta, _Brown, _White);
    bkcolor_name : ARRAY [0..7] OF STRING = ('BLACK  ', 'BLUE   ',
                                        'GREEN  ', 'CYAN   ', 'RED    ',
                                        'MAGENTA', 'BROWN  ', 'WHITE  ');
 
VAR
    a, i, j, k : Integer;
 
BEGIN  { Begin main program }
 
    a := _SetVideoMode( _MRes4Color );
    FOR i := 0 TO 3 DO
        BEGIN
        a := _SelectPalette( i );
        FOR k := 0 TO 7 DO
            BEGIN
            _SetBkColor( bkcolor[k] );
            FOR j := 0 TO 3 DO
                BEGIN
                _SetTextPosition( 1, 1 );
                Writeln( 'Background color: ', bkcolor_name[k] );
                Writeln( '   Palette: ', i );
                Writeln( '   Number: ', j );
                _SetColor( j );
                _Rectangle( _GFillInterior, 160, 100, 320, 200 );
                Readln;    { Wait for ENTER to be pressed }
                END; { for j }
            END; { for k }
        END; { for i }
 
    a := _SetVideoMode( _DefaultMode );    { restore original palette }
 
END.