Some notes on GCOL

Now let's pass on what Alan Munday had found.

His 'undiscovered' form was:

GCOL A%,R%,G%,B%

where A% sets the required 'gcol action' value (in the range 0-7) and the last three parameters set the colour with the usual 'rgb' (0-255) values. The meanings of the values of A% are:

0 - plot the chosen colour on the screen
1 - OR the current screen colour with the chosen colour
2 - AND the current screen colour with the chosen colour
3 - EOR the current screen colour with the chosen colour
4 - invert the current screen colour (ignoring the colour)
5 - do nothing
6 - AND the current screen colour with NOT the chosen colour
7 - OR the current screen colour with NOT the chosen colour

(In fact, A% is optional and, if omitted, will default to 0.)

The following short demonstration listing, provided by Alan, ought to make things clearer.

 
ON ERROR REPORT: PRINT " at Line";ERL:END
MODE 40
COLOUR 255:CLS

Step%=4
FOR a%=0 TO 7
  PRINT TAB(a%*10,22)" a%= ";a%
  FOR b%=0 TO 255 STEP Step%
    FOR c%=0 TO 255 STEP Step%
      FOR d%=0 TO 255 STEP Step%
        GCOL a%,b%,c%,d%
        PLOT69,b%/2+40+150*a%,c%/2+300
      NEXT
    NEXT
  NEXT
NEXT
END

This produces a set of eight small squares across the (black) screen with each square plotting 64 points each of (in principle) a different colour - and each square showing the effect of each of the possible A% values from left to right.

As you might expect, the sixth square (A%=5) is always blank - and you may notice that squares 2 and 8 (and 3 and 7) are mirror images, which follows from their action codes.

More GCOL

While in this area, maybe you are more familiar with the command GCOL A%,ColourNumber% TINT Tint% where TINT Tint% is optional. A% sets the action as before, but this time the colour is chosen by using the 'colour number' (0-127 for foreground, 128-255 for background).

What is probably less well known is that A% can take other values than 0-7. If you add 16, 32, 48, 64 or 80 to your chosen A% value then colour patterns (as defined by VDU23,2 to VDU23,5) are used as fill colours. Finally, add a further 8 to the number and the pattern becomes transparent.

Lots of things to play with here!


Source: Archive Magazine 13.6 - "Learners' Column"
Publication: Archive Magazine
Contributors: Ray Favre , Alan Munday