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.FOR
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
CC CGA.FOR - Demonstrates CGA colors.
INCLUDE 'FGRAPH.FI'
INCLUDE 'FGRAPH.FD'
INTEGER*2 dummy2, i, j, k
INTEGER*4 dummy4
INTEGER*4 bkcolor(8) /
+ $BLACK, $BLUE , $GREEN, $CYAN,
+ $RED , $MAGENTA, $BROWN, $WHITE /
CHARACTER*7 bkcolorname(8) /
+ 'BLACK', 'BLUE' , 'GREEN', 'CYAN',
+ 'RED' , 'MAGENTA', 'BROWN', 'WHITE' /
RECORD / rccoord / curpos
IF( setvideomode( $MRES4COLOR ) .EQ. 0 )
+ STOP 'Error: cannot set CGA graphics mode'
DO i = 0, 3
dummy2 = selectpalette( i )
DO k = 1, 8
dummy4 = setbkcolor( bkcolor(k) )
DO j = 0, 3
CALL settextposition( 1, 1, curpos )
WRITE (*, 9000) bkcolorname(k), i, j
dummy2 = setcolor( INT4( j ) )
dummy2 = rectangle( $GFILLINTERIOR, 160, 100, 320, 200 )
READ (*,*) ! Wait for ENTER key to be pressed
END DO
END DO
END DO
dummy2 = setvideomode( $DEFAULTMODE )
9000 FORMAT( ' background color: ', A / ' palette:', I3 /
+ ' color: ', I3 / )
END